Skip to content

Commit

Permalink
fix old avformat iterate(gcc)
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed May 9, 2018
1 parent 9a487b6 commit 715a466
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/AVDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,12 @@ static void getFFmpegInputFormats(QStringList* formats, QStringList* extensions)
static QStringList fmts;
if (exts.isEmpty() && fmts.isEmpty()) {
QStringList e, f;
const AVInputFormat *i = NULL;
#if AVFORMAT_STATIC_REGISTER
const AVInputFormat *i = NULL;
void* it = NULL;
while ((i = av_demuxer_iterate(&it))) {
#else
AVInputFormat *i = NULL;
av_register_all(); // MUST register all input/output formats
while ((i = av_iformat_next(i))) {
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/AVMuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,13 @@ static void getFFmpegOutputFormats(QStringList* formats, QStringList* extensions
static QStringList fmts;
if (exts.isEmpty() && fmts.isEmpty()) {
QStringList e, f;
const AVOutputFormat *o = NULL;
#if AVFORMAT_STATIC_REGISTER
const AVOutputFormat *o = NULL;
void* it = NULL;
while ((o = av_muxer_iterate(&it))) {
#else
av_register_all(); // MUST register all input/output formats
AVOutputFormat *o = NULL;
while ((o = av_oformat_next(o))) {
#endif
if (o->extensions)
Expand Down
6 changes: 4 additions & 2 deletions src/QtAV_Global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,12 @@ QString avformatOptions()
void* obj = const_cast<void*>(reinterpret_cast<const void*>(avformat_get_class()));
opts = Internal::optionsToString((void*)&obj);
opts.append(ushort('\n'));
const AVInputFormat *i = NULL;
#if AVFORMAT_STATIC_REGISTER
const AVInputFormat *i = NULL;
void* it = NULL;
while ((i = av_demuxer_iterate(&it))) {
#else
AVInputFormat *i = NULL;
av_register_all(); // MUST register all input/output formats
while ((i = av_iformat_next(i))) {
#endif
Expand All @@ -290,12 +291,13 @@ QString avformatOptions()
.arg(QLatin1String(i->name))
.arg(opt));
}
const AVOutputFormat *o = NULL;
#if AVFORMAT_STATIC_REGISTER
const AVOutputFormat *o = NULL;
it = NULL;
while ((o = av_muxer_iterate(&it))) {
#else
av_register_all(); // MUST register all input/output formats
AVOutputFormat *o = NULL;
while ((o = av_oformat_next(o))) {
#endif
QString opt(Internal::optionsToString((void*)&o->priv_class).trimmed());
Expand Down
6 changes: 4 additions & 2 deletions src/subtitle/SubtitleProcessorFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ QStringList ffmpeg_supported_sub_extensions_by_codec()
if (c->type != AVMEDIA_TYPE_SUBTITLE)
continue;
qDebug("sub codec: %s", c->name);
const AVInputFormat *i = NULL;
#if AVFORMAT_STATIC_REGISTER
const AVInputFormat *i = NULL;
void* it2 = NULL;
while ((i = av_demuxer_iterate(&it2))) {
#else
av_register_all(); // MUST register all input/output formats
AVInputFormat *i = NULL;
while ((i = av_iformat_next(i))) {
#endif
if (!strcmp(i->name, c->name)) {
Expand All @@ -121,12 +122,13 @@ QStringList ffmpeg_supported_sub_extensions_by_codec()
QStringList ffmpeg_supported_sub_extensions()
{
QStringList exts;
const AVInputFormat *i = NULL;
#if AVFORMAT_STATIC_REGISTER
const AVInputFormat *i = NULL;
void* it = NULL;
while ((i = av_demuxer_iterate(&it))) {
#else
av_register_all(); // MUST register all input/output formats
AVInputFormat *i = NULL;
while ((i = av_iformat_next(i))) {
#endif
// strstr parameters can not be null
Expand Down

0 comments on commit 715a466

Please sign in to comment.