Hi,
don't worry... I'll not dare to ask for more! ;-)
Instead I'm providing a little patch to get rid of one restriction... :)
Am Samstag, 30. Juni 2007 20:43 schrieb Michael Riepe:
> - "Open recent" only works with single MPEG or project files. Does
> anyone use this function at all?
Of course,... I'm using that feature!
But it's enough for me that it works with project files...
>
> - "Play" (video) only works within the first file. Audio (2-sec)
> playing should not be affected.
>
That's the thing I missed... :-(
Therefore I had a look what's to do to change that.
Actually the only thing one needs, is the size of the previous files (to
subtract it from the current in buffer offset) and the name of the current
file (to call mplayer with). So I wrote a few helper functions (in buffer.h)
to get the current file name, number and offset in dvbcut.cpp by giving the
total buffer offset...
Maybe not the best way to do it since my C++/dvbcut knowlege is rather limited
but it works... :)
My original idea was to supply the whole list of filenames to mplayer starting
at the current one. But unfortunatly mplayer don't keeps playing when
reaching the end of the current file... like it does if called from the
commandline... :-(
Also mplayer does not play if one calls it inside the GOP where the cut to the
next file happens... don't know why... but I assume that's the reason why the
file list is also not working!
If someone has an idea... I just commented out the code for the version
with the file list and in the patch mplayer is only called with the current
file.
> It *may* work as expected if there are small gaps (e.g. removed
> commercial breaks) *and* you place a stop marker before and a start
> marker after each gap. I didn't try that yet, however. Nor did I try
> cutting VOBs.
I'll give it a try... ;-)
ciao
Ralph
diff -Naur svn/src/buffer.cpp mydvbcut/src/buffer.cpp
--- svn/src/buffer.cpp 2007-07-01 18:02:49.000000000 +0200
+++ mydvbcut/src/buffer.cpp 2007-07-01 15:39:26.000000000 +0200
@@ -180,6 +180,7 @@
}
f.off = filesize;
f.end = filesize += size;
+ f.name = filename;
files.push_back(f);
return true;
}
diff -Naur svn/src/buffer.h mydvbcut/src/buffer.h
--- svn/src/buffer.h 2007-07-01 18:02:49.000000000 +0200
+++ mydvbcut/src/buffer.h 2007-07-01 17:14:14.000000000 +0200
@@ -145,6 +145,7 @@
struct infile {
dvbcut_off_t off;
dvbcut_off_t end;
+ std::string name;
int fd;
};
std::vector<infile> files;
@@ -183,6 +184,34 @@
}
dvbcut_off_t getfilesize() const { return filesize; }
dvbcut_off_t getfilepos() const { return pos + readpos; }
+
+ unsigned int getfilenum(dvbcut_off_t offset) {
+ unsigned int num=0;
+ std::vector<infile>::const_iterator it = files.begin();
+ while( it != files.end() ) {
+ if(offset < it->end) return num;
+ ++num;
+ ++it;
+ }
+ return -1;
+ }
+ dvbcut_off_t getfileoff(dvbcut_off_t offset) {
+ std::vector<infile>::const_iterator it = files.begin();
+ while( it != files.end() ) {
+ if(offset < it->end) return it->off;
+ ++it;
+ }
+ return -1;
+ }
+ std::string getfilename(dvbcut_off_t offset) {
+ std::vector<infile>::const_iterator it = files.begin();
+ while( it != files.end() ) {
+ if(offset < it->end) return it->name;
+ ++it;
+ }
+ return NULL;
+ }
+
};
class outbuffer : protected buffer
diff -Naur svn/src/dvbcut.cpp mydvbcut/src/dvbcut.cpp
--- svn/src/dvbcut.cpp 2007-07-01 18:02:49.000000000 +0200
+++ mydvbcut/src/dvbcut.cpp 2007-07-01 18:01:13.000000000 +0200
@@ -671,7 +671,8 @@
mplayer_process->addArgument("-wid");
mplayer_process->addArgument(QString().sprintf("0x%x",int(imagedisplay->winId())));
mplayer_process->addArgument("-sb");
- mplayer_process->addArgument(QString::number(offset));
+ // subtract offset of previous files
+ mplayer_process->addArgument(QString::number(offset - mpg->getfileoff(offset)));
mplayer_process->addArgument("-geometry");
mplayer_process->addArgument(QString().sprintf("%dx%d+0+0",int(imagedisplay->width()),int(imagedisplay->height())));
@@ -680,8 +681,23 @@
mplayer_process->addArgument(QString().sprintf("0x%x",int(mpg->mplayeraudioid(currentaudiotrack))));
}
- mplayer_process->addArgument(QString(mpgfilen.front()));
+ // 1. Version: call mplayer always with first file
+ //mplayer_process->addArgument(QString(mpgfilen.front()));
+ // 2. Version: call mplayer with appropriate file name only
+ mplayer_process->addArgument(QString(mpg->getfilename(offset)));
+
+ // 3. Version: call mplayer with list of file names starting at current file
+ /* UNFORTUNATELY MPLAYER STOPS WHEN REACHING END OF CURRENT FILE... DON'T KNOW WHY!!! :-(
+ unsigned int n=0, n_offset=mpg->getfilenum(offset);
+ std::list<std::string>::const_iterator it = mpgfilen.begin();
+ while( it != mpgfilen.end() ) {
+ if (n>=n_offset) mplayer_process->addArgument(QString(*it));
+ ++n;
+ ++it;
+ }
+ */
+
mplayer_process->setCommunication(QProcess::Stdout|QProcess::Stderr|QProcess::DupStderr);
connect(mplayer_process, SIGNAL(processExited()), this, SLOT(mplayer_exited()));
diff -Naur svn/src/mpgfile.h mydvbcut/src/mpgfile.h
--- svn/src/mpgfile.h 2007-07-01 18:02:49.000000000 +0200
+++ mydvbcut/src/mpgfile.h 2007-07-01 17:11:40.000000000 +0200
@@ -156,6 +156,18 @@
{
return buf.getfilepos();
}
+ unsigned int getfilenum(dvbcut_off_t offset)
+ {
+ return buf.getfilenum(offset);
+ }
+ dvbcut_off_t getfileoff(dvbcut_off_t offset)
+ {
+ return buf.getfileoff(offset);
+ }
+ std::string getfilename(dvbcut_off_t offset)
+ {
+ return buf.getfilename(offset);
+ }
static pts_t char2pts(const unsigned char *h)
{
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
DVBCUT-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dvbcut-user