forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not notify EndOfMedia if stopped by user wang-bin#833
- Loading branch information
Showing
3 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -513,11 513,6 @@ bool AVDemuxThread::waitForStarted(int msec) | |
return true; | ||
} | ||
|
||
void AVDemuxThread::eofDecoded() | ||
{ | ||
Q_EMIT mediaStatusChanged(QtAV::EndOfMedia); | ||
} | ||
|
||
void AVDemuxThread::run() | ||
{ | ||
m_buffering = false; | ||
|
@@ -546,7 541,6 @@ void AVDemuxThread::run() | |
vqueue->setBlocking(true); | ||
} | ||
connect(thread, SIGNAL(seekFinished(qint64)), this, SIGNAL(seekFinished(qint64)), Qt::DirectConnection); | ||
connect(thread, SIGNAL(eofDecoded()), this, SLOT(eofDecoded())); | ||
seek_tasks.clear(); | ||
int was_end = 0; | ||
if (ademuxer) { | ||
|
@@ -585,7 579,6 @@ void AVDemuxThread::run() | |
if (m_buffering) { | ||
m_buffering = false; | ||
Q_EMIT mediaStatusChanged(QtAV::BufferedMedia); | ||
Q_EMIT mediaStatusChanged(QtAV::EndOfMedia); | ||
} | ||
was_end = qMin(was_end 1, kMaxEof); | ||
bool exit_thread = !user_paused; | ||
|
@@ -607,6 600,10 @@ void AVDemuxThread::run() | |
msleep(100); | ||
continue; | ||
} | ||
if (demuxer->mediaStatus() == StalledMedia) { | ||
qDebug("stalled media. exiting demuxing thread"); | ||
break; | ||
} | ||
was_end = 0; | ||
if (tryPause()) { | ||
continue; //the queue is empty and will block | ||
|
@@ -717,9 714,12 @@ void AVDemuxThread::run() | |
video_thread->pause(false); | ||
video_thread->wait(500); | ||
} | ||
thread->disconnect(this, SIGNAL(eofDecoded())); | ||
thread->disconnect(this, SIGNAL(seekFinished(qint64))); | ||
qDebug("Demux thread stops running...."); | ||
if (demuxer->atEnd()) | ||
Q_EMIT mediaStatusChanged(QtAV::EndOfMedia); | ||
else | ||
Q_EMIT mediaStatusChanged(QtAV::StalledMedia); | ||
} | ||
|
||
bool AVDemuxThread::tryPause(unsigned long timeout) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -71,7 71,6 @@ private slots: | |
void frameDeliveredOnStepForward(); | ||
void eofDecodedOnStepForward(); | ||
void onAVThreadQuit(); | ||
void eofDecoded(); | ||
|
||
protected: | ||
virtual void run(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 1,6 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -435,18 435,20 @@ bool AVDemuxer::readFrame() | |
if (ret == AVERROR_EOF | ||
|| avio_feof(d->format_ctx->pb)) { | ||
if (!d->eof) { | ||
if (getInterruptStatus()) { //eof error if interrupted! | ||
if (getInterruptStatus()) { | ||
AVError::ErrorCode ec(AVError::ReadError); | ||
QString msg(tr("error reading stream data")); | ||
handleError(ret, &ec, msg); | ||
} | ||
d->eof = true; | ||
if (mediaStatus() != StalledMedia) { | ||
d->eof = true; | ||
#if 0 // EndOfMedia when demux thread finished | ||
d->started = false; | ||
setMediaStatus(EndOfMedia); | ||
Q_EMIT finished(); | ||
d->started = false; | ||
setMediaStatus(EndOfMedia); | ||
Q_EMIT finished(); | ||
#endif | ||
qDebug("End of file. erreof=%d feof=%d", ret == AVERROR_EOF, avio_feof(d->format_ctx->pb)); | ||
qDebug("End of file. erreof=%d feof=%d", ret == AVERROR_EOF, avio_feof(d->format_ctx->pb)); | ||
} | ||
} | ||
return false; | ||
} | ||
|