[FFmpeg-devel,v3,1/6] lavc: add new API for iterating codecs and codec parsers

Submitted by Josh de Kock on Jan. 31, 2018, 8:25 p.m.

Details

Message ID 1517430355-4183-1-git-send-email-josh@itanimul.li
State New
Headers show

Commit Message

Josh de Kock Jan. 31, 2018, 8:25 p.m.
Also replace linked list with an array.
---
 configure              |   12 +-
 doc/APIchanges         |    4 +
 libavcodec/.gitignore  |    2 +
 libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
 libavcodec/avcodec.h   |   31 +
 libavcodec/parser.c    |   84 ++-
 libavcodec/utils.c     |  112 ----
 libavcodec/version.h   |    3 +
 8 files changed, 971 insertions(+), 750 deletions(-)

Comments

Michael Niedermayer Feb. 1, 2018, 3:03 a.m.
On Wed, Jan 31, 2018 at 08:25:50PM +0000, Josh de Kock wrote:
> Also replace linked list with an array.
> ---
>  configure              |   12 +-
>  doc/APIchanges         |    4 +
>  libavcodec/.gitignore  |    2 +
>  libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>  libavcodec/avcodec.h   |   31 +
>  libavcodec/parser.c    |   84 ++-
>  libavcodec/utils.c     |  112 ----
>  libavcodec/version.h   |    3 +
>  8 files changed, 971 insertions(+), 750 deletions(-)

breaks build
simple example:
cd buildhere && ../configure && make -j12
LD	ffmpeg_g
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0xd8): undefined reference to `ff_hap_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4b8): undefined reference to `ff_libfdk_aac_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c0): undefined reference to `ff_libgsm_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c8): undefined reference to `ff_libgsm_ms_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d0): undefined reference to `ff_libilbc_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d8): undefined reference to `ff_libmp3lame_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e0): undefined reference to `ff_libopencore_amrnb_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e8): undefined reference to `ff_libopenjpeg_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f0): undefined reference to `ff_libopus_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f8): undefined reference to `ff_libspeex_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x500): undefined reference to `ff_libtheora_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x508): undefined reference to `ff_libtwolame_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x510): undefined reference to `ff_libvo_amrwbenc_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x518): undefined reference to `ff_libvorbis_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x520): undefined reference to `ff_libvpx_vp8_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x528): undefined reference to `ff_libvpx_vp9_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x530): undefined reference to `ff_libwebp_anim_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x538): undefined reference to `ff_libwebp_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x540): undefined reference to `ff_libx264_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x548): undefined reference to `ff_libx264rgb_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x550): undefined reference to `ff_libx265_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x558): undefined reference to `ff_libxavs_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x560): undefined reference to `ff_libxvid_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x568): undefined reference to `ff_libopenh264_encoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12e8): undefined reference to `ff_libfdk_aac_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f0): undefined reference to `ff_libgsm_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f8): undefined reference to `ff_libgsm_ms_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1300): undefined reference to `ff_libilbc_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1308): undefined reference to `ff_libopencore_amrnb_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1310): undefined reference to `ff_libopencore_amrwb_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1318): undefined reference to `ff_libopenjpeg_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1320): undefined reference to `ff_libopus_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1328): undefined reference to `ff_libspeex_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1330): undefined reference to `ff_libvorbis_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1338): undefined reference to `ff_libvpx_vp8_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1340): undefined reference to `ff_libvpx_vp9_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1348): undefined reference to `ff_libzvbi_teletext_decoder'
libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1368): undefined reference to `ff_libopenh264_decoder'

[...]
Josh de Kock Feb. 1, 2018, 8:57 a.m.
> On 1 Feb 2018, at 03:03, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 
>> On Wed, Jan 31, 2018 at 08:25:50PM +0000, Josh de Kock wrote:
>> Also replace linked list with an array.
>> ---
>> configure              |   12 +-
>> doc/APIchanges         |    4 +
>> libavcodec/.gitignore  |    2 +
>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>> libavcodec/avcodec.h   |   31 +
>> libavcodec/parser.c    |   84 ++-
>> libavcodec/utils.c     |  112 ----
>> libavcodec/version.h   |    3 +
>> 8 files changed, 971 insertions(+), 750 deletions(-)
> 
> breaks build
> simple example:
> cd buildhere && ../configure && make -j12
> LD    ffmpeg_g
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0xd8): undefined reference to `ff_hap_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4b8): undefined reference to `ff_libfdk_aac_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c0): undefined reference to `ff_libgsm_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c8): undefined reference to `ff_libgsm_ms_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d0): undefined reference to `ff_libilbc_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d8): undefined reference to `ff_libmp3lame_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e0): undefined reference to `ff_libopencore_amrnb_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e8): undefined reference to `ff_libopenjpeg_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f0): undefined reference to `ff_libopus_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f8): undefined reference to `ff_libspeex_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x500): undefined reference to `ff_libtheora_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x508): undefined reference to `ff_libtwolame_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x510): undefined reference to `ff_libvo_amrwbenc_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x518): undefined reference to `ff_libvorbis_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x520): undefined reference to `ff_libvpx_vp8_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x528): undefined reference to `ff_libvpx_vp9_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x530): undefined reference to `ff_libwebp_anim_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x538): undefined reference to `ff_libwebp_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x540): undefined reference to `ff_libx264_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x548): undefined reference to `ff_libx264rgb_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x550): undefined reference to `ff_libx265_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x558): undefined reference to `ff_libxavs_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x560): undefined reference to `ff_libxvid_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x568): undefined reference to `ff_libopenh264_encoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12e8): undefined reference to `ff_libfdk_aac_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f0): undefined reference to `ff_libgsm_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f8): undefined reference to `ff_libgsm_ms_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1300): undefined reference to `ff_libilbc_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1308): undefined reference to `ff_libopencore_amrnb_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1310): undefined reference to `ff_libopencore_amrwb_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1318): undefined reference to `ff_libopenjpeg_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1320): undefined reference to `ff_libopus_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1328): undefined reference to `ff_libspeex_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1330): undefined reference to `ff_libvorbis_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1338): undefined reference to `ff_libvpx_vp8_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1340): undefined reference to `ff_libvpx_vp9_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1348): undefined reference to `ff_libzvbi_teletext_decoder'
> libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1368): undefined reference to `ff_libopenh264_decoder'
> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I can’t reproduce this at all, I’m going to need more info.
Muhammad Faiz Feb. 1, 2018, 6:51 p.m.
On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
> Also replace linked list with an array.
> ---
>  configure              |   12 +-
>  doc/APIchanges         |    4 +
>  libavcodec/.gitignore  |    2 +
>  libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>  libavcodec/avcodec.h   |   31 +
>  libavcodec/parser.c    |   84 ++-
>  libavcodec/utils.c     |  112 ----
>  libavcodec/version.h   |    3 +
>  8 files changed, 971 insertions(+), 750 deletions(-)
>

I have a plan to sort codecs based on name and codec_id (which overlap
with this patch). Is it OK if I overtake this?
If it is not OK, I will wait until this patchset pushed.

Thank's.
Michael Niedermayer Feb. 2, 2018, 2 a.m.
On Thu, Feb 01, 2018 at 08:57:40AM +0000, Josh de Kock wrote:
> 
> > On 1 Feb 2018, at 03:03, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > 
> >> On Wed, Jan 31, 2018 at 08:25:50PM +0000, Josh de Kock wrote:
> >> Also replace linked list with an array.
> >> ---
> >> configure              |   12 +-
> >> doc/APIchanges         |    4 +
> >> libavcodec/.gitignore  |    2 +
> >> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
> >> libavcodec/avcodec.h   |   31 +
> >> libavcodec/parser.c    |   84 ++-
> >> libavcodec/utils.c     |  112 ----
> >> libavcodec/version.h   |    3 +
> >> 8 files changed, 971 insertions(+), 750 deletions(-)
> > 
> > breaks build
> > simple example:
> > cd buildhere && ../configure && make -j12
> > LD    ffmpeg_g
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0xd8): undefined reference to `ff_hap_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4b8): undefined reference to `ff_libfdk_aac_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c0): undefined reference to `ff_libgsm_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4c8): undefined reference to `ff_libgsm_ms_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d0): undefined reference to `ff_libilbc_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4d8): undefined reference to `ff_libmp3lame_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e0): undefined reference to `ff_libopencore_amrnb_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4e8): undefined reference to `ff_libopenjpeg_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f0): undefined reference to `ff_libopus_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x4f8): undefined reference to `ff_libspeex_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x500): undefined reference to `ff_libtheora_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x508): undefined reference to `ff_libtwolame_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x510): undefined reference to `ff_libvo_amrwbenc_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x518): undefined reference to `ff_libvorbis_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x520): undefined reference to `ff_libvpx_vp8_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x528): undefined reference to `ff_libvpx_vp9_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x530): undefined reference to `ff_libwebp_anim_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x538): undefined reference to `ff_libwebp_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x540): undefined reference to `ff_libx264_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x548): undefined reference to `ff_libx264rgb_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x550): undefined reference to `ff_libx265_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x558): undefined reference to `ff_libxavs_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x560): undefined reference to `ff_libxvid_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x568): undefined reference to `ff_libopenh264_encoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12e8): undefined reference to `ff_libfdk_aac_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f0): undefined reference to `ff_libgsm_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x12f8): undefined reference to `ff_libgsm_ms_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1300): undefined reference to `ff_libilbc_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1308): undefined reference to `ff_libopencore_amrnb_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1310): undefined reference to `ff_libopencore_amrwb_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1318): undefined reference to `ff_libopenjpeg_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1320): undefined reference to `ff_libopus_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1328): undefined reference to `ff_libspeex_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1330): undefined reference to `ff_libvorbis_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1338): undefined reference to `ff_libvpx_vp8_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1340): undefined reference to `ff_libvpx_vp9_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1348): undefined reference to `ff_libzvbi_teletext_decoder'
> > libavcodec/libavcodec.a(allcodecs.o):(.rodata+0x1368): undefined reference to `ff_libopenh264_decoder'
> > 
> > [...]
> > -- 
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> I can’t reproduce this at all, I’m going to need more info.

did you try building in a subdirectory ?

[...]
Josh de Kock Feb. 2, 2018, 3:23 p.m.
> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
> 
>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
>> Also replace linked list with an array.
>> ---
>> configure              |   12 +-
>> doc/APIchanges         |    4 +
>> libavcodec/.gitignore  |    2 +
>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>> libavcodec/avcodec.h   |   31 +
>> libavcodec/parser.c    |   84 ++-
>> libavcodec/utils.c     |  112 ----
>> libavcodec/version.h   |    3 +
>> 8 files changed, 971 insertions(+), 750 deletions(-)
>> 
> 
> I have a plan to sort codecs based on name and codec_id (which overlap
> with this patch). Is it OK if I overtake this?
> If it is not OK, I will wait until this patchset pushed.
> 

I am unsure why you would need to sort codecs. The point of my patches is to bring the rest of ffmpeg up to the bsf iteration api (which abstracts internals away from the user). I planned on doing lavfi as well, but how the build system worked with filter names made it awkward. Hence me submitting these patches without a lavfi counterpart (I stills haven’t worked out the best way to do it yet). The way you’ve done your static initialisation of lavfi seems like a backwards way to do it, and would make overalls consistency difficult (something quite desirable, which my patches work towards).
Rostislav Pehlivanov Feb. 2, 2018, 3:41 p.m.
On 31 January 2018 at 20:25, Josh de Kock <josh@itanimul.li> wrote:

> Also replace linked list with an array.
> ---
>  configure              |   12 +-
>  doc/APIchanges         |    4 +
>  libavcodec/.gitignore  |    2 +
>  libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--
> ------------------
>  libavcodec/avcodec.h   |   31 +
>  libavcodec/parser.c    |   84 ++-
>  libavcodec/utils.c     |  112 ----
>  libavcodec/version.h   |    3 +
>  8 files changed, 971 insertions(+), 750 deletions(-)


I'd appreciate some credit, I did write most of the patch :)
Josh de Kock Feb. 2, 2018, 4:01 p.m.
> On 2 Feb 2018, at 15:41, Rostislav Pehlivanov <atomnuker@gmail.com> wrote:
> 
>> On 31 January 2018 at 20:25, Josh de Kock <josh@itanimul.li> wrote:
>> 
>> Also replace linked list with an array.
>> ---
>> configure              |   12 +-
>> doc/APIchanges         |    4 +
>> libavcodec/.gitignore  |    2 +
>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--
>> ------------------
>> libavcodec/avcodec.h   |   31 +
>> libavcodec/parser.c    |   84 ++-
>> libavcodec/utils.c     |  112 ----
>> libavcodec/version.h   |    3 +
>> 8 files changed, 971 insertions(+), 750 deletions(-)
> 
> 
> I'd appreciate some credit, I did write most of the patch :)

I rewrote the lavc patch from scratch since I couldn’t getting yours to work, but I can credit your for the idea/original version or something. Just ping me on irc
Muhammad Faiz Feb. 2, 2018, 6:49 p.m.
On Fri, Feb 2, 2018 at 10:23 PM, Josh de Kock <josh@itanimul.li> wrote:
>
>> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
>>
>>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
>>> Also replace linked list with an array.
>>> ---
>>> configure              |   12 +-
>>> doc/APIchanges         |    4 +
>>> libavcodec/.gitignore  |    2 +
>>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>>> libavcodec/avcodec.h   |   31 +
>>> libavcodec/parser.c    |   84 ++-
>>> libavcodec/utils.c     |  112 ----
>>> libavcodec/version.h   |    3 +
>>> 8 files changed, 971 insertions(+), 750 deletions(-)
>>>
>>
>> I have a plan to sort codecs based on name and codec_id (which overlap
>> with this patch). Is it OK if I overtake this?
>> If it is not OK, I will wait until this patchset pushed.
>>
>
> I am unsure why you would need to sort codecs.

For performance reason.

>                                        The point of my patches is to bring the rest of ffmpeg up to the bsf iteration api (which abstracts internals away from the user). I planned on doing lavfi as well, but how the build system worked with filter names made it awkward. Hence me submitting these patches without a lavfi counterpart (I stills haven’t worked out the best way to do it yet). The way you’ve done your static initialisation of lavfi seems like a backwards way to do it, and would make overalls consistency difficult (something quite desirable, which my patches work towards).

Imho, av*iterate things are less elegant than av*next. But, the change
actually is not based on elegance, but based on performance (av*next
requires initialization of next pointer).

Thank's.
James Almer Feb. 2, 2018, 6:53 p.m.
On 2/2/2018 12:23 PM, Josh de Kock wrote:
> 
>> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
>>
>>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
>>> Also replace linked list with an array.
>>> ---
>>> configure              |   12 +-
>>> doc/APIchanges         |    4 +
>>> libavcodec/.gitignore  |    2 +
>>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>>> libavcodec/avcodec.h   |   31 +
>>> libavcodec/parser.c    |   84 ++-
>>> libavcodec/utils.c     |  112 ----
>>> libavcodec/version.h   |    3 +
>>> 8 files changed, 971 insertions(+), 750 deletions(-)
>>>
>>
>> I have a plan to sort codecs based on name and codec_id (which overlap
>> with this patch). Is it OK if I overtake this?
>> If it is not OK, I will wait until this patchset pushed.
>>
> 
> I am unsure why you would need to sort codecs. The point of my patches is to bring the rest of ffmpeg up to the bsf iteration api (which abstracts internals away from the user).

