Skip to content

Commit

Permalink
fix avdevice input file if contains multiple ':' wang-bin#766
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Nov 17, 2016
1 parent fbea8f1 commit a2c84ce
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/AVDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,19 +741,19 @@ bool AVDemuxer::load()
static const QString avd_scheme(QStringLiteral("avdevice:"));
if (d->file.startsWith(avd_scheme)) {
QStringList parts = d->file.split(QStringLiteral(":"));
if (parts.count() != 3) {
int s0 = avd_scheme.size();
const int s1 = d->file.indexOf(QChar(':'), s0);
if (s1 < 0) {
qDebug("invalid avdevice specification");
setMediaStatus(InvalidMedia);
return false;
}
if (d->file.startsWith(avd_scheme + QStringLiteral("//"))) {
if (d->file.at(s0) == QChar('/') && d->file.at(s0+1) == QChar('/')) {
// avdevice://avfoundation:device_name
d->input_format = av_find_input_format(parts[1].mid(2).toUtf8().constData());
} else {
// avdevice:video4linux2:file_name
d->input_format = av_find_input_format(parts[1].toUtf8().constData());
}
d->file = parts[2];
s0 += 2;
} // else avdevice:video4linux2:file_name
d->input_format = av_find_input_format(d->file.mid(s0, s1-s0).toUtf8().constData());
d->file = d->file.mid(s1+1);
}
#endif
//alloc av format context
Expand Down

0 comments on commit a2c84ce

Please sign in to comment.