Hi,
Here is a quick hack that can save the extra dvdauthor run
and disk space for the intermediate mpg file.
dvdauthor can read from stdin, therefore with a shell script like
========== my-dvd.sh ===========================
#!/bin/sh
exec dvdauthor -t -v mpeg2 -o /mount/dvdexport -
================================================
you can master a dvd title directly by specifying
"|my-dvd.sh"
as the output file in the export file dialog.
(Maybe this could be made more elegant, but I didn't
want to mess with the dialog itself.)
As a next step it would of course be nice to generate
the xml file for dvdauthor _before_ the actual export
as a temporary and specify its name in an environment
variable.
Regards,
Wolfram.
diff -ur dvbcut/src/dvbcut.cpp dvbcut-wg/src/dvbcut.cpp
--- dvbcut/src/dvbcut.cpp 2007-11-11 20:59:10.000000000 +0100
+++ dvbcut-wg/src/dvbcut.cpp 2007-11-25 17:33:00.000000000 +0100
@@ -399,6 +399,35 @@
expd->hide();
}
+ int child_pid = -1;
+ int pipe_fds[2];
+
+#ifndef __WIN32__
+ // check for piped output
+ if (expfilen[0] == '|') {
+ if (::pipe(pipe_fds) < 0)
+ return;
+ child_pid = fork();
+ if (child_pid == 0) {
+ ::close(pipe_fds[1]);
+ if (pipe_fds[0] != STDIN_FILENO) {
+ dup2(pipe_fds[0], STDIN_FILENO);
+ }
+ //fprintf(stderr, "Executing %s\n", expfilen.c_str()+1);
+ for (int fd=0; fd<256; ++fd)
+ if (fd != STDIN_FILENO)
+ ::close(fd);
+ execl("/bin/sh", "sh", "-c", expfilen.c_str()+1, (char *)0);
+ exit(127);
+ }
+ ::close(pipe_fds[0]);
+ if (child_pid < 0) {
+ ::close(pipe_fds[1]);
+ return;
+ }
+ } else
+#endif
+
if (QFileInfo(expfilen).exists() && question(
"File exists - dvbcut",
expfilen+"\nalready exists. "
@@ -426,23 +455,33 @@
if (expd->audiolist->isSelected(a))
audiostreammask|=1u<<a;
+ std::string out_file = (child_pid < 0) ? expfilen :
+ std::string("pipe:") + (const char*)QString::number(pipe_fds[1]);
+
switch(settings().export_format) {
case 1:
- mux=std::auto_ptr<muxer>(new
mpegmuxer(audiostreammask,*mpg,expfilen.c_str(),false,0));
+ mux=std::auto_ptr<muxer>(new
mpegmuxer(audiostreammask,*mpg,out_file.c_str(),false,0));
break;
case 2:
- mux=std::auto_ptr<muxer>(new
lavfmuxer("dvd",audiostreammask,*mpg,expfilen.c_str()));
+ mux=std::auto_ptr<muxer>(new
lavfmuxer("dvd",audiostreammask,*mpg,out_file.c_str()));
break;
case 3:
- mux=std::auto_ptr<muxer>(new
lavfmuxer("mpegts",audiostreammask,*mpg,expfilen.c_str()));
+ mux=std::auto_ptr<muxer>(new
lavfmuxer("mpegts",audiostreammask,*mpg,out_file.c_str()));
break;
case 0:
default:
- mux=std::auto_ptr<muxer>(new
mpegmuxer(audiostreammask,*mpg,expfilen.c_str()));
+ mux=std::auto_ptr<muxer>(new
mpegmuxer(audiostreammask,*mpg,out_file.c_str()));
break;
}
if (!mux->ready()) {
+#ifndef __WIN32__
+ if (child_pid > 0) {
+ ::close(pipe_fds[1]);
+ int wstatus;
+ while (waitpid(child_pid, &wstatus, 0)==-1 && errno==EINTR);
+ }
+#endif
log->printerror("Unable to set up muxer!");
if (nogui)
delete log;
@@ -474,6 +513,13 @@
}
mux.reset();
+#ifndef __WIN32__
+ if (child_pid > 0) {
+ ::close(pipe_fds[1]);
+ int wstatus;
+ while (waitpid(child_pid, &wstatus, 0)==-1 && errno==EINTR);
+ }
+#endif
log->printheading("Saved %d pictures (%02d:%02d:%02d.%03d)",savedpic,
int(savedtime/(3600*90000)),
diff -ur dvbcut/src/mpegmuxer.cpp dvbcut-wg/src/mpegmuxer.cpp
--- dvbcut/src/mpegmuxer.cpp 2007-11-11 20:59:10.000000000 +0100
+++ dvbcut-wg/src/mpegmuxer.cpp 2007-11-25 17:47:00.000000000 +0100
@@ -137,7 +137,10 @@
allbuffers*=1.05; // 5% assumed muxing overhead
ptsoffset=pts_t(90000.*(allbuffers/50./muxrate))+90;
- fd=::open(filename,O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,0666);
+ if (!strncmp(filename, "pipe:", 5))
+ fd = atoi(filename+5);
+ else
+ fd=::open(filename,O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,0666);
}
mpegmuxer::~mpegmuxer()
diff -ur dvbcut/src/port.h dvbcut-wg/src/port.h
--- dvbcut/src/port.h 2007-07-28 12:57:53.000000000 +0200
+++ dvbcut-wg/src/port.h 2007-11-25 15:17:30.000000000 +0100
@@ -22,6 +22,9 @@
#define _DVBCUT_PORT_H
#include <sys/types.h>
+#ifndef __WIN32__
+#include <sys/wait.h>
+#endif
#include <stdint.h>
typedef int64_t dvbcut_off_t;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
DVBCUT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dvbcut-user