Doesn't bsf use next() and not iterate()?
Hendrik Leppkes Feb. 2, 2018, 6:55 p.m.
On Fri, Feb 2, 2018 at 7:49 PM, Muhammad Faiz <mfcc64@gmail.com> wrote:
> On Fri, Feb 2, 2018 at 10:23 PM, Josh de Kock <josh@itanimul.li> wrote:
>>
>>> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
>>>
>>>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
>>>> Also replace linked list with an array.
>>>> ---
>>>> configure              |   12 +-
>>>> doc/APIchanges         |    4 +
>>>> libavcodec/.gitignore  |    2 +
>>>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>>>> libavcodec/avcodec.h   |   31 +
>>>> libavcodec/parser.c    |   84 ++-
>>>> libavcodec/utils.c     |  112 ----
>>>> libavcodec/version.h   |    3 +
>>>> 8 files changed, 971 insertions(+), 750 deletions(-)
>>>>
>>>
>>> I have a plan to sort codecs based on name and codec_id (which overlap
>>> with this patch). Is it OK if I overtake this?
>>> If it is not OK, I will wait until this patchset pushed.
>>>
>>
>> I am unsure why you would need to sort codecs.
>
> For performance reason.

Performance of what?

- Hendrik
Josh de Kock Feb. 2, 2018, 6:59 p.m.
On Fri, Feb 2, 2018, at 6:53 PM, James Almer wrote:
> On 2/2/2018 12:23 PM, Josh de Kock wrote:
> > 
> >> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
> >>
> >>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
> >>> Also replace linked list with an array.
> >>> ---
> >>> configure              |   12 +-
> >>> doc/APIchanges         |    4 +
> >>> libavcodec/.gitignore  |    2 +
> >>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
> >>> libavcodec/avcodec.h   |   31 +
> >>> libavcodec/parser.c    |   84 ++-
> >>> libavcodec/utils.c     |  112 ----
> >>> libavcodec/version.h   |    3 +
> >>> 8 files changed, 971 insertions(+), 750 deletions(-)
> >>>
> >>
> >> I have a plan to sort codecs based on name and codec_id (which overlap
> >> with this patch). Is it OK if I overtake this?
> >> If it is not OK, I will wait until this patchset pushed.
> >>
> > 
> > I am unsure why you would need to sort codecs. The point of my patches is to bring the rest of ffmpeg up to the bsf iteration api (which abstracts internals away from the user).
> 
> Doesn't bsf use next() and not iterate()?

It does but it doesn't really make sense to use _next when all the other _next functions dont work like bsf. I was contemplating whether I should rename the bsf api to use _iterate as well (i.e. deprecate current name, rename current functions, and have a function with the old names calling the new names).
Muhammad Faiz Feb. 2, 2018, 10:57 p.m.
On Sat, Feb 3, 2018 at 1:55 AM, Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> On Fri, Feb 2, 2018 at 7:49 PM, Muhammad Faiz <mfcc64@gmail.com> wrote:
>> On Fri, Feb 2, 2018 at 10:23 PM, Josh de Kock <josh@itanimul.li> wrote:
>>>
>>>> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
>>>>
>>>>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
>>>>> Also replace linked list with an array.
>>>>> ---
>>>>> configure              |   12 +-
>>>>> doc/APIchanges         |    4 +
>>>>> libavcodec/.gitignore  |    2 +
>>>>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--------------------
>>>>> libavcodec/avcodec.h   |   31 +
>>>>> libavcodec/parser.c    |   84 ++-
>>>>> libavcodec/utils.c     |  112 ----
>>>>> libavcodec/version.h   |    3 +
>>>>> 8 files changed, 971 insertions(+), 750 deletions(-)
>>>>>
>>>>
>>>> I have a plan to sort codecs based on name and codec_id (which overlap
>>>> with this patch). Is it OK if I overtake this?
>>>> If it is not OK, I will wait until this patchset pushed.
>>>>
>>>
>>> I am unsure why you would need to sort codecs.
>>
>> For performance reason.
>
> Performance of what?

avcodec_find_decoder/encoder (by using bsearch).
Hendrik Leppkes Feb. 2, 2018, 11:34 p.m.
Am 02.02.2018 11:58 nachm. schrieb "Muhammad Faiz" <mfcc64@gmail.com>:

On Sat, Feb 3, 2018 at 1:55 AM, Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> On Fri, Feb 2, 2018 at 7:49 PM, Muhammad Faiz <mfcc64@gmail.com> wrote:
>> On Fri, Feb 2, 2018 at 10:23 PM, Josh de Kock <josh@itanimul.li> wrote:
>>>
>>>> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
>>>>
>>>>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
>>>>> Also replace linked list with an array.
>>>>> ---
>>>>> configure              |   12 +-
>>>>> doc/APIchanges         |    4 +
>>>>> libavcodec/.gitignore  |    2 +
>>>>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--
------------------
>>>>> libavcodec/avcodec.h   |   31 +
>>>>> libavcodec/parser.c    |   84 ++-
>>>>> libavcodec/utils.c     |  112 ----
>>>>> libavcodec/version.h   |    3 +
>>>>> 8 files changed, 971 insertions(+), 750 deletions(-)
>>>>>
>>>>
>>>> I have a plan to sort codecs based on name and codec_id (which overlap
>>>> with this patch). Is it OK if I overtake this?
>>>> If it is not OK, I will wait until this patchset pushed.
>>>>
>>>
>>> I am unsure why you would need to sort codecs.
>>
>> For performance reason.
>
> Performance of what?

avcodec_find_decoder/encoder (by using bsearch).


Considering you can have multiple of those for any given codec Id and order
matters, that seems like a risky idea, or a rather complex one at least.
Perhaps not the first (or second) place to start optimization.

- Hendrik
Muhammad Faiz Feb. 3, 2018, 12:19 a.m.
On Sat, Feb 3, 2018 at 6:34 AM, Hendrik Leppkes <h.leppkes@gmail.com> wrote:
> Am 02.02.2018 11:58 nachm. schrieb "Muhammad Faiz" <mfcc64@gmail.com>:
>
> On Sat, Feb 3, 2018 at 1:55 AM, Hendrik Leppkes <h.leppkes@gmail.com> wrote:
>> On Fri, Feb 2, 2018 at 7:49 PM, Muhammad Faiz <mfcc64@gmail.com> wrote:
>>> On Fri, Feb 2, 2018 at 10:23 PM, Josh de Kock <josh@itanimul.li> wrote:
>>>>
>>>>> On 1 Feb 2018, at 18:51, Muhammad Faiz <mfcc64@gmail.com> wrote:
>>>>>
>>>>>> On Thu, Feb 1, 2018 at 3:25 AM, Josh de Kock <josh@itanimul.li> wrote:
>>>>>> Also replace linked list with an array.
>>>>>> ---
>>>>>> configure              |   12 +-
>>>>>> doc/APIchanges         |    4 +
>>>>>> libavcodec/.gitignore  |    2 +
>>>>>> libavcodec/allcodecs.c | 1473 ++++++++++++++++++++++++++++--
> ------------------
>>>>>> libavcodec/avcodec.h   |   31 +
>>>>>> libavcodec/parser.c    |   84 ++-
>>>>>> libavcodec/utils.c     |  112 ----
>>>>>> libavcodec/version.h   |    3 +
>>>>>> 8 files changed, 971 insertions(+), 750 deletions(-)
>>>>>>
>>>>>
>>>>> I have a plan to sort codecs based on name and codec_id (which overlap
>>>>> with this patch). Is it OK if I overtake this?
>>>>> If it is not OK, I will wait until this patchset pushed.
>>>>>
>>>>
>>>> I am unsure why you would need to sort codecs.
>>>
>>> For performance reason.
>>
>> Performance of what?
>
> avcodec_find_decoder/encoder (by using bsearch).
>
>
> Considering you can have multiple of those for any given codec Id and order
> matters, that seems like a risky idea, or a rather complex one at least.
> Perhaps not the first (or second) place to start optimization.

I've thought about it.

Thank's.

Patch hide | download patch | download mbox

diff --git a/configure b/configure
index fcfa7aa..d0bb8c7 100755
--- a/configure
+++ b/configure
@@ -3523,9 +3523,6 @@  find_things(){
     sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
 }
 
-ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
-DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
-PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
 OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
@@ -3539,6 +3536,13 @@  find_things_extern(){
     sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
 }
 
+ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
+DECODER_LIST=$(find_things_extern decoder AVCodec libavcodec/allcodecs.c)
+CODEC_LIST="
+    $ENCODER_LIST
+    $DECODER_LIST
+"
+PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parser.c)
 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
 HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
@@ -7027,6 +7031,8 @@  print_enabled_components(){
     cp_if_changed $TMPH $file
 }
 
+print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
+print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
 print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
 print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
 
diff --git a/doc/APIchanges b/doc/APIchanges
index 6185545..77da22c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@  libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2018-01-xx - xxxxxxx - lavc 58.9.100 - avcodec.h
+  Deprecate use of avcodec_register(), avcodec_register_all(), and
+  av_codec_next(). Add av_codec_iterate().
+
 2018-01-xx - xxxxxxx - lavf 58.7.100 - avformat.h
   Deprecate AVFormatContext filename field which had limited length, use the
   new dynamically allocated url field instead.
