Skip to content

Commit 715a466

Browse files
committed
fix old avformat iterate(gcc)
1 parent 9a487b6 commit 715a466

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/AVDemuxer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,11 +357,12 @@ static void getFFmpegInputFormats(QStringList* formats, QStringList* extensions)
357357
static QStringList fmts;
358358
if (exts.isEmpty() && fmts.isEmpty()) {
359359
QStringList e, f;
360-
const AVInputFormat *i = NULL;
361360
#if AVFORMAT_STATIC_REGISTER
361+
const AVInputFormat *i = NULL;
362362
void* it = NULL;
363363
while ((i = av_demuxer_iterate(&it))) {
364364
#else
365+
AVInputFormat *i = NULL;
365366
av_register_all(); // MUST register all input/output formats
366367
while ((i = av_iformat_next(i))) {
367368
#endif

src/AVMuxer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,13 @@ static void getFFmpegOutputFormats(QStringList* formats, QStringList* extensions
189189
static QStringList fmts;
190190
if (exts.isEmpty() && fmts.isEmpty()) {
191191
QStringList e, f;
192-
const AVOutputFormat *o = NULL;
193192
#if AVFORMAT_STATIC_REGISTER
193+
const AVOutputFormat *o = NULL;
194194
void* it = NULL;
195195
while ((o = av_muxer_iterate(&it))) {
196196
#else
197197
av_register_all(); // MUST register all input/output formats
198+
AVOutputFormat *o = NULL;
198199
while ((o = av_oformat_next(o))) {
199200
#endif
200201
if (o->extensions)

src/QtAV_Global.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,12 @@ QString avformatOptions()
275275
void* obj = const_cast<void*>(reinterpret_cast<const void*>(avformat_get_class()));
276276
opts = Internal::optionsToString((void*)&obj);
277277
opts.append(ushort('\n'));
278-
const AVInputFormat *i = NULL;
279278
#if AVFORMAT_STATIC_REGISTER
279+
const AVInputFormat *i = NULL;
280280
void* it = NULL;
281281
while ((i = av_demuxer_iterate(&it))) {
282282
#else
283+
AVInputFormat *i = NULL;
283284
av_register_all(); // MUST register all input/output formats
284285
while ((i = av_iformat_next(i))) {
285286
#endif
@@ -290,12 +291,13 @@ QString avformatOptions()
290291
.arg(QLatin1String(i->name))
291292
.arg(opt));
292293
}
293-
const AVOutputFormat *o = NULL;
294294
#if AVFORMAT_STATIC_REGISTER
295+
const AVOutputFormat *o = NULL;
295296
it = NULL;
296297
while ((o = av_muxer_iterate(&it))) {
297298
#else
298299
av_register_all(); // MUST register all input/output formats
300+
AVOutputFormat *o = NULL;
299301
while ((o = av_oformat_next(o))) {
300302
#endif
301303
QString opt(Internal::optionsToString((void*)&o->priv_class).trimmed());

src/subtitle/SubtitleProcessorFFmpeg.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ QStringList ffmpeg_supported_sub_extensions_by_codec()
9191
if (c->type != AVMEDIA_TYPE_SUBTITLE)
9292
continue;
9393
qDebug("sub codec: %s", c->name);
94-
const AVInputFormat *i = NULL;
9594
#if AVFORMAT_STATIC_REGISTER
95+
const AVInputFormat *i = NULL;
9696
void* it2 = NULL;
9797
while ((i = av_demuxer_iterate(&it2))) {
9898
#else
9999
av_register_all(); // MUST register all input/output formats
100+
AVInputFormat *i = NULL;
100101
while ((i = av_iformat_next(i))) {
101102
#endif
102103
if (!strcmp(i->name, c->name)) {
@@ -121,12 +122,13 @@ QStringList ffmpeg_supported_sub_extensions_by_codec()
121122
QStringList ffmpeg_supported_sub_extensions()
122123
{
123124
QStringList exts;
124-
const AVInputFormat *i = NULL;
125125
#if AVFORMAT_STATIC_REGISTER
126+
const AVInputFormat *i = NULL;
126127
void* it = NULL;
127128
while ((i = av_demuxer_iterate(&it))) {
128129
#else
129130
av_register_all(); // MUST register all input/output formats
131+
AVInputFormat *i = NULL;
130132
while ((i = av_iformat_next(i))) {
131133
#endif
132134
// strstr parameters can not be null

0 commit comments

Comments
 (0)