Skip to content

Commit

Permalink
"play multiple files" patch by Ralph Glasstetter
Browse files Browse the repository at this point in the history
git-svn-id: https://dvbcut.svn.sourceforge.net/svnroot/dvbcut/trunk@47 36490176-9c1c-0410-b649-dbf2af5787bf
  • Loading branch information
too-tired committed Jul 2, 2007
1 parent bafab8d commit 0185a31
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2007-07-02 Michael Riepe <[email protected]>

* src/buffer.cpp:
* src/buffer.h:
* src/dvbcut.cpp:
"play multiple files" patch by Ralph Glasstetter.

2007-06-30 Michael Riepe <[email protected]>

* src/buffer.cpp (class inbuffer):
Expand Down
15 changes: 15 additions & 0 deletions src/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,21 @@ inbuffer::providedata(unsigned int amount, long long position) {
return inbytes();
}

int
inbuffer::getfilenum(dvbcut_off_t offset, dvbcut_off_t &fileoff) {
std::vector<infile>::const_iterator it = files.begin();
unsigned int num = 0;
while (it != files.end()) {
if (offset < it->end) {
fileoff = it->off;
return num;
}
++num;
++it;
}
return -1;
}

// OUTBUFFER ****************************************************************

outbuffer::~outbuffer()
Expand Down
1 change: 1 addition & 0 deletions src/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class inbuffer {
}
dvbcut_off_t getfilesize() const { return filesize; }
dvbcut_off_t getfilepos() const { return pos + readpos; }
int getfilenum(dvbcut_off_t offset, dvbcut_off_t &fileoff);
};

class outbuffer : protected buffer
Expand Down
15 changes: 12 additions & 3 deletions src/dvbcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,11 @@ void dvbcut::playPlay()
dvbcut_off_t offset=(*mpg)[curpic].getpos().packetposition();
mplayer_curpts=(*mpg)[curpic].getpts();

dvbcut_off_t partoffset;
int partindex = buf.getfilenum(offset, partoffset);
if (partindex == -1)
return; // what else can we do?

mplayer_process=new QProcess(QString("mplayer"));
mplayer_process->addArgument("-noconsolecontrols");
#ifdef __WIN32__
Expand All @@ -671,7 +676,7 @@ void dvbcut::playPlay()
mplayer_process->addArgument("-wid");
mplayer_process->addArgument(QString().sprintf("0x%x",int(imagedisplay->winId())));
mplayer_process->addArgument("-sb");
mplayer_process->addArgument(QString::number(offset));
mplayer_process->addArgument(QString::number(offset - partoffset));
mplayer_process->addArgument("-geometry");
mplayer_process->addArgument(QString().sprintf("%dx%d+0+0",int(imagedisplay->width()),int(imagedisplay->height())));

Expand All @@ -680,8 +685,12 @@ void dvbcut::playPlay()
mplayer_process->addArgument(QString().sprintf("0x%x",int(mpg->mplayeraudioid(currentaudiotrack))));
}

mplayer_process->addArgument(QString(mpgfilen.front()));

// for now, pass all filenames from the current one up to the last one
std::list<std::string>::const_iterator it = mpgfilen.begin();
for (int i = 0; it != mpgfilen.end(); ++i, ++it)
if (i >= partindex)
mplayer_process->addArgument(QString(*it));

mplayer_process->setCommunication(QProcess::Stdout|QProcess::Stderr|QProcess::DupStderr);

connect(mplayer_process, SIGNAL(processExited()), this, SLOT(mplayer_exited()));
Expand Down

0 comments on commit 0185a31

Please sign in to comment.