diff --git a/libavcodec/.gitignore b/libavcodec/.gitignore
index 77a2ab1..28814f7 100644
--- a/libavcodec/.gitignore
+++ b/libavcodec/.gitignore
@@ -2,3 +2,5 @@ 
 /*_tables.c
 /*_tables.h
 /bsf_list.c
+/codec_list.c
+/parser_list.c
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index ed1e7ab..e8f0eca 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -29,641 +29,864 @@ 
 #include "avcodec.h"
 #include "version.h"
 
-#define REGISTER_ENCODER(X, x)                                          \
-    {                                                                   \
-        extern AVCodec ff_##x##_encoder;                                \
-        if (CONFIG_##X##_ENCODER)                                       \
-            avcodec_register(&ff_##x##_encoder);                        \
-    }
+extern AVCodec ff_a64multi_encoder;
+extern AVCodec ff_a64multi5_encoder;
+extern AVCodec ff_aasc_decoder;
+extern AVCodec ff_aic_decoder;
+extern AVCodec ff_alias_pix_encoder;
+extern AVCodec ff_alias_pix_decoder;
+extern AVCodec ff_amv_encoder;
+extern AVCodec ff_amv_decoder;
+extern AVCodec ff_anm_decoder;
+extern AVCodec ff_ansi_decoder;
+extern AVCodec ff_apng_encoder;
+extern AVCodec ff_apng_decoder;
+extern AVCodec ff_asv1_encoder;
+extern AVCodec ff_asv1_decoder;
+extern AVCodec ff_asv2_encoder;
+extern AVCodec ff_asv2_decoder;
+extern AVCodec ff_aura_decoder;
+extern AVCodec ff_aura2_decoder;
+extern AVCodec ff_avrp_encoder;
+extern AVCodec ff_avrp_decoder;
+extern AVCodec ff_avrn_decoder;
+extern AVCodec ff_avs_decoder;
+extern AVCodec ff_avui_encoder;
+extern AVCodec ff_avui_decoder;
+extern AVCodec ff_ayuv_encoder;
+extern AVCodec ff_ayuv_decoder;
+extern AVCodec ff_bethsoftvid_decoder;
+extern AVCodec ff_bfi_decoder;
+extern AVCodec ff_bink_decoder;
+extern AVCodec ff_bmp_encoder;
+extern AVCodec ff_bmp_decoder;
+extern AVCodec ff_bmv_video_decoder;
+extern AVCodec ff_brender_pix_decoder;
+extern AVCodec ff_c93_decoder;
+extern AVCodec ff_cavs_decoder;
+extern AVCodec ff_cdgraphics_decoder;
+extern AVCodec ff_cdxl_decoder;
+extern AVCodec ff_cfhd_decoder;
+extern AVCodec ff_cinepak_encoder;
+extern AVCodec ff_cinepak_decoder;
+extern AVCodec ff_clearvideo_decoder;
+extern AVCodec ff_cljr_encoder;
+extern AVCodec ff_cljr_decoder;
+extern AVCodec ff_cllc_decoder;
+extern AVCodec ff_comfortnoise_encoder;
+extern AVCodec ff_comfortnoise_decoder;
+extern AVCodec ff_cpia_decoder;
+extern AVCodec ff_cscd_decoder;
+extern AVCodec ff_cyuv_decoder;
+extern AVCodec ff_dds_decoder;
+extern AVCodec ff_dfa_decoder;
+extern AVCodec ff_dirac_decoder;
+extern AVCodec ff_dnxhd_encoder;
+extern AVCodec ff_dnxhd_decoder;
+extern AVCodec ff_dpx_encoder;
+extern AVCodec ff_dpx_decoder;
+extern AVCodec ff_dsicinvideo_decoder;
+extern AVCodec ff_dvaudio_decoder;
+extern AVCodec ff_dvvideo_encoder;
+extern AVCodec ff_dvvideo_decoder;
+extern AVCodec ff_dxa_decoder;
+extern AVCodec ff_dxtory_decoder;
+extern AVCodec ff_dxv_decoder;
+extern AVCodec ff_eacmv_decoder;
+extern AVCodec ff_eamad_decoder;
+extern AVCodec ff_eatgq_decoder;
+extern AVCodec ff_eatgv_decoder;
+extern AVCodec ff_eatqi_decoder;
+extern AVCodec ff_eightbps_decoder;
+extern AVCodec ff_eightsvx_exp_decoder;
+extern AVCodec ff_eightsvx_fib_decoder;
+extern AVCodec ff_escape124_decoder;
+extern AVCodec ff_escape130_decoder;
+extern AVCodec ff_exr_decoder;
+extern AVCodec ff_ffv1_encoder;
+extern AVCodec ff_ffv1_decoder;
+extern AVCodec ff_ffvhuff_encoder;
+extern AVCodec ff_ffvhuff_decoder;
+extern AVCodec ff_fic_decoder;
+extern AVCodec ff_fits_encoder;
+extern AVCodec ff_fits_decoder;
+extern AVCodec ff_flashsv_encoder;
+extern AVCodec ff_flashsv_decoder;
+extern AVCodec ff_flashsv2_encoder;
+extern AVCodec ff_flashsv2_decoder;
+extern AVCodec ff_flic_decoder;
+extern AVCodec ff_flv_encoder;
+extern AVCodec ff_flv_decoder;
+extern AVCodec ff_fmvc_decoder;
+extern AVCodec ff_fourxm_decoder;
+extern AVCodec ff_fraps_decoder;
+extern AVCodec ff_frwu_decoder;
+extern AVCodec ff_g2m_decoder;
+extern AVCodec ff_gdv_decoder;
+extern AVCodec ff_gif_encoder;
+extern AVCodec ff_gif_decoder;
+extern AVCodec ff_h261_encoder;
+extern AVCodec ff_h261_decoder;
+extern AVCodec ff_h263_encoder;
+extern AVCodec ff_h263_decoder;
+extern AVCodec ff_h263i_decoder;
+extern AVCodec ff_h263p_encoder;
+extern AVCodec ff_h263p_decoder;
+extern AVCodec ff_h263_v4l2m2m_decoder;
+extern AVCodec ff_h264_decoder;
+extern AVCodec ff_h264_crystalhd_decoder;
+extern AVCodec ff_h264_v4l2m2m_decoder;
+extern AVCodec ff_h264_mediacodec_decoder;
+extern AVCodec ff_h264_mmal_decoder;
+extern AVCodec ff_h264_qsv_decoder;
+extern AVCodec ff_h264_rkmpp_decoder;
+extern AVCodec ff_hap_encoder;
+extern AVCodec ff_hap_decoder;
+extern AVCodec ff_hevc_decoder;
+extern AVCodec ff_hevc_qsv_decoder;
+extern AVCodec ff_hevc_rkmpp_decoder;
+extern AVCodec ff_hevc_v4l2m2m_decoder;
+extern AVCodec ff_hnm4_video_decoder;
+extern AVCodec ff_hq_hqa_decoder;
+extern AVCodec ff_hqx_decoder;
+extern AVCodec ff_huffyuv_encoder;
+extern AVCodec ff_huffyuv_decoder;
+extern AVCodec ff_idcin_decoder;
+extern AVCodec ff_iff_ilbm_decoder;
+extern AVCodec ff_indeo2_decoder;
+extern AVCodec ff_indeo3_decoder;
+extern AVCodec ff_indeo4_decoder;
+extern AVCodec ff_indeo5_decoder;
+extern AVCodec ff_interplay_video_decoder;
+extern AVCodec ff_jpeg2000_encoder;
+extern AVCodec ff_jpeg2000_decoder;
+extern AVCodec ff_jpegls_encoder;
+extern AVCodec ff_jpegls_decoder;
+extern AVCodec ff_jv_decoder;
+extern AVCodec ff_kgv1_decoder;
+extern AVCodec ff_kmvc_decoder;
+extern AVCodec ff_lagarith_decoder;
+extern AVCodec ff_ljpeg_encoder;
+extern AVCodec ff_loco_decoder;
+extern AVCodec ff_m101_decoder;
+extern AVCodec ff_magicyuv_encoder;
+extern AVCodec ff_magicyuv_decoder;
+extern AVCodec ff_mdec_decoder;
+extern AVCodec ff_mimic_decoder;
+extern AVCodec ff_mjpeg_encoder;
+extern AVCodec ff_mjpeg_decoder;
+extern AVCodec ff_mjpegb_decoder;
+extern AVCodec ff_mmvideo_decoder;
+extern AVCodec ff_motionpixels_decoder;
+extern AVCodec ff_mpeg1video_encoder;
+extern AVCodec ff_mpeg1video_decoder;
+extern AVCodec ff_mpeg2video_encoder;
+extern AVCodec ff_mpeg2video_decoder;
+extern AVCodec ff_mpeg4_encoder;
+extern AVCodec ff_mpeg4_decoder;
+extern AVCodec ff_mpeg4_crystalhd_decoder;
+extern AVCodec ff_mpeg4_v4l2m2m_decoder;
+extern AVCodec ff_mpeg4_mmal_decoder;
+extern AVCodec ff_mpegvideo_decoder;
+extern AVCodec ff_mpeg1_v4l2m2m_decoder;
+extern AVCodec ff_mpeg2_mmal_decoder;
+extern AVCodec ff_mpeg2_crystalhd_decoder;
+extern AVCodec ff_mpeg2_v4l2m2m_decoder;
+extern AVCodec ff_mpeg2_qsv_decoder;
+extern AVCodec ff_mpeg2_mediacodec_decoder;
+extern AVCodec ff_msa1_decoder;
+extern AVCodec ff_mscc_decoder;
+extern AVCodec ff_msmpeg4v1_decoder;
+extern AVCodec ff_msmpeg4v2_encoder;
+extern AVCodec ff_msmpeg4v2_decoder;
+extern AVCodec ff_msmpeg4v3_encoder;
+extern AVCodec ff_msmpeg4v3_decoder;
+extern AVCodec ff_msmpeg4_crystalhd_decoder;
+extern AVCodec ff_msrle_decoder;
+extern AVCodec ff_mss1_decoder;
+extern AVCodec ff_mss2_decoder;
+extern AVCodec ff_msvideo1_encoder;
+extern AVCodec ff_msvideo1_decoder;
+extern AVCodec ff_mszh_decoder;
+extern AVCodec ff_mts2_decoder;
+extern AVCodec ff_mvc1_decoder;
+extern AVCodec ff_mvc2_decoder;
+extern AVCodec ff_mxpeg_decoder;
+extern AVCodec ff_nuv_decoder;
+extern AVCodec ff_paf_video_decoder;
+extern AVCodec ff_pam_encoder;
+extern AVCodec ff_pam_decoder;
+extern AVCodec ff_pbm_encoder;
+extern AVCodec ff_pbm_decoder;
+extern AVCodec ff_pcx_encoder;
+extern AVCodec ff_pcx_decoder;
+extern AVCodec ff_pgm_encoder;
+extern AVCodec ff_pgm_decoder;
+extern AVCodec ff_pgmyuv_encoder;
+extern AVCodec ff_pgmyuv_decoder;
+extern AVCodec ff_pictor_decoder;
+extern AVCodec ff_pixlet_decoder;
+extern AVCodec ff_png_encoder;
+extern AVCodec ff_png_decoder;
+extern AVCodec ff_ppm_encoder;
+extern AVCodec ff_ppm_decoder;
+extern AVCodec ff_prores_encoder;
+extern AVCodec ff_prores_decoder;
+extern AVCodec ff_prores_aw_encoder;
+extern AVCodec ff_prores_ks_encoder;
+extern AVCodec ff_prores_lgpl_decoder;
+extern AVCodec ff_psd_decoder;
+extern AVCodec ff_ptx_decoder;
+extern AVCodec ff_qdraw_decoder;
+extern AVCodec ff_qpeg_decoder;
+extern AVCodec ff_qtrle_encoder;
+extern AVCodec ff_qtrle_decoder;
+extern AVCodec ff_r10k_encoder;
+extern AVCodec ff_r10k_decoder;
+extern AVCodec ff_r210_encoder;
+extern AVCodec ff_r210_decoder;
+extern AVCodec ff_rawvideo_encoder;
+extern AVCodec ff_rawvideo_decoder;
+extern AVCodec ff_rl2_decoder;
+extern AVCodec ff_roq_encoder;
+extern AVCodec ff_roq_decoder;
+extern AVCodec ff_rpza_decoder;
+extern AVCodec ff_rscc_decoder;
+extern AVCodec ff_rv10_encoder;
+extern AVCodec ff_rv10_decoder;
+extern AVCodec ff_rv20_encoder;
+extern AVCodec ff_rv20_decoder;
+extern AVCodec ff_rv30_decoder;
+extern AVCodec ff_rv40_decoder;
+extern AVCodec ff_s302m_encoder;
+extern AVCodec ff_s302m_decoder;
+extern AVCodec ff_sanm_decoder;
+extern AVCodec ff_scpr_decoder;
+extern AVCodec ff_screenpresso_decoder;
+extern AVCodec ff_sdx2_dpcm_decoder;
+extern AVCodec ff_sgi_encoder;
+extern AVCodec ff_sgi_decoder;
+extern AVCodec ff_sgirle_decoder;
+extern AVCodec ff_sheervideo_decoder;
+extern AVCodec ff_smacker_decoder;
+extern AVCodec ff_smc_decoder;
+extern AVCodec ff_smvjpeg_decoder;
+extern AVCodec ff_snow_encoder;
+extern AVCodec ff_snow_decoder;
+extern AVCodec ff_sp5x_decoder;
+extern AVCodec ff_speedhq_decoder;
+extern AVCodec ff_srgc_decoder;
+extern AVCodec ff_sunrast_encoder;
+extern AVCodec ff_sunrast_decoder;
+extern AVCodec ff_svq1_encoder;
+extern AVCodec ff_svq1_decoder;
+extern AVCodec ff_svq3_decoder;
+extern AVCodec ff_targa_encoder;
+extern AVCodec ff_targa_decoder;
+extern AVCodec ff_targa_y216_decoder;
+extern AVCodec ff_tdsc_decoder;
+extern AVCodec ff_theora_decoder;
+extern AVCodec ff_thp_decoder;
+extern AVCodec ff_tiertexseqvideo_decoder;
+extern AVCodec ff_tiff_encoder;
+extern AVCodec ff_tiff_decoder;
+extern AVCodec ff_tmv_decoder;
+extern AVCodec ff_truemotion1_decoder;
+extern AVCodec ff_truemotion2_decoder;
+extern AVCodec ff_truemotion2rt_decoder;
+extern AVCodec ff_tscc_decoder;
+extern AVCodec ff_tscc2_decoder;
+extern AVCodec ff_txd_decoder;
+extern AVCodec ff_ulti_decoder;
+extern AVCodec ff_utvideo_encoder;
+extern AVCodec ff_utvideo_decoder;
+extern AVCodec ff_v210_encoder;
+extern AVCodec ff_v210_decoder;
+extern AVCodec ff_v210x_decoder;
+extern AVCodec ff_v308_encoder;
+extern AVCodec ff_v308_decoder;
+extern AVCodec ff_v408_encoder;
+extern AVCodec ff_v408_decoder;
+extern AVCodec ff_v410_encoder;
+extern AVCodec ff_v410_decoder;
+extern AVCodec ff_vb_decoder;
+extern AVCodec ff_vble_decoder;
+extern AVCodec ff_vc1_decoder;
+extern AVCodec ff_vc1_crystalhd_decoder;
+extern AVCodec ff_vc1image_decoder;
+extern AVCodec ff_vc1_mmal_decoder;
+extern AVCodec ff_vc1_qsv_decoder;
+extern AVCodec ff_vc1_v4l2m2m_decoder;
+extern AVCodec ff_vc2_encoder;
+extern AVCodec ff_vcr1_decoder;
+extern AVCodec ff_vmdvideo_decoder;
+extern AVCodec ff_vmnc_decoder;
+extern AVCodec ff_vp3_decoder;
+extern AVCodec ff_vp5_decoder;
+extern AVCodec ff_vp6_decoder;
+extern AVCodec ff_vp6a_decoder;
+extern AVCodec ff_vp6f_decoder;
+extern AVCodec ff_vp7_decoder;
+extern AVCodec ff_vp8_decoder;
+extern AVCodec ff_vp8_rkmpp_decoder;
+extern AVCodec ff_vp8_v4l2m2m_decoder;
+extern AVCodec ff_vp9_decoder;
+extern AVCodec ff_vp9_rkmpp_decoder;
+extern AVCodec ff_vp9_v4l2m2m_decoder;
+extern AVCodec ff_vqa_decoder;
+extern AVCodec ff_bitpacked_decoder;
+extern AVCodec ff_webp_decoder;
+extern AVCodec ff_wrapped_avframe_encoder;
+extern AVCodec ff_wrapped_avframe_decoder;
+extern AVCodec ff_wmv1_encoder;
+extern AVCodec ff_wmv1_decoder;
+extern AVCodec ff_wmv2_encoder;
+extern AVCodec ff_wmv2_decoder;
+extern AVCodec ff_wmv3_decoder;
+extern AVCodec ff_wmv3_crystalhd_decoder;
+extern AVCodec ff_wmv3image_decoder;
+extern AVCodec ff_wnv1_decoder;
+extern AVCodec ff_xan_wc3_decoder;
+extern AVCodec ff_xan_wc4_decoder;
+extern AVCodec ff_xbm_encoder;
+extern AVCodec ff_xbm_decoder;
+extern AVCodec ff_xface_encoder;
+extern AVCodec ff_xface_decoder;
+extern AVCodec ff_xl_decoder;
+extern AVCodec ff_xpm_decoder;
+extern AVCodec ff_xwd_encoder;
+extern AVCodec ff_xwd_decoder;
+extern AVCodec ff_y41p_encoder;
+extern AVCodec ff_y41p_decoder;
+extern AVCodec ff_ylc_decoder;
+extern AVCodec ff_yop_decoder;
+extern AVCodec ff_yuv4_encoder;
+extern AVCodec ff_yuv4_decoder;
+extern AVCodec ff_zero12v_decoder;
+extern AVCodec ff_zerocodec_decoder;
+extern AVCodec ff_zlib_encoder;
+extern AVCodec ff_zlib_decoder;
+extern AVCodec ff_zmbv_encoder;
+extern AVCodec ff_zmbv_decoder;
+
+/* audio codecs */
+extern AVCodec ff_aac_encoder;
+extern AVCodec ff_aac_decoder;
+extern AVCodec ff_aac_fixed_decoder;
+extern AVCodec ff_aac_latm_decoder;
+extern AVCodec ff_ac3_encoder;
+extern AVCodec ff_ac3_decoder;
+extern AVCodec ff_ac3_fixed_encoder;
+extern AVCodec ff_ac3_fixed_decoder;
+extern AVCodec ff_alac_encoder;
+extern AVCodec ff_alac_decoder;
+extern AVCodec ff_als_decoder;
+extern AVCodec ff_amrnb_decoder;
+extern AVCodec ff_amrwb_decoder;
+extern AVCodec ff_ape_decoder;
+extern AVCodec ff_aptx_encoder;
+extern AVCodec ff_aptx_decoder;
+extern AVCodec ff_atrac1_decoder;
+extern AVCodec ff_atrac3_decoder;
+extern AVCodec ff_atrac3al_decoder;
+extern AVCodec ff_atrac3p_decoder;
+extern AVCodec ff_atrac3pal_decoder;
+extern AVCodec ff_binkaudio_dct_decoder;
+extern AVCodec ff_binkaudio_rdft_decoder;
+extern AVCodec ff_bmv_audio_decoder;
+extern AVCodec ff_cook_decoder;
+extern AVCodec ff_dca_encoder;
+extern AVCodec ff_dca_decoder;
+extern AVCodec ff_dolby_e_decoder;
+extern AVCodec ff_dsd_lsbf_decoder;
+extern AVCodec ff_dsd_msbf_decoder;
+extern AVCodec ff_dsd_lsbf_planar_decoder;
+extern AVCodec ff_dsd_msbf_planar_decoder;
+extern AVCodec ff_dsicinaudio_decoder;
+extern AVCodec ff_dss_sp_decoder;
+extern AVCodec ff_dst_decoder;
+extern AVCodec ff_eac3_encoder;
+extern AVCodec ff_eac3_decoder;
+extern AVCodec ff_evrc_decoder;
+extern AVCodec ff_ffwavesynth_decoder;
+extern AVCodec ff_flac_encoder;
+extern AVCodec ff_flac_decoder;
+extern AVCodec ff_g723_1_encoder;
+extern AVCodec ff_g723_1_decoder;
+extern AVCodec ff_g729_decoder;
+extern AVCodec ff_gsm_decoder;
+extern AVCodec ff_gsm_ms_decoder;
+extern AVCodec ff_iac_decoder;
+extern AVCodec ff_imc_decoder;
+extern AVCodec ff_interplay_acm_decoder;
+extern AVCodec ff_mace3_decoder;
+extern AVCodec ff_mace6_decoder;
+extern AVCodec ff_metasound_decoder;
+extern AVCodec ff_mlp_encoder;
+extern AVCodec ff_mlp_decoder;
+extern AVCodec ff_mp1_decoder;
+extern AVCodec ff_mp1float_decoder;
+extern AVCodec ff_mp2_encoder;
+extern AVCodec ff_mp2_decoder;
+extern AVCodec ff_mp2float_decoder;
+extern AVCodec ff_mp2fixed_encoder;
+extern AVCodec ff_mp3_decoder;
+extern AVCodec ff_mp3float_decoder;
+extern AVCodec ff_mp3adu_decoder;
+extern AVCodec ff_mp3adufloat_decoder;
+extern AVCodec ff_mp3on4_decoder;
+extern AVCodec ff_mp3on4float_decoder;
+extern AVCodec ff_mpc7_decoder;
+extern AVCodec ff_mpc8_decoder;
+extern AVCodec ff_nellymoser_encoder;
+extern AVCodec ff_nellymoser_decoder;
+extern AVCodec ff_on2avc_decoder;
+extern AVCodec ff_opus_encoder;
+extern AVCodec ff_opus_decoder;
+extern AVCodec ff_paf_audio_decoder;
+extern AVCodec ff_qcelp_decoder;
+extern AVCodec ff_qdm2_decoder;
+extern AVCodec ff_qdmc_decoder;
+extern AVCodec ff_ra_144_encoder;
+extern AVCodec ff_ra_144_decoder;
+extern AVCodec ff_ra_288_decoder;
+extern AVCodec ff_ralf_decoder;
+extern AVCodec ff_shorten_decoder;
+extern AVCodec ff_sipr_decoder;
+extern AVCodec ff_smackaud_decoder;
+extern AVCodec ff_sonic_encoder;
+extern AVCodec ff_sonic_decoder;
+extern AVCodec ff_sonic_ls_encoder;
+extern AVCodec ff_tak_decoder;
+extern AVCodec ff_truehd_encoder;
+extern AVCodec ff_truehd_decoder;
+extern AVCodec ff_truespeech_decoder;
+extern AVCodec ff_tta_encoder;
+extern AVCodec ff_tta_decoder;
+extern AVCodec ff_twinvq_decoder;
+extern AVCodec ff_vmdaudio_decoder;
+extern AVCodec ff_vorbis_encoder;
+extern AVCodec ff_vorbis_decoder;
+extern AVCodec ff_wavpack_encoder;
+extern AVCodec ff_wavpack_decoder;
+extern AVCodec ff_wmalossless_decoder;
+extern AVCodec ff_wmapro_decoder;
+extern AVCodec ff_wmav1_encoder;
+extern AVCodec ff_wmav1_decoder;
+extern AVCodec ff_wmav2_encoder;
+extern AVCodec ff_wmav2_decoder;
+extern AVCodec ff_wmavoice_decoder;
+extern AVCodec ff_ws_snd1_decoder;
+extern AVCodec ff_xma1_decoder;
+extern AVCodec ff_xma2_decoder;
+
+/* PCM codecs */
+extern AVCodec ff_pcm_alaw_encoder;
+extern AVCodec ff_pcm_alaw_decoder;
+extern AVCodec ff_pcm_bluray_decoder;
+extern AVCodec ff_pcm_dvd_decoder;
+extern AVCodec ff_pcm_f16le_decoder;
+extern AVCodec ff_pcm_f24le_decoder;
+extern AVCodec ff_pcm_f32be_encoder;
+extern AVCodec ff_pcm_f32be_decoder;
+extern AVCodec ff_pcm_f32le_encoder;
+extern AVCodec ff_pcm_f32le_decoder;
+extern AVCodec ff_pcm_f64be_encoder;
+extern AVCodec ff_pcm_f64be_decoder;
+extern AVCodec ff_pcm_f64le_encoder;
+extern AVCodec ff_pcm_f64le_decoder;
+extern AVCodec ff_pcm_lxf_decoder;
+extern AVCodec ff_pcm_mulaw_encoder;
+extern AVCodec ff_pcm_mulaw_decoder;
+extern AVCodec ff_pcm_s8_encoder;
+extern AVCodec ff_pcm_s8_decoder;
+extern AVCodec ff_pcm_s8_planar_encoder;
+extern AVCodec ff_pcm_s8_planar_decoder;
+extern AVCodec ff_pcm_s16be_encoder;
+extern AVCodec ff_pcm_s16be_decoder;
+extern AVCodec ff_pcm_s16be_planar_encoder;
+extern AVCodec ff_pcm_s16be_planar_decoder;
+extern AVCodec ff_pcm_s16le_encoder;
+extern AVCodec ff_pcm_s16le_decoder;
+extern AVCodec ff_pcm_s16le_planar_encoder;
+extern AVCodec ff_pcm_s16le_planar_decoder;
+extern AVCodec ff_pcm_s24be_encoder;
+extern AVCodec ff_pcm_s24be_decoder;
+extern AVCodec ff_pcm_s24daud_encoder;
+extern AVCodec ff_pcm_s24daud_decoder;
+extern AVCodec ff_pcm_s24le_encoder;
+extern AVCodec ff_pcm_s24le_decoder;
+extern AVCodec ff_pcm_s24le_planar_encoder;
+extern AVCodec ff_pcm_s24le_planar_decoder;
+extern AVCodec ff_pcm_s32be_encoder;
+extern AVCodec ff_pcm_s32be_decoder;
+extern AVCodec ff_pcm_s32le_encoder;
+extern AVCodec ff_pcm_s32le_decoder;
+extern AVCodec ff_pcm_s32le_planar_encoder;
+extern AVCodec ff_pcm_s32le_planar_decoder;
+extern AVCodec ff_pcm_s64be_encoder;
+extern AVCodec ff_pcm_s64be_decoder;
+extern AVCodec ff_pcm_s64le_encoder;
+extern AVCodec ff_pcm_s64le_decoder;
+extern AVCodec ff_pcm_u8_encoder;
+extern AVCodec ff_pcm_u8_decoder;
+extern AVCodec ff_pcm_u16be_encoder;
+extern AVCodec ff_pcm_u16be_decoder;
+extern AVCodec ff_pcm_u16le_encoder;
+extern AVCodec ff_pcm_u16le_decoder;
+extern AVCodec ff_pcm_u24be_encoder;
+extern AVCodec ff_pcm_u24be_decoder;
+extern AVCodec ff_pcm_u24le_encoder;
+extern AVCodec ff_pcm_u24le_decoder;
+extern AVCodec ff_pcm_u32be_encoder;
+extern AVCodec ff_pcm_u32be_decoder;
+extern AVCodec ff_pcm_u32le_encoder;
+extern AVCodec ff_pcm_u32le_decoder;
+extern AVCodec ff_pcm_zork_decoder;
+
+/* DPCM codecs */
+extern AVCodec ff_gremlin_dpcm_decoder;
+extern AVCodec ff_interplay_dpcm_decoder;
+extern AVCodec ff_roq_dpcm_encoder;
+extern AVCodec ff_roq_dpcm_decoder;
+extern AVCodec ff_sol_dpcm_decoder;
+extern AVCodec ff_xan_dpcm_decoder;
+
+/* ADPCM codecs */
+extern AVCodec ff_adpcm_4xm_decoder;
+extern AVCodec ff_adpcm_adx_encoder;
+extern AVCodec ff_adpcm_adx_decoder;
+extern AVCodec ff_adpcm_afc_decoder;
+extern AVCodec ff_adpcm_aica_decoder;
+extern AVCodec ff_adpcm_ct_decoder;
+extern AVCodec ff_adpcm_dtk_decoder;
+extern AVCodec ff_adpcm_ea_decoder;
+extern AVCodec ff_adpcm_ea_maxis_xa_decoder;
+extern AVCodec ff_adpcm_ea_r1_decoder;
+extern AVCodec ff_adpcm_ea_r2_decoder;
+extern AVCodec ff_adpcm_ea_r3_decoder;
+extern AVCodec ff_adpcm_ea_xas_decoder;
+extern AVCodec ff_adpcm_g722_encoder;
+extern AVCodec ff_adpcm_g722_decoder;
+extern AVCodec ff_adpcm_g726_encoder;
+extern AVCodec ff_adpcm_g726_decoder;
+extern AVCodec ff_adpcm_g726le_encoder;
+extern AVCodec ff_adpcm_g726le_decoder;
+extern AVCodec ff_adpcm_ima_amv_decoder;
+extern AVCodec ff_adpcm_ima_apc_decoder;
+extern AVCodec ff_adpcm_ima_dat4_decoder;
+extern AVCodec ff_adpcm_ima_dk3_decoder;
+extern AVCodec ff_adpcm_ima_dk4_decoder;
+extern AVCodec ff_adpcm_ima_ea_eacs_decoder;
+extern AVCodec ff_adpcm_ima_ea_sead_decoder;
+extern AVCodec ff_adpcm_ima_iss_decoder;
+extern AVCodec ff_adpcm_ima_oki_decoder;
+extern AVCodec ff_adpcm_ima_qt_encoder;
+extern AVCodec ff_adpcm_ima_qt_decoder;
+extern AVCodec ff_adpcm_ima_rad_decoder;
+extern AVCodec ff_adpcm_ima_smjpeg_decoder;
+extern AVCodec ff_adpcm_ima_wav_encoder;
+extern AVCodec ff_adpcm_ima_wav_decoder;
+extern AVCodec ff_adpcm_ima_ws_decoder;
+extern AVCodec ff_adpcm_ms_encoder;
+extern AVCodec ff_adpcm_ms_decoder;
+extern AVCodec ff_adpcm_mtaf_decoder;
+extern AVCodec ff_adpcm_psx_decoder;
+extern AVCodec ff_adpcm_sbpro_2_decoder;
+extern AVCodec ff_adpcm_sbpro_3_decoder;
+extern AVCodec ff_adpcm_sbpro_4_decoder;
+extern AVCodec ff_adpcm_swf_encoder;
+extern AVCodec ff_adpcm_swf_decoder;
+extern AVCodec ff_adpcm_thp_decoder;
+extern AVCodec ff_adpcm_thp_le_decoder;
+extern AVCodec ff_adpcm_vima_decoder;
+extern AVCodec ff_adpcm_xa_decoder;
+extern AVCodec ff_adpcm_yamaha_encoder;
+extern AVCodec ff_adpcm_yamaha_decoder;
+
+/* subtitles */
+extern AVCodec ff_ssa_encoder;
+extern AVCodec ff_ssa_decoder;
+extern AVCodec ff_ass_encoder;
+extern AVCodec ff_ass_decoder;
+extern AVCodec ff_ccaption_decoder;
+extern AVCodec ff_dvbsub_encoder;
+extern AVCodec ff_dvbsub_decoder;
+extern AVCodec ff_dvdsub_encoder;
+extern AVCodec ff_dvdsub_decoder;
+extern AVCodec ff_jacosub_decoder;
+extern AVCodec ff_microdvd_decoder;
+extern AVCodec ff_movtext_encoder;
+extern AVCodec ff_movtext_decoder;
+extern AVCodec ff_mpl2_decoder;
+extern AVCodec ff_pgssub_decoder;
+extern AVCodec ff_pjs_decoder;
+extern AVCodec ff_realtext_decoder;
+extern AVCodec ff_sami_decoder;
+extern AVCodec ff_srt_encoder;
+extern AVCodec ff_srt_decoder;
+extern AVCodec ff_stl_decoder;
+extern AVCodec ff_subrip_encoder;
+extern AVCodec ff_subrip_decoder;
+extern AVCodec ff_subviewer_decoder;
+extern AVCodec ff_subviewer1_decoder;
+extern AVCodec ff_text_encoder;
+extern AVCodec ff_text_decoder;
+extern AVCodec ff_vplayer_decoder;
+extern AVCodec ff_webvtt_encoder;
+extern AVCodec ff_webvtt_decoder;
+extern AVCodec ff_xsub_encoder;
+extern AVCodec ff_xsub_decoder;
+
+/* external libraries */
+extern AVCodec ff_aac_at_encoder;
+extern AVCodec ff_aac_at_decoder;
+extern AVCodec ff_ac3_at_decoder;
+extern AVCodec ff_adpcm_ima_qt_at_decoder;
+extern AVCodec ff_alac_at_encoder;
+extern AVCodec ff_alac_at_decoder;
+extern AVCodec ff_amr_nb_at_decoder;
+extern AVCodec ff_eac3_at_decoder;
+extern AVCodec ff_gsm_ms_at_decoder;
+extern AVCodec ff_ilbc_at_encoder;
+extern AVCodec ff_ilbc_at_decoder;
+extern AVCodec ff_mp1_at_decoder;
+extern AVCodec ff_mp2_at_decoder;
+extern AVCodec ff_mp3_at_decoder;
+extern AVCodec ff_pcm_alaw_at_encoder;
+extern AVCodec ff_pcm_alaw_at_decoder;
+extern AVCodec ff_pcm_mulaw_at_encoder;
+extern AVCodec ff_pcm_mulaw_at_decoder;
+extern AVCodec ff_qdmc_at_decoder;
+extern AVCodec ff_qdm2_at_decoder;
+extern AVCodec ff_libcelt_decoder;
+extern AVCodec ff_libfdk_aac_encoder;
+extern AVCodec ff_libfdk_aac_decoder;
+extern AVCodec ff_libgsm_encoder;
+extern AVCodec ff_libgsm_decoder;
+extern AVCodec ff_libgsm_ms_encoder;
+extern AVCodec ff_libgsm_ms_decoder;
+extern AVCodec ff_libilbc_encoder;
+extern AVCodec ff_libilbc_decoder;
+extern AVCodec ff_libmp3lame_encoder;
+extern AVCodec ff_libopencore_amrnb_encoder;
+extern AVCodec ff_libopencore_amrnb_decoder;
+extern AVCodec ff_libopencore_amrwb_decoder;
+extern AVCodec ff_libopenjpeg_encoder;
+extern AVCodec ff_libopenjpeg_decoder;
+extern AVCodec ff_libopus_encoder;
+extern AVCodec ff_libopus_decoder;
+extern AVCodec ff_librsvg_decoder;
+extern AVCodec ff_libshine_encoder;
+extern AVCodec ff_libspeex_encoder;
+extern AVCodec ff_libspeex_decoder;
+extern AVCodec ff_libtheora_encoder;
+extern AVCodec ff_libtwolame_encoder;
+extern AVCodec ff_libvo_amrwbenc_encoder;
+extern AVCodec ff_libvorbis_encoder;
+extern AVCodec ff_libvorbis_decoder;
+extern AVCodec ff_libvpx_vp8_encoder;
+extern AVCodec ff_libvpx_vp8_decoder;
+extern AVCodec ff_libvpx_vp9_encoder;
+extern AVCodec ff_libvpx_vp9_decoder;
+extern AVCodec ff_libwavpack_encoder;
+/* preferred over libwebp */
+extern AVCodec ff_libwebp_anim_encoder;
+extern AVCodec ff_libwebp_encoder;
+extern AVCodec ff_libx262_encoder;
+extern AVCodec ff_libx264_encoder;
+extern AVCodec ff_libx264rgb_encoder;
+extern AVCodec ff_libx265_encoder;
+extern AVCodec ff_libxavs_encoder;
+extern AVCodec ff_libxvid_encoder;
+extern AVCodec ff_libzvbi_teletext_decoder;
+
+/* text */
+extern AVCodec ff_bintext_decoder;
+extern AVCodec ff_xbin_decoder;
+extern AVCodec ff_idf_decoder;
 
