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.
ffmpeg: disable deprecated avcodec iterator/register
- Loading branch information
Showing
13 changed files
with
78 additions
and
30 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-2017 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -326,7 326,9 @@ AVDemuxer::AVDemuxer(QObject *parent) | |
class AVInitializer { | ||
public: | ||
AVInitializer() { | ||
#if !AVCODEC_STATIC_REGISTER | ||
avcodec_register_all(); | ||
#endif | ||
#if QTAV_HAVE(AVDEVICE) | ||
avdevice_register_all(); | ||
#endif | ||
|
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,7 1,7 @@ | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
solve the version problem and diffirent api in FFmpeg and libav | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -61,6 61,8 @@ extern "C" | |
#include <libavutil/avstring.h> | ||
#include <libavfilter/version.h> | ||
|
||
#define AVCODEC_STATIC_REGISTER FFMPEG_MODULE_CHECK(LIBAVCODEC, 58, 10, 100) | ||
|
||
#if !FFMPEG_MODULE_CHECK(LIBAVUTIL, 51, 73, 101) | ||
#include <libavutil/channel_layout.h> | ||
#endif | ||
|
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-2017 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -190,7 190,7 @@ QString aboutQtAV_HTML() | |
{ | ||
static QString about = QString::fromLatin1("<img src='qrc:/QtAV.svg'><h3>QtAV " QTAV_VERSION_STR_LONG "</h3>\n" | ||
"<p>%1</p><p>%2</p><p>%3 </p>" | ||
"<p>Copyright (C) 2012-2017 Wang Bin (aka. Lucas Wang) <a href='mailto:[email protected]'>[email protected]</a></p>\n" | ||
"<p>Copyright (C) 2012-2018 Wang Bin (aka. Lucas Wang) <a href='mailto:[email protected]'>[email protected]</a></p>\n" | ||
"<p>%4: <a href='http://qtav.org/donate.html'>http://qtav.org/donate.html</a></p>\n" | ||
"<p>%5: <a href='https://github.com/wang-bin/QtAV'>https://github.com/wang-bin/QtAV</a></p>\n" | ||
"<p>%6: <a href='http://qtav.org'>http://qtav.org</a></p>" | ||
|
@@ -305,9 305,14 @@ QString avcodecOptions() | |
void* obj = const_cast<void*>(reinterpret_cast<const void*>(avcodec_get_class())); | ||
opts = Internal::optionsToString((void*)&obj); | ||
opts.append(ushort('\n')); | ||
const AVCodec* c = NULL; | ||
#if AVCODEC_STATIC_REGISTER | ||
void* it = NULL; | ||
while ((c = av_codec_iterate(&it))) { | ||
#else | ||
avcodec_register_all(); | ||
AVCodec* c = NULL; | ||
while ((c=av_codec_next(c))) { | ||
while ((c = av_codec_next(c))) { | ||
#endif | ||
QString opt(Internal::optionsToString((void*)&c->priv_class).trimmed()); | ||
if (opt.isEmpty()) | ||
continue; | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -47,7 47,9 @@ static AVCodec* get_codec(const QString &name, const QString& hwa, AVCodecID cid | |
AVDecoder::AVDecoder(AVDecoderPrivate &d) | ||
:DPTR_INIT(&d) | ||
{ | ||
#if !AVCODEC_STATIC_REGISTER | ||
avcodec_register_all(); // avcodec_find_decoder will always be used | ||
#endif | ||
} | ||
|
||
AVDecoder::~AVDecoder() | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -43,9 43,14 @@ QStringList AudioDecoder::supportedCodecs() | |
static QStringList codecs; | ||
if (!codecs.isEmpty()) | ||
return codecs; | ||
const AVCodec* c = NULL; | ||
#if AVCODEC_STATIC_REGISTER | ||
void* it = NULL; | ||
while ((c = av_codec_iterate(&it))) { | ||
#else | ||
avcodec_register_all(); | ||
AVCodec* c = NULL; | ||
while ((c=av_codec_next(c))) { | ||
while ((c = av_codec_next(c))) { | ||
#endif | ||
if (!av_codec_is_decoder(c) || c->type != AVMEDIA_TYPE_AUDIO) | ||
continue; | ||
codecs.append(QString::fromLatin1(c->name)); | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -63,7 63,9 @@ class AudioDecoderFFmpegPrivate Q_DECL_FINAL: public AudioDecoderPrivate | |
: AudioDecoderPrivate() | ||
, frame(av_frame_alloc()) | ||
{ | ||
#if !AVCODEC_STATIC_REGISTER | ||
avcodec_register_all(); | ||
#endif | ||
} | ||
~AudioDecoderFFmpegPrivate() { | ||
if (frame) { | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2015) | ||
|
@@ -45,9 45,14 @@ QStringList AudioEncoder::supportedCodecs() | |
static QStringList codecs; | ||
if (!codecs.isEmpty()) | ||
return codecs; | ||
const AVCodec* c = NULL; | ||
#if AVCODEC_STATIC_REGISTER | ||
void* it = NULL; | ||
while ((c = av_codec_iterate(&it))) { | ||
#else | ||
avcodec_register_all(); | ||
AVCodec* c = NULL; | ||
while ((c=av_codec_next(c))) { | ||
while ((c = av_codec_next(c))) { | ||
#endif | ||
if (!av_codec_is_encoder(c) || c->type != AVMEDIA_TYPE_AUDIO) | ||
continue; | ||
codecs.append(QString::fromLatin1(c->name)); | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
|
@@ -93,9 93,14 @@ QStringList VideoDecoder::supportedCodecs() | |
static QStringList codecs; | ||
if (!codecs.isEmpty()) | ||
return codecs; | ||
const AVCodec* c = NULL; | ||
#if AVCODEC_STATIC_REGISTER | ||
void* it = NULL; | ||
while ((c = av_codec_iterate(&it))) { | ||
#else | ||
avcodec_register_all(); | ||
AVCodec* c = NULL; | ||
while ((c=av_codec_next(c))) { | ||
while ((c = av_codec_next(c))) { | ||
#endif | ||
if (!av_codec_is_decoder(c) || c->type != AVMEDIA_TYPE_VIDEO) | ||
continue; | ||
codecs.append(QString::fromLatin1(c->name)); | ||
|
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: Media play library based on Qt and FFmpeg | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2016) | ||
|
@@ -34,7 34,9 @@ namespace QtAV { | |
|
||
static bool check_ffmpeg_hevc_dxva2() | ||
{ | ||
#if !AVCODEC_STATIC_REGISTER | ||
avcodec_register_all(); | ||
#endif | ||
AVHWAccel *hwa = av_hwaccel_next(0); | ||
while (hwa) { | ||
if (strncmp("hevc_dxva2", hwa->name, 10) == 0) | ||
|
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-2017 Wang Bin <[email protected]> | ||
Copyright (C) 2012-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2014) | ||
|
@@ -51,7 51,9 @@ class VideoDecoderFFmpegBasePrivate : public VideoDecoderPrivate | |
, width(0) | ||
, height(0) | ||
{ | ||
#if !AVCODEC_STATIC_REGISTER | ||
avcodec_register_all(); | ||
#endif | ||
frame = av_frame_alloc(); | ||
} | ||
virtual ~VideoDecoderFFmpegBasePrivate() { | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2015) | ||
|
@@ -46,9 46,14 @@ QStringList VideoEncoder::supportedCodecs() | |
static QStringList codecs; | ||
if (!codecs.isEmpty()) | ||
return codecs; | ||
const AVCodec* c = NULL; | ||
#if AVCODEC_STATIC_REGISTER | ||
void* it = NULL; | ||
while ((c = av_codec_iterate(&it))) { | ||
#else | ||
avcodec_register_all(); | ||
AVCodec* c = NULL; | ||
while ((c=av_codec_next(c))) { | ||
while ((c = av_codec_next(c))) { | ||
#endif | ||
if (!av_codec_is_encoder(c) || c->type != AVMEDIA_TYPE_VIDEO) | ||
continue; | ||
codecs.append(QString::fromLatin1(c->name)); | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2015) | ||
|
@@ -90,7 90,9 @@ class VideoEncoderFFmpegPrivate Q_DECL_FINAL: public VideoEncoderPrivate | |
: VideoEncoderPrivate() | ||
, nb_encoded(0) | ||
{ | ||
#if !AVCODEC_STATIC_REGISTER | ||
avcodec_register_all(); | ||
#endif | ||
// NULL: codec-specific defaults won't be initialized, which may result in suboptimal default settings (this is important mainly for encoders, e.g. libx264). | ||
avctx = avcodec_alloc_context3(NULL); | ||
} | ||
|
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-2018 Wang Bin <[email protected]> | ||
* This file is part of QtAV (from 2014) | ||
|
@@ -80,12 80,16 @@ QString SubtitleProcessorFFmpeg::name() const | |
QStringList ffmpeg_supported_sub_extensions_by_codec() | ||
{ | ||
QStringList exts; | ||
AVCodec *c = av_codec_next(NULL); | ||
while (c) { | ||
if (c->type != AVMEDIA_TYPE_SUBTITLE) { | ||
c = av_codec_next(c); | ||
const AVCodec* c = NULL; | ||
#if AVCODEC_STATIC_REGISTER | ||
void* it = NULL; | ||
while ((c = av_codec_iterate(&it))) { | ||
#else | ||
avcodec_register_all(); | ||
while ((c = av_codec_next(c))) { | ||
#endif | ||
if (c->type != AVMEDIA_TYPE_SUBTITLE) | ||
continue; | ||
} | ||
qDebug("sub codec: %s", c->name); | ||
AVInputFormat *i = av_iformat_next(NULL); | ||
while (i) { | ||
|
@@ -105,7 109,6 @@ QStringList ffmpeg_supported_sub_extensions_by_codec() | |
//qDebug("codec name '%s' is not found in AVInputFormat, just append codec name", c->name); | ||
//exts.append(c->name); | ||
} | ||
c = av_codec_next(c); | ||
} | ||
return exts; | ||
} | ||
|
@@ -127,7 130,13 @@ QStringList ffmpeg_supported_sub_extensions() | |
// AVCodecDescriptor.name and AVCodec.name may be different. avcodec_get_name() use AVCodecDescriptor if possible | ||
QStringList codecs; | ||
const AVCodec* c = NULL; | ||
#if AVCODEC_STATIC_REGISTER | ||
void* it = NULL; | ||
while ((c = av_codec_iterate(&it))) { | ||
#else | ||
avcodec_register_all(); | ||
while ((c = av_codec_next(c))) { | ||
#endif | ||
if (c->type == AVMEDIA_TYPE_SUBTITLE) | ||
codecs.append(QString::fromLatin1(c->name)); | ||
} | ||
|