-#define REGISTER_DECODER(X, x)                                          \
-    {                                                                   \
-        extern AVCodec ff_##x##_decoder;                                \
-        if (CONFIG_##X##_DECODER)                                       \
-            avcodec_register(&ff_##x##_decoder);                        \
+/* external libraries, that shouldn't be used by default if one of the
+ * above is available */
+extern AVCodec ff_h263_v4l2m2m_encoder;
+extern AVCodec ff_libopenh264_encoder;
+extern AVCodec ff_libopenh264_decoder;
+extern AVCodec ff_h264_amf_encoder;
+extern AVCodec ff_h264_cuvid_decoder;
+extern AVCodec ff_h264_nvenc_encoder;
+extern AVCodec ff_h264_omx_encoder;
+extern AVCodec ff_h264_qsv_encoder;
+extern AVCodec ff_h264_v4l2m2m_encoder;
+extern AVCodec ff_h264_vaapi_encoder;
+extern AVCodec ff_h264_videotoolbox_encoder;
+#if FF_API_NVENC_OLD_NAME
+extern AVCodec ff_nvenc_encoder;
+extern AVCodec ff_nvenc_h264_encoder;
+extern AVCodec ff_nvenc_hevc_encoder;
+#endif
+extern AVCodec ff_hevc_amf_encoder;
+extern AVCodec ff_hevc_cuvid_decoder;
+extern AVCodec ff_hevc_mediacodec_decoder;
+extern AVCodec ff_hevc_nvenc_encoder;
+extern AVCodec ff_hevc_qsv_encoder;
+extern AVCodec ff_hevc_v4l2m2m_encoder;
+extern AVCodec ff_hevc_vaapi_encoder;
+extern AVCodec ff_hevc_videotoolbox_encoder;
+extern AVCodec ff_libkvazaar_encoder;
+extern AVCodec ff_mjpeg_cuvid_decoder;
+extern AVCodec ff_mjpeg_qsv_encoder;
+extern AVCodec ff_mjpeg_vaapi_encoder;
+extern AVCodec ff_mpeg1_cuvid_decoder;
+extern AVCodec ff_mpeg2_cuvid_decoder;
+extern AVCodec ff_mpeg2_qsv_encoder;
+extern AVCodec ff_mpeg2_vaapi_encoder;
+extern AVCodec ff_mpeg4_cuvid_decoder;
+extern AVCodec ff_mpeg4_mediacodec_decoder;
+extern AVCodec ff_mpeg4_v4l2m2m_encoder;
+extern AVCodec ff_vc1_cuvid_decoder;
+extern AVCodec ff_vp8_cuvid_decoder;
+extern AVCodec ff_vp8_mediacodec_decoder;
+extern AVCodec ff_vp8_qsv_decoder;
+extern AVCodec ff_vp8_v4l2m2m_encoder;
+extern AVCodec ff_vp8_vaapi_encoder;
+extern AVCodec ff_vp9_cuvid_decoder;
+extern AVCodec ff_vp9_mediacodec_decoder;
+extern AVCodec ff_vp9_vaapi_encoder;
+
+#include "codec_list.c"
+
+#if CONFIG_ME_CMP
+#include "me_cmp.h"
+#endif
+
+static AVOnce av_codec_static_init = AV_ONCE_INIT;
+static void av_codec_init_static(void)
+{
+#if CONFIG_ME_CMP
+    ff_me_cmp_init_static();
+#endif
+    for (int i = 0; codec_list[i]; i++) {
+        if (codec_list[i]->init_static_data)
+            codec_list[i]->init_static_data((AVCodec*)codec_list[i]);
     }
+}
+
+const AVCodec *av_codec_iterate(void **opaque)
+{
+    uintptr_t i = (uintptr_t)*opaque;
+    const AVCodec *c = codec_list[i];
+
+    ff_thread_once(&av_codec_static_init, av_codec_init_static);
 
-#define REGISTER_ENCDEC(X, x) REGISTER_ENCODER(X, x); REGISTER_DECODER(X, x)
+    if (c)
+        *opaque = (void*)(i + 1);
 
-#define REGISTER_PARSER(X, x)                                           \
-    {                                                                   \
-        extern AVCodecParser ff_##x##_parser;                           \
-        if (CONFIG_##X##_PARSER)                                        \
-            av_register_codec_parser(&ff_##x##_parser);                 \
+    return c;
+}
+
+#if FF_API_NEXT
+FF_DISABLE_DEPRECATION_WARNINGS
+static AVOnce av_codec_next_init = AV_ONCE_INIT;
+
+static void av_codec_init_next(void)
+{
+    AVCodec *prev = NULL, *p;
+    void *i = 0;
+    while ((p = (AVCodec*)av_codec_iterate(&i))) {
+        if (prev)
+            prev->next = p;
+        prev = p;
     }
+}
+
 
-static void register_all(void)
+
+av_cold void avcodec_register(AVCodec *codec)
 {
-    /* video codecs */
-    REGISTER_ENCODER(A64MULTI,          a64multi);
-    REGISTER_ENCODER(A64MULTI5,         a64multi5);
-    REGISTER_DECODER(AASC,              aasc);
-    REGISTER_DECODER(AIC,               aic);
-    REGISTER_ENCDEC (ALIAS_PIX,         alias_pix);
-    REGISTER_ENCDEC (AMV,               amv);
-    REGISTER_DECODER(ANM,               anm);
-    REGISTER_DECODER(ANSI,              ansi);
-    REGISTER_ENCDEC (APNG,              apng);
-    REGISTER_ENCDEC (ASV1,              asv1);
-    REGISTER_ENCDEC (ASV2,              asv2);
-    REGISTER_DECODER(AURA,              aura);
-    REGISTER_DECODER(AURA2,             aura2);
-    REGISTER_ENCDEC (AVRP,              avrp);
-    REGISTER_DECODER(AVRN,              avrn);
-    REGISTER_DECODER(AVS,               avs);
-    REGISTER_ENCDEC (AVUI,              avui);
-    REGISTER_ENCDEC (AYUV,              ayuv);
-    REGISTER_DECODER(BETHSOFTVID,       bethsoftvid);
-    REGISTER_DECODER(BFI,               bfi);
-    REGISTER_DECODER(BINK,              bink);
-    REGISTER_ENCDEC (BMP,               bmp);
-    REGISTER_DECODER(BMV_VIDEO,         bmv_video);
-    REGISTER_DECODER(BRENDER_PIX,       brender_pix);
-    REGISTER_DECODER(C93,               c93);
-    REGISTER_DECODER(CAVS,              cavs);
-    REGISTER_DECODER(CDGRAPHICS,        cdgraphics);
-    REGISTER_DECODER(CDXL,              cdxl);
-    REGISTER_DECODER(CFHD,              cfhd);
-    REGISTER_ENCDEC (CINEPAK,           cinepak);
-    REGISTER_DECODER(CLEARVIDEO,        clearvideo);
-    REGISTER_ENCDEC (CLJR,              cljr);
-    REGISTER_DECODER(CLLC,              cllc);
-    REGISTER_ENCDEC (COMFORTNOISE,      comfortnoise);
-    REGISTER_DECODER(CPIA,              cpia);
-    REGISTER_DECODER(CSCD,              cscd);
-    REGISTER_DECODER(CYUV,              cyuv);
-    REGISTER_DECODER(DDS,               dds);
-    REGISTER_DECODER(DFA,               dfa);
-    REGISTER_DECODER(DIRAC,             dirac);
-    REGISTER_ENCDEC (DNXHD,             dnxhd);
-    REGISTER_ENCDEC (DPX,               dpx);
-    REGISTER_DECODER(DSICINVIDEO,       dsicinvideo);
-    REGISTER_DECODER(DVAUDIO,           dvaudio);
-    REGISTER_ENCDEC (DVVIDEO,           dvvideo);
-    REGISTER_DECODER(DXA,               dxa);
-    REGISTER_DECODER(DXTORY,            dxtory);
-    REGISTER_DECODER(DXV,               dxv);
-    REGISTER_DECODER(EACMV,             eacmv);
-    REGISTER_DECODER(EAMAD,             eamad);
-    REGISTER_DECODER(EATGQ,             eatgq);
-    REGISTER_DECODER(EATGV,             eatgv);
-    REGISTER_DECODER(EATQI,             eatqi);
-    REGISTER_DECODER(EIGHTBPS,          eightbps);
-    REGISTER_DECODER(EIGHTSVX_EXP,      eightsvx_exp);
-    REGISTER_DECODER(EIGHTSVX_FIB,      eightsvx_fib);
-    REGISTER_DECODER(ESCAPE124,         escape124);
-    REGISTER_DECODER(ESCAPE130,         escape130);
-    REGISTER_DECODER(EXR,               exr);
-    REGISTER_ENCDEC (FFV1,              ffv1);
-    REGISTER_ENCDEC (FFVHUFF,           ffvhuff);
-    REGISTER_DECODER(FIC,               fic);
-    REGISTER_ENCDEC (FITS,              fits);
-    REGISTER_ENCDEC (FLASHSV,           flashsv);
-    REGISTER_ENCDEC (FLASHSV2,          flashsv2);
-    REGISTER_DECODER(FLIC,              flic);
-    REGISTER_ENCDEC (FLV,               flv);
-    REGISTER_DECODER(FMVC,              fmvc);
-    REGISTER_DECODER(FOURXM,            fourxm);
-    REGISTER_DECODER(FRAPS,             fraps);
-    REGISTER_DECODER(FRWU,              frwu);
-    REGISTER_DECODER(G2M,               g2m);
-    REGISTER_DECODER(GDV,               gdv);
-    REGISTER_ENCDEC (GIF,               gif);
-    REGISTER_ENCDEC (H261,              h261);
-    REGISTER_ENCDEC (H263,              h263);
-    REGISTER_DECODER(H263I,             h263i);
-    REGISTER_ENCDEC (H263P,             h263p);
-    REGISTER_DECODER(H263_V4L2M2M,      h263_v4l2m2m);
-    REGISTER_DECODER(H264,              h264);
-    REGISTER_DECODER(H264_CRYSTALHD,    h264_crystalhd);
-    REGISTER_DECODER(H264_V4L2M2M,      h264_v4l2m2m);
-    REGISTER_DECODER(H264_MEDIACODEC,   h264_mediacodec);
-    REGISTER_DECODER(H264_MMAL,         h264_mmal);
-    REGISTER_DECODER(H264_QSV,          h264_qsv);
-    REGISTER_DECODER(H264_RKMPP,        h264_rkmpp);
-    REGISTER_ENCDEC (HAP,               hap);
-    REGISTER_DECODER(HEVC,              hevc);
-    REGISTER_DECODER(HEVC_QSV,          hevc_qsv);
-    REGISTER_DECODER(HEVC_RKMPP,        hevc_rkmpp);
-    REGISTER_DECODER(HEVC_V4L2M2M,      hevc_v4l2m2m);
-    REGISTER_DECODER(HNM4_VIDEO,        hnm4_video);
-    REGISTER_DECODER(HQ_HQA,            hq_hqa);
-    REGISTER_DECODER(HQX,               hqx);
-    REGISTER_ENCDEC (HUFFYUV,           huffyuv);
-    REGISTER_DECODER(IDCIN,             idcin);
-    REGISTER_DECODER(IFF_ILBM,          iff_ilbm);
-    REGISTER_DECODER(INDEO2,            indeo2);
-    REGISTER_DECODER(INDEO3,            indeo3);
-    REGISTER_DECODER(INDEO4,            indeo4);
-    REGISTER_DECODER(INDEO5,            indeo5);
-    REGISTER_DECODER(INTERPLAY_VIDEO,   interplay_video);
-    REGISTER_ENCDEC (JPEG2000,          jpeg2000);
-    REGISTER_ENCDEC (JPEGLS,            jpegls);
-    REGISTER_DECODER(JV,                jv);
-    REGISTER_DECODER(KGV1,              kgv1);
-    REGISTER_DECODER(KMVC,              kmvc);
-    REGISTER_DECODER(LAGARITH,          lagarith);
-    REGISTER_ENCODER(LJPEG,             ljpeg);
-    REGISTER_DECODER(LOCO,              loco);
-    REGISTER_DECODER(M101,              m101);
-    REGISTER_ENCDEC (MAGICYUV,          magicyuv);
-    REGISTER_DECODER(MDEC,              mdec);
-    REGISTER_DECODER(MIMIC,             mimic);
-    REGISTER_ENCDEC (MJPEG,             mjpeg);
-    REGISTER_DECODER(MJPEGB,            mjpegb);
-    REGISTER_DECODER(MMVIDEO,           mmvideo);
-    REGISTER_DECODER(MOTIONPIXELS,      motionpixels);
-    REGISTER_ENCDEC (MPEG1VIDEO,        mpeg1video);
-    REGISTER_ENCDEC (MPEG2VIDEO,        mpeg2video);
-    REGISTER_ENCDEC (MPEG4,             mpeg4);
-    REGISTER_DECODER(MPEG4_CRYSTALHD,   mpeg4_crystalhd);
-    REGISTER_DECODER(MPEG4_V4L2M2M,     mpeg4_v4l2m2m);
-    REGISTER_DECODER(MPEG4_MMAL,        mpeg4_mmal);
-    REGISTER_DECODER(MPEGVIDEO,         mpegvideo);
-    REGISTER_DECODER(MPEG1_V4L2M2M,     mpeg1_v4l2m2m);
-    REGISTER_DECODER(MPEG2_MMAL,        mpeg2_mmal);
-    REGISTER_DECODER(MPEG2_CRYSTALHD,   mpeg2_crystalhd);
-    REGISTER_DECODER(MPEG2_V4L2M2M,     mpeg2_v4l2m2m);
-    REGISTER_DECODER(MPEG2_QSV,         mpeg2_qsv);
-    REGISTER_DECODER(MPEG2_MEDIACODEC,  mpeg2_mediacodec);
-    REGISTER_DECODER(MSA1,              msa1);
-    REGISTER_DECODER(MSCC,              mscc);
-    REGISTER_DECODER(MSMPEG4V1,         msmpeg4v1);
-    REGISTER_ENCDEC (MSMPEG4V2,         msmpeg4v2);
-    REGISTER_ENCDEC (MSMPEG4V3,         msmpeg4v3);
-    REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
-    REGISTER_DECODER(MSRLE,             msrle);
-    REGISTER_DECODER(MSS1,              mss1);
-    REGISTER_DECODER(MSS2,              mss2);
-    REGISTER_ENCDEC (MSVIDEO1,          msvideo1);
-    REGISTER_DECODER(MSZH,              mszh);
-    REGISTER_DECODER(MTS2,              mts2);
-    REGISTER_DECODER(MVC1,              mvc1);
-    REGISTER_DECODER(MVC2,              mvc2);
-    REGISTER_DECODER(MXPEG,             mxpeg);
-    REGISTER_DECODER(NUV,               nuv);
-    REGISTER_DECODER(PAF_VIDEO,         paf_video);
-    REGISTER_ENCDEC (PAM,               pam);
-    REGISTER_ENCDEC (PBM,               pbm);
-    REGISTER_ENCDEC (PCX,               pcx);
-    REGISTER_ENCDEC (PGM,               pgm);
-    REGISTER_ENCDEC (PGMYUV,            pgmyuv);
-    REGISTER_DECODER(PICTOR,            pictor);
-    REGISTER_DECODER(PIXLET,            pixlet);
-    REGISTER_ENCDEC (PNG,               png);
-    REGISTER_ENCDEC (PPM,               ppm);
-    REGISTER_ENCDEC (PRORES,            prores);
-    REGISTER_ENCODER(PRORES_AW,         prores_aw);
-    REGISTER_ENCODER(PRORES_KS,         prores_ks);
-    REGISTER_DECODER(PRORES_LGPL,       prores_lgpl);
-    REGISTER_DECODER(PSD,               psd);
-    REGISTER_DECODER(PTX,               ptx);
-    REGISTER_DECODER(QDRAW,             qdraw);
-    REGISTER_DECODER(QPEG,              qpeg);
-    REGISTER_ENCDEC (QTRLE,             qtrle);
-    REGISTER_ENCDEC (R10K,              r10k);
-    REGISTER_ENCDEC (R210,              r210);
-    REGISTER_ENCDEC (RAWVIDEO,          rawvideo);
-    REGISTER_DECODER(RL2,               rl2);
-    REGISTER_ENCDEC (ROQ,               roq);
-    REGISTER_DECODER(RPZA,              rpza);
-    REGISTER_DECODER(RSCC,              rscc);
-    REGISTER_ENCDEC (RV10,              rv10);
-    REGISTER_ENCDEC (RV20,              rv20);
-    REGISTER_DECODER(RV30,              rv30);
-    REGISTER_DECODER(RV40,              rv40);
-    REGISTER_ENCDEC (S302M,             s302m);
-    REGISTER_DECODER(SANM,              sanm);
-    REGISTER_DECODER(SCPR,              scpr);
-    REGISTER_DECODER(SCREENPRESSO,      screenpresso);
-    REGISTER_DECODER(SDX2_DPCM,         sdx2_dpcm);
-    REGISTER_ENCDEC (SGI,               sgi);
-    REGISTER_DECODER(SGIRLE,            sgirle);
-    REGISTER_DECODER(SHEERVIDEO,        sheervideo);
-    REGISTER_DECODER(SMACKER,           smacker);
-    REGISTER_DECODER(SMC,               smc);
-    REGISTER_DECODER(SMVJPEG,           smvjpeg);
-    REGISTER_ENCDEC (SNOW,              snow);
-    REGISTER_DECODER(SP5X,              sp5x);
-    REGISTER_DECODER(SPEEDHQ,           speedhq);
-    REGISTER_DECODER(SRGC,              srgc);
-    REGISTER_ENCDEC (SUNRAST,           sunrast);
-    REGISTER_ENCDEC (SVQ1,              svq1);
-    REGISTER_DECODER(SVQ3,              svq3);
-    REGISTER_ENCDEC (TARGA,             targa);
-    REGISTER_DECODER(TARGA_Y216,        targa_y216);
-    REGISTER_DECODER(TDSC,              tdsc);
-    REGISTER_DECODER(THEORA,            theora);
-    REGISTER_DECODER(THP,               thp);
-    REGISTER_DECODER(TIERTEXSEQVIDEO,   tiertexseqvideo);
-    REGISTER_ENCDEC (TIFF,              tiff);
-    REGISTER_DECODER(TMV,               tmv);
-    REGISTER_DECODER(TRUEMOTION1,       truemotion1);
-    REGISTER_DECODER(TRUEMOTION2,       truemotion2);
-    REGISTER_DECODER(TRUEMOTION2RT,     truemotion2rt);
-    REGISTER_DECODER(TSCC,              tscc);
-    REGISTER_DECODER(TSCC2,             tscc2);
-    REGISTER_DECODER(TXD,               txd);
-    REGISTER_DECODER(ULTI,              ulti);
-    REGISTER_ENCDEC (UTVIDEO,           utvideo);
-    REGISTER_ENCDEC (V210,              v210);
-    REGISTER_DECODER(V210X,             v210x);
-    REGISTER_ENCDEC (V308,              v308);
-    REGISTER_ENCDEC (V408,              v408);
-    REGISTER_ENCDEC (V410,              v410);
-    REGISTER_DECODER(VB,                vb);
-    REGISTER_DECODER(VBLE,              vble);
-    REGISTER_DECODER(VC1,               vc1);
-    REGISTER_DECODER(VC1_CRYSTALHD,     vc1_crystalhd);
-    REGISTER_DECODER(VC1IMAGE,          vc1image);
-    REGISTER_DECODER(VC1_MMAL,          vc1_mmal);
-    REGISTER_DECODER(VC1_QSV,           vc1_qsv);
-    REGISTER_DECODER(VC1_V4L2M2M,       vc1_v4l2m2m);
-    REGISTER_ENCODER(VC2,               vc2);
-    REGISTER_DECODER(VCR1,              vcr1);
-    REGISTER_DECODER(VMDVIDEO,          vmdvideo);
-    REGISTER_DECODER(VMNC,              vmnc);
-    REGISTER_DECODER(VP3,               vp3);
-    REGISTER_DECODER(VP5,               vp5);
-    REGISTER_DECODER(VP6,               vp6);
-    REGISTER_DECODER(VP6A,              vp6a);
-    REGISTER_DECODER(VP6F,              vp6f);
-    REGISTER_DECODER(VP7,               vp7);
-    REGISTER_DECODER(VP8,               vp8);
-    REGISTER_DECODER(VP8_RKMPP,         vp8_rkmpp);
-    REGISTER_DECODER(VP8_V4L2M2M,       vp8_v4l2m2m);
-    REGISTER_DECODER(VP9,               vp9);
-    REGISTER_DECODER(VP9_RKMPP,         vp9_rkmpp);
-    REGISTER_DECODER(VP9_V4L2M2M,       vp9_v4l2m2m);
-    REGISTER_DECODER(VQA,               vqa);
-    REGISTER_DECODER(BITPACKED,         bitpacked);
-    REGISTER_DECODER(WEBP,              webp);
-    REGISTER_ENCDEC (WRAPPED_AVFRAME,   wrapped_avframe);
-    REGISTER_ENCDEC (WMV1,              wmv1);
-    REGISTER_ENCDEC (WMV2,              wmv2);
-    REGISTER_DECODER(WMV3,              wmv3);
-    REGISTER_DECODER(WMV3_CRYSTALHD,    wmv3_crystalhd);
-    REGISTER_DECODER(WMV3IMAGE,         wmv3image);
-    REGISTER_DECODER(WNV1,              wnv1);
-    REGISTER_DECODER(XAN_WC3,           xan_wc3);
-    REGISTER_DECODER(XAN_WC4,           xan_wc4);
-    REGISTER_ENCDEC (XBM,               xbm);
-    REGISTER_ENCDEC (XFACE,             xface);
-    REGISTER_DECODER(XL,                xl);
-    REGISTER_DECODER(XPM,               xpm);
-    REGISTER_ENCDEC (XWD,               xwd);
-    REGISTER_ENCDEC (Y41P,              y41p);
-    REGISTER_DECODER(YLC,               ylc);
-    REGISTER_DECODER(YOP,               yop);
-    REGISTER_ENCDEC (YUV4,              yuv4);
-    REGISTER_DECODER(ZERO12V,           zero12v);
-    REGISTER_DECODER(ZEROCODEC,         zerocodec);
-    REGISTER_ENCDEC (ZLIB,              zlib);
-    REGISTER_ENCDEC (ZMBV,              zmbv);
-
-    /* audio codecs */
-    REGISTER_ENCDEC (AAC,               aac);
-    REGISTER_DECODER(AAC_FIXED,         aac_fixed);
-    REGISTER_DECODER(AAC_LATM,          aac_latm);
-    REGISTER_ENCDEC (AC3,               ac3);
-    REGISTER_ENCDEC (AC3_FIXED,         ac3_fixed);
-    REGISTER_ENCDEC (ALAC,              alac);
-    REGISTER_DECODER(ALS,               als);
-    REGISTER_DECODER(AMRNB,             amrnb);
-    REGISTER_DECODER(AMRWB,             amrwb);
-    REGISTER_DECODER(APE,               ape);
-    REGISTER_ENCDEC (APTX,              aptx);
-    REGISTER_DECODER(ATRAC1,            atrac1);
-    REGISTER_DECODER(ATRAC3,            atrac3);
-    REGISTER_DECODER(ATRAC3AL,          atrac3al);
-    REGISTER_DECODER(ATRAC3P,           atrac3p);
-    REGISTER_DECODER(ATRAC3PAL,         atrac3pal);
-    REGISTER_DECODER(BINKAUDIO_DCT,     binkaudio_dct);
-    REGISTER_DECODER(BINKAUDIO_RDFT,    binkaudio_rdft);
-    REGISTER_DECODER(BMV_AUDIO,         bmv_audio);
-    REGISTER_DECODER(COOK,              cook);
-    REGISTER_ENCDEC (DCA,               dca);
-    REGISTER_DECODER(DOLBY_E,           dolby_e);
-    REGISTER_DECODER(DSD_LSBF,          dsd_lsbf);
-    REGISTER_DECODER(DSD_MSBF,          dsd_msbf);
-    REGISTER_DECODER(DSD_LSBF_PLANAR,   dsd_lsbf_planar);
-    REGISTER_DECODER(DSD_MSBF_PLANAR,   dsd_msbf_planar);
-    REGISTER_DECODER(DSICINAUDIO,       dsicinaudio);
-    REGISTER_DECODER(DSS_SP,            dss_sp);
-    REGISTER_DECODER(DST,               dst);
-    REGISTER_ENCDEC (EAC3,              eac3);
-    REGISTER_DECODER(EVRC,              evrc);
-    REGISTER_DECODER(FFWAVESYNTH,       ffwavesynth);
-    REGISTER_ENCDEC (FLAC,              flac);
-    REGISTER_ENCDEC (G723_1,            g723_1);
-    REGISTER_DECODER(G729,              g729);
-    REGISTER_DECODER(GSM,               gsm);
-    REGISTER_DECODER(GSM_MS,            gsm_ms);
-    REGISTER_DECODER(IAC,               iac);
-    REGISTER_DECODER(IMC,               imc);
-    REGISTER_DECODER(INTERPLAY_ACM,     interplay_acm);
-    REGISTER_DECODER(MACE3,             mace3);
-    REGISTER_DECODER(MACE6,             mace6);
-    REGISTER_DECODER(METASOUND,         metasound);
-    REGISTER_ENCDEC (MLP,               mlp);
-    REGISTER_DECODER(MP1,               mp1);
-    REGISTER_DECODER(MP1FLOAT,          mp1float);
-    REGISTER_ENCDEC (MP2,               mp2);
-    REGISTER_DECODER(MP2FLOAT,          mp2float);
-    REGISTER_ENCODER(MP2FIXED,          mp2fixed);
-    REGISTER_DECODER(MP3,               mp3);
-    REGISTER_DECODER(MP3FLOAT,          mp3float);
-    REGISTER_DECODER(MP3ADU,            mp3adu);
-    REGISTER_DECODER(MP3ADUFLOAT,       mp3adufloat);
-    REGISTER_DECODER(MP3ON4,            mp3on4);
-    REGISTER_DECODER(MP3ON4FLOAT,       mp3on4float);
-    REGISTER_DECODER(MPC7,              mpc7);
-    REGISTER_DECODER(MPC8,              mpc8);
-    REGISTER_ENCDEC (NELLYMOSER,        nellymoser);
-    REGISTER_DECODER(ON2AVC,            on2avc);
-    REGISTER_ENCDEC (OPUS,              opus);
-    REGISTER_DECODER(PAF_AUDIO,         paf_audio);
-    REGISTER_DECODER(QCELP,             qcelp);
-    REGISTER_DECODER(QDM2,              qdm2);
-    REGISTER_DECODER(QDMC,              qdmc);
-    REGISTER_ENCDEC (RA_144,            ra_144);
-    REGISTER_DECODER(RA_288,            ra_288);
-    REGISTER_DECODER(RALF,              ralf);
-    REGISTER_DECODER(SHORTEN,           shorten);
-    REGISTER_DECODER(SIPR,              sipr);
-    REGISTER_DECODER(SMACKAUD,          smackaud);
-    REGISTER_ENCDEC (SONIC,             sonic);
-    REGISTER_ENCODER(SONIC_LS,          sonic_ls);
-    REGISTER_DECODER(TAK,               tak);
-    REGISTER_ENCDEC (TRUEHD,            truehd);
-    REGISTER_DECODER(TRUESPEECH,        truespeech);
-    REGISTER_ENCDEC (TTA,               tta);
-    REGISTER_DECODER(TWINVQ,            twinvq);
-    REGISTER_DECODER(VMDAUDIO,          vmdaudio);
-    REGISTER_ENCDEC (VORBIS,            vorbis);
-    REGISTER_ENCDEC (WAVPACK,           wavpack);
-    REGISTER_DECODER(WMALOSSLESS,       wmalossless);
-    REGISTER_DECODER(WMAPRO,            wmapro);
-    REGISTER_ENCDEC (WMAV1,             wmav1);
-    REGISTER_ENCDEC (WMAV2,             wmav2);
-    REGISTER_DECODER(WMAVOICE,          wmavoice);
-    REGISTER_DECODER(WS_SND1,           ws_snd1);
-    REGISTER_DECODER(XMA1,              xma1);
-    REGISTER_DECODER(XMA2,              xma2);
-
-    /* PCM codecs */
-    REGISTER_ENCDEC (PCM_ALAW,          pcm_alaw);
-    REGISTER_DECODER(PCM_BLURAY,        pcm_bluray);
-    REGISTER_DECODER(PCM_DVD,           pcm_dvd);
-    REGISTER_DECODER(PCM_F16LE,         pcm_f16le);
-    REGISTER_DECODER(PCM_F24LE,         pcm_f24le);
-    REGISTER_ENCDEC (PCM_F32BE,         pcm_f32be);
-    REGISTER_ENCDEC (PCM_F32LE,         pcm_f32le);
-    REGISTER_ENCDEC (PCM_F64BE,         pcm_f64be);
-    REGISTER_ENCDEC (PCM_F64LE,         pcm_f64le);
-    REGISTER_DECODER(PCM_LXF,           pcm_lxf);
-    REGISTER_ENCDEC (PCM_MULAW,         pcm_mulaw);
-    REGISTER_ENCDEC (PCM_S8,            pcm_s8);
-    REGISTER_ENCDEC (PCM_S8_PLANAR,     pcm_s8_planar);
-    REGISTER_ENCDEC (PCM_S16BE,         pcm_s16be);
-    REGISTER_ENCDEC (PCM_S16BE_PLANAR,  pcm_s16be_planar);
-    REGISTER_ENCDEC (PCM_S16LE,         pcm_s16le);
-    REGISTER_ENCDEC (PCM_S16LE_PLANAR,  pcm_s16le_planar);
-    REGISTER_ENCDEC (PCM_S24BE,         pcm_s24be);
-    REGISTER_ENCDEC (PCM_S24DAUD,       pcm_s24daud);
-    REGISTER_ENCDEC (PCM_S24LE,         pcm_s24le);
-    REGISTER_ENCDEC (PCM_S24LE_PLANAR,  pcm_s24le_planar);
-    REGISTER_ENCDEC (PCM_S32BE,         pcm_s32be);
-    REGISTER_ENCDEC (PCM_S32LE,         pcm_s32le);
-    REGISTER_ENCDEC (PCM_S32LE_PLANAR,  pcm_s32le_planar);
-    REGISTER_ENCDEC (PCM_S64BE,         pcm_s64be);
-    REGISTER_ENCDEC (PCM_S64LE,         pcm_s64le);
-    REGISTER_ENCDEC (PCM_U8,            pcm_u8);
-    REGISTER_ENCDEC (PCM_U16BE,         pcm_u16be);
-    REGISTER_ENCDEC (PCM_U16LE,         pcm_u16le);
-    REGISTER_ENCDEC (PCM_U24BE,         pcm_u24be);
-    REGISTER_ENCDEC (PCM_U24LE,         pcm_u24le);
-    REGISTER_ENCDEC (PCM_U32BE,         pcm_u32be);
-    REGISTER_ENCDEC (PCM_U32LE,         pcm_u32le);
-    REGISTER_DECODER(PCM_ZORK,          pcm_zork);
-
-    /* DPCM codecs */
-    REGISTER_DECODER(GREMLIN_DPCM,      gremlin_dpcm);
-    REGISTER_DECODER(INTERPLAY_DPCM,    interplay_dpcm);
-    REGISTER_ENCDEC (ROQ_DPCM,          roq_dpcm);
-    REGISTER_DECODER(SOL_DPCM,          sol_dpcm);
-    REGISTER_DECODER(XAN_DPCM,          xan_dpcm);
-
-    /* ADPCM codecs */
-    REGISTER_DECODER(ADPCM_4XM,         adpcm_4xm);
-    REGISTER_ENCDEC (ADPCM_ADX,         adpcm_adx);
-    REGISTER_DECODER(ADPCM_AFC,         adpcm_afc);
-    REGISTER_DECODER(ADPCM_AICA,        adpcm_aica);
-    REGISTER_DECODER(ADPCM_CT,          adpcm_ct);
-    REGISTER_DECODER(ADPCM_DTK,         adpcm_dtk);
-    REGISTER_DECODER(ADPCM_EA,          adpcm_ea);
-    REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
-    REGISTER_DECODER(ADPCM_EA_R1,       adpcm_ea_r1);
-    REGISTER_DECODER(ADPCM_EA_R2,       adpcm_ea_r2);
-    REGISTER_DECODER(ADPCM_EA_R3,       adpcm_ea_r3);
-    REGISTER_DECODER(ADPCM_EA_XAS,      adpcm_ea_xas);
-    REGISTER_ENCDEC (ADPCM_G722,        adpcm_g722);
-    REGISTER_ENCDEC (ADPCM_G726,        adpcm_g726);
-    REGISTER_ENCDEC (ADPCM_G726LE,      adpcm_g726le);
-    REGISTER_DECODER(ADPCM_IMA_AMV,     adpcm_ima_amv);
-    REGISTER_DECODER(ADPCM_IMA_APC,     adpcm_ima_apc);
-    REGISTER_DECODER(ADPCM_IMA_DAT4,    adpcm_ima_dat4);
-    REGISTER_DECODER(ADPCM_IMA_DK3,     adpcm_ima_dk3);
-    REGISTER_DECODER(ADPCM_IMA_DK4,     adpcm_ima_dk4);
-    REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
-    REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
-    REGISTER_DECODER(ADPCM_IMA_ISS,     adpcm_ima_iss);
-    REGISTER_DECODER(ADPCM_IMA_OKI,     adpcm_ima_oki);
-    REGISTER_ENCDEC (ADPCM_IMA_QT,      adpcm_ima_qt);
-    REGISTER_DECODER(ADPCM_IMA_RAD,     adpcm_ima_rad);
-    REGISTER_DECODER(ADPCM_IMA_SMJPEG,  adpcm_ima_smjpeg);
-    REGISTER_ENCDEC (ADPCM_IMA_WAV,     adpcm_ima_wav);
-    REGISTER_DECODER(ADPCM_IMA_WS,      adpcm_ima_ws);
-    REGISTER_ENCDEC (ADPCM_MS,          adpcm_ms);
-    REGISTER_DECODER(ADPCM_MTAF,        adpcm_mtaf);
-    REGISTER_DECODER(ADPCM_PSX,         adpcm_psx);
-    REGISTER_DECODER(ADPCM_SBPRO_2,     adpcm_sbpro_2);
-    REGISTER_DECODER(ADPCM_SBPRO_3,     adpcm_sbpro_3);
-    REGISTER_DECODER(ADPCM_SBPRO_4,     adpcm_sbpro_4);
-    REGISTER_ENCDEC (ADPCM_SWF,         adpcm_swf);
-    REGISTER_DECODER(ADPCM_THP,         adpcm_thp);
-    REGISTER_DECODER(ADPCM_THP_LE,      adpcm_thp_le);
-    REGISTER_DECODER(ADPCM_VIMA,        adpcm_vima);
-    REGISTER_DECODER(ADPCM_XA,          adpcm_xa);
-    REGISTER_ENCDEC (ADPCM_YAMAHA,      adpcm_yamaha);
-
-    /* subtitles */
-    REGISTER_ENCDEC (SSA,               ssa);
-    REGISTER_ENCDEC (ASS,               ass);
-    REGISTER_DECODER(CCAPTION,          ccaption);
-    REGISTER_ENCDEC (DVBSUB,            dvbsub);
-    REGISTER_ENCDEC (DVDSUB,            dvdsub);
-    REGISTER_DECODER(JACOSUB,           jacosub);
-    REGISTER_DECODER(MICRODVD,          microdvd);
-    REGISTER_ENCDEC (MOVTEXT,           movtext);
-    REGISTER_DECODER(MPL2,              mpl2);
-    REGISTER_DECODER(PGSSUB,            pgssub);
-    REGISTER_DECODER(PJS,               pjs);
-    REGISTER_DECODER(REALTEXT,          realtext);
-    REGISTER_DECODER(SAMI,              sami);
-    REGISTER_ENCDEC (SRT,               srt);
-    REGISTER_DECODER(STL,               stl);
-    REGISTER_ENCDEC (SUBRIP,            subrip);
-    REGISTER_DECODER(SUBVIEWER,         subviewer);
-    REGISTER_DECODER(SUBVIEWER1,        subviewer1);
-    REGISTER_ENCDEC (TEXT,              text);
-    REGISTER_DECODER(VPLAYER,           vplayer);
-    REGISTER_ENCDEC (WEBVTT,            webvtt);
-    REGISTER_ENCDEC (XSUB,              xsub);
-
-    /* external libraries */
-    REGISTER_ENCDEC (AAC_AT,            aac_at);
-    REGISTER_DECODER(AC3_AT,            ac3_at);
-    REGISTER_DECODER(ADPCM_IMA_QT_AT,   adpcm_ima_qt_at);
-    REGISTER_ENCDEC (ALAC_AT,           alac_at);
-    REGISTER_DECODER(AMR_NB_AT,         amr_nb_at);
-    REGISTER_DECODER(EAC3_AT,           eac3_at);
-    REGISTER_DECODER(GSM_MS_AT,         gsm_ms_at);
-    REGISTER_ENCDEC (ILBC_AT,           ilbc_at);
-    REGISTER_DECODER(MP1_AT,            mp1_at);
-    REGISTER_DECODER(MP2_AT,            mp2_at);
-    REGISTER_DECODER(MP3_AT,            mp3_at);
-    REGISTER_ENCDEC (PCM_ALAW_AT,       pcm_alaw_at);
-    REGISTER_ENCDEC (PCM_MULAW_AT,      pcm_mulaw_at);
-    REGISTER_DECODER(QDMC_AT,           qdmc_at);
-    REGISTER_DECODER(QDM2_AT,           qdm2_at);
-    REGISTER_DECODER(LIBCELT,           libcelt);
-    REGISTER_ENCDEC (LIBFDK_AAC,        libfdk_aac);
-    REGISTER_ENCDEC (LIBGSM,            libgsm);
-    REGISTER_ENCDEC (LIBGSM_MS,         libgsm_ms);
-    REGISTER_ENCDEC (LIBILBC,           libilbc);
-    REGISTER_ENCODER(LIBMP3LAME,        libmp3lame);
-    REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
-    REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
-    REGISTER_ENCDEC (LIBOPENJPEG,       libopenjpeg);
-    REGISTER_ENCDEC (LIBOPUS,           libopus);
-    REGISTER_DECODER(LIBRSVG,           librsvg);
-    REGISTER_ENCODER(LIBSHINE,          libshine);
-    REGISTER_ENCDEC (LIBSPEEX,          libspeex);
-    REGISTER_ENCODER(LIBTHEORA,         libtheora);
-    REGISTER_ENCODER(LIBTWOLAME,        libtwolame);
-    REGISTER_ENCODER(LIBVO_AMRWBENC,    libvo_amrwbenc);
-    REGISTER_ENCDEC (LIBVORBIS,         libvorbis);
-    REGISTER_ENCDEC (LIBVPX_VP8,        libvpx_vp8);
-    REGISTER_ENCDEC (LIBVPX_VP9,        libvpx_vp9);
-    REGISTER_ENCODER(LIBWAVPACK,        libwavpack);
-    REGISTER_ENCODER(LIBWEBP_ANIM,      libwebp_anim);  /* preferred over libwebp */
-    REGISTER_ENCODER(LIBWEBP,           libwebp);
-    REGISTER_ENCODER(LIBX262,           libx262);
-    REGISTER_ENCODER(LIBX264,           libx264);
-    REGISTER_ENCODER(LIBX264RGB,        libx264rgb);
-    REGISTER_ENCODER(LIBX265,           libx265);
-    REGISTER_ENCODER(LIBXAVS,           libxavs);
-    REGISTER_ENCODER(LIBXVID,           libxvid);
-    REGISTER_DECODER(LIBZVBI_TELETEXT,  libzvbi_teletext);
-
-    /* text */
-    REGISTER_DECODER(BINTEXT,           bintext);
-    REGISTER_DECODER(XBIN,              xbin);
-    REGISTER_DECODER(IDF,               idf);
-
-    /* external libraries, that shouldn't be used by default if one of the
-     * above is available */
-    REGISTER_ENCODER(H263_V4L2M2M,      h263_v4l2m2m);
-    REGISTER_ENCDEC (LIBOPENH264,       libopenh264);
-    REGISTER_ENCODER(H264_AMF,          h264_amf);
-    REGISTER_DECODER(H264_CUVID,        h264_cuvid);
-    REGISTER_ENCODER(H264_NVENC,        h264_nvenc);
-    REGISTER_ENCODER(H264_OMX,          h264_omx);
-    REGISTER_ENCODER(H264_QSV,          h264_qsv);
-    REGISTER_ENCODER(H264_V4L2M2M,      h264_v4l2m2m);
-    REGISTER_ENCODER(H264_VAAPI,        h264_vaapi);
-    REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
-#if FF_API_NVENC_OLD_NAME
-    REGISTER_ENCODER(NVENC,             nvenc);
-    REGISTER_ENCODER(NVENC_H264,        nvenc_h264);
-    REGISTER_ENCODER(NVENC_HEVC,        nvenc_hevc);
-#endif
-    REGISTER_ENCODER(HEVC_AMF,          hevc_amf);
-    REGISTER_DECODER(HEVC_CUVID,        hevc_cuvid);
-    REGISTER_DECODER(HEVC_MEDIACODEC,   hevc_mediacodec);
-    REGISTER_ENCODER(HEVC_NVENC,        hevc_nvenc);
-    REGISTER_ENCODER(HEVC_QSV,          hevc_qsv);
-    REGISTER_ENCODER(HEVC_V4L2M2M,      hevc_v4l2m2m);
-    REGISTER_ENCODER(HEVC_VAAPI,        hevc_vaapi);
-    REGISTER_ENCODER(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
-    REGISTER_ENCODER(LIBKVAZAAR,        libkvazaar);
-    REGISTER_DECODER(MJPEG_CUVID,       mjpeg_cuvid);
-    REGISTER_ENCODER(MJPEG_QSV,         mjpeg_qsv);
-    REGISTER_ENCODER(MJPEG_VAAPI,       mjpeg_vaapi);
-    REGISTER_DECODER(MPEG1_CUVID,       mpeg1_cuvid);
-    REGISTER_DECODER(MPEG2_CUVID,       mpeg2_cuvid);
-    REGISTER_ENCODER(MPEG2_QSV,         mpeg2_qsv);
-    REGISTER_ENCODER(MPEG2_VAAPI,       mpeg2_vaapi);
-    REGISTER_DECODER(MPEG4_CUVID,       mpeg4_cuvid);
-    REGISTER_DECODER(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
-    REGISTER_ENCODER(MPEG4_V4L2M2M,     mpeg4_v4l2m2m);
-    REGISTER_DECODER(VC1_CUVID,         vc1_cuvid);
-    REGISTER_DECODER(VP8_CUVID,         vp8_cuvid);
-    REGISTER_DECODER(VP8_MEDIACODEC,    vp8_mediacodec);
-    REGISTER_DECODER(VP8_QSV,           vp8_qsv);
-    REGISTER_ENCODER(VP8_V4L2M2M,       vp8_v4l2m2m);
-    REGISTER_ENCODER(VP8_VAAPI,         vp8_vaapi);
-    REGISTER_DECODER(VP9_CUVID,         vp9_cuvid);
-    REGISTER_DECODER(VP9_MEDIACODEC,    vp9_mediacodec);
-    REGISTER_ENCODER(VP9_VAAPI,         vp9_vaapi);
-
-    /* parsers */
-    REGISTER_PARSER(AAC,                aac);
-    REGISTER_PARSER(AAC_LATM,           aac_latm);
-    REGISTER_PARSER(AC3,                ac3);
-    REGISTER_PARSER(ADX,                adx);
-    REGISTER_PARSER(BMP,                bmp);
-    REGISTER_PARSER(CAVSVIDEO,          cavsvideo);
-    REGISTER_PARSER(COOK,               cook);
-    REGISTER_PARSER(DCA,                dca);
-    REGISTER_PARSER(DIRAC,              dirac);
-    REGISTER_PARSER(DNXHD,              dnxhd);
-    REGISTER_PARSER(DPX,                dpx);
-    REGISTER_PARSER(DVAUDIO,            dvaudio);
-    REGISTER_PARSER(DVBSUB,             dvbsub);
-    REGISTER_PARSER(DVDSUB,             dvdsub);
-    REGISTER_PARSER(DVD_NAV,            dvd_nav);
-    REGISTER_PARSER(FLAC,               flac);
-    REGISTER_PARSER(G729,               g729);
-    REGISTER_PARSER(GSM,                gsm);
-    REGISTER_PARSER(H261,               h261);
-    REGISTER_PARSER(H263,               h263);
-    REGISTER_PARSER(H264,               h264);
-    REGISTER_PARSER(HEVC,               hevc);
-    REGISTER_PARSER(MJPEG,              mjpeg);
-    REGISTER_PARSER(MLP,                mlp);
-    REGISTER_PARSER(MPEG4VIDEO,         mpeg4video);
-    REGISTER_PARSER(MPEGAUDIO,          mpegaudio);
-    REGISTER_PARSER(MPEGVIDEO,          mpegvideo);
-    REGISTER_PARSER(OPUS,               opus);
-    REGISTER_PARSER(PNG,                png);
-    REGISTER_PARSER(PNM,                pnm);
-    REGISTER_PARSER(RV30,               rv30);
-    REGISTER_PARSER(RV40,               rv40);
-    REGISTER_PARSER(SIPR,               sipr);
-    REGISTER_PARSER(TAK,                tak);
-    REGISTER_PARSER(VC1,                vc1);
-    REGISTER_PARSER(VORBIS,             vorbis);
-    REGISTER_PARSER(VP3,                vp3);
-    REGISTER_PARSER(VP8,                vp8);
-    REGISTER_PARSER(VP9,                vp9);
-    REGISTER_PARSER(XMA,                xma);
+    ff_thread_once(&av_codec_next_init, av_codec_init_next);
+}
+
+AVCodec *av_codec_next(const AVCodec *c)
+{
+    ff_thread_once(&av_codec_next_init, av_codec_init_next);
+
+    if (c)
+        return c->next;
+    else
+        return (AVCodec*)codec_list[0];
 }
 
 void avcodec_register_all(void)
 {
-    static AVOnce control = AV_ONCE_INIT;
+    ff_thread_once(&av_codec_next_init, av_codec_init_next);
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
+{
+    switch(id){
+        //This is for future deprecatec codec ids, its empty since
+        //last major bump but will fill up again over time, please don't remove it
+        default                                         : return id;
+    }
+}
+
+static AVCodec *find_codec(enum AVCodecID id, int (*x)(const AVCodec *))
+{
+    const AVCodec *p, *experimental = NULL;
+    void *i = 0;
+
+    id = remap_deprecated_codec_id(id);
+
+    while ((p = av_codec_iterate(&i))) {
+        if (!x(p))
+            continue;
+        if (p->id == id) {
+            if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) {
+                experimental = p;
+            } else
+                return (AVCodec*)p;
+        }
+    }
 
-    ff_thread_once(&control, register_all);
+    return (AVCodec*)experimental;
+}
+
+AVCodec *avcodec_find_encoder(enum AVCodecID id)
+{
+    return find_codec(id, av_codec_is_encoder);
+}
+
+AVCodec *avcodec_find_decoder(enum AVCodecID id)
+{
+    return find_codec(id, av_codec_is_decoder);
+}
+
+static AVCodec *find_codec_by_name(const char *name, int (*x)(const AVCodec *))
+{
+    void *i = 0;
+    const AVCodec *p;
+
+    if (!name)
+        return NULL;
+
+    while ((p = av_codec_iterate(&i))) {
+        if (!x(p))
+            continue;
+        if (strcmp(name, p->name) == 0)
+            return (AVCodec*)p;
+    }
+
+    return NULL;
+}
+
+AVCodec *avcodec_find_encoder_by_name(const char *name)
+{
+    return find_codec_by_name(name, av_codec_is_encoder);
+}
+
+AVCodec *avcodec_find_decoder_by_name(const char *name)
+{
+    return find_codec_by_name(name, av_codec_is_decoder);
 }
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8fbbc79..99f5fb9 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3979,11 +3979,25 @@  typedef struct AVCodecParameters {
 } AVCodecParameters;
 
 /**
+ * Iterate over all registered codecs.
+ *
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
+ *               point to NULL to start the iteration.
+ *
+ * @return the next registered codec or NULL when the iteration is
+ *         finished
+ */
+const AVCodec *av_codec_iterate(void **opaque);
+
+#if FF_API_NEXT
+/**
  * If c is NULL, returns the first registered codec,
  * if c is non-NULL, returns the next registered codec after c,
  * or NULL if c is the last one.
  */
+attribute_deprecated
 AVCodec *av_codec_next(const AVCodec *c);
+#endif
 
 /**
  * Return the LIBAVCODEC_VERSION_INT constant.
@@ -4000,6 +4014,7 @@  const char *avcodec_configuration(void);
  */
 const char *avcodec_license(void);
 
+#if FF_API_NEXT
 /**
  * Register the codec codec and initialize libavcodec.
  *
@@ -4008,6 +4023,7 @@  const char *avcodec_license(void);
  *
  * @see avcodec_register_all()
  */
+attribute_deprecated
 void avcodec_register(AVCodec *codec);
 
 /**
@@ -4020,7 +4036,9 @@  void avcodec_register(AVCodec *codec);
  * @see av_register_codec_parser
  * @see av_register_bitstream_filter
  */
+attribute_deprecated
 void avcodec_register_all(void);
+#endif
 
 /**
  * Allocate an AVCodecContext and set its fields to default values. The
@@ -5120,8 +5138,21 @@  typedef struct AVCodecParser {
     struct AVCodecParser *next;
 } AVCodecParser;
 
+/**
+ * Iterate over all registered codec parsers.
+ *
+ * @param opaque a pointer where libavcodec will store the iteration state. Must
+ *               point to NULL to start the iteration.
+ *
+ * @return the next registered codec parser or NULL when the iteration is
+ *         finished
+ */
+const AVCodecParser *av_parser_iterate(void **opaque);
+
+attribute_deprecated
 AVCodecParser *av_parser_next(const AVCodecParser *c);
 
+attribute_deprecated
 void av_register_codec_parser(AVCodecParser *parser);
 AVCodecParserContext *av_parser_init(int codec_id);
 
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 747ea2e..7a68275 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -32,36 +32,100 @@ 
 #include "internal.h"
 #include "parser.h"
 
-static AVCodecParser *av_first_parser = NULL;
+/* Parsers */
+extern AVCodecParser ff_aac_parser;
+extern AVCodecParser ff_aac_latm_parser;
+extern AVCodecParser ff_ac3_parser;
+extern AVCodecParser ff_adx_parser;
+extern AVCodecParser ff_bmp_parser;
+extern AVCodecParser ff_cavsvideo_parser;
+extern AVCodecParser ff_cook_parser;
+extern AVCodecParser ff_dca_parser;
+extern AVCodecParser ff_dirac_parser;
+extern AVCodecParser ff_dnxhd_parser;
+extern AVCodecParser ff_dpx_parser;
+extern AVCodecParser ff_dvaudio_parser;
+extern AVCodecParser ff_dvbsub_parser;
+extern AVCodecParser ff_dvdsub_parser;
+extern AVCodecParser ff_dvd_nav_parser;
+extern AVCodecParser ff_flac_parser;
+extern AVCodecParser ff_g729_parser;
+extern AVCodecParser ff_gsm_parser;
+extern AVCodecParser ff_h261_parser;
+extern AVCodecParser ff_h263_parser;
+extern AVCodecParser ff_h264_parser;
+extern AVCodecParser ff_hevc_parser;
+extern AVCodecParser ff_mjpeg_parser;
+extern AVCodecParser ff_mlp_parser;
+extern AVCodecParser ff_mpeg4video_parser;
+extern AVCodecParser ff_mpegaudio_parser;
+extern AVCodecParser ff_mpegvideo_parser;
+extern AVCodecParser ff_opus_parser;
+extern AVCodecParser ff_png_parser;
+extern AVCodecParser ff_pnm_parser;
+extern AVCodecParser ff_rv30_parser;
+extern AVCodecParser ff_rv40_parser;
+extern AVCodecParser ff_sipr_parser;
+extern AVCodecParser ff_tak_parser;
+extern AVCodecParser ff_vc1_parser;
+extern AVCodecParser ff_vorbis_parser;
+extern AVCodecParser ff_vp3_parser;
+extern AVCodecParser ff_vp8_parser;
+extern AVCodecParser ff_vp9_parser;
+extern AVCodecParser ff_xma_parser;
+
+#include "parser_list.c"
+
+static AVOnce av_parser_next_init = AV_ONCE_INIT;
+
+static void av_parser_init_next(void)
+{
+    AVCodecParser *prev = NULL, *p;
+    int i = 0;
+    while ((p = (AVCodecParser*)parser_list[i++])) {
+        if (prev)
+            prev->next = p;
+        prev = p;
+    }
+}
 
 AVCodecParser *av_parser_next(const AVCodecParser *p)
 {
+    ff_thread_once(&av_parser_next_init, av_parser_init_next);
+
     if (p)
         return p->next;
     else
-        return av_first_parser;
+        return (AVCodecParser*)parser_list[0];
 }
 
-static AVMutex parser_register_mutex = AV_MUTEX_INITIALIZER;
+const AVCodecParser *av_parser_iterate(void **opaque)
+{
+    uintptr_t i = (uintptr_t)*opaque;
+    const AVCodecParser *p = parser_list[i];
+
+    if (p)
+        *opaque = (void*)(i + 1);
+
+    return p;
+}
 
 void av_register_codec_parser(AVCodecParser *parser)
 {
-    ff_mutex_lock(&parser_register_mutex);
-    parser->next = av_first_parser;
-    av_first_parser = parser;
-    ff_mutex_unlock(&parser_register_mutex);
+    ff_thread_once(&av_parser_next_init, av_parser_init_next);
 }
 
 AVCodecParserContext *av_parser_init(int codec_id)
 {
     AVCodecParserContext *s = NULL;
-    AVCodecParser *parser;
+    const AVCodecParser *parser;
+    void *i = 0;
     int ret;
 
     if (codec_id == AV_CODEC_ID_NONE)
         return NULL;
 
-    for (parser = av_first_parser; parser; parser = parser->next) {
+    while ((parser = av_parser_iterate(&i))) {
         if (parser->codec_ids[0] == codec_id ||
             parser->codec_ids[1] == codec_id ||
             parser->codec_ids[2] == codec_id ||
@@ -75,7 +139,7 @@  found:
     s = av_mallocz(sizeof(AVCodecParserContext));
     if (!s)
         goto err_out;
-    s->parser = parser;
+    s->parser = (AVCodecParser*)parser;
     s->priv_data = av_mallocz(parser->priv_data_size);
     if (!s->priv_data)
         goto err_out;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4c71843..8c7d056 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -46,7 +46,6 @@ 
 #include "decode.h"
 #include "hwaccel.h"
 #include "libavutil/opt.h"
-#include "me_cmp.h"
 #include "mpegvideo.h"
 #include "thread.h"
 #include "frame_thread_encoder.h"
@@ -92,30 +91,6 @@  void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
         memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
 }
 
-/* encoder management */
-static AVCodec *first_avcodec = NULL;
-static AVCodec **last_avcodec = &first_avcodec;
-
-AVCodec *av_codec_next(const AVCodec *c)
-{
-    if (c)
-        return c->next;
-    else
-        return first_avcodec;
-}
-
-static av_cold void avcodec_init(void)
-{
-    static int initialized = 0;
-
-    if (initialized != 0)
-        return;
-    initialized = 1;
-
-    if (CONFIG_ME_CMP)
-        ff_me_cmp_init_static();
-}
-
 int av_codec_is_encoder(const AVCodec *codec)
 {
     return codec && (codec->encode_sub || codec->encode2 ||codec->send_frame);
@@ -126,28 +101,6 @@  int av_codec_is_decoder(const AVCodec *codec)
     return codec && (codec->decode || codec->receive_frame);
 }
 
-static AVMutex codec_register_mutex = AV_MUTEX_INITIALIZER;
-
-av_cold void avcodec_register(AVCodec *codec)
-{
-    AVCodec **p;
-    avcodec_init();
-
-    ff_mutex_lock(&codec_register_mutex);
-    p = last_avcodec;
-
-    while (*p)
-        p = &(*p)->next;
-    *p          = codec;
-    codec->next = NULL;
-    last_avcodec = &codec->next;
-
-    ff_mutex_unlock(&codec_register_mutex);
-
-    if (codec->init_static_data)
-        codec->init_static_data(codec);
-}
-
 int ff_set_dimensions(AVCodecContext *s, int width, int height)
 {
     int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s);
@@ -1168,71 +1121,6 @@  FF_ENABLE_DEPRECATION_WARNINGS
     return 0;
 }
 
-static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
-{
-    switch(id){
-        //This is for future deprecatec codec ids, its empty since
-        //last major bump but will fill up again over time, please don't remove it
-        default                                         : return id;
-    }
-}
-
-static AVCodec *find_encdec(enum AVCodecID id, int encoder)
-{
-    AVCodec *p, *experimental = NULL;
-    p = first_avcodec;
-    id= remap_deprecated_codec_id(id);
-    while (p) {
-        if ((encoder ? av_codec_is_encoder(p) : av_codec_is_decoder(p)) &&
-            p->id == id) {
-            if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) {
-                experimental = p;
-            } else
-                return p;
-        }
-        p = p->next;
-    }
-    return experimental;
-}
-
-AVCodec *avcodec_find_encoder(enum AVCodecID id)
-{
-    return find_encdec(id, 1);
-}
-
-AVCodec *avcodec_find_encoder_by_name(const char *name)
-{
-    AVCodec *p;
-    if (!name)
-        return NULL;
-    p = first_avcodec;
-    while (p) {
-        if (av_codec_is_encoder(p) && strcmp(name, p->name) == 0)
-            return p;
-        p = p->next;
-    }
-    return NULL;
-}
-
-AVCodec *avcodec_find_decoder(enum AVCodecID id)
-{
-    return find_encdec(id, 0);
-}
-
-AVCodec *avcodec_find_decoder_by_name(const char *name)
-{
-    AVCodec *p;
-    if (!name)
-        return NULL;
-    p = first_avcodec;
-    while (p) {
-        if (av_codec_is_decoder(p) && strcmp(name, p->name) == 0)
-            return p;
-        p = p->next;
-    }
-    return NULL;
-}
-
 const char *avcodec_get_name(enum AVCodecID id)
 {
     const AVCodecDescriptor *cd;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 47a15d5..8cc0f9b 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -129,6 +129,9 @@ 
 #ifndef FF_API_LOCKMGR
 #define FF_API_LOCKMGR (LIBAVCODEC_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_NEXT
+#define FF_API_NEXT              (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
 
 
 #endif /* AVCODEC_VERSION_H */