[FFmpeg-devel] [PATCH 25/27] avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sat Feb 10 16:50:43 EET 2024


This commit does for AVInputFormat what commit
59c9dc82f450638a3068deeb1db5c56f6d155752 did for AVOutputFormat:
It adds a new type FFInputFormat, moves all the internals
of AVInputFormat to it and adds a now reduced AVInputFormat
as first member.

This does not affect/improve extensibility of both public
or private fields for demuxers (it is still a mess due to lavd).

This is possible since 50f34172e0cca2cabc5836308ec66dbf93f5f2a3
(which removed the last usage of an internal field of AVInputFormat
in fftools).

(Hint: tools/probetest.c accesses the internals of FFInputFormat
as well, but given that it is a testing tool this is not considered
a problem.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 configure                      |   8 +-
 libavdevice/alldevices.c       |  49 +--
 libavdevice/alsa_dec.c         |  11 +-
 libavdevice/android_camera.c   |  11 +-
 libavdevice/avdevice.c         |   5 +-
 libavdevice/bktr.c             |  11 +-
 libavdevice/decklink_dec_c.c   |  11 +-
 libavdevice/dshow.c            |  12 +-
 libavdevice/fbdev_dec.c        |  11 +-
 libavdevice/gdigrab.c          |  11 +-
 libavdevice/iec61883.c         |  11 +-
 libavdevice/jack.c             |  11 +-
 libavdevice/kmsgrab.c          |  11 +-
 libavdevice/lavfi.c            |  11 +-
 libavdevice/libcdio.c          |   8 +-
 libavdevice/libdc1394.c        |  11 +-
 libavdevice/openal-dec.c       |  11 +-
 libavdevice/oss_dec.c          |  11 +-
 libavdevice/pulse_audio_dec.c  |  11 +-
 libavdevice/sndio_dec.c        |  11 +-
 libavdevice/utils.c            |   5 +-
 libavdevice/v4l2.c             |  10 +-
 libavdevice/vfwcap.c           |  11 +-
 libavdevice/xcbgrab.c          |  11 +-
 libavformat/3dostr.c           |  11 +-
 libavformat/4xm.c              |   7 +-
 libavformat/aacdec.c           |  13 +-
 libavformat/aadec.c            |  12 +-
 libavformat/aaxdec.c           |  10 +-
 libavformat/ac3dec.c           |  25 +-
 libavformat/ac4dec.c           |  11 +-
 libavformat/acedec.c           |   9 +-
 libavformat/acm.c              |  12 +-
 libavformat/act.c              |   7 +-
 libavformat/adp.c              |   9 +-
 libavformat/ads.c              |   9 +-
 libavformat/adxdec.c           |  10 +-
 libavformat/aea.c              |  11 +-
 libavformat/afc.c              |  11 +-
 libavformat/aiffdec.c          |   8 +-
 libavformat/aixdec.c           |  10 +-
 libavformat/allformats.c       | 731 +++++++++++++++++----------------
 libavformat/alp.c              |   7 +-
 libavformat/amr.c              |  31 +-
 libavformat/anm.c              |   6 +-
 libavformat/apac.c             |  12 +-
 libavformat/apc.c              |   6 +-
 libavformat/ape.c              |   9 +-
 libavformat/apm.c              |   7 +-
 libavformat/apngdec.c          |  11 +-
 libavformat/aptxdec.c          |  25 +-
 libavformat/aqtitledec.c       |  11 +-
 libavformat/argo_asf.c         |   7 +-
 libavformat/argo_brp.c         |   7 +-
 libavformat/argo_cvg.c         |   7 +-
 libavformat/asfdec_f.c         |  10 +-
 libavformat/asfdec_o.c         |   8 +-
 libavformat/assdec.c           |   7 +-
 libavformat/astdec.c           |  13 +-
 libavformat/au.c               |   9 +-
 libavformat/av1dec.c           |  25 +-
 libavformat/avformat.h         |  98 -----
 libavformat/avidec.c           |  10 +-
 libavformat/avisynth.c         |  11 +-
 libavformat/avr.c              |  11 +-
 libavformat/avs.c              |   7 +-
 libavformat/bethsoftvid.c      |   7 +-
 libavformat/bfi.c              |   6 +-
 libavformat/bink.c             |   8 +-
 libavformat/binka.c            |  11 +-
 libavformat/bintext.c          |  37 +-
 libavformat/bit.c              |   9 +-
 libavformat/bmv.c              |   9 +-
 libavformat/boadec.c           |   9 +-
 libavformat/bonk.c             |  12 +-
 libavformat/brstm.c            |  16 +-
 libavformat/c93.c              |   7 +-
 libavformat/cafdec.c           |   8 +-
 libavformat/cdg.c              |  11 +-
 libavformat/cdxl.c             |  13 +-
 libavformat/cinedec.c          |   7 +-
 libavformat/codec2.c           |  23 +-
 libavformat/concatdec.c        |   8 +-
 libavformat/dashdec.c          |  10 +-
 libavformat/dauddec.c          |   9 +-
 libavformat/dcstr.c            |  11 +-
 libavformat/demux.c            |  20 +-
 libavformat/demux.h            | 107 ++++-
 libavformat/demux_utils.c      |   8 +-
 libavformat/derf.c             |   9 +-
 libavformat/dfa.c              |   9 +-
 libavformat/dfpwmdec.c         |  13 +-
 libavformat/dhav.c             |  11 +-
 libavformat/dsfdec.c           |   9 +-
 libavformat/dsicin.c           |   7 +-
 libavformat/dss.c              |   9 +-
 libavformat/dtsdec.c           |  13 +-
 libavformat/dtshddec.c         |  11 +-
 libavformat/dv.c               |   8 +-
 libavformat/dxa.c              |   7 +-
 libavformat/eacdata.c          |   9 +-
 libavformat/electronicarts.c   |   9 +-
 libavformat/epafdec.c          |  11 +-
 libavformat/evcdec.c           |  13 +-
 libavformat/ffmetadec.c        |   6 +-
 libavformat/filmstripdec.c     |   9 +-
 libavformat/fitsdec.c          |  11 +-
 libavformat/flacdec.c          |  12 +-
 libavformat/flic.c             |   7 +-
 libavformat/flvdec.c           |  32 +-
 libavformat/format.c           |   5 +-
 libavformat/frmdec.c           |   7 +-
 libavformat/fsb.c              |  11 +-
 libavformat/fwse.c             |   9 +-
 libavformat/g722.c             |  13 +-
 libavformat/g723_1.c           |  11 +-
 libavformat/g726.c             |  19 +-
 libavformat/g729dec.c          |  13 +-
 libavformat/gdv.c              |   7 +-
 libavformat/genh.c             |   9 +-
 libavformat/gifdec.c           |  13 +-
 libavformat/gsmdec.c           |  13 +-
 libavformat/gxf.c              |   6 +-
 libavformat/hca.c              |  13 +-
 libavformat/hcom.c             |   7 +-
 libavformat/hls.c              |  12 +-
 libavformat/hnm.c              |   9 +-
 libavformat/iamfdec.c          |  11 +-
 libavformat/icodec.c           |   9 +-
 libavformat/idcin.c            |   8 +-
 libavformat/idroqdec.c         |   7 +-
 libavformat/iff.c              |   9 +-
 libavformat/ifv.c              |   9 +-
 libavformat/ilbc.c             |   9 +-
 libavformat/imfdec.c           |  10 +-
 libavformat/img2_alias_pix.c   |   9 +-
 libavformat/img2_brender_pix.c |   9 +-
 libavformat/img2dec.c          |  48 +--
 libavformat/imx.c              |  11 +-
 libavformat/ingenientdec.c     |  13 +-
 libavformat/internal.h         |   6 +-
 libavformat/ipmovie.c          |   6 +-
 libavformat/ipudec.c           |  13 +-
 libavformat/ircamdec.c         |  11 +-
 libavformat/iss.c              |   7 +-
 libavformat/iv8.c              |   9 +-
 libavformat/ivfdec.c           |  11 +-
 libavformat/jacosubdec.c       |   7 +-
 libavformat/jpegxl_anim_dec.c  |  13 +-
 libavformat/jvdec.c            |   7 +-
 libavformat/kvag.c             |   7 +-
 libavformat/lafdec.c           |  11 +-
 libavformat/libgme.c           |   9 +-
 libavformat/libmodplug.c       |  11 +-
 libavformat/libopenmpt.c       |  19 +-
 libavformat/lmlm4.c            |   7 +-
 libavformat/loasdec.c          |  11 +-
 libavformat/lrcdec.c           |   7 +-
 libavformat/luodatdec.c        |  11 +-
 libavformat/lvfdec.c           |  11 +-
 libavformat/lxfdec.c           |   8 +-
 libavformat/matroskadec.c      |  18 +-
 libavformat/mca.c              |   8 +-
 libavformat/mccdec.c           |   9 +-
 libavformat/mgsts.c            |   9 +-
 libavformat/microdvddec.c      |   9 +-
 libavformat/mlpdec.c           |  25 +-
 libavformat/mlvdec.c           |   6 +-
 libavformat/mm.c               |   7 +-
 libavformat/mmf.c              |   9 +-
 libavformat/mods.c             |  11 +-
 libavformat/moflex.c           |  11 +-
 libavformat/mov.c              |  12 +-
 libavformat/mp3dec.c           |  12 +-
 libavformat/mpc.c              |   8 +-
 libavformat/mpc8.c             |   6 +-
 libavformat/mpeg.c             |  20 +-
 libavformat/mpegts.c           |  24 +-
 libavformat/mpjpegdec.c        |  15 +-
 libavformat/mpl2dec.c          |   9 +-
 libavformat/mpsubdec.c         |   9 +-
 libavformat/msf.c              |   9 +-
 libavformat/msnwc_tcp.c        |   7 +-
 libavformat/mspdec.c           |   9 +-
 libavformat/mtaf.c             |   9 +-
 libavformat/mtv.c              |   7 +-
 libavformat/musx.c             |   9 +-
 libavformat/mvdec.c            |   7 +-
 libavformat/mvi.c              |   9 +-
 libavformat/mxfdec.c           |  10 +-
 libavformat/mxg.c              |   9 +-
 libavformat/ncdec.c            |   9 +-
 libavformat/nistspheredec.c    |  11 +-
 libavformat/nspdec.c           |  11 +-
 libavformat/nsvdec.c           |   7 +-
 libavformat/nutdec.c           |  12 +-
 libavformat/nuv.c              |   8 +-
 libavformat/oggdec.c           |  10 +-
 libavformat/omadec.c           |  13 +-
 libavformat/osq.c              |  12 +-
 libavformat/paf.c              |   7 +-
 libavformat/pcmdec.c           |  29 +-
 libavformat/pdvdec.c           |   9 +-
 libavformat/pjsdec.c           |   9 +-
 libavformat/pmpdec.c           |   7 +-
 libavformat/pp_bnk.c           |   7 +-
 libavformat/psxstr.c           |   9 +-
 libavformat/pva.c              |   7 +-
 libavformat/pvfdec.c           |  11 +-
 libavformat/qcp.c              |   7 +-
 libavformat/qoadec.c           |  11 +-
 libavformat/r3d.c              |   7 +-
 libavformat/rawdec.c           |  19 +-
 libavformat/rawdec.h           |  25 +-
 libavformat/rawvideodec.c      |  63 +--
 libavformat/rdt.c              |   3 +-
 libavformat/realtextdec.c      |   9 +-
 libavformat/redspark.c         |   9 +-
 libavformat/rka.c              |   8 +-
 libavformat/rl2.c              |   6 +-
 libavformat/rm.h               |   2 +-
 libavformat/rmdec.c            |  22 +-
 libavformat/rpl.c              |   7 +-
 libavformat/rsd.c              |  12 +-
 libavformat/rsodec.c           |  11 +-
 libavformat/rtsp.c             |  19 +-
 libavformat/rtspdec.c          |  11 +-
 libavformat/s337m.c            |   9 +-
 libavformat/samidec.c          |   9 +-
 libavformat/sapdec.c           |   9 +-
 libavformat/sbcdec.c           |  13 +-
 libavformat/sbgdec.c           |  11 +-
 libavformat/sccdec.c           |   9 +-
 libavformat/scd.c              |   7 +-
 libavformat/sdns.c             |  10 +-
 libavformat/sdr2.c             |  11 +-
 libavformat/sdsdec.c           |  11 +-
 libavformat/sdxdec.c           |  11 +-
 libavformat/seek.c             |  22 +-
 libavformat/segafilm.c         |   7 +-
 libavformat/serdec.c           |  13 +-
 libavformat/sga.c              |  11 +-
 libavformat/shortendec.c       |  13 +-
 libavformat/sierravmd.c        |   7 +-
 libavformat/siff.c             |   9 +-
 libavformat/smacker.c          |   6 +-
 libavformat/smjpegdec.c        |  11 +-
 libavformat/smush.c            |   7 +-
 libavformat/sol.c              |   7 +-
 libavformat/soxdec.c           |   7 +-
 libavformat/spdifdec.c         |   9 +-
 libavformat/srtdec.c           |   7 +-
 libavformat/stldec.c           |   9 +-
 libavformat/subtitles.h        |   2 +-
 libavformat/subviewer1dec.c    |   9 +-
 libavformat/subviewerdec.c     |   9 +-
 libavformat/supdec.c           |  13 +-
 libavformat/svag.c             |   9 +-
 libavformat/svs.c              |   9 +-
 libavformat/swfdec.c           |   6 +-
 libavformat/takdec.c           |  13 +-
 libavformat/tedcaptionsdec.c   |   9 +-
 libavformat/thp.c              |   7 +-
 libavformat/tiertexseq.c       |   7 +-
 libavformat/tmv.c              |   9 +-
 libavformat/tta.c              |   9 +-
 libavformat/tty.c              |  13 +-
 libavformat/txd.c              |   7 +-
 libavformat/ty.c               |  11 +-
 libavformat/usmdec.c           |  10 +-
 libavformat/vag.c              |   9 +-
 libavformat/vapoursynth.c      |   9 +-
 libavformat/vc1test.c          |  10 +-
 libavformat/vividas.c          |   7 +-
 libavformat/vivo.c             |   9 +-
 libavformat/vocdec.c           |   9 +-
 libavformat/vpk.c              |   8 +-
 libavformat/vplayerdec.c       |   9 +-
 libavformat/vqf.c              |   9 +-
 libavformat/wady.c             |  10 +-
 libavformat/wavarc.c           |  10 +-
 libavformat/wavdec.c           |  24 +-
 libavformat/wc3movie.c         |   7 +-
 libavformat/webvttdec.c        |  11 +-
 libavformat/westwood_aud.c     |   7 +-
 libavformat/westwood_vqa.c     |   6 +-
 libavformat/wsddec.c           |  13 +-
 libavformat/wtvdec.c           |   8 +-
 libavformat/wvdec.c            |   9 +-
 libavformat/wvedec.c           |   7 +-
 libavformat/xa.c               |   7 +-
 libavformat/xmd.c              |  10 +-
 libavformat/xmv.c              |   9 +-
 libavformat/xvag.c             |   9 +-
 libavformat/xwma.c             |   7 +-
 libavformat/yop.c              |  10 +-
 libavformat/yuv4mpegdec.c      |   9 +-
 tools/probetest.c              |   5 +-
 tools/target_dem_fuzzer.c      |   6 +-
 299 files changed, 2178 insertions(+), 1940 deletions(-)

diff --git a/configure b/configure
index c0d3791c9e..e44fc755ce 100755
--- a/configure
+++ b/configure
@@ -4117,9 +4117,9 @@ find_filters_extern(){
 
 FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
 OUTDEV_LIST=$(find_things_extern muxer FFOutputFormat libavdevice/alldevices.c outdev)
-INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
+INDEV_LIST=$(find_things_extern demuxer FFInputFormat libavdevice/alldevices.c indev)
 MUXER_LIST=$(find_things_extern muxer FFOutputFormat libavformat/allformats.c)
-DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
+DEMUXER_LIST=$(find_things_extern demuxer FFInputFormat libavformat/allformats.c)
 ENCODER_LIST=$(find_things_extern encoder FFCodec libavcodec/allcodecs.c)
 DECODER_LIST=$(find_things_extern decoder FFCodec libavcodec/allcodecs.c)
 CODEC_LIST="
@@ -8187,9 +8187,9 @@ print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_
 print_enabled_components libavcodec/codec_list.c FFCodec codec_list $CODEC_LIST
 print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
 print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $BSF_LIST
-print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
+print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $DEMUXER_LIST
 print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $MUXER_LIST
-print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
+print_enabled_components libavdevice/indev_list.c FFInputFormat indev_list $INDEV_LIST
 print_enabled_components libavdevice/outdev_list.c FFOutputFormat outdev_list $OUTDEV_LIST
 print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
 
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 8a90fcb5d7..5ee97c56b6 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -18,46 +18,47 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "libavformat/mux.h"
 #include "avdevice.h"
 
 /* devices */
-extern const AVInputFormat  ff_alsa_demuxer;
+extern const FFInputFormat  ff_alsa_demuxer;
 extern const FFOutputFormat ff_alsa_muxer;
-extern const AVInputFormat  ff_android_camera_demuxer;
+extern const FFInputFormat  ff_android_camera_demuxer;
 extern const FFOutputFormat ff_audiotoolbox_muxer;
-extern const AVInputFormat  ff_avfoundation_demuxer;
-extern const AVInputFormat  ff_bktr_demuxer;
+extern const FFInputFormat  ff_avfoundation_demuxer;
+extern const FFInputFormat  ff_bktr_demuxer;
 extern const FFOutputFormat ff_caca_muxer;
-extern const AVInputFormat  ff_decklink_demuxer;
+extern const FFInputFormat  ff_decklink_demuxer;
 extern const FFOutputFormat ff_decklink_muxer;
-extern const AVInputFormat  ff_dshow_demuxer;
-extern const AVInputFormat  ff_fbdev_demuxer;
+extern const FFInputFormat  ff_dshow_demuxer;
+extern const FFInputFormat  ff_fbdev_demuxer;
 extern const FFOutputFormat ff_fbdev_muxer;
-extern const AVInputFormat  ff_gdigrab_demuxer;
-extern const AVInputFormat  ff_iec61883_demuxer;
-extern const AVInputFormat  ff_jack_demuxer;
-extern const AVInputFormat  ff_kmsgrab_demuxer;
-extern const AVInputFormat  ff_lavfi_demuxer;
-extern const AVInputFormat  ff_openal_demuxer;
+extern const FFInputFormat  ff_gdigrab_demuxer;
+extern const FFInputFormat  ff_iec61883_demuxer;
+extern const FFInputFormat  ff_jack_demuxer;
+extern const FFInputFormat  ff_kmsgrab_demuxer;
+extern const FFInputFormat  ff_lavfi_demuxer;
+extern const FFInputFormat  ff_openal_demuxer;
 extern const FFOutputFormat ff_opengl_muxer;
-extern const AVInputFormat  ff_oss_demuxer;
+extern const FFInputFormat  ff_oss_demuxer;
 extern const FFOutputFormat ff_oss_muxer;
-extern const AVInputFormat  ff_pulse_demuxer;
+extern const FFInputFormat  ff_pulse_demuxer;
 extern const FFOutputFormat ff_pulse_muxer;
 extern const FFOutputFormat ff_sdl2_muxer;
-extern const AVInputFormat  ff_sndio_demuxer;
+extern const FFInputFormat  ff_sndio_demuxer;
 extern const FFOutputFormat ff_sndio_muxer;
-extern const AVInputFormat  ff_v4l2_demuxer;
+extern const FFInputFormat  ff_v4l2_demuxer;
 extern const FFOutputFormat ff_v4l2_muxer;
-extern const AVInputFormat  ff_vfwcap_demuxer;
-extern const AVInputFormat  ff_xcbgrab_demuxer;
+extern const FFInputFormat  ff_vfwcap_demuxer;
+extern const FFInputFormat  ff_xcbgrab_demuxer;
 extern const FFOutputFormat ff_xv_muxer;
 
 /* external libraries */
-extern const AVInputFormat  ff_libcdio_demuxer;
-extern const AVInputFormat  ff_libdc1394_demuxer;
+extern const FFInputFormat  ff_libcdio_demuxer;
+extern const FFInputFormat  ff_libdc1394_demuxer;
 
 #include "libavdevice/outdev_list.c"
 #include "libavdevice/indev_list.c"
@@ -72,12 +73,12 @@ static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
     const AVClass *pc;
     const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT;
     AVClassCategory category = AV_CLASS_CATEGORY_NA;
-    const AVInputFormat *fmt = NULL;
+    const FFInputFormat *fmt = NULL;
     int i = 0;
 
     while (prev && (fmt = indev_list[i])) {
         i++;
-        if (prev == fmt)
+        if (prev == &fmt->p)
             break;
     }
 
@@ -85,7 +86,7 @@ static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
         fmt = indev_list[i++];
         if (!fmt)
             break;
-        pc = fmt->priv_class;
+        pc = fmt->p.priv_class;
         if (!pc)
             continue;
         category = pc->category;
diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c
index b518bbdac6..018afaef08 100644
--- a/libavdevice/alsa_dec.c
+++ b/libavdevice/alsa_dec.c
@@ -52,6 +52,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
 
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 
 #include "avdevice.h"
@@ -157,14 +158,14 @@ static const AVClass alsa_demuxer_class = {
     .category       = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 };
 
-const AVInputFormat ff_alsa_demuxer = {
-    .name           = "alsa",
-    .long_name      = NULL_IF_CONFIG_SMALL("ALSA audio input"),
+const FFInputFormat ff_alsa_demuxer = {
+    .p.name         = "alsa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("ALSA audio input"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &alsa_demuxer_class,
     .priv_data_size = sizeof(AlsaData),
     .read_header    = audio_read_header,
     .read_packet    = audio_read_packet,
     .read_close     = ff_alsa_close,
     .get_device_list = audio_get_device_list,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &alsa_demuxer_class,
 };
diff --git a/libavdevice/android_camera.c b/libavdevice/android_camera.c
index c981985f10..3aa8597c63 100644
--- a/libavdevice/android_camera.c
+++ b/libavdevice/android_camera.c
@@ -33,6 +33,7 @@
 #include <media/NdkImageReader.h>
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "libavutil/avstring.h"
 #include "libavutil/display.h"
@@ -860,13 +861,13 @@ static const AVClass android_camera_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_android_camera_demuxer = {
-    .name           = "android_camera",
-    .long_name      = NULL_IF_CONFIG_SMALL("Android camera input device"),
+const FFInputFormat ff_android_camera_demuxer = {
+    .p.name         = "android_camera",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Android camera input device"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &android_camera_class,
     .priv_data_size = sizeof(AndroidCameraCtx),
     .read_header    = android_camera_read_header,
     .read_packet    = android_camera_read_packet,
     .read_close     = android_camera_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &android_camera_class,
 };
diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index 38110ddfdb..cd7b03ef48 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -19,6 +19,7 @@
 #include "libavutil/avassert.h"
 #include "avdevice.h"
 #include "internal.h"
+#include "libavformat/demux.h"
 #include "libavformat/mux.h"
 
 int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type,
@@ -44,7 +45,7 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
     av_assert0(device_list);
     av_assert0(s->oformat || s->iformat);
     if ((s->oformat && !ffofmt(s->oformat)->get_device_list) ||
-        (s->iformat && !s->iformat->get_device_list)) {
+        (s->iformat && !ffifmt(s->iformat)->get_device_list)) {
         *device_list = NULL;
         return AVERROR(ENOSYS);
     }
@@ -56,7 +57,7 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
     if (s->oformat)
         ret = ffofmt(s->oformat)->get_device_list(s, *device_list);
     else
-        ret = s->iformat->get_device_list(s, *device_list);
+        ret = ffifmt(s->iformat)->get_device_list(s, *device_list);
     if (ret < 0) {
         avdevice_free_list_devices(device_list);
         return ret;
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 864726468f..a46adfafe0 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -24,6 +24,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "libavutil/file_open.h"
 #include "libavutil/internal.h"
@@ -352,13 +353,13 @@ static const AVClass bktr_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_bktr_demuxer = {
-    .name           = "bktr",
-    .long_name      = NULL_IF_CONFIG_SMALL("video grab"),
+const FFInputFormat ff_bktr_demuxer = {
+    .p.name         = "bktr",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("video grab"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &bktr_class,
     .priv_data_size = sizeof(VideoData),
     .read_header    = grab_read_header,
     .read_packet    = grab_read_packet,
     .read_close     = grab_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &bktr_class,
 };
diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c
index 2159702c96..1863833ff4 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -21,6 +21,7 @@
  */
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavutil/opt.h"
 
 #include "decklink_common_c.h"
@@ -111,11 +112,11 @@ static const AVClass decklink_demuxer_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_decklink_demuxer = {
-    .name           = "decklink",
-    .long_name      = NULL_IF_CONFIG_SMALL("Blackmagic DeckLink input"),
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &decklink_demuxer_class,
+const FFInputFormat ff_decklink_demuxer = {
+    .p.name          = "decklink",
+    .p.long_name     = NULL_IF_CONFIG_SMALL("Blackmagic DeckLink input"),
+    .p.flags         = AVFMT_NOFILE,
+    .p.priv_class    = &decklink_demuxer_class,
     .priv_data_size = sizeof(struct decklink_cctx),
     .get_device_list = ff_decklink_list_input_devices,
     .read_header   = ff_decklink_read_header,
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 5946a72cc2..0330d1d0b6 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -24,6 +24,7 @@
 #include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
 #include "libavutil/mem.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "libavformat/riff.h"
 #include "avdevice.h"
@@ -1924,14 +1925,15 @@ static const AVClass dshow_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_dshow_demuxer = {
-    .name           = "dshow",
-    .long_name      = NULL_IF_CONFIG_SMALL("DirectShow capture"),
+const FFInputFormat ff_dshow_demuxer = {
+    .p.name         = "dshow",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("DirectShow capture"),
+    .p.flags        = AVFMT_NOFILE | AVFMT_NOBINSEARCH |
+                      AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
+    .p.priv_class   = &dshow_class,
     .priv_data_size = sizeof(struct dshow_ctx),
     .read_header    = dshow_read_header,
     .read_packet    = dshow_read_packet,
     .read_close     = dshow_read_close,
     .get_device_list= dshow_get_device_list,
-    .flags          = AVFMT_NOFILE | AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
-    .priv_class     = &dshow_class,
 };
diff --git a/libavdevice/fbdev_dec.c b/libavdevice/fbdev_dec.c
index 460a71d13f..51e7bd73ab 100644
--- a/libavdevice/fbdev_dec.c
+++ b/libavdevice/fbdev_dec.c
@@ -41,6 +41,7 @@
 #include "libavutil/time.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "avdevice.h"
 #include "fbdev_common.h"
@@ -232,14 +233,14 @@ static const AVClass fbdev_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_fbdev_demuxer = {
-    .name           = "fbdev",
-    .long_name      = NULL_IF_CONFIG_SMALL("Linux framebuffer"),
+const FFInputFormat ff_fbdev_demuxer = {
+    .p.name          = "fbdev",
+    .p.long_name     = NULL_IF_CONFIG_SMALL("Linux framebuffer"),
+    .p.flags         = AVFMT_NOFILE,
+    .p.priv_class    = &fbdev_class,
     .priv_data_size = sizeof(FBDevContext),
     .read_header    = fbdev_read_header,
     .read_packet    = fbdev_read_packet,
     .read_close     = fbdev_read_close,
     .get_device_list = fbdev_get_device_list,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &fbdev_class,
 };
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index b2858ecd89..58e876ea9e 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -29,6 +29,7 @@
  */
 
 #include "config.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
@@ -677,13 +678,13 @@ static const AVClass gdigrab_class = {
 };
 
 /** gdi grabber device demuxer declaration */
-const AVInputFormat ff_gdigrab_demuxer = {
-    .name           = "gdigrab",
-    .long_name      = NULL_IF_CONFIG_SMALL("GDI API Windows frame grabber"),
+const FFInputFormat ff_gdigrab_demuxer = {
+    .p.name         = "gdigrab",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("GDI API Windows frame grabber"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &gdigrab_class,
     .priv_data_size = sizeof(struct gdigrab),
     .read_header    = gdigrab_read_header,
     .read_packet    = gdigrab_read_packet,
     .read_close     = gdigrab_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &gdigrab_class,
 };
diff --git a/libavdevice/iec61883.c b/libavdevice/iec61883.c
index 7223ba2e64..c88e1bd18c 100644
--- a/libavdevice/iec61883.c
+++ b/libavdevice/iec61883.c
@@ -30,6 +30,7 @@
 #include <libavc1394/avc1394.h>
 #include <libavc1394/rom1394.h>
 #include <libiec61883/iec61883.h>
+#include "libavformat/demux.h"
 #include "libavformat/dv.h"
 #include "libavformat/mpegts.h"
 #include "libavutil/opt.h"
@@ -502,13 +503,13 @@ static const AVClass iec61883_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_iec61883_demuxer = {
-    .name           = "iec61883",
-    .long_name      = NULL_IF_CONFIG_SMALL("libiec61883 (new DV1394) A/V input device"),
+const FFInputFormat ff_iec61883_demuxer = {
+    .p.name         = "iec61883",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("libiec61883 (new DV1394) A/V input device"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &iec61883_class,
     .priv_data_size = sizeof(struct iec61883_data),
     .read_header    = iec61883_read_header,
     .read_packet    = iec61883_read_packet,
     .read_close     = iec61883_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &iec61883_class,
 };
diff --git a/libavdevice/jack.c b/libavdevice/jack.c
index db056d824f..40f2af5ccc 100644
--- a/libavdevice/jack.c
+++ b/libavdevice/jack.c
@@ -30,6 +30,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "timefilter.h"
 #include "avdevice.h"
@@ -341,13 +342,13 @@ static const AVClass jack_indev_class = {
     .category       = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 };
 
-const AVInputFormat ff_jack_demuxer = {
-    .name           = "jack",
-    .long_name      = NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
+const FFInputFormat ff_jack_demuxer = {
+    .p.name         = "jack",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &jack_indev_class,
     .priv_data_size = sizeof(JackData),
     .read_header    = audio_read_header,
     .read_packet    = audio_read_packet,
     .read_close     = audio_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &jack_indev_class,
 };
diff --git a/libavdevice/kmsgrab.c b/libavdevice/kmsgrab.c
index ba9b306c65..bf6341e9fd 100644
--- a/libavdevice/kmsgrab.c
+++ b/libavdevice/kmsgrab.c
@@ -42,6 +42,7 @@
 #include "libavutil/time.h"
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 
 typedef struct KMSGrabContext {
@@ -708,13 +709,13 @@ static const AVClass kmsgrab_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_kmsgrab_demuxer = {
-    .name           = "kmsgrab",
-    .long_name      = NULL_IF_CONFIG_SMALL("KMS screen capture"),
+const FFInputFormat ff_kmsgrab_demuxer = {
+    .p.name         = "kmsgrab",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("KMS screen capture"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &kmsgrab_class,
     .priv_data_size = sizeof(KMSGrabContext),
     .read_header    = &kmsgrab_read_header,
     .read_packet    = &kmsgrab_read_packet,
     .read_close     = &kmsgrab_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &kmsgrab_class,
 };
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 2bfd0b81c7..58ad62bd97 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -39,6 +39,7 @@
 #include "libavutil/pixdesc.h"
 #include "libavfilter/avfilter.h"
 #include "libavfilter/buffersink.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "avdevice.h"
 
@@ -493,14 +494,14 @@ static const AVClass lavfi_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_INPUT,
 };
 
-const AVInputFormat ff_lavfi_demuxer = {
-    .name           = "lavfi",
-    .long_name      = NULL_IF_CONFIG_SMALL("Libavfilter virtual input device"),
+const FFInputFormat ff_lavfi_demuxer = {
+    .p.name         = "lavfi",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Libavfilter virtual input device"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &lavfi_class,
     .priv_data_size = sizeof(LavfiContext),
     .read_header    = lavfi_read_header,
     .read_packet    = lavfi_read_packet,
     .read_close     = lavfi_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &lavfi_class,
     .flags_internal = FF_FMT_INIT_CLEANUP,
 };
diff --git a/libavdevice/libcdio.c b/libavdevice/libcdio.c
index 28c339564f..47ff8fd4d8 100644
--- a/libavdevice/libcdio.c
+++ b/libavdevice/libcdio.c
@@ -180,13 +180,13 @@ static const AVClass libcdio_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 };
 
-const AVInputFormat ff_libcdio_demuxer = {
-    .name           = "libcdio",
+const FFInputFormat ff_libcdio_demuxer = {
+    .p.name         = "libcdio",
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &libcdio_class,
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_close     = read_close,
     .read_seek      = read_seek,
     .priv_data_size = sizeof(CDIOContext),
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &libcdio_class,
 };
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index e98b88c1a2..c73d07a60f 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -31,6 +31,7 @@
 #include "libavutil/pixdesc.h"
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 
 typedef struct dc1394_data {
@@ -288,13 +289,13 @@ static int dc1394_close(AVFormatContext * context)
     return 0;
 }
 
-const AVInputFormat ff_libdc1394_demuxer = {
-    .name           = "libdc1394",
-    .long_name      = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"),
+const FFInputFormat ff_libdc1394_demuxer = {
+    .p.name         = "libdc1394",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &libdc1394_class,
     .priv_data_size = sizeof(struct dc1394_data),
     .read_header    = dc1394_read_header,
     .read_packet    = dc1394_read_packet,
     .read_close     = dc1394_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &libdc1394_class,
 };
diff --git a/libavdevice/openal-dec.c b/libavdevice/openal-dec.c
index 91a40ae020..53b34abd5a 100644
--- a/libavdevice/openal-dec.c
+++ b/libavdevice/openal-dec.c
@@ -26,6 +26,7 @@
 
 #include "libavutil/opt.h"
 #include "libavutil/time.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "avdevice.h"
 
@@ -248,14 +249,14 @@ static const AVClass class = {
     .category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 };
 
-const AVInputFormat ff_openal_demuxer = {
-    .name = "openal",
-    .long_name = NULL_IF_CONFIG_SMALL("OpenAL audio capture device"),
+const FFInputFormat ff_openal_demuxer = {
+    .p.name         = "openal",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("OpenAL audio capture device"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &class,
     .priv_data_size = sizeof(al_data),
     .read_probe = NULL,
     .read_header = read_header,
     .read_packet = read_packet,
     .read_close = read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &class
 };
diff --git a/libavdevice/oss_dec.c b/libavdevice/oss_dec.c
index 2cdc4324e8..f727d6e110 100644
--- a/libavdevice/oss_dec.c
+++ b/libavdevice/oss_dec.c
@@ -35,6 +35,7 @@
 #include "libavutil/time.h"
 
 #include "avdevice.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 
 #include "oss.h"
@@ -130,13 +131,13 @@ static const AVClass oss_demuxer_class = {
     .category       = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 };
 
-const AVInputFormat ff_oss_demuxer = {
-    .name           = "oss",
-    .long_name      = NULL_IF_CONFIG_SMALL("OSS (Open Sound System) capture"),
+const FFInputFormat ff_oss_demuxer = {
+    .p.name         = "oss",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("OSS (Open Sound System) capture"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &oss_demuxer_class,
     .priv_data_size = sizeof(OSSAudioData),
     .read_header    = audio_read_header,
     .read_packet    = audio_read_packet,
     .read_close     = audio_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &oss_demuxer_class,
 };
diff --git a/libavdevice/pulse_audio_dec.c b/libavdevice/pulse_audio_dec.c
index 2545462939..32be18e7dd 100644
--- a/libavdevice/pulse_audio_dec.c
+++ b/libavdevice/pulse_audio_dec.c
@@ -29,6 +29,7 @@
 #include "libavutil/time.h"
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 #include "libavformat/version.h"
 #include "pulse_audio_common.h"
@@ -393,14 +394,14 @@ static const AVClass pulse_demuxer_class = {
     .category       = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 };
 
-const AVInputFormat ff_pulse_demuxer = {
-    .name           = "pulse",
-    .long_name      = NULL_IF_CONFIG_SMALL("Pulse audio input"),
+const FFInputFormat ff_pulse_demuxer = {
+    .p.name          = "pulse",
+    .p.long_name     = NULL_IF_CONFIG_SMALL("Pulse audio input"),
+    .p.flags         = AVFMT_NOFILE,
+    .p.priv_class    = &pulse_demuxer_class,
     .priv_data_size = sizeof(PulseData),
     .read_header    = pulse_read_header,
     .read_packet    = pulse_read_packet,
     .read_close     = pulse_close,
     .get_device_list = pulse_get_device_list,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &pulse_demuxer_class,
 };
diff --git a/libavdevice/sndio_dec.c b/libavdevice/sndio_dec.c
index 6059830367..309394189b 100644
--- a/libavdevice/sndio_dec.c
+++ b/libavdevice/sndio_dec.c
@@ -27,6 +27,7 @@
 #include "libavutil/time.h"
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 
 #include "libavdevice/sndio.h"
@@ -109,13 +110,13 @@ static const AVClass sndio_demuxer_class = {
     .category       = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
 };
 
-const AVInputFormat ff_sndio_demuxer = {
-    .name           = "sndio",
-    .long_name      = NULL_IF_CONFIG_SMALL("sndio audio capture"),
+const FFInputFormat ff_sndio_demuxer = {
+    .p.name         = "sndio",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("sndio audio capture"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &sndio_demuxer_class,
     .priv_data_size = sizeof(SndioData),
     .read_header    = audio_read_header,
     .read_packet    = audio_read_packet,
     .read_close     = audio_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &sndio_demuxer_class,
 };
diff --git a/libavdevice/utils.c b/libavdevice/utils.c
index d9a52c53ab..c72a839dfa 100644
--- a/libavdevice/utils.c
+++ b/libavdevice/utils.c
@@ -19,6 +19,7 @@
 #include "internal.h"
 #include "libavutil/opt.h"
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 
 int ff_alloc_input_device_context(AVFormatContext **avctx, const AVInputFormat *iformat, const char *format)
 {
@@ -38,8 +39,8 @@ int ff_alloc_input_device_context(AVFormatContext **avctx, const AVInputFormat *
         goto error;
     }
     s->iformat = iformat;
-    if (s->iformat->priv_data_size > 0) {
-        s->priv_data = av_mallocz(s->iformat->priv_data_size);
+    if (ffifmt(s->iformat)->priv_data_size > 0) {
+        s->priv_data = av_mallocz(ffifmt(s->iformat)->priv_data_size);
         if (!s->priv_data) {
             ret = AVERROR(ENOMEM);
             goto error;
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 5e85d1a2b3..818b874eb1 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -1134,15 +1134,15 @@ static const AVClass v4l2_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
 };
 
-const AVInputFormat ff_v4l2_demuxer = {
-    .name           = "video4linux2,v4l2",
-    .long_name      = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
+const FFInputFormat ff_v4l2_demuxer = {
+    .p.name          = "video4linux2,v4l2",
+    .p.long_name     = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
+    .p.flags         = AVFMT_NOFILE,
+    .p.priv_class    = &v4l2_class,
     .priv_data_size = sizeof(struct video_data),
     .read_probe     = v4l2_read_probe,
     .read_header    = v4l2_read_header,
     .read_packet    = v4l2_read_packet,
     .read_close     = v4l2_read_close,
     .get_device_list = v4l2_get_device_list,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &v4l2_class,
 };
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index 86a40b4af4..dd077dd08c 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -25,6 +25,7 @@
 #include "libavutil/parseutils.h"
 
 #include "libavcodec/packet_internal.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 
 // windows.h must no be included before winsock2.h, and libavformat internal
@@ -482,13 +483,13 @@ static const AVClass vfw_class = {
     .category   = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
 };
 
-const AVInputFormat ff_vfwcap_demuxer = {
-    .name           = "vfwcap",
-    .long_name      = NULL_IF_CONFIG_SMALL("VfW video capture"),
+const FFInputFormat ff_vfwcap_demuxer = {
+    .p.name         = "vfwcap",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("VfW video capture"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &vfw_class,
     .priv_data_size = sizeof(struct vfw_ctx),
     .read_header    = vfw_read_header,
     .read_packet    = vfw_read_packet,
     .read_close     = vfw_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &vfw_class,
 };
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 64a68ba497..8feae17455 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -45,6 +45,7 @@
 #include "libavutil/time.h"
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavformat/internal.h"
 
 typedef struct XCBGrabContext {
@@ -900,13 +901,13 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_xcbgrab_demuxer = {
-    .name           = "x11grab",
-    .long_name      = NULL_IF_CONFIG_SMALL("X11 screen capture, using XCB"),
+const FFInputFormat ff_xcbgrab_demuxer = {
+    .p.name         = "x11grab",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("X11 screen capture, using XCB"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &xcbgrab_class,
     .priv_data_size = sizeof(XCBGrabContext),
     .read_header    = xcbgrab_read_header,
     .read_packet    = xcbgrab_read_packet,
     .read_close     = xcbgrab_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &xcbgrab_class,
 };
diff --git a/libavformat/3dostr.c b/libavformat/3dostr.c
index fea12d03e6..78b8205904 100644
--- a/libavformat/3dostr.c
+++ b/libavformat/3dostr.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int threedostr_probe(const AVProbeData *p)
@@ -191,12 +192,12 @@ static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt)
     return AVERROR_EOF;
 }
 
-const AVInputFormat ff_threedostr_demuxer = {
-    .name           = "3dostr",
-    .long_name      = NULL_IF_CONFIG_SMALL("3DO STR"),
+const FFInputFormat ff_threedostr_demuxer = {
+    .p.name         = "3dostr",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("3DO STR"),
+    .p.extensions   = "str",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = threedostr_probe,
     .read_header    = threedostr_read_header,
     .read_packet    = threedostr_read_packet,
-    .extensions     = "str",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index fdf6e4b84b..3424791b81 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -31,6 +31,7 @@
 #include "libavutil/intfloat.h"
 #include "libavcodec/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define     RIFF_TAG MKTAG('R', 'I', 'F', 'F')
@@ -396,9 +397,9 @@ static int fourxm_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_fourxm_demuxer = {
-    .name           = "4xm",
-    .long_name      = NULL_IF_CONFIG_SMALL("4X Technologies"),
+const FFInputFormat ff_fourxm_demuxer = {
+    .p.name         = "4xm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("4X Technologies"),
     .priv_data_size = sizeof(FourxmDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = fourxm_probe,
diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 4da98a6884..e267886e1a 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -24,6 +24,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "id3v1.h"
 #include "id3v2.h"
@@ -208,14 +209,14 @@ retry:
     return ret;
 }
 
-const AVInputFormat ff_aac_demuxer = {
-    .name         = "aac",
-    .long_name    = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio Coding)"),
+const FFInputFormat ff_aac_demuxer = {
+    .p.name       = "aac",
+    .p.long_name  = NULL_IF_CONFIG_SMALL("raw ADTS AAC (Advanced Audio Coding)"),
+    .p.flags      = AVFMT_GENERIC_INDEX,
+    .p.extensions = "aac",
+    .p.mime_type  = "audio/aac,audio/aacp,audio/x-aac",
     .read_probe   = adts_aac_probe,
     .read_header  = adts_aac_read_header,
     .read_packet  = adts_aac_read_packet,
-    .flags        = AVFMT_GENERIC_INDEX,
-    .extensions   = "aac",
-    .mime_type    = "audio/aac,audio/aacp,audio/x-aac",
     .raw_codec_id = AV_CODEC_ID_AAC,
 };
diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index e7b048b1f9..dd698d0d5d 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -371,17 +371,17 @@ static const AVClass aa_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_aa_demuxer = {
-    .name           = "aa",
-    .long_name      = NULL_IF_CONFIG_SMALL("Audible AA format files"),
-    .priv_class     = &aa_class,
+const FFInputFormat ff_aa_demuxer = {
+    .p.name         = "aa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Audible AA format files"),
+    .p.priv_class   = &aa_class,
+    .p.extensions   = "aa",
+    .p.flags        = AVFMT_NO_BYTE_SEEK | AVFMT_NOGENSEARCH,
     .priv_data_size = sizeof(AADemuxContext),
-    .extensions     = "aa",
     .read_probe     = aa_probe,
     .read_header    = aa_read_header,
     .read_packet    = aa_read_packet,
     .read_seek      = aa_read_seek,
     .read_close     = aa_read_close,
-    .flags          = AVFMT_NO_BYTE_SEEK | AVFMT_NOGENSEARCH,
     .flags_internal = FF_FMT_INIT_CLEANUP,
 };
diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c
index 4e352f8ce3..0ccd4944db 100644
--- a/libavformat/aaxdec.c
+++ b/libavformat/aaxdec.c
@@ -383,15 +383,15 @@ static int aax_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_aax_demuxer = {
-    .name           = "aax",
-    .long_name      = NULL_IF_CONFIG_SMALL("CRI AAX"),
+const FFInputFormat ff_aax_demuxer = {
+    .p.name         = "aax",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("CRI AAX"),
+    .p.extensions   = "aax",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(AAXContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = aax_probe,
     .read_header    = aax_read_header,
     .read_packet    = aax_read_packet,
     .read_close     = aax_read_close,
-    .extensions     = "aax",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c
index 989d126a81..0b1557d68c 100644
--- a/libavformat/ac3dec.c
+++ b/libavformat/ac3dec.c
@@ -25,6 +25,7 @@
 #include "libavutil/crc.h"
 #include "libavcodec/ac3_parser.h"
 #include "avformat.h"
+#include "demux.h"
 #include "rawdec.h"
 
 static int ac3_eac3_probe(const AVProbeData *p, enum AVCodecID expected_codec_id)
@@ -104,17 +105,17 @@ static int ac3_probe(const AVProbeData *p)
     return ac3_eac3_probe(p, AV_CODEC_ID_AC3);
 }
 
-const AVInputFormat ff_ac3_demuxer = {
-    .name           = "ac3",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw AC-3"),
+const FFInputFormat ff_ac3_demuxer = {
+    .p.name         = "ac3",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw AC-3"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "ac3",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = ac3_probe,
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "ac3",
     .raw_codec_id   = AV_CODEC_ID_AC3,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
 
@@ -124,16 +125,16 @@ static int eac3_probe(const AVProbeData *p)
     return ac3_eac3_probe(p, AV_CODEC_ID_EAC3);
 }
 
-const AVInputFormat ff_eac3_demuxer = {
-    .name           = "eac3",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
+const FFInputFormat ff_eac3_demuxer = {
+    .p.name         = "eac3",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "eac3,ec3",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = eac3_probe,
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "eac3,ec3",
     .raw_codec_id   = AV_CODEC_ID_EAC3,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
diff --git a/libavformat/ac4dec.c b/libavformat/ac4dec.c
index 71950f52dc..f647f557cc 100644
--- a/libavformat/ac4dec.c
+++ b/libavformat/ac4dec.c
@@ -22,6 +22,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/crc.h"
 #include "avformat.h"
+#include "demux.h"
 #include "rawdec.h"
 
 static int ac4_probe(const AVProbeData *p)
@@ -93,12 +94,12 @@ static int ac4_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_ac4_demuxer = {
-    .name           = "ac4",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw AC-4"),
+const FFInputFormat ff_ac4_demuxer = {
+    .p.name         = "ac4",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw AC-4"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "ac4",
     .read_probe     = ac4_probe,
     .read_header    = ac4_read_header,
     .read_packet    = ac4_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "ac4",
 };
diff --git a/libavformat/acedec.c b/libavformat/acedec.c
index 6322af31f3..5ab6de02f4 100644
--- a/libavformat/acedec.c
+++ b/libavformat/acedec.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int ace_probe(const AVProbeData *p)
@@ -104,11 +105,11 @@ static int ace_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align);
 }
 
-const AVInputFormat ff_ace_demuxer = {
-    .name           = "ace",
-    .long_name      = NULL_IF_CONFIG_SMALL("tri-Ace Audio Container"),
+const FFInputFormat ff_ace_demuxer = {
+    .p.name         = "ace",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("tri-Ace Audio Container"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = ace_probe,
     .read_header    = ace_read_header,
     .read_packet    = ace_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/acm.c b/libavformat/acm.c
index 28a040330f..b9126ef824 100644
--- a/libavformat/acm.c
+++ b/libavformat/acm.c
@@ -61,15 +61,15 @@ static int acm_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_acm_demuxer = {
-    .name           = "acm",
-    .long_name      = NULL_IF_CONFIG_SMALL("Interplay ACM"),
+const FFInputFormat ff_acm_demuxer = {
+    .p.name         = "acm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Interplay ACM"),
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
+    .p.extensions   = "acm",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = acm_probe,
     .read_header    = acm_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
-    .extensions     = "acm",
     .raw_codec_id   = AV_CODEC_ID_INTERPLAY_ACM,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/act.c b/libavformat/act.c
index da73fcceca..255568dd3c 100644
--- a/libavformat/act.c
+++ b/libavformat/act.c
@@ -22,6 +22,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "riff.h"
 #include "internal.h"
 
@@ -198,9 +199,9 @@ static int read_packet(AVFormatContext *s,
     return ret;
 }
 
-const AVInputFormat ff_act_demuxer = {
-    .name           = "act",
-    .long_name      = "ACT Voice file format",
+const FFInputFormat ff_act_demuxer = {
+    .p.name         = "act",
+    .p.long_name    = "ACT Voice file format",
     .priv_data_size = sizeof(ACTContext),
     .read_probe     = probe,
     .read_header    = read_header,
diff --git a/libavformat/adp.c b/libavformat/adp.c
index c9a5a04507..2e69c7a199 100644
--- a/libavformat/adp.c
+++ b/libavformat/adp.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int adp_probe(const AVProbeData *p)
@@ -82,11 +83,11 @@ static int adp_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_adp_demuxer = {
-    .name           = "adp",
-    .long_name      = NULL_IF_CONFIG_SMALL("ADP"),
+const FFInputFormat ff_adp_demuxer = {
+    .p.name         = "adp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("ADP"),
+    .p.extensions   = "adp,dtk",
     .read_probe     = adp_probe,
     .read_header    = adp_read_header,
     .read_packet    = adp_read_packet,
-    .extensions     = "adp,dtk",
 };
diff --git a/libavformat/ads.c b/libavformat/ads.c
index c19498490d..ea81248765 100644
--- a/libavformat/ads.c
+++ b/libavformat/ads.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int ads_probe(const AVProbeData *p)
@@ -80,11 +81,11 @@ static int ads_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_ads_demuxer = {
-    .name           = "ads",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony PS2 ADS"),
+const FFInputFormat ff_ads_demuxer = {
+    .p.name         = "ads",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony PS2 ADS"),
+    .p.extensions   = "ads,ss2",
     .read_probe     = ads_probe,
     .read_header    = ads_read_header,
     .read_packet    = ads_read_packet,
-    .extensions     = "ads,ss2",
 };
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index b6bd3303a7..0909884f19 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -128,14 +128,14 @@ static int adx_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_adx_demuxer = {
-    .name           = "adx",
-    .long_name      = NULL_IF_CONFIG_SMALL("CRI ADX"),
+const FFInputFormat ff_adx_demuxer = {
+    .p.name         = "adx",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("CRI ADX"),
+    .p.extensions   = "adx",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = adx_probe,
     .priv_data_size = sizeof(ADXDemuxerContext),
     .read_header    = adx_read_header,
     .read_packet    = adx_read_packet,
-    .extensions     = "adx",
     .raw_codec_id   = AV_CODEC_ID_ADPCM_ADX,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/aea.c b/libavformat/aea.c
index 52e3147729..4cb2da6639 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -23,6 +23,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "pcm.h"
 
 #define AT1_SU_SIZE 212
@@ -89,13 +90,13 @@ static int aea_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align);
 }
 
-const AVInputFormat ff_aea_demuxer = {
-    .name           = "aea",
-    .long_name      = NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
+const FFInputFormat ff_aea_demuxer = {
+    .p.name         = "aea",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "aea",
     .read_probe     = aea_read_probe,
     .read_header    = aea_read_header,
     .read_packet    = aea_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "aea",
 };
diff --git a/libavformat/afc.c b/libavformat/afc.c
index 898c7d03eb..3113554c0f 100644
--- a/libavformat/afc.c
+++ b/libavformat/afc.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct AFCDemuxContext {
@@ -68,12 +69,12 @@ static int afc_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_afc_demuxer = {
-    .name           = "afc",
-    .long_name      = NULL_IF_CONFIG_SMALL("AFC"),
+const FFInputFormat ff_afc_demuxer = {
+    .p.name         = "afc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AFC"),
+    .p.extensions   = "afc",
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
     .priv_data_size = sizeof(AFCDemuxContext),
     .read_header    = afc_read_header,
     .read_packet    = afc_read_packet,
-    .extensions     = "afc",
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
 };
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 5314d159ef..9318943f96 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -433,13 +433,13 @@ static int aiff_read_packet(AVFormatContext *s,
     return 0;
 }
 
-const AVInputFormat ff_aiff_demuxer = {
-    .name           = "aiff",
-    .long_name      = NULL_IF_CONFIG_SMALL("Audio IFF"),
+const FFInputFormat ff_aiff_demuxer = {
+    .p.name         = "aiff",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Audio IFF"),
+    .p.codec_tag    = ff_aiff_codec_tags_list,
     .priv_data_size = sizeof(AIFFInputContext),
     .read_probe     = aiff_probe,
     .read_header    = aiff_read_header,
     .read_packet    = aiff_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .codec_tag      = ff_aiff_codec_tags_list,
 };
diff --git a/libavformat/aixdec.c b/libavformat/aixdec.c
index f7d8e17acd..edecbac5b3 100644
--- a/libavformat/aixdec.c
+++ b/libavformat/aixdec.c
@@ -130,12 +130,12 @@ static int aix_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_aix_demuxer = {
-    .name        = "aix",
-    .long_name   = NULL_IF_CONFIG_SMALL("CRI AIX"),
+const FFInputFormat ff_aix_demuxer = {
+    .p.name      = "aix",
+    .p.long_name = NULL_IF_CONFIG_SMALL("CRI AIX"),
+    .p.extensions= "aix",
+    .p.flags     = AVFMT_GENERIC_INDEX,
     .read_probe  = aix_probe,
     .read_header = aix_read_header,
     .read_packet = aix_read_packet,
-    .extensions  = "aix",
-    .flags       = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index b04b43cab3..32e443e3b1 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -25,268 +25,269 @@
 
 #include "libavformat/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "mux.h"
 
 /* (de)muxers */
 extern const FFOutputFormat ff_a64_muxer;
-extern const AVInputFormat  ff_aa_demuxer;
-extern const AVInputFormat  ff_aac_demuxer;
-extern const AVInputFormat  ff_aax_demuxer;
-extern const AVInputFormat  ff_ac3_demuxer;
+extern const FFInputFormat  ff_aa_demuxer;
+extern const FFInputFormat  ff_aac_demuxer;
+extern const FFInputFormat  ff_aax_demuxer;
+extern const FFInputFormat  ff_ac3_demuxer;
 extern const FFOutputFormat ff_ac3_muxer;
-extern const AVInputFormat  ff_ac4_demuxer;
+extern const FFInputFormat  ff_ac4_demuxer;
 extern const FFOutputFormat ff_ac4_muxer;
-extern const AVInputFormat  ff_ace_demuxer;
-extern const AVInputFormat  ff_acm_demuxer;
-extern const AVInputFormat  ff_act_demuxer;
-extern const AVInputFormat  ff_adf_demuxer;
-extern const AVInputFormat  ff_adp_demuxer;
-extern const AVInputFormat  ff_ads_demuxer;
+extern const FFInputFormat  ff_ace_demuxer;
+extern const FFInputFormat  ff_acm_demuxer;
+extern const FFInputFormat  ff_act_demuxer;
+extern const FFInputFormat  ff_adf_demuxer;
+extern const FFInputFormat  ff_adp_demuxer;
+extern const FFInputFormat  ff_ads_demuxer;
 extern const FFOutputFormat ff_adts_muxer;
-extern const AVInputFormat  ff_adx_demuxer;
+extern const FFInputFormat  ff_adx_demuxer;
 extern const FFOutputFormat ff_adx_muxer;
-extern const AVInputFormat  ff_aea_demuxer;
-extern const AVInputFormat  ff_afc_demuxer;
-extern const AVInputFormat  ff_aiff_demuxer;
+extern const FFInputFormat  ff_aea_demuxer;
+extern const FFInputFormat  ff_afc_demuxer;
+extern const FFInputFormat  ff_aiff_demuxer;
 extern const FFOutputFormat ff_aiff_muxer;
-extern const AVInputFormat  ff_aix_demuxer;
-extern const AVInputFormat  ff_alp_demuxer;
+extern const FFInputFormat  ff_aix_demuxer;
+extern const FFInputFormat  ff_alp_demuxer;
 extern const FFOutputFormat ff_alp_muxer;
-extern const AVInputFormat  ff_amr_demuxer;
+extern const FFInputFormat  ff_amr_demuxer;
 extern const FFOutputFormat ff_amr_muxer;
-extern const AVInputFormat  ff_amrnb_demuxer;
-extern const AVInputFormat  ff_amrwb_demuxer;
+extern const FFInputFormat  ff_amrnb_demuxer;
+extern const FFInputFormat  ff_amrwb_demuxer;
 extern const FFOutputFormat ff_amv_muxer;
-extern const AVInputFormat  ff_anm_demuxer;
-extern const AVInputFormat  ff_apac_demuxer;
-extern const AVInputFormat  ff_apc_demuxer;
-extern const AVInputFormat  ff_ape_demuxer;
-extern const AVInputFormat  ff_apm_demuxer;
+extern const FFInputFormat  ff_anm_demuxer;
+extern const FFInputFormat  ff_apac_demuxer;
+extern const FFInputFormat  ff_apc_demuxer;
+extern const FFInputFormat  ff_ape_demuxer;
+extern const FFInputFormat  ff_apm_demuxer;
 extern const FFOutputFormat ff_apm_muxer;
-extern const AVInputFormat  ff_apng_demuxer;
+extern const FFInputFormat  ff_apng_demuxer;
 extern const FFOutputFormat ff_apng_muxer;
-extern const AVInputFormat  ff_aptx_demuxer;
+extern const FFInputFormat  ff_aptx_demuxer;
 extern const FFOutputFormat ff_aptx_muxer;
-extern const AVInputFormat  ff_aptx_hd_demuxer;
+extern const FFInputFormat  ff_aptx_hd_demuxer;
 extern const FFOutputFormat ff_aptx_hd_muxer;
-extern const AVInputFormat  ff_aqtitle_demuxer;
-extern const AVInputFormat  ff_argo_asf_demuxer;
+extern const FFInputFormat  ff_aqtitle_demuxer;
+extern const FFInputFormat  ff_argo_asf_demuxer;
 extern const FFOutputFormat ff_argo_asf_muxer;
-extern const AVInputFormat  ff_argo_brp_demuxer;
-extern const AVInputFormat  ff_argo_cvg_demuxer;
+extern const FFInputFormat  ff_argo_brp_demuxer;
+extern const FFInputFormat  ff_argo_cvg_demuxer;
 extern const FFOutputFormat ff_argo_cvg_muxer;
-extern const AVInputFormat  ff_asf_demuxer;
+extern const FFInputFormat  ff_asf_demuxer;
 extern const FFOutputFormat ff_asf_muxer;
-extern const AVInputFormat  ff_asf_o_demuxer;
-extern const AVInputFormat  ff_ass_demuxer;
+extern const FFInputFormat  ff_asf_o_demuxer;
+extern const FFInputFormat  ff_ass_demuxer;
 extern const FFOutputFormat ff_ass_muxer;
-extern const AVInputFormat  ff_ast_demuxer;
+extern const FFInputFormat  ff_ast_demuxer;
 extern const FFOutputFormat ff_ast_muxer;
 extern const FFOutputFormat ff_asf_stream_muxer;
-extern const AVInputFormat  ff_au_demuxer;
+extern const FFInputFormat  ff_au_demuxer;
 extern const FFOutputFormat ff_au_muxer;
-extern const AVInputFormat  ff_av1_demuxer;
-extern const AVInputFormat  ff_avi_demuxer;
+extern const FFInputFormat  ff_av1_demuxer;
+extern const FFInputFormat  ff_avi_demuxer;
 extern const FFOutputFormat ff_avi_muxer;
 extern const FFOutputFormat ff_avif_muxer;
-extern const AVInputFormat  ff_avisynth_demuxer;
+extern const FFInputFormat  ff_avisynth_demuxer;
 extern const FFOutputFormat ff_avm2_muxer;
-extern const AVInputFormat  ff_avr_demuxer;
-extern const AVInputFormat  ff_avs_demuxer;
-extern const AVInputFormat  ff_avs2_demuxer;
+extern const FFInputFormat  ff_avr_demuxer;
+extern const FFInputFormat  ff_avs_demuxer;
+extern const FFInputFormat  ff_avs2_demuxer;
 extern const FFOutputFormat ff_avs2_muxer;
-extern const AVInputFormat  ff_avs3_demuxer;
+extern const FFInputFormat  ff_avs3_demuxer;
 extern const FFOutputFormat ff_avs3_muxer;
-extern const AVInputFormat  ff_bethsoftvid_demuxer;
-extern const AVInputFormat  ff_bfi_demuxer;
-extern const AVInputFormat  ff_bintext_demuxer;
-extern const AVInputFormat  ff_bink_demuxer;
-extern const AVInputFormat  ff_binka_demuxer;
-extern const AVInputFormat  ff_bit_demuxer;
+extern const FFInputFormat  ff_bethsoftvid_demuxer;
+extern const FFInputFormat  ff_bfi_demuxer;
+extern const FFInputFormat  ff_bintext_demuxer;
+extern const FFInputFormat  ff_bink_demuxer;
+extern const FFInputFormat  ff_binka_demuxer;
+extern const FFInputFormat  ff_bit_demuxer;
 extern const FFOutputFormat ff_bit_muxer;
-extern const AVInputFormat  ff_bitpacked_demuxer;
-extern const AVInputFormat  ff_bmv_demuxer;
-extern const AVInputFormat  ff_bfstm_demuxer;
-extern const AVInputFormat  ff_brstm_demuxer;
-extern const AVInputFormat  ff_boa_demuxer;
-extern const AVInputFormat  ff_bonk_demuxer;
-extern const AVInputFormat  ff_c93_demuxer;
-extern const AVInputFormat  ff_caf_demuxer;
+extern const FFInputFormat  ff_bitpacked_demuxer;
+extern const FFInputFormat  ff_bmv_demuxer;
+extern const FFInputFormat  ff_bfstm_demuxer;
+extern const FFInputFormat  ff_brstm_demuxer;
+extern const FFInputFormat  ff_boa_demuxer;
+extern const FFInputFormat  ff_bonk_demuxer;
+extern const FFInputFormat  ff_c93_demuxer;
+extern const FFInputFormat  ff_caf_demuxer;
 extern const FFOutputFormat ff_caf_muxer;
-extern const AVInputFormat  ff_cavsvideo_demuxer;
+extern const FFInputFormat  ff_cavsvideo_demuxer;
 extern const FFOutputFormat ff_cavsvideo_muxer;
-extern const AVInputFormat  ff_cdg_demuxer;
-extern const AVInputFormat  ff_cdxl_demuxer;
-extern const AVInputFormat  ff_cine_demuxer;
-extern const AVInputFormat  ff_codec2_demuxer;
+extern const FFInputFormat  ff_cdg_demuxer;
+extern const FFInputFormat  ff_cdxl_demuxer;
+extern const FFInputFormat  ff_cine_demuxer;
+extern const FFInputFormat  ff_codec2_demuxer;
 extern const FFOutputFormat ff_codec2_muxer;
-extern const AVInputFormat  ff_codec2raw_demuxer;
+extern const FFInputFormat  ff_codec2raw_demuxer;
 extern const FFOutputFormat ff_codec2raw_muxer;
-extern const AVInputFormat  ff_concat_demuxer;
+extern const FFInputFormat  ff_concat_demuxer;
 extern const FFOutputFormat ff_crc_muxer;
-extern const AVInputFormat  ff_dash_demuxer;
+extern const FFInputFormat  ff_dash_demuxer;
 extern const FFOutputFormat ff_dash_muxer;
-extern const AVInputFormat  ff_data_demuxer;
+extern const FFInputFormat  ff_data_demuxer;
 extern const FFOutputFormat ff_data_muxer;
-extern const AVInputFormat  ff_daud_demuxer;
+extern const FFInputFormat  ff_daud_demuxer;
 extern const FFOutputFormat ff_daud_muxer;
-extern const AVInputFormat  ff_dcstr_demuxer;
-extern const AVInputFormat  ff_derf_demuxer;
-extern const AVInputFormat  ff_dfa_demuxer;
-extern const AVInputFormat  ff_dfpwm_demuxer;
+extern const FFInputFormat  ff_dcstr_demuxer;
+extern const FFInputFormat  ff_derf_demuxer;
+extern const FFInputFormat  ff_dfa_demuxer;
+extern const FFInputFormat  ff_dfpwm_demuxer;
 extern const FFOutputFormat ff_dfpwm_muxer;
-extern const AVInputFormat  ff_dhav_demuxer;
-extern const AVInputFormat  ff_dirac_demuxer;
+extern const FFInputFormat  ff_dhav_demuxer;
+extern const FFInputFormat  ff_dirac_demuxer;
 extern const FFOutputFormat ff_dirac_muxer;
-extern const AVInputFormat  ff_dnxhd_demuxer;
+extern const FFInputFormat  ff_dnxhd_demuxer;
 extern const FFOutputFormat ff_dnxhd_muxer;
-extern const AVInputFormat  ff_dsf_demuxer;
-extern const AVInputFormat  ff_dsicin_demuxer;
-extern const AVInputFormat  ff_dss_demuxer;
-extern const AVInputFormat  ff_dts_demuxer;
+extern const FFInputFormat  ff_dsf_demuxer;
+extern const FFInputFormat  ff_dsicin_demuxer;
+extern const FFInputFormat  ff_dss_demuxer;
+extern const FFInputFormat  ff_dts_demuxer;
 extern const FFOutputFormat ff_dts_muxer;
-extern const AVInputFormat  ff_dtshd_demuxer;
-extern const AVInputFormat  ff_dv_demuxer;
+extern const FFInputFormat  ff_dtshd_demuxer;
+extern const FFInputFormat  ff_dv_demuxer;
 extern const FFOutputFormat ff_dv_muxer;
-extern const AVInputFormat  ff_dvbsub_demuxer;
-extern const AVInputFormat  ff_dvbtxt_demuxer;
-extern const AVInputFormat  ff_dxa_demuxer;
-extern const AVInputFormat  ff_ea_demuxer;
-extern const AVInputFormat  ff_ea_cdata_demuxer;
-extern const AVInputFormat  ff_eac3_demuxer;
+extern const FFInputFormat  ff_dvbsub_demuxer;
+extern const FFInputFormat  ff_dvbtxt_demuxer;
+extern const FFInputFormat  ff_dxa_demuxer;
+extern const FFInputFormat  ff_ea_demuxer;
+extern const FFInputFormat  ff_ea_cdata_demuxer;
+extern const FFInputFormat  ff_eac3_demuxer;
 extern const FFOutputFormat ff_eac3_muxer;
-extern const AVInputFormat  ff_epaf_demuxer;
-extern const AVInputFormat  ff_evc_demuxer;
+extern const FFInputFormat  ff_epaf_demuxer;
+extern const FFInputFormat  ff_evc_demuxer;
 extern const FFOutputFormat ff_evc_muxer;
 extern const FFOutputFormat ff_f4v_muxer;
-extern const AVInputFormat  ff_ffmetadata_demuxer;
+extern const FFInputFormat  ff_ffmetadata_demuxer;
 extern const FFOutputFormat ff_ffmetadata_muxer;
 extern const FFOutputFormat ff_fifo_muxer;
 extern const FFOutputFormat ff_fifo_test_muxer;
-extern const AVInputFormat  ff_filmstrip_demuxer;
+extern const FFInputFormat  ff_filmstrip_demuxer;
 extern const FFOutputFormat ff_filmstrip_muxer;
-extern const AVInputFormat  ff_fits_demuxer;
+extern const FFInputFormat  ff_fits_demuxer;
 extern const FFOutputFormat ff_fits_muxer;
-extern const AVInputFormat  ff_flac_demuxer;
+extern const FFInputFormat  ff_flac_demuxer;
 extern const FFOutputFormat ff_flac_muxer;
-extern const AVInputFormat  ff_flic_demuxer;
-extern const AVInputFormat  ff_flv_demuxer;
+extern const FFInputFormat  ff_flic_demuxer;
+extern const FFInputFormat  ff_flv_demuxer;
 extern const FFOutputFormat ff_flv_muxer;
-extern const AVInputFormat  ff_live_flv_demuxer;
-extern const AVInputFormat  ff_fourxm_demuxer;
+extern const FFInputFormat  ff_live_flv_demuxer;
+extern const FFInputFormat  ff_fourxm_demuxer;
 extern const FFOutputFormat ff_framecrc_muxer;
 extern const FFOutputFormat ff_framehash_muxer;
 extern const FFOutputFormat ff_framemd5_muxer;
-extern const AVInputFormat  ff_frm_demuxer;
-extern const AVInputFormat  ff_fsb_demuxer;
-extern const AVInputFormat  ff_fwse_demuxer;
-extern const AVInputFormat  ff_g722_demuxer;
+extern const FFInputFormat  ff_frm_demuxer;
+extern const FFInputFormat  ff_fsb_demuxer;
+extern const FFInputFormat  ff_fwse_demuxer;
+extern const FFInputFormat  ff_g722_demuxer;
 extern const FFOutputFormat ff_g722_muxer;
-extern const AVInputFormat  ff_g723_1_demuxer;
+extern const FFInputFormat  ff_g723_1_demuxer;
 extern const FFOutputFormat ff_g723_1_muxer;
-extern const AVInputFormat  ff_g726_demuxer;
+extern const FFInputFormat  ff_g726_demuxer;
 extern const FFOutputFormat ff_g726_muxer;
-extern const AVInputFormat  ff_g726le_demuxer;
+extern const FFInputFormat  ff_g726le_demuxer;
 extern const FFOutputFormat ff_g726le_muxer;
-extern const AVInputFormat  ff_g729_demuxer;
-extern const AVInputFormat  ff_gdv_demuxer;
-extern const AVInputFormat  ff_genh_demuxer;
-extern const AVInputFormat  ff_gif_demuxer;
+extern const FFInputFormat  ff_g729_demuxer;
+extern const FFInputFormat  ff_gdv_demuxer;
+extern const FFInputFormat  ff_genh_demuxer;
+extern const FFInputFormat  ff_gif_demuxer;
 extern const FFOutputFormat ff_gif_muxer;
-extern const AVInputFormat  ff_gsm_demuxer;
+extern const FFInputFormat  ff_gsm_demuxer;
 extern const FFOutputFormat ff_gsm_muxer;
-extern const AVInputFormat  ff_gxf_demuxer;
+extern const FFInputFormat  ff_gxf_demuxer;
 extern const FFOutputFormat ff_gxf_muxer;
-extern const AVInputFormat  ff_h261_demuxer;
+extern const FFInputFormat  ff_h261_demuxer;
 extern const FFOutputFormat ff_h261_muxer;
-extern const AVInputFormat  ff_h263_demuxer;
+extern const FFInputFormat  ff_h263_demuxer;
 extern const FFOutputFormat ff_h263_muxer;
-extern const AVInputFormat  ff_h264_demuxer;
+extern const FFInputFormat  ff_h264_demuxer;
 extern const FFOutputFormat ff_h264_muxer;
 extern const FFOutputFormat ff_hash_muxer;
-extern const AVInputFormat  ff_hca_demuxer;
-extern const AVInputFormat  ff_hcom_demuxer;
+extern const FFInputFormat  ff_hca_demuxer;
+extern const FFInputFormat  ff_hcom_demuxer;
 extern const FFOutputFormat ff_hds_muxer;
-extern const AVInputFormat  ff_hevc_demuxer;
+extern const FFInputFormat  ff_hevc_demuxer;
 extern const FFOutputFormat ff_hevc_muxer;
-extern const AVInputFormat  ff_hls_demuxer;
+extern const FFInputFormat  ff_hls_demuxer;
 extern const FFOutputFormat ff_hls_muxer;
-extern const AVInputFormat  ff_hnm_demuxer;
-extern const AVInputFormat  ff_iamf_demuxer;
+extern const FFInputFormat  ff_hnm_demuxer;
+extern const FFInputFormat  ff_iamf_demuxer;
 extern const FFOutputFormat ff_iamf_muxer;
-extern const AVInputFormat  ff_ico_demuxer;
+extern const FFInputFormat  ff_ico_demuxer;
 extern const FFOutputFormat ff_ico_muxer;
-extern const AVInputFormat  ff_idcin_demuxer;
-extern const AVInputFormat  ff_idf_demuxer;
-extern const AVInputFormat  ff_iff_demuxer;
-extern const AVInputFormat  ff_ifv_demuxer;
-extern const AVInputFormat  ff_ilbc_demuxer;
+extern const FFInputFormat  ff_idcin_demuxer;
+extern const FFInputFormat  ff_idf_demuxer;
+extern const FFInputFormat  ff_iff_demuxer;
+extern const FFInputFormat  ff_ifv_demuxer;
+extern const FFInputFormat  ff_ilbc_demuxer;
 extern const FFOutputFormat ff_ilbc_muxer;
-extern const AVInputFormat  ff_image2_demuxer;
+extern const FFInputFormat  ff_image2_demuxer;
 extern const FFOutputFormat ff_image2_muxer;
-extern const AVInputFormat  ff_image2pipe_demuxer;
+extern const FFInputFormat  ff_image2pipe_demuxer;
 extern const FFOutputFormat ff_image2pipe_muxer;
-extern const AVInputFormat  ff_image2_alias_pix_demuxer;
-extern const AVInputFormat  ff_image2_brender_pix_demuxer;
-extern const AVInputFormat  ff_imf_demuxer;
-extern const AVInputFormat  ff_ingenient_demuxer;
-extern const AVInputFormat  ff_ipmovie_demuxer;
+extern const FFInputFormat  ff_image2_alias_pix_demuxer;
+extern const FFInputFormat  ff_image2_brender_pix_demuxer;
+extern const FFInputFormat  ff_imf_demuxer;
+extern const FFInputFormat  ff_ingenient_demuxer;
+extern const FFInputFormat  ff_ipmovie_demuxer;
 extern const FFOutputFormat ff_ipod_muxer;
-extern const AVInputFormat  ff_ipu_demuxer;
-extern const AVInputFormat  ff_ircam_demuxer;
+extern const FFInputFormat  ff_ipu_demuxer;
+extern const FFInputFormat  ff_ircam_demuxer;
 extern const FFOutputFormat ff_ircam_muxer;
 extern const FFOutputFormat ff_ismv_muxer;
-extern const AVInputFormat  ff_iss_demuxer;
-extern const AVInputFormat  ff_iv8_demuxer;
-extern const AVInputFormat  ff_ivf_demuxer;
+extern const FFInputFormat  ff_iss_demuxer;
+extern const FFInputFormat  ff_iv8_demuxer;
+extern const FFInputFormat  ff_ivf_demuxer;
 extern const FFOutputFormat ff_ivf_muxer;
-extern const AVInputFormat  ff_ivr_demuxer;
-extern const AVInputFormat  ff_jacosub_demuxer;
+extern const FFInputFormat  ff_ivr_demuxer;
+extern const FFInputFormat  ff_jacosub_demuxer;
 extern const FFOutputFormat ff_jacosub_muxer;
-extern const AVInputFormat  ff_jv_demuxer;
-extern const AVInputFormat  ff_jpegxl_anim_demuxer;
-extern const AVInputFormat  ff_kux_demuxer;
-extern const AVInputFormat  ff_kvag_demuxer;
+extern const FFInputFormat  ff_jv_demuxer;
+extern const FFInputFormat  ff_jpegxl_anim_demuxer;
+extern const FFInputFormat  ff_kux_demuxer;
+extern const FFInputFormat  ff_kvag_demuxer;
 extern const FFOutputFormat ff_kvag_muxer;
-extern const AVInputFormat  ff_laf_demuxer;
+extern const FFInputFormat  ff_laf_demuxer;
 extern const FFOutputFormat ff_latm_muxer;
-extern const AVInputFormat  ff_lmlm4_demuxer;
-extern const AVInputFormat  ff_loas_demuxer;
-extern const AVInputFormat  ff_luodat_demuxer;
-extern const AVInputFormat  ff_lrc_demuxer;
+extern const FFInputFormat  ff_lmlm4_demuxer;
+extern const FFInputFormat  ff_loas_demuxer;
+extern const FFInputFormat  ff_luodat_demuxer;
+extern const FFInputFormat  ff_lrc_demuxer;
 extern const FFOutputFormat ff_lrc_muxer;
-extern const AVInputFormat  ff_lvf_demuxer;
-extern const AVInputFormat  ff_lxf_demuxer;
-extern const AVInputFormat  ff_m4v_demuxer;
+extern const FFInputFormat  ff_lvf_demuxer;
+extern const FFInputFormat  ff_lxf_demuxer;
+extern const FFInputFormat  ff_m4v_demuxer;
 extern const FFOutputFormat ff_m4v_muxer;
-extern const AVInputFormat  ff_mca_demuxer;
-extern const AVInputFormat  ff_mcc_demuxer;
+extern const FFInputFormat  ff_mca_demuxer;
+extern const FFInputFormat  ff_mcc_demuxer;
 extern const FFOutputFormat ff_md5_muxer;
-extern const AVInputFormat  ff_matroska_demuxer;
+extern const FFInputFormat  ff_matroska_demuxer;
 extern const FFOutputFormat ff_matroska_muxer;
 extern const FFOutputFormat ff_matroska_audio_muxer;
-extern const AVInputFormat  ff_mgsts_demuxer;
-extern const AVInputFormat  ff_microdvd_demuxer;
+extern const FFInputFormat  ff_mgsts_demuxer;
+extern const FFInputFormat  ff_microdvd_demuxer;
 extern const FFOutputFormat ff_microdvd_muxer;
-extern const AVInputFormat  ff_mjpeg_demuxer;
+extern const FFInputFormat  ff_mjpeg_demuxer;
 extern const FFOutputFormat ff_mjpeg_muxer;
-extern const AVInputFormat  ff_mjpeg_2000_demuxer;
-extern const AVInputFormat  ff_mlp_demuxer;
+extern const FFInputFormat  ff_mjpeg_2000_demuxer;
+extern const FFInputFormat  ff_mlp_demuxer;
 extern const FFOutputFormat ff_mlp_muxer;
-extern const AVInputFormat  ff_mlv_demuxer;
-extern const AVInputFormat  ff_mm_demuxer;
-extern const AVInputFormat  ff_mmf_demuxer;
+extern const FFInputFormat  ff_mlv_demuxer;
+extern const FFInputFormat  ff_mm_demuxer;
+extern const FFInputFormat  ff_mmf_demuxer;
 extern const FFOutputFormat ff_mmf_muxer;
-extern const AVInputFormat  ff_mods_demuxer;
-extern const AVInputFormat  ff_moflex_demuxer;
-extern const AVInputFormat  ff_mov_demuxer;
+extern const FFInputFormat  ff_mods_demuxer;
+extern const FFInputFormat  ff_moflex_demuxer;
+extern const FFInputFormat  ff_mov_demuxer;
 extern const FFOutputFormat ff_mov_muxer;
 extern const FFOutputFormat ff_mp2_muxer;
-extern const AVInputFormat  ff_mp3_demuxer;
+extern const FFInputFormat  ff_mp3_demuxer;
 extern const FFOutputFormat ff_mp3_muxer;
 extern const FFOutputFormat ff_mp4_muxer;
-extern const AVInputFormat  ff_mpc_demuxer;
-extern const AVInputFormat  ff_mpc8_demuxer;
+extern const FFInputFormat  ff_mpc_demuxer;
+extern const FFInputFormat  ff_mpc8_demuxer;
 extern const FFOutputFormat ff_mpeg1system_muxer;
 extern const FFOutputFormat ff_mpeg1vcd_muxer;
 extern const FFOutputFormat ff_mpeg1video_muxer;
@@ -294,282 +295,282 @@ extern const FFOutputFormat ff_mpeg2dvd_muxer;
 extern const FFOutputFormat ff_mpeg2svcd_muxer;
 extern const FFOutputFormat ff_mpeg2video_muxer;
 extern const FFOutputFormat ff_mpeg2vob_muxer;
-extern const AVInputFormat  ff_mpegps_demuxer;
-extern const AVInputFormat  ff_mpegts_demuxer;
+extern const FFInputFormat  ff_mpegps_demuxer;
+extern const FFInputFormat  ff_mpegts_demuxer;
 extern const FFOutputFormat ff_mpegts_muxer;
-extern const AVInputFormat  ff_mpegtsraw_demuxer;
-extern const AVInputFormat  ff_mpegvideo_demuxer;
-extern const AVInputFormat  ff_mpjpeg_demuxer;
+extern const FFInputFormat  ff_mpegtsraw_demuxer;
+extern const FFInputFormat  ff_mpegvideo_demuxer;
+extern const FFInputFormat  ff_mpjpeg_demuxer;
 extern const FFOutputFormat ff_mpjpeg_muxer;
-extern const AVInputFormat  ff_mpl2_demuxer;
-extern const AVInputFormat  ff_mpsub_demuxer;
-extern const AVInputFormat  ff_msf_demuxer;
-extern const AVInputFormat  ff_msnwc_tcp_demuxer;
-extern const AVInputFormat  ff_msp_demuxer;
-extern const AVInputFormat  ff_mtaf_demuxer;
-extern const AVInputFormat  ff_mtv_demuxer;
-extern const AVInputFormat  ff_musx_demuxer;
-extern const AVInputFormat  ff_mv_demuxer;
-extern const AVInputFormat  ff_mvi_demuxer;
-extern const AVInputFormat  ff_mxf_demuxer;
+extern const FFInputFormat  ff_mpl2_demuxer;
+extern const FFInputFormat  ff_mpsub_demuxer;
+extern const FFInputFormat  ff_msf_demuxer;
+extern const FFInputFormat  ff_msnwc_tcp_demuxer;
+extern const FFInputFormat  ff_msp_demuxer;
+extern const FFInputFormat  ff_mtaf_demuxer;
+extern const FFInputFormat  ff_mtv_demuxer;
+extern const FFInputFormat  ff_musx_demuxer;
+extern const FFInputFormat  ff_mv_demuxer;
+extern const FFInputFormat  ff_mvi_demuxer;
+extern const FFInputFormat  ff_mxf_demuxer;
 extern const FFOutputFormat ff_mxf_muxer;
 extern const FFOutputFormat ff_mxf_d10_muxer;
 extern const FFOutputFormat ff_mxf_opatom_muxer;
-extern const AVInputFormat  ff_mxg_demuxer;
-extern const AVInputFormat  ff_nc_demuxer;
-extern const AVInputFormat  ff_nistsphere_demuxer;
-extern const AVInputFormat  ff_nsp_demuxer;
-extern const AVInputFormat  ff_nsv_demuxer;
+extern const FFInputFormat  ff_mxg_demuxer;
+extern const FFInputFormat  ff_nc_demuxer;
+extern const FFInputFormat  ff_nistsphere_demuxer;
+extern const FFInputFormat  ff_nsp_demuxer;
+extern const FFInputFormat  ff_nsv_demuxer;
 extern const FFOutputFormat ff_null_muxer;
-extern const AVInputFormat  ff_nut_demuxer;
+extern const FFInputFormat  ff_nut_demuxer;
 extern const FFOutputFormat ff_nut_muxer;
-extern const AVInputFormat  ff_nuv_demuxer;
-extern const AVInputFormat  ff_obu_demuxer;
+extern const FFInputFormat  ff_nuv_demuxer;
+extern const FFInputFormat  ff_obu_demuxer;
 extern const FFOutputFormat ff_obu_muxer;
 extern const FFOutputFormat ff_oga_muxer;
-extern const AVInputFormat  ff_ogg_demuxer;
+extern const FFInputFormat  ff_ogg_demuxer;
 extern const FFOutputFormat ff_ogg_muxer;
 extern const FFOutputFormat ff_ogv_muxer;
-extern const AVInputFormat  ff_oma_demuxer;
+extern const FFInputFormat  ff_oma_demuxer;
 extern const FFOutputFormat ff_oma_muxer;
 extern const FFOutputFormat ff_opus_muxer;
-extern const AVInputFormat  ff_osq_demuxer;
-extern const AVInputFormat  ff_paf_demuxer;
-extern const AVInputFormat  ff_pcm_alaw_demuxer;
+extern const FFInputFormat  ff_osq_demuxer;
+extern const FFInputFormat  ff_paf_demuxer;
+extern const FFInputFormat  ff_pcm_alaw_demuxer;
 extern const FFOutputFormat ff_pcm_alaw_muxer;
-extern const AVInputFormat  ff_pcm_mulaw_demuxer;
+extern const FFInputFormat  ff_pcm_mulaw_demuxer;
 extern const FFOutputFormat ff_pcm_mulaw_muxer;
-extern const AVInputFormat  ff_pcm_vidc_demuxer;
+extern const FFInputFormat  ff_pcm_vidc_demuxer;
 extern const FFOutputFormat ff_pcm_vidc_muxer;
-extern const AVInputFormat  ff_pcm_f64be_demuxer;
+extern const FFInputFormat  ff_pcm_f64be_demuxer;
 extern const FFOutputFormat ff_pcm_f64be_muxer;
-extern const AVInputFormat  ff_pcm_f64le_demuxer;
+extern const FFInputFormat  ff_pcm_f64le_demuxer;
 extern const FFOutputFormat ff_pcm_f64le_muxer;
-extern const AVInputFormat  ff_pcm_f32be_demuxer;
+extern const FFInputFormat  ff_pcm_f32be_demuxer;
 extern const FFOutputFormat ff_pcm_f32be_muxer;
-extern const AVInputFormat  ff_pcm_f32le_demuxer;
+extern const FFInputFormat  ff_pcm_f32le_demuxer;
 extern const FFOutputFormat ff_pcm_f32le_muxer;
-extern const AVInputFormat  ff_pcm_s32be_demuxer;
+extern const FFInputFormat  ff_pcm_s32be_demuxer;
 extern const FFOutputFormat ff_pcm_s32be_muxer;
-extern const AVInputFormat  ff_pcm_s32le_demuxer;
+extern const FFInputFormat  ff_pcm_s32le_demuxer;
 extern const FFOutputFormat ff_pcm_s32le_muxer;
-extern const AVInputFormat  ff_pcm_s24be_demuxer;
+extern const FFInputFormat  ff_pcm_s24be_demuxer;
 extern const FFOutputFormat ff_pcm_s24be_muxer;
-extern const AVInputFormat  ff_pcm_s24le_demuxer;
+extern const FFInputFormat  ff_pcm_s24le_demuxer;
 extern const FFOutputFormat ff_pcm_s24le_muxer;
-extern const AVInputFormat  ff_pcm_s16be_demuxer;
+extern const FFInputFormat  ff_pcm_s16be_demuxer;
 extern const FFOutputFormat ff_pcm_s16be_muxer;
-extern const AVInputFormat  ff_pcm_s16le_demuxer;
+extern const FFInputFormat  ff_pcm_s16le_demuxer;
 extern const FFOutputFormat ff_pcm_s16le_muxer;
-extern const AVInputFormat  ff_pcm_s8_demuxer;
+extern const FFInputFormat  ff_pcm_s8_demuxer;
 extern const FFOutputFormat ff_pcm_s8_muxer;
-extern const AVInputFormat  ff_pcm_u32be_demuxer;
+extern const FFInputFormat  ff_pcm_u32be_demuxer;
 extern const FFOutputFormat ff_pcm_u32be_muxer;
-extern const AVInputFormat  ff_pcm_u32le_demuxer;
+extern const FFInputFormat  ff_pcm_u32le_demuxer;
 extern const FFOutputFormat ff_pcm_u32le_muxer;
-extern const AVInputFormat  ff_pcm_u24be_demuxer;
+extern const FFInputFormat  ff_pcm_u24be_demuxer;
 extern const FFOutputFormat ff_pcm_u24be_muxer;
-extern const AVInputFormat  ff_pcm_u24le_demuxer;
+extern const FFInputFormat  ff_pcm_u24le_demuxer;
 extern const FFOutputFormat ff_pcm_u24le_muxer;
-extern const AVInputFormat  ff_pcm_u16be_demuxer;
+extern const FFInputFormat  ff_pcm_u16be_demuxer;
 extern const FFOutputFormat ff_pcm_u16be_muxer;
-extern const AVInputFormat  ff_pcm_u16le_demuxer;
+extern const FFInputFormat  ff_pcm_u16le_demuxer;
 extern const FFOutputFormat ff_pcm_u16le_muxer;
-extern const AVInputFormat  ff_pcm_u8_demuxer;
+extern const FFInputFormat  ff_pcm_u8_demuxer;
 extern const FFOutputFormat ff_pcm_u8_muxer;
-extern const AVInputFormat  ff_pdv_demuxer;
-extern const AVInputFormat  ff_pjs_demuxer;
-extern const AVInputFormat  ff_pmp_demuxer;
-extern const AVInputFormat  ff_pp_bnk_demuxer;
+extern const FFInputFormat  ff_pdv_demuxer;
+extern const FFInputFormat  ff_pjs_demuxer;
+extern const FFInputFormat  ff_pmp_demuxer;
+extern const FFInputFormat  ff_pp_bnk_demuxer;
 extern const FFOutputFormat ff_psp_muxer;
-extern const AVInputFormat  ff_pva_demuxer;
-extern const AVInputFormat  ff_pvf_demuxer;
-extern const AVInputFormat  ff_qcp_demuxer;
-extern const AVInputFormat  ff_qoa_demuxer;
-extern const AVInputFormat  ff_r3d_demuxer;
-extern const AVInputFormat  ff_rawvideo_demuxer;
+extern const FFInputFormat  ff_pva_demuxer;
+extern const FFInputFormat  ff_pvf_demuxer;
+extern const FFInputFormat  ff_qcp_demuxer;
+extern const FFInputFormat  ff_qoa_demuxer;
+extern const FFInputFormat  ff_r3d_demuxer;
+extern const FFInputFormat  ff_rawvideo_demuxer;
 extern const FFOutputFormat ff_rawvideo_muxer;
 extern const FFOutputFormat ff_rcwt_muxer;
-extern const AVInputFormat  ff_realtext_demuxer;
-extern const AVInputFormat  ff_redspark_demuxer;
-extern const AVInputFormat  ff_rka_demuxer;
-extern const AVInputFormat  ff_rl2_demuxer;
-extern const AVInputFormat  ff_rm_demuxer;
+extern const FFInputFormat  ff_realtext_demuxer;
+extern const FFInputFormat  ff_redspark_demuxer;
+extern const FFInputFormat  ff_rka_demuxer;
+extern const FFInputFormat  ff_rl2_demuxer;
+extern const FFInputFormat  ff_rm_demuxer;
 extern const FFOutputFormat ff_rm_muxer;
-extern const AVInputFormat  ff_roq_demuxer;
+extern const FFInputFormat  ff_roq_demuxer;
 extern const FFOutputFormat ff_roq_muxer;
-extern const AVInputFormat  ff_rpl_demuxer;
-extern const AVInputFormat  ff_rsd_demuxer;
-extern const AVInputFormat  ff_rso_demuxer;
+extern const FFInputFormat  ff_rpl_demuxer;
+extern const FFInputFormat  ff_rsd_demuxer;
+extern const FFInputFormat  ff_rso_demuxer;
 extern const FFOutputFormat ff_rso_muxer;
-extern const AVInputFormat  ff_rtp_demuxer;
+extern const FFInputFormat  ff_rtp_demuxer;
 extern const FFOutputFormat ff_rtp_muxer;
 extern const FFOutputFormat ff_rtp_mpegts_muxer;
-extern const AVInputFormat  ff_rtsp_demuxer;
+extern const FFInputFormat  ff_rtsp_demuxer;
 extern const FFOutputFormat ff_rtsp_muxer;
-extern const AVInputFormat  ff_s337m_demuxer;
-extern const AVInputFormat  ff_sami_demuxer;
-extern const AVInputFormat  ff_sap_demuxer;
+extern const FFInputFormat  ff_s337m_demuxer;
+extern const FFInputFormat  ff_sami_demuxer;
+extern const FFInputFormat  ff_sap_demuxer;
 extern const FFOutputFormat ff_sap_muxer;
-extern const AVInputFormat  ff_sbc_demuxer;
+extern const FFInputFormat  ff_sbc_demuxer;
 extern const FFOutputFormat ff_sbc_muxer;
-extern const AVInputFormat  ff_sbg_demuxer;
-extern const AVInputFormat  ff_scc_demuxer;
+extern const FFInputFormat  ff_sbg_demuxer;
+extern const FFInputFormat  ff_scc_demuxer;
 extern const FFOutputFormat ff_scc_muxer;
-extern const AVInputFormat  ff_scd_demuxer;
-extern const AVInputFormat  ff_sdns_demuxer;
-extern const AVInputFormat  ff_sdp_demuxer;
-extern const AVInputFormat  ff_sdr2_demuxer;
-extern const AVInputFormat  ff_sds_demuxer;
-extern const AVInputFormat  ff_sdx_demuxer;
-extern const AVInputFormat  ff_segafilm_demuxer;
+extern const FFInputFormat  ff_scd_demuxer;
+extern const FFInputFormat  ff_sdns_demuxer;
+extern const FFInputFormat  ff_sdp_demuxer;
+extern const FFInputFormat  ff_sdr2_demuxer;
+extern const FFInputFormat  ff_sds_demuxer;
+extern const FFInputFormat  ff_sdx_demuxer;
+extern const FFInputFormat  ff_segafilm_demuxer;
 extern const FFOutputFormat ff_segafilm_muxer;
 extern const FFOutputFormat ff_segment_muxer;
 extern const FFOutputFormat ff_stream_segment_muxer;
-extern const AVInputFormat  ff_ser_demuxer;
-extern const AVInputFormat  ff_sga_demuxer;
-extern const AVInputFormat  ff_shorten_demuxer;
-extern const AVInputFormat  ff_siff_demuxer;
-extern const AVInputFormat  ff_simbiosis_imx_demuxer;
-extern const AVInputFormat  ff_sln_demuxer;
-extern const AVInputFormat  ff_smacker_demuxer;
-extern const AVInputFormat  ff_smjpeg_demuxer;
+extern const FFInputFormat  ff_ser_demuxer;
+extern const FFInputFormat  ff_sga_demuxer;
+extern const FFInputFormat  ff_shorten_demuxer;
+extern const FFInputFormat  ff_siff_demuxer;
+extern const FFInputFormat  ff_simbiosis_imx_demuxer;
+extern const FFInputFormat  ff_sln_demuxer;
+extern const FFInputFormat  ff_smacker_demuxer;
+extern const FFInputFormat  ff_smjpeg_demuxer;
 extern const FFOutputFormat ff_smjpeg_muxer;
 extern const FFOutputFormat ff_smoothstreaming_muxer;
-extern const AVInputFormat  ff_smush_demuxer;
-extern const AVInputFormat  ff_sol_demuxer;
-extern const AVInputFormat  ff_sox_demuxer;
+extern const FFInputFormat  ff_smush_demuxer;
+extern const FFInputFormat  ff_sol_demuxer;
+extern const FFInputFormat  ff_sox_demuxer;
 extern const FFOutputFormat ff_sox_muxer;
 extern const FFOutputFormat ff_spx_muxer;
-extern const AVInputFormat  ff_spdif_demuxer;
+extern const FFInputFormat  ff_spdif_demuxer;
 extern const FFOutputFormat ff_spdif_muxer;
-extern const AVInputFormat  ff_srt_demuxer;
+extern const FFInputFormat  ff_srt_demuxer;
 extern const FFOutputFormat ff_srt_muxer;
-extern const AVInputFormat  ff_str_demuxer;
-extern const AVInputFormat  ff_stl_demuxer;
+extern const FFInputFormat  ff_str_demuxer;
+extern const FFInputFormat  ff_stl_demuxer;
 extern const FFOutputFormat ff_streamhash_muxer;
-extern const AVInputFormat  ff_subviewer1_demuxer;
-extern const AVInputFormat  ff_subviewer_demuxer;
-extern const AVInputFormat  ff_sup_demuxer;
+extern const FFInputFormat  ff_subviewer1_demuxer;
+extern const FFInputFormat  ff_subviewer_demuxer;
+extern const FFInputFormat  ff_sup_demuxer;
 extern const FFOutputFormat ff_sup_muxer;
-extern const AVInputFormat  ff_svag_demuxer;
-extern const AVInputFormat  ff_svs_demuxer;
-extern const AVInputFormat  ff_swf_demuxer;
+extern const FFInputFormat  ff_svag_demuxer;
+extern const FFInputFormat  ff_svs_demuxer;
+extern const FFInputFormat  ff_swf_demuxer;
 extern const FFOutputFormat ff_swf_muxer;
-extern const AVInputFormat  ff_tak_demuxer;
+extern const FFInputFormat  ff_tak_demuxer;
 extern const FFOutputFormat ff_tee_muxer;
-extern const AVInputFormat  ff_tedcaptions_demuxer;
+extern const FFInputFormat  ff_tedcaptions_demuxer;
 extern const FFOutputFormat ff_tg2_muxer;
 extern const FFOutputFormat ff_tgp_muxer;
-extern const AVInputFormat  ff_thp_demuxer;
-extern const AVInputFormat  ff_threedostr_demuxer;
-extern const AVInputFormat  ff_tiertexseq_demuxer;
+extern const FFInputFormat  ff_thp_demuxer;
+extern const FFInputFormat  ff_threedostr_demuxer;
+extern const FFInputFormat  ff_tiertexseq_demuxer;
 extern const FFOutputFormat ff_mkvtimestamp_v2_muxer;
-extern const AVInputFormat  ff_tmv_demuxer;
-extern const AVInputFormat  ff_truehd_demuxer;
+extern const FFInputFormat  ff_tmv_demuxer;
+extern const FFInputFormat  ff_truehd_demuxer;
 extern const FFOutputFormat ff_truehd_muxer;
-extern const AVInputFormat  ff_tta_demuxer;
+extern const FFInputFormat  ff_tta_demuxer;
 extern const FFOutputFormat ff_tta_muxer;
 extern const FFOutputFormat ff_ttml_muxer;
-extern const AVInputFormat  ff_txd_demuxer;
-extern const AVInputFormat  ff_tty_demuxer;
-extern const AVInputFormat  ff_ty_demuxer;
+extern const FFInputFormat  ff_txd_demuxer;
+extern const FFInputFormat  ff_tty_demuxer;
+extern const FFInputFormat  ff_ty_demuxer;
 extern const FFOutputFormat ff_uncodedframecrc_muxer;
-extern const AVInputFormat  ff_usm_demuxer;
-extern const AVInputFormat  ff_v210_demuxer;
-extern const AVInputFormat  ff_v210x_demuxer;
-extern const AVInputFormat  ff_vag_demuxer;
-extern const AVInputFormat  ff_vc1_demuxer;
+extern const FFInputFormat  ff_usm_demuxer;
+extern const FFInputFormat  ff_v210_demuxer;
+extern const FFInputFormat  ff_v210x_demuxer;
+extern const FFInputFormat  ff_vag_demuxer;
+extern const FFInputFormat  ff_vc1_demuxer;
 extern const FFOutputFormat ff_vc1_muxer;
-extern const AVInputFormat  ff_vc1t_demuxer;
+extern const FFInputFormat  ff_vc1t_demuxer;
 extern const FFOutputFormat ff_vc1t_muxer;
-extern const AVInputFormat  ff_vividas_demuxer;
-extern const AVInputFormat  ff_vivo_demuxer;
-extern const AVInputFormat  ff_vmd_demuxer;
-extern const AVInputFormat  ff_vobsub_demuxer;
-extern const AVInputFormat  ff_voc_demuxer;
+extern const FFInputFormat  ff_vividas_demuxer;
+extern const FFInputFormat  ff_vivo_demuxer;
+extern const FFInputFormat  ff_vmd_demuxer;
+extern const FFInputFormat  ff_vobsub_demuxer;
+extern const FFInputFormat  ff_voc_demuxer;
 extern const FFOutputFormat ff_voc_muxer;
-extern const AVInputFormat  ff_vpk_demuxer;
-extern const AVInputFormat  ff_vplayer_demuxer;
-extern const AVInputFormat  ff_vqf_demuxer;
-extern const AVInputFormat  ff_vvc_demuxer;
+extern const FFInputFormat  ff_vpk_demuxer;
+extern const FFInputFormat  ff_vplayer_demuxer;
+extern const FFInputFormat  ff_vqf_demuxer;
+extern const FFInputFormat  ff_vvc_demuxer;
 extern const FFOutputFormat ff_vvc_muxer;
-extern const AVInputFormat  ff_w64_demuxer;
+extern const FFInputFormat  ff_w64_demuxer;
 extern const FFOutputFormat ff_w64_muxer;
-extern const AVInputFormat  ff_wady_demuxer;
-extern const AVInputFormat  ff_wavarc_demuxer;
-extern const AVInputFormat  ff_wav_demuxer;
+extern const FFInputFormat  ff_wady_demuxer;
+extern const FFInputFormat  ff_wavarc_demuxer;
+extern const FFInputFormat  ff_wav_demuxer;
 extern const FFOutputFormat ff_wav_muxer;
-extern const AVInputFormat  ff_wc3_demuxer;
+extern const FFInputFormat  ff_wc3_demuxer;
 extern const FFOutputFormat ff_webm_muxer;
-extern const AVInputFormat  ff_webm_dash_manifest_demuxer;
+extern const FFInputFormat  ff_webm_dash_manifest_demuxer;
 extern const FFOutputFormat ff_webm_dash_manifest_muxer;
 extern const FFOutputFormat ff_webm_chunk_muxer;
 extern const FFOutputFormat ff_webp_muxer;
-extern const AVInputFormat  ff_webvtt_demuxer;
+extern const FFInputFormat  ff_webvtt_demuxer;
 extern const FFOutputFormat ff_webvtt_muxer;
-extern const AVInputFormat  ff_wsaud_demuxer;
+extern const FFInputFormat  ff_wsaud_demuxer;
 extern const FFOutputFormat ff_wsaud_muxer;
-extern const AVInputFormat  ff_wsd_demuxer;
-extern const AVInputFormat  ff_wsvqa_demuxer;
-extern const AVInputFormat  ff_wtv_demuxer;
+extern const FFInputFormat  ff_wsd_demuxer;
+extern const FFInputFormat  ff_wsvqa_demuxer;
+extern const FFInputFormat  ff_wtv_demuxer;
 extern const FFOutputFormat ff_wtv_muxer;
-extern const AVInputFormat  ff_wve_demuxer;
-extern const AVInputFormat  ff_wv_demuxer;
+extern const FFInputFormat  ff_wve_demuxer;
+extern const FFInputFormat  ff_wv_demuxer;
 extern const FFOutputFormat ff_wv_muxer;
-extern const AVInputFormat  ff_xa_demuxer;
-extern const AVInputFormat  ff_xbin_demuxer;
-extern const AVInputFormat  ff_xmd_demuxer;
-extern const AVInputFormat  ff_xmv_demuxer;
-extern const AVInputFormat  ff_xvag_demuxer;
-extern const AVInputFormat  ff_xwma_demuxer;
-extern const AVInputFormat  ff_yop_demuxer;
-extern const AVInputFormat  ff_yuv4mpegpipe_demuxer;
+extern const FFInputFormat  ff_xa_demuxer;
+extern const FFInputFormat  ff_xbin_demuxer;
+extern const FFInputFormat  ff_xmd_demuxer;
+extern const FFInputFormat  ff_xmv_demuxer;
+extern const FFInputFormat  ff_xvag_demuxer;
+extern const FFInputFormat  ff_xwma_demuxer;
+extern const FFInputFormat  ff_yop_demuxer;
+extern const FFInputFormat  ff_yuv4mpegpipe_demuxer;
 extern const FFOutputFormat ff_yuv4mpegpipe_muxer;
 /* image demuxers */
-extern const AVInputFormat  ff_image_bmp_pipe_demuxer;
-extern const AVInputFormat  ff_image_cri_pipe_demuxer;
-extern const AVInputFormat  ff_image_dds_pipe_demuxer;
-extern const AVInputFormat  ff_image_dpx_pipe_demuxer;
-extern const AVInputFormat  ff_image_exr_pipe_demuxer;
-extern const AVInputFormat  ff_image_gem_pipe_demuxer;
-extern const AVInputFormat  ff_image_gif_pipe_demuxer;
-extern const AVInputFormat  ff_image_hdr_pipe_demuxer;
-extern const AVInputFormat  ff_image_j2k_pipe_demuxer;
-extern const AVInputFormat  ff_image_jpeg_pipe_demuxer;
-extern const AVInputFormat  ff_image_jpegls_pipe_demuxer;
-extern const AVInputFormat  ff_image_jpegxl_pipe_demuxer;
-extern const AVInputFormat  ff_image_pam_pipe_demuxer;
-extern const AVInputFormat  ff_image_pbm_pipe_demuxer;
-extern const AVInputFormat  ff_image_pcx_pipe_demuxer;
-extern const AVInputFormat  ff_image_pfm_pipe_demuxer;
-extern const AVInputFormat  ff_image_pgmyuv_pipe_demuxer;
-extern const AVInputFormat  ff_image_pgm_pipe_demuxer;
-extern const AVInputFormat  ff_image_pgx_pipe_demuxer;
-extern const AVInputFormat  ff_image_phm_pipe_demuxer;
-extern const AVInputFormat  ff_image_photocd_pipe_demuxer;
-extern const AVInputFormat  ff_image_pictor_pipe_demuxer;
-extern const AVInputFormat  ff_image_png_pipe_demuxer;
-extern const AVInputFormat  ff_image_ppm_pipe_demuxer;
-extern const AVInputFormat  ff_image_psd_pipe_demuxer;
-extern const AVInputFormat  ff_image_qdraw_pipe_demuxer;
-extern const AVInputFormat  ff_image_qoi_pipe_demuxer;
-extern const AVInputFormat  ff_image_sgi_pipe_demuxer;
-extern const AVInputFormat  ff_image_svg_pipe_demuxer;
-extern const AVInputFormat  ff_image_sunrast_pipe_demuxer;
-extern const AVInputFormat  ff_image_tiff_pipe_demuxer;
-extern const AVInputFormat  ff_image_vbn_pipe_demuxer;
-extern const AVInputFormat  ff_image_webp_pipe_demuxer;
-extern const AVInputFormat  ff_image_xbm_pipe_demuxer;
-extern const AVInputFormat  ff_image_xpm_pipe_demuxer;
-extern const AVInputFormat  ff_image_xwd_pipe_demuxer;
+extern const FFInputFormat  ff_image_bmp_pipe_demuxer;
+extern const FFInputFormat  ff_image_cri_pipe_demuxer;
+extern const FFInputFormat  ff_image_dds_pipe_demuxer;
+extern const FFInputFormat  ff_image_dpx_pipe_demuxer;
+extern const FFInputFormat  ff_image_exr_pipe_demuxer;
+extern const FFInputFormat  ff_image_gem_pipe_demuxer;
+extern const FFInputFormat  ff_image_gif_pipe_demuxer;
+extern const FFInputFormat  ff_image_hdr_pipe_demuxer;
+extern const FFInputFormat  ff_image_j2k_pipe_demuxer;
+extern const FFInputFormat  ff_image_jpeg_pipe_demuxer;
+extern const FFInputFormat  ff_image_jpegls_pipe_demuxer;
+extern const FFInputFormat  ff_image_jpegxl_pipe_demuxer;
+extern const FFInputFormat  ff_image_pam_pipe_demuxer;
+extern const FFInputFormat  ff_image_pbm_pipe_demuxer;
+extern const FFInputFormat  ff_image_pcx_pipe_demuxer;
+extern const FFInputFormat  ff_image_pfm_pipe_demuxer;
+extern const FFInputFormat  ff_image_pgmyuv_pipe_demuxer;
+extern const FFInputFormat  ff_image_pgm_pipe_demuxer;
+extern const FFInputFormat  ff_image_pgx_pipe_demuxer;
+extern const FFInputFormat  ff_image_phm_pipe_demuxer;
+extern const FFInputFormat  ff_image_photocd_pipe_demuxer;
+extern const FFInputFormat  ff_image_pictor_pipe_demuxer;
+extern const FFInputFormat  ff_image_png_pipe_demuxer;
+extern const FFInputFormat  ff_image_ppm_pipe_demuxer;
+extern const FFInputFormat  ff_image_psd_pipe_demuxer;
+extern const FFInputFormat  ff_image_qdraw_pipe_demuxer;
+extern const FFInputFormat  ff_image_qoi_pipe_demuxer;
+extern const FFInputFormat  ff_image_sgi_pipe_demuxer;
+extern const FFInputFormat  ff_image_svg_pipe_demuxer;
+extern const FFInputFormat  ff_image_sunrast_pipe_demuxer;
+extern const FFInputFormat  ff_image_tiff_pipe_demuxer;
+extern const FFInputFormat  ff_image_vbn_pipe_demuxer;
+extern const FFInputFormat  ff_image_webp_pipe_demuxer;
+extern const FFInputFormat  ff_image_xbm_pipe_demuxer;
+extern const FFInputFormat  ff_image_xpm_pipe_demuxer;
+extern const FFInputFormat  ff_image_xwd_pipe_demuxer;
 
 /* external libraries */
 extern const FFOutputFormat ff_chromaprint_muxer;
-extern const AVInputFormat  ff_libgme_demuxer;
-extern const AVInputFormat  ff_libmodplug_demuxer;
-extern const AVInputFormat  ff_libopenmpt_demuxer;
-extern const AVInputFormat  ff_vapoursynth_demuxer;
+extern const FFInputFormat  ff_libgme_demuxer;
+extern const FFInputFormat  ff_libmodplug_demuxer;
+extern const FFInputFormat  ff_libopenmpt_demuxer;
+extern const FFInputFormat  ff_vapoursynth_demuxer;
 
 #include "libavformat/muxer_list.c"
 #include "libavformat/demuxer_list.c"
@@ -602,22 +603,24 @@ const AVInputFormat *av_demuxer_iterate(void **opaque)
 {
     static const uintptr_t size = sizeof(demuxer_list)/sizeof(demuxer_list[0]) - 1;
     uintptr_t i = (uintptr_t)*opaque;
-    const AVInputFormat *f = NULL;
+    const FFInputFormat *f = NULL;
     uintptr_t tmp;
 
     if (i < size) {
         f = demuxer_list[i];
     } else if (tmp = atomic_load_explicit(&indev_list_intptr, memory_order_relaxed)) {
-        const AVInputFormat *const *indev_list = (const AVInputFormat *const *)tmp;
+        const FFInputFormat *const *indev_list = (const FFInputFormat *const *)tmp;
         f = indev_list[i - size];
     }
 
-    if (f)
+    if (f) {
         *opaque = (void*)(i + 1);
-    return f;
+        return &f->p;
+    }
+    return NULL;
 }
 
-void avpriv_register_devices(const FFOutputFormat * const o[], const AVInputFormat * const i[])
+void avpriv_register_devices(const FFOutputFormat * const o[], const FFInputFormat * const i[])
 {
     atomic_store_explicit(&outdev_list_intptr, (uintptr_t)o, memory_order_relaxed);
     atomic_store_explicit(&indev_list_intptr,  (uintptr_t)i, memory_order_relaxed);
diff --git a/libavformat/alp.c b/libavformat/alp.c
index 8c6066a59c..3db256cd05 100644
--- a/libavformat/alp.c
+++ b/libavformat/alp.c
@@ -24,6 +24,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "rawenc.h"
@@ -163,9 +164,9 @@ static int alp_seek(AVFormatContext *s, int stream_index,
     return avio_seek(s->pb, hdr->header_size + 8, SEEK_SET);
 }
 
-const AVInputFormat ff_alp_demuxer = {
-    .name           = "alp",
-    .long_name      = NULL_IF_CONFIG_SMALL("LEGO Racers ALP"),
+const FFInputFormat ff_alp_demuxer = {
+    .p.name         = "alp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("LEGO Racers ALP"),
     .priv_data_size = sizeof(ALPHeader),
     .read_probe     = alp_probe,
     .read_header    = alp_read_header,
diff --git a/libavformat/amr.c b/libavformat/amr.c
index b6615d8295..85815e8675 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -29,6 +29,7 @@ Write and read amr data according to RFC3267, http://www.ietf.org/rfc/rfc3267.tx
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "rawdec.h"
@@ -140,15 +141,15 @@ static int amr_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_amr_demuxer = {
-    .name           = "amr",
-    .long_name      = NULL_IF_CONFIG_SMALL("3GPP AMR"),
+const FFInputFormat ff_amr_demuxer = {
+    .p.name         = "amr",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("3GPP AMR"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .priv_data_size = sizeof(AMRContext),
     .read_probe     = amr_probe,
     .read_header    = amr_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
 
@@ -197,15 +198,15 @@ static int amrnb_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_amrnb_demuxer = {
-    .name           = "amrnb",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw AMR-NB"),
+const FFInputFormat ff_amrnb_demuxer = {
+    .p.name         = "amrnb",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw AMR-NB"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .priv_data_size = sizeof(AMRContext),
     .read_probe     = amrnb_probe,
     .read_header    = amrnb_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
 
@@ -254,15 +255,15 @@ static int amrwb_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_amrwb_demuxer = {
-    .name           = "amrwb",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw AMR-WB"),
+const FFInputFormat ff_amrwb_demuxer = {
+    .p.name         = "amrwb",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw AMR-WB"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .priv_data_size = sizeof(AMRContext),
     .read_probe     = amrwb_probe,
     .read_header    = amrwb_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
 
diff --git a/libavformat/anm.c b/libavformat/anm.c
index f2ac6958a9..789780d606 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -215,9 +215,9 @@ repeat:
     return 0;
 }
 
-const AVInputFormat ff_anm_demuxer = {
-    .name           = "anm",
-    .long_name      = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
+const FFInputFormat ff_anm_demuxer = {
+    .p.name         = "anm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
     .priv_data_size = sizeof(AnmDemuxContext),
     .read_probe     = probe,
     .read_header    = read_header,
diff --git a/libavformat/apac.c b/libavformat/apac.c
index 18970e19dd..139035ca13 100644
--- a/libavformat/apac.c
+++ b/libavformat/apac.c
@@ -72,15 +72,15 @@ static int apac_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_apac_demuxer = {
-    .name           = "apac",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw APAC"),
+const FFInputFormat ff_apac_demuxer = {
+    .p.name         = "apac",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw APAC"),
+    .p.extensions   = "apc",
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = apac_probe,
     .read_header    = apac_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .extensions     = "apc",
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
     .raw_codec_id   = AV_CODEC_ID_APAC,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/apc.c b/libavformat/apc.c
index b8b18c966c..d24f57d021 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -79,9 +79,9 @@ static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_apc_demuxer = {
-    .name           = "apc",
-    .long_name      = NULL_IF_CONFIG_SMALL("CRYO APC"),
+const FFInputFormat ff_apc_demuxer = {
+    .p.name         = "apc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("CRYO APC"),
     .read_probe     = apc_probe,
     .read_header    = apc_read_header,
     .read_packet    = apc_read_packet,
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 92e9ac7cb1..b3994d12fd 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -24,6 +24,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "apetag.h"
 
@@ -444,9 +445,10 @@ static int ape_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-const AVInputFormat ff_ape_demuxer = {
-    .name           = "ape",
-    .long_name      = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
+const FFInputFormat ff_ape_demuxer = {
+    .p.name         = "ape",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
+    .p.extensions   = "ape,apl,mac",
     .priv_data_size = sizeof(APEContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = ape_probe,
@@ -454,5 +456,4 @@ const AVInputFormat ff_ape_demuxer = {
     .read_packet    = ape_read_packet,
     .read_close     = ape_read_close,
     .read_seek      = ape_read_seek,
-    .extensions     = "ape,apl,mac",
 };
diff --git a/libavformat/apm.c b/libavformat/apm.c
index ccb8e22437..bcde82d958 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -23,6 +23,7 @@
 #include "config_components.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "rawenc.h"
@@ -202,9 +203,9 @@ static int apm_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_apm_demuxer = {
-    .name           = "apm",
-    .long_name      = NULL_IF_CONFIG_SMALL("Ubisoft Rayman 2 APM"),
+const FFInputFormat ff_apm_demuxer = {
+    .p.name         = "apm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Ubisoft Rayman 2 APM"),
     .read_probe     = apm_probe,
     .read_header    = apm_read_header,
     .read_packet    = apm_read_packet
diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
index 8f5f37a2b1..4690283337 100644
--- a/libavformat/apngdec.c
+++ b/libavformat/apngdec.c
@@ -28,6 +28,7 @@
 
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
@@ -421,13 +422,13 @@ static const AVClass demuxer_class = {
     .category   = AV_CLASS_CATEGORY_DEMUXER,
 };
 
-const AVInputFormat ff_apng_demuxer = {
-    .name           = "apng",
-    .long_name      = NULL_IF_CONFIG_SMALL("Animated Portable Network Graphics"),
+const FFInputFormat ff_apng_demuxer = {
+    .p.name         = "apng",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Animated Portable Network Graphics"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &demuxer_class,
     .priv_data_size = sizeof(APNGDemuxContext),
     .read_probe     = apng_probe,
     .read_header    = apng_read_header,
     .read_packet    = apng_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .priv_class     = &demuxer_class,
 };
diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c
index 0637a8afde..2fca45a71e 100644
--- a/libavformat/aptxdec.c
+++ b/libavformat/aptxdec.c
@@ -24,6 +24,7 @@
 
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 
 #define APTX_BLOCK_SIZE   4
 #define APTX_PACKET_SIZE  (256*APTX_BLOCK_SIZE)
@@ -101,27 +102,27 @@ static const AVClass aptx_demuxer_class = {
 };
 
 #if CONFIG_APTX_DEMUXER
-const AVInputFormat ff_aptx_demuxer = {
-    .name           = "aptx",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw aptX"),
-    .extensions     = "aptx",
+const FFInputFormat ff_aptx_demuxer = {
+    .p.name         = "aptx",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw aptX"),
+    .p.extensions   = "aptx",
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &aptx_demuxer_class,
     .priv_data_size = sizeof(AptXDemuxerContext),
     .read_header    = aptx_read_header,
     .read_packet    = aptx_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .priv_class     = &aptx_demuxer_class,
 };
 #endif
 
 #if CONFIG_APTX_HD_DEMUXER
-const AVInputFormat ff_aptx_hd_demuxer = {
-    .name           = "aptx_hd",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw aptX HD"),
-    .extensions     = "aptxhd",
+const FFInputFormat ff_aptx_hd_demuxer = {
+    .p.name         = "aptx_hd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw aptX HD"),
+    .p.extensions   = "aptxhd",
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &aptx_demuxer_class,
     .priv_data_size = sizeof(AptXDemuxerContext),
     .read_header    = aptx_hd_read_header,
     .read_packet    = aptx_hd_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .priv_class     = &aptx_demuxer_class,
 };
 #endif
diff --git a/libavformat/aqtitledec.c b/libavformat/aqtitledec.c
index 6c14b23862..e8e538e414 100644
--- a/libavformat/aqtitledec.c
+++ b/libavformat/aqtitledec.c
@@ -27,6 +27,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/opt.h"
@@ -135,9 +136,11 @@ static const AVClass aqt_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_aqtitle_demuxer = {
-    .name           = "aqtitle",
-    .long_name      = NULL_IF_CONFIG_SMALL("AQTitle subtitles"),
+const FFInputFormat ff_aqtitle_demuxer = {
+    .p.name         = "aqtitle",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AQTitle subtitles"),
+    .p.extensions   = "aqt",
+    .p.priv_class   = &aqt_class,
     .priv_data_size = sizeof(AQTitleContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = aqt_probe,
@@ -145,6 +148,4 @@ const AVInputFormat ff_aqtitle_demuxer = {
     .read_packet    = aqt_read_packet,
     .read_seek2     = aqt_read_seek,
     .read_close     = aqt_read_close,
-    .extensions     = "aqt",
-    .priv_class     = &aqt_class,
 };
diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c
index 5f38b68b6a..0e1eae24fb 100644
--- a/libavformat/argo_asf.c
+++ b/libavformat/argo_asf.c
@@ -24,6 +24,7 @@
 
 #include "libavutil/avstring.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "libavutil/channel_layout.h"
@@ -272,9 +273,9 @@ static int argo_asf_seek(AVFormatContext *s, int stream_index,
  * - Argonaut Sound File?
  * - Audio Stream File?
  */
-const AVInputFormat ff_argo_asf_demuxer = {
-    .name           = "argo_asf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Argonaut Games ASF"),
+const FFInputFormat ff_argo_asf_demuxer = {
+    .p.name         = "argo_asf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Argonaut Games ASF"),
     .priv_data_size = sizeof(ArgoASFDemuxContext),
     .read_probe     = argo_asf_probe,
     .read_header    = argo_asf_read_header,
diff --git a/libavformat/argo_brp.c b/libavformat/argo_brp.c
index 2ccdbd3e5b..f88def3731 100644
--- a/libavformat/argo_brp.c
+++ b/libavformat/argo_brp.c
@@ -21,6 +21,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avassert.h"
@@ -413,9 +414,9 @@ static int argo_brp_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_argo_brp_demuxer = {
-    .name           = "argo_brp",
-    .long_name      = NULL_IF_CONFIG_SMALL("Argonaut Games BRP"),
+const FFInputFormat ff_argo_brp_demuxer = {
+    .p.name         = "argo_brp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Argonaut Games BRP"),
     .priv_data_size = sizeof(ArgoBRPDemuxContext),
     .read_probe     = argo_brp_probe,
     .read_header    = argo_brp_read_header,
diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c
index 2c74200b7d..0cf0bf3e9a 100644
--- a/libavformat/argo_cvg.c
+++ b/libavformat/argo_cvg.c
@@ -25,6 +25,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "libavutil/opt.h"
@@ -253,9 +254,9 @@ static int argo_cvg_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_argo_cvg_demuxer = {
-    .name           = "argo_cvg",
-    .long_name      = NULL_IF_CONFIG_SMALL("Argonaut Games CVG"),
+const FFInputFormat ff_argo_cvg_demuxer = {
+    .p.name         = "argo_cvg",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Argonaut Games CVG"),
     .priv_data_size = sizeof(ArgoCVGDemuxContext),
     .read_probe     = argo_cvg_probe,
     .read_header    = argo_cvg_read_header,
diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c
index a579c3e894..9713c02b0a 100644
--- a/libavformat/asfdec_f.c
+++ b/libavformat/asfdec_f.c
@@ -1617,9 +1617,11 @@ static int asf_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_asf_demuxer = {
-    .name           = "asf",
-    .long_name      = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"),
+const FFInputFormat ff_asf_demuxer = {
+    .p.name         = "asf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"),
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH,
+    .p.priv_class   = &asf_class,
     .priv_data_size = sizeof(ASFContext),
     .read_probe     = asf_probe,
     .read_header    = asf_read_header,
@@ -1627,6 +1629,4 @@ const AVInputFormat ff_asf_demuxer = {
     .read_close     = asf_read_close,
     .read_seek      = asf_read_seek,
     .read_timestamp = asf_read_pts,
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH,
-    .priv_class     = &asf_class,
 };
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index 10942ecfa0..484fb64b36 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1674,9 +1674,10 @@ failed:
     return ret;
 }
 
-const AVInputFormat ff_asf_o_demuxer = {
-    .name           = "asf_o",
-    .long_name      = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"),
+const FFInputFormat ff_asf_o_demuxer = {
+    .p.name         = "asf_o",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"),
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH,
     .priv_data_size = sizeof(ASFContext),
     .read_probe     = asf_probe,
     .read_header    = asf_read_header,
@@ -1684,5 +1685,4 @@ const AVInputFormat ff_asf_o_demuxer = {
     .read_close     = asf_read_close,
     .read_timestamp = asf_read_timestamp,
     .read_seek      = asf_read_seek,
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH,
 };
diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index bf7b8a73a2..a689a59689 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -23,6 +23,7 @@
 #include <stdint.h>
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/bprint.h"
@@ -160,9 +161,9 @@ end:
     return res;
 }
 
-const AVInputFormat ff_ass_demuxer = {
-    .name           = "ass",
-    .long_name      = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
+const FFInputFormat ff_ass_demuxer = {
+    .p.name         = "ass",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .priv_data_size = sizeof(ASSContext),
     .read_probe     = ass_probe,
diff --git a/libavformat/astdec.c b/libavformat/astdec.c
index f812f6437c..7185e27fd4 100644
--- a/libavformat/astdec.c
+++ b/libavformat/astdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "ast.h"
 
@@ -111,13 +112,13 @@ static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_ast_demuxer = {
-    .name           = "ast",
-    .long_name      = NULL_IF_CONFIG_SMALL("AST (Audio Stream)"),
+const FFInputFormat ff_ast_demuxer = {
+    .p.name         = "ast",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AST (Audio Stream)"),
+    .p.extensions   = "ast",
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.codec_tag    = ff_ast_codec_tags_list,
     .read_probe     = ast_probe,
     .read_header    = ast_read_header,
     .read_packet    = ast_read_packet,
-    .extensions     = "ast",
-    .flags          = AVFMT_GENERIC_INDEX,
-    .codec_tag      = ff_ast_codec_tags_list,
 };
diff --git a/libavformat/au.c b/libavformat/au.c
index 63dfd71d0f..da1fc79f0d 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -32,6 +32,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 #include "mux.h"
@@ -235,14 +236,14 @@ static int au_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_au_demuxer = {
-    .name        = "au",
-    .long_name   = NULL_IF_CONFIG_SMALL("Sun AU"),
+const FFInputFormat ff_au_demuxer = {
+    .p.name      = "au",
+    .p.long_name = NULL_IF_CONFIG_SMALL("Sun AU"),
+    .p.codec_tag = au_codec_tags,
     .read_probe  = au_probe,
     .read_header = au_read_header,
     .read_packet = ff_pcm_read_packet,
     .read_seek   = ff_pcm_read_seek,
-    .codec_tag   = au_codec_tags,
 };
 
 #endif /* CONFIG_AU_DEMUXER */
diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c
index c4542a5cbe..3382613d54 100644
--- a/libavformat/av1dec.c
+++ b/libavformat/av1dec.c
@@ -27,6 +27,7 @@
 #include "libavcodec/bsf.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct AV1DemuxContext {
@@ -281,18 +282,18 @@ end:
     return ret;
 }
 
-const AVInputFormat ff_av1_demuxer = {
-    .name           = "av1",
-    .long_name      = NULL_IF_CONFIG_SMALL("AV1 Annex B"),
+const FFInputFormat ff_av1_demuxer = {
+    .p.name         = "av1",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AV1 Annex B"),
+    .p.extensions   = "obu",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &av1_demuxer_class,
     .priv_data_size = sizeof(AV1DemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = annexb_probe,
     .read_header    = av1_read_header,
     .read_packet    = annexb_read_packet,
     .read_close     = av1_read_close,
-    .extensions     = "obu",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
-    .priv_class     = &av1_demuxer_class,
 };
 #endif
 
@@ -426,17 +427,17 @@ static int obu_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_obu_demuxer = {
-    .name           = "obu",
-    .long_name      = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"),
+const FFInputFormat ff_obu_demuxer = {
+    .p.name         = "obu",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"),
+    .p.extensions   = "obu",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &av1_demuxer_class,
     .priv_data_size = sizeof(AV1DemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = obu_probe,
     .read_header    = av1_read_header,
     .read_packet    = obu_read_packet,
     .read_close     = av1_read_close,
-    .extensions     = "obu",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
-    .priv_class     = &av1_demuxer_class,
 };
 #endif
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ed02dd87b9..5fd1387e9e 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -330,7 +330,6 @@
 
 struct AVFormatContext;
 struct AVFrame;
-struct AVDeviceInfoList;
 
 /**
  * @defgroup metadata_api Public Metadata API
@@ -584,103 +583,6 @@ typedef struct AVInputFormat {
      * @see av_probe_input_format2
      */
     const char *mime_type;
-
-    /*****************************************************************
-     * No fields below this line are part of the public API. They
-     * may not be used outside of libavformat and can be changed and
-     * removed at will.
-     * New public fields should be added right above.
-     *****************************************************************
-     */
-    /**
-     * Raw demuxers store their codec ID here.
-     */
-    int raw_codec_id;
-
-    /**
-     * Size of private data so that it can be allocated in the wrapper.
-     */
-    int priv_data_size;
-
-    /**
-     * Internal flags. See FF_FMT_FLAG_* in internal.h.
-     */
-    int flags_internal;
-
-    /**
-     * Tell if a given file has a chance of being parsed as this format.
-     * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes
-     * big so you do not have to check for that unless you need more.
-     */
-    int (*read_probe)(const AVProbeData *);
-
-    /**
-     * Read the format header and initialize the AVFormatContext
-     * structure. Return 0 if OK. 'avformat_new_stream' should be
-     * called to create new streams.
-     */
-    int (*read_header)(struct AVFormatContext *);
-
-    /**
-     * Read one packet and put it in 'pkt'. pts and flags are also
-     * set. 'avformat_new_stream' can be called only if the flag
-     * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a
-     * background thread).
-     * @return 0 on success, < 0 on error.
-     *         Upon returning an error, pkt must be unreferenced by the caller.
-     */
-    int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
-
-    /**
-     * Close the stream. The AVFormatContext and AVStreams are not
-     * freed by this function
-     */
-    int (*read_close)(struct AVFormatContext *);
-
-    /**
-     * Seek to a given timestamp relative to the frames in
-     * stream component stream_index.
-     * @param stream_index Must not be -1.
-     * @param flags Selects which direction should be preferred if no exact
-     *              match is available.
-     * @return >= 0 on success (but not necessarily the new offset)
-     */
-    int (*read_seek)(struct AVFormatContext *,
-                     int stream_index, int64_t timestamp, int flags);
-
-    /**
-     * Get the next timestamp in stream[stream_index].time_base units.
-     * @return the timestamp or AV_NOPTS_VALUE if an error occurred
-     */
-    int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
-                              int64_t *pos, int64_t pos_limit);
-
-    /**
-     * Start/resume playing - only meaningful if using a network-based format
-     * (RTSP).
-     */
-    int (*read_play)(struct AVFormatContext *);
-
-    /**
-     * Pause playing - only meaningful if using a network-based format
-     * (RTSP).
-     */
-    int (*read_pause)(struct AVFormatContext *);
-
-    /**
-     * Seek to timestamp ts.
-     * Seeking will be done so that the point from which all active streams
-     * can be presented successfully will be closest to ts and within min/max_ts.
-     * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
-     */
-    int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-
-    /**
-     * Returns device list with it properties.
-     * @see avdevice_list_devices() for more details.
-     */
-    int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
-
 } AVInputFormat;
 /**
  * @}
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 00bd7a98a9..f3183b2698 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -2010,16 +2010,16 @@ static int avi_probe(const AVProbeData *p)
     return 0;
 }
 
-const AVInputFormat ff_avi_demuxer = {
-    .name           = "avi",
-    .long_name      = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
+const FFInputFormat ff_avi_demuxer = {
+    .p.name         = "avi",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"),
+    .p.extensions   = "avi",
+    .p.priv_class   = &demuxer_class,
     .priv_data_size = sizeof(AVIContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
-    .extensions     = "avi",
     .read_probe     = avi_probe,
     .read_header    = avi_read_header,
     .read_packet    = avi_read_packet,
     .read_close     = avi_read_close,
     .read_seek      = avi_read_seek,
-    .priv_class = &demuxer_class,
 };
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 027e8c63f6..482607460b 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -26,6 +26,7 @@
 #include "libavcodec/internal.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "config.h"
 
@@ -1197,14 +1198,14 @@ static const AVClass avisynth_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_avisynth_demuxer = {
-    .name           = "avisynth",
-    .long_name      = NULL_IF_CONFIG_SMALL("AviSynth script"),
+const FFInputFormat ff_avisynth_demuxer = {
+    .p.name         = "avisynth",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AviSynth script"),
+    .p.extensions   = "avs",
+    .p.priv_class   = &avisynth_demuxer_class,
     .priv_data_size = sizeof(AviSynthContext),
     .read_header    = avisynth_read_header,
     .read_packet    = avisynth_read_packet,
     .read_close     = avisynth_read_close,
     .read_seek      = avisynth_read_seek,
-    .extensions     = "avs",
-    .priv_class     = &avisynth_demuxer_class,
 };
diff --git a/libavformat/avr.c b/libavformat/avr.c
index dce977b6ac..12286c04d4 100644
--- a/libavformat/avr.c
+++ b/libavformat/avr.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -90,13 +91,13 @@ static int avr_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_avr_demuxer = {
-    .name           = "avr",
-    .long_name      = NULL_IF_CONFIG_SMALL("AVR (Audio Visual Research)"),
+const FFInputFormat ff_avr_demuxer = {
+    .p.name         = "avr",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("AVR (Audio Visual Research)"),
+    .p.extensions   = "avr",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = avr_probe,
     .read_header    = avr_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "avr",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/avs.c b/libavformat/avs.c
index 19f0373157..3cd814836b 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -26,6 +26,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "voc.h"
 
 
@@ -228,9 +229,9 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
     }
 }
 
-const AVInputFormat ff_avs_demuxer = {
-    .name           = "avs",
-    .long_name      = NULL_IF_CONFIG_SMALL("Argonaut Games Creature Shock"),
+const FFInputFormat ff_avs_demuxer = {
+    .p.name         = "avs",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Argonaut Games Creature Shock"),
     .priv_data_size = sizeof(AvsFormat),
     .read_probe     = avs_probe,
     .read_header    = avs_read_header,
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index cfb7d57332..bdf1bdc6c0 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -31,6 +31,7 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavcodec/bethsoftvideo.h"
 
@@ -290,9 +291,9 @@ static int vid_read_packet(AVFormatContext *s,
     }
 }
 
-const AVInputFormat ff_bethsoftvid_demuxer = {
-    .name           = "bethsoftvid",
-    .long_name      = NULL_IF_CONFIG_SMALL("Bethesda Softworks VID"),
+const FFInputFormat ff_bethsoftvid_demuxer = {
+    .p.name         = "bethsoftvid",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Bethesda Softworks VID"),
     .priv_data_size = sizeof(BVID_DemuxContext),
     .read_probe     = vid_probe,
     .read_header    = vid_read_header,
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 6bcd3cd400..06bf5d2c17 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -176,9 +176,9 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
     return ret;
 }
 
-const AVInputFormat ff_bfi_demuxer = {
-    .name           = "bfi",
-    .long_name      = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
+const FFInputFormat ff_bfi_demuxer = {
+    .p.name         = "bfi",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
     .priv_data_size = sizeof(BFIContext),
     .read_probe     = bfi_probe,
     .read_header    = bfi_read_header,
diff --git a/libavformat/bink.c b/libavformat/bink.c
index f4079dfb1d..0632d390a2 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -324,13 +324,13 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
     return 0;
 }
 
-const AVInputFormat ff_bink_demuxer = {
-    .name           = "bink",
-    .long_name      = NULL_IF_CONFIG_SMALL("Bink"),
+const FFInputFormat ff_bink_demuxer = {
+    .p.name         = "bink",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Bink"),
+    .p.flags        = AVFMT_SHOW_IDS,
     .priv_data_size = sizeof(BinkDemuxContext),
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_seek      = read_seek,
-    .flags          = AVFMT_SHOW_IDS,
 };
diff --git a/libavformat/binka.c b/libavformat/binka.c
index 00703ad015..cc5f2555ca 100644
--- a/libavformat/binka.c
+++ b/libavformat/binka.c
@@ -20,6 +20,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int binka_probe(const AVProbeData *p)
@@ -89,12 +90,12 @@ static int binka_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_binka_demuxer = {
-    .name           = "binka",
-    .long_name      = NULL_IF_CONFIG_SMALL("Bink Audio"),
+const FFInputFormat ff_binka_demuxer = {
+    .p.name         = "binka",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Bink Audio"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "binka",
     .read_probe     = binka_probe,
     .read_header    = binka_read_header,
     .read_packet    = binka_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "binka",
 };
diff --git a/libavformat/bintext.c b/libavformat/bintext.c
index b6f14a03e5..90d48b6691 100644
--- a/libavformat/bintext.c
+++ b/libavformat/bintext.c
@@ -36,6 +36,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "sauce.h"
 #include "libavcodec/bintext.h"
@@ -388,50 +389,50 @@ static const AVOption options[] = {
 }}
 
 #if CONFIG_BINTEXT_DEMUXER
-const AVInputFormat ff_bintext_demuxer = {
-    .name           = "bin",
-    .long_name      = NULL_IF_CONFIG_SMALL("Binary text"),
+const FFInputFormat ff_bintext_demuxer = {
+    .p.name         = "bin",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Binary text"),
+    .p.priv_class   = CLASS("Binary text demuxer"),
     .priv_data_size = sizeof(BinDemuxContext),
     .read_probe     = bin_probe,
     .read_header    = bintext_read_header,
     .read_packet    = read_packet,
-    .priv_class     = CLASS("Binary text demuxer"),
 };
 #endif
 
 #if CONFIG_XBIN_DEMUXER
-const AVInputFormat ff_xbin_demuxer = {
-    .name           = "xbin",
-    .long_name      = NULL_IF_CONFIG_SMALL("eXtended BINary text (XBIN)"),
+const FFInputFormat ff_xbin_demuxer = {
+    .p.name         = "xbin",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("eXtended BINary text (XBIN)"),
+    .p.priv_class   = CLASS("eXtended BINary text (XBIN) demuxer"),
     .priv_data_size = sizeof(BinDemuxContext),
     .read_probe     = xbin_probe,
     .read_header    = xbin_read_header,
     .read_packet    = read_packet,
-    .priv_class     = CLASS("eXtended BINary text (XBIN) demuxer"),
 };
 #endif
 
 #if CONFIG_ADF_DEMUXER
-const AVInputFormat ff_adf_demuxer = {
-    .name           = "adf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Artworx Data Format"),
+const FFInputFormat ff_adf_demuxer = {
+    .p.name         = "adf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Artworx Data Format"),
+    .p.extensions   = "adf",
+    .p.priv_class   = CLASS("Artworx Data Format demuxer"),
     .priv_data_size = sizeof(BinDemuxContext),
     .read_header    = adf_read_header,
     .read_packet    = read_packet,
-    .extensions     = "adf",
-    .priv_class     = CLASS("Artworx Data Format demuxer"),
 };
 #endif
 
 #if CONFIG_IDF_DEMUXER
-const AVInputFormat ff_idf_demuxer = {
-    .name           = "idf",
-    .long_name      = NULL_IF_CONFIG_SMALL("iCE Draw File"),
+const FFInputFormat ff_idf_demuxer = {
+    .p.name         = "idf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("iCE Draw File"),
+    .p.extensions   = "idf",
+    .p.priv_class   = CLASS("iCE Draw File demuxer"),
     .priv_data_size = sizeof(BinDemuxContext),
     .read_probe     = idf_probe,
     .read_header    = idf_read_header,
     .read_packet    = read_packet,
-    .extensions     = "idf",
-    .priv_class     = CLASS("iCE Draw File demuxer"),
 };
 #endif
diff --git a/libavformat/bit.c b/libavformat/bit.c
index c3b9cf4d3d..8133b1f44d 100644
--- a/libavformat/bit.c
+++ b/libavformat/bit.c
@@ -22,6 +22,7 @@
 #include "config_components.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "libavcodec/get_bits.h"
@@ -113,13 +114,13 @@ static int read_packet(AVFormatContext *s,
     return 0;
 }
 
-const AVInputFormat ff_bit_demuxer = {
-    .name        = "bit",
-    .long_name   = NULL_IF_CONFIG_SMALL("G.729 BIT file format"),
+const FFInputFormat ff_bit_demuxer = {
+    .p.name       = "bit",
+    .p.long_name  = NULL_IF_CONFIG_SMALL("G.729 BIT file format"),
+    .p.extensions = "bit",
     .read_probe  = probe,
     .read_header = read_header,
     .read_packet = read_packet,
-    .extensions  = "bit",
 };
 #endif
 
diff --git a/libavformat/bmv.c b/libavformat/bmv.c
index e1f667076e..b2980cf582 100644
--- a/libavformat/bmv.c
+++ b/libavformat/bmv.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 enum BMVFlags {
@@ -124,12 +125,12 @@ static int bmv_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_bmv_demuxer = {
-    .name           = "bmv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Discworld II BMV"),
+const FFInputFormat ff_bmv_demuxer = {
+    .p.name         = "bmv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Discworld II BMV"),
+    .p.extensions   = "bmv",
     .priv_data_size = sizeof(BMVContext),
     .read_header    = bmv_read_header,
     .read_packet    = bmv_read_packet,
     .read_close     = bmv_read_close,
-    .extensions     = "bmv",
 };
diff --git a/libavformat/boadec.c b/libavformat/boadec.c
index 02763142fb..d70966c97f 100644
--- a/libavformat/boadec.c
+++ b/libavformat/boadec.c
@@ -22,6 +22,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int probe(const AVProbeData *p)
@@ -78,11 +79,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, st->codecpar->block_align);
 }
 
-const AVInputFormat ff_boa_demuxer = {
-    .name           = "boa",
-    .long_name      = NULL_IF_CONFIG_SMALL("Black Ops Audio"),
+const FFInputFormat ff_boa_demuxer = {
+    .p.name         = "boa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Black Ops Audio"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/bonk.c b/libavformat/bonk.c
index bd99c553e7..44de8e2087 100644
--- a/libavformat/bonk.c
+++ b/libavformat/bonk.c
@@ -103,15 +103,15 @@ static int bonk_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_bonk_demuxer = {
-    .name           = "bonk",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw Bonk"),
+const FFInputFormat ff_bonk_demuxer = {
+    .p.name         = "bonk",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw Bonk"),
+    .p.extensions   = "bonk",
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = bonk_probe,
     .read_header    = bonk_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .extensions     = "bonk",
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
     .raw_codec_id   = AV_CODEC_ID_BONK,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/brstm.c b/libavformat/brstm.c
index 628c556e66..5b2a59b6eb 100644
--- a/libavformat/brstm.c
+++ b/libavformat/brstm.c
@@ -467,9 +467,10 @@ static int read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_brstm_demuxer = {
-    .name           = "brstm",
-    .long_name      = NULL_IF_CONFIG_SMALL("BRSTM (Binary Revolution Stream)"),
+const FFInputFormat ff_brstm_demuxer = {
+    .p.name         = "brstm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("BRSTM (Binary Revolution Stream)"),
+    .p.extensions   = "brstm",
     .priv_data_size = sizeof(BRSTMDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = probe,
@@ -477,12 +478,12 @@ const AVInputFormat ff_brstm_demuxer = {
     .read_packet    = read_packet,
     .read_close     = read_close,
     .read_seek      = read_seek,
-    .extensions     = "brstm",
 };
 
-const AVInputFormat ff_bfstm_demuxer = {
-    .name           = "bfstm",
-    .long_name      = NULL_IF_CONFIG_SMALL("BFSTM (Binary Cafe Stream)"),
+const FFInputFormat ff_bfstm_demuxer = {
+    .p.name         = "bfstm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("BFSTM (Binary Cafe Stream)"),
+    .p.extensions   = "bfstm,bcstm",
     .priv_data_size = sizeof(BRSTMDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = probe_bfstm,
@@ -490,5 +491,4 @@ const AVInputFormat ff_bfstm_demuxer = {
     .read_packet    = read_packet,
     .read_close     = read_close,
     .read_seek      = read_seek,
-    .extensions     = "bfstm,bcstm",
 };
diff --git a/libavformat/c93.c b/libavformat/c93.c
index 9ecf1427a9..933fe4a99e 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "voc.h"
 #include "libavutil/intreadwrite.h"
@@ -185,9 +186,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_c93_demuxer = {
-    .name           = "c93",
-    .long_name      = NULL_IF_CONFIG_SMALL("Interplay C93"),
+const FFInputFormat ff_c93_demuxer = {
+    .p.name         = "c93",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Interplay C93"),
     .priv_data_size = sizeof(C93DemuxContext),
     .read_probe     = probe,
     .read_header    = read_header,
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index f5ba0f4108..426c56b9bd 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -512,13 +512,13 @@ static int read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_caf_demuxer = {
-    .name           = "caf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Apple CAF (Core Audio Format)"),
+const FFInputFormat ff_caf_demuxer = {
+    .p.name         = "caf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Apple CAF (Core Audio Format)"),
+    .p.codec_tag    = ff_caf_codec_tags_list,
     .priv_data_size = sizeof(CafContext),
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_seek      = read_seek,
-    .codec_tag      = ff_caf_codec_tags_list,
 };
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index f598285911..2030cdff89 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define CDG_PACKET_SIZE    24
@@ -83,12 +84,12 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_cdg_demuxer = {
-    .name           = "cdg",
-    .long_name      = NULL_IF_CONFIG_SMALL("CD Graphics"),
+const FFInputFormat ff_cdg_demuxer = {
+    .p.name         = "cdg",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("CD Graphics"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "cdg",
     .read_probe     = read_probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "cdg",
 };
diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index 065148360e..0ed426d55a 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -24,6 +24,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define CDXL_HEADER_SIZE 32
@@ -257,15 +258,15 @@ static const AVClass cdxl_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_cdxl_demuxer = {
-    .name           = "cdxl",
-    .long_name      = NULL_IF_CONFIG_SMALL("Commodore CDXL video"),
+const FFInputFormat ff_cdxl_demuxer = {
+    .p.name         = "cdxl",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Commodore CDXL video"),
+    .p.priv_class   = &cdxl_demuxer_class,
+    .p.extensions   = "cdxl,xl",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(CDXLDemuxContext),
-    .priv_class     = &cdxl_demuxer_class,
     .read_probe     = cdxl_read_probe,
     .read_header    = cdxl_read_header,
     .read_packet    = cdxl_read_packet,
     .read_seek      = read_seek,
-    .extensions     = "cdxl,xl",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c
index e8d9657ee1..9ddfc90b47 100644
--- a/libavformat/cinedec.c
+++ b/libavformat/cinedec.c
@@ -29,6 +29,7 @@
 #include "libavcodec/bmp.h"
 #include "libavutil/intfloat.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct {
@@ -336,9 +337,9 @@ static int cine_read_seek(AVFormatContext *avctx, int stream_index, int64_t time
     return 0;
 }
 
-const AVInputFormat ff_cine_demuxer = {
-    .name           = "cine",
-    .long_name      = NULL_IF_CONFIG_SMALL("Phantom Cine"),
+const FFInputFormat ff_cine_demuxer = {
+    .p.name         = "cine",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Phantom Cine"),
     .priv_data_size = sizeof(CineDemuxContext),
     .read_probe     = cine_read_probe,
     .read_header    = cine_read_header,
diff --git a/libavformat/codec2.c b/libavformat/codec2.c
index f0f7b89253..4a3e10c6e3 100644
--- a/libavformat/codec2.c
+++ b/libavformat/codec2.c
@@ -27,6 +27,7 @@
 #include "libavutil/opt.h"
 #include "avio_internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "rawenc.h"
@@ -294,18 +295,18 @@ static const AVClass codec2raw_demux_class = {
 };
 
 #if CONFIG_CODEC2_DEMUXER
-const AVInputFormat ff_codec2_demuxer = {
-    .name           = "codec2",
-    .long_name      = NULL_IF_CONFIG_SMALL("codec2 .c2 demuxer"),
+const FFInputFormat ff_codec2_demuxer = {
+    .p.name         = "codec2",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("codec2 .c2 demuxer"),
+    .p.extensions   = "c2",
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &codec2_demux_class,
     .priv_data_size = sizeof(Codec2Context),
-    .extensions     = "c2",
     .read_probe     = codec2_probe,
     .read_header    = codec2_read_header,
     .read_packet    = codec2_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
     .raw_codec_id   = AV_CODEC_ID_CODEC2,
-    .priv_class     = &codec2_demux_class,
 };
 #endif
 
@@ -324,15 +325,15 @@ const FFOutputFormat ff_codec2_muxer = {
 #endif
 
 #if CONFIG_CODEC2RAW_DEMUXER
-const AVInputFormat ff_codec2raw_demuxer = {
-    .name           = "codec2raw",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw codec2 demuxer"),
+const FFInputFormat ff_codec2raw_demuxer = {
+    .p.name         = "codec2raw",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw codec2 demuxer"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &codec2raw_demux_class,
     .priv_data_size = sizeof(Codec2Context),
     .read_header    = codec2raw_read_header,
     .read_packet    = codec2_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
     .raw_codec_id   = AV_CODEC_ID_CODEC2,
-    .priv_class     = &codec2raw_demux_class,
 };
 #endif
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index ffa8ade25b..2abe479fb0 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -936,9 +936,10 @@ static const AVClass concat_class = {
 };
 
 
-const AVInputFormat ff_concat_demuxer = {
-    .name           = "concat",
-    .long_name      = NULL_IF_CONFIG_SMALL("Virtual concatenation script"),
+const FFInputFormat ff_concat_demuxer = {
+    .p.name         = "concat",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Virtual concatenation script"),
+    .p.priv_class   = &concat_class,
     .priv_data_size = sizeof(ConcatContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = concat_probe,
@@ -946,5 +947,4 @@ const AVInputFormat ff_concat_demuxer = {
     .read_packet    = concat_read_packet,
     .read_close     = concat_read_close,
     .read_seek2     = concat_seek,
-    .priv_class     = &concat_class,
 };
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 1215407f3c..2998bcfb48 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2355,10 +2355,11 @@ static const AVClass dash_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_dash_demuxer = {
-    .name           = "dash",
-    .long_name      = NULL_IF_CONFIG_SMALL("Dynamic Adaptive Streaming over HTTP"),
-    .priv_class     = &dash_class,
+const FFInputFormat ff_dash_demuxer = {
+    .p.name         = "dash",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Dynamic Adaptive Streaming over HTTP"),
+    .p.priv_class   = &dash_class,
+    .p.flags        = AVFMT_NO_BYTE_SEEK,
     .priv_data_size = sizeof(DASHContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = dash_probe,
@@ -2366,5 +2367,4 @@ const AVInputFormat ff_dash_demuxer = {
     .read_packet    = dash_read_packet,
     .read_close     = dash_close,
     .read_seek      = dash_read_seek,
-    .flags          = AVFMT_NO_BYTE_SEEK,
 };
diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c
index 7e411091ec..7631cd7065 100644
--- a/libavformat/dauddec.c
+++ b/libavformat/dauddec.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int daud_header(AVFormatContext *s) {
@@ -53,10 +54,10 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
     return ret;
 }
 
-const AVInputFormat ff_daud_demuxer = {
-    .name           = "daud",
-    .long_name      = NULL_IF_CONFIG_SMALL("D-Cinema audio"),
+const FFInputFormat ff_daud_demuxer = {
+    .p.name         = "daud",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("D-Cinema audio"),
+    .p.extensions   = "302,daud",
     .read_header    = daud_header,
     .read_packet    = daud_packet,
-    .extensions     = "302,daud",
 };
diff --git a/libavformat/dcstr.c b/libavformat/dcstr.c
index 286ec92df3..3badb7d4c8 100644
--- a/libavformat/dcstr.c
+++ b/libavformat/dcstr.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int dcstr_probe(const AVProbeData *p)
@@ -80,12 +81,12 @@ static int dcstr_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align);
 }
 
-const AVInputFormat ff_dcstr_demuxer = {
-    .name           = "dcstr",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sega DC STR"),
+const FFInputFormat ff_dcstr_demuxer = {
+    .p.name         = "dcstr",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sega DC STR"),
+    .p.extensions   = "str",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOBINSEARCH,
     .read_probe     = dcstr_probe,
     .read_header    = dcstr_read_header,
     .read_packet    = dcstr_read_packet,
-    .extensions     = "str",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOBINSEARCH,
 };
diff --git a/libavformat/demux.c b/libavformat/demux.c
index f0929a2479..670f2c0a65 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -283,8 +283,8 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
     s->duration = s->start_time = AV_NOPTS_VALUE;
 
     /* Allocate private data. */
-    if (s->iformat->priv_data_size > 0) {
-        if (!(s->priv_data = av_mallocz(s->iformat->priv_data_size))) {
+    if (ffifmt(s->iformat)->priv_data_size > 0) {
+        if (!(s->priv_data = av_mallocz(ffifmt(s->iformat)->priv_data_size))) {
             ret = AVERROR(ENOMEM);
             goto fail;
         }
@@ -300,9 +300,9 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
     if (s->pb)
         ff_id3v2_read_dict(s->pb, &si->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta);
 
-    if (s->iformat->read_header)
-        if ((ret = s->iformat->read_header(s)) < 0) {
-            if (s->iformat->flags_internal & FF_FMT_INIT_CLEANUP)
+    if (ffifmt(s->iformat)->read_header)
+        if ((ret = ffifmt(s->iformat)->read_header(s)) < 0) {
+            if (ffifmt(s->iformat)->flags_internal & FF_FMT_INIT_CLEANUP)
                 goto close;
             goto fail;
         }
@@ -347,8 +347,8 @@ int avformat_open_input(AVFormatContext **ps, const char *filename,
     return 0;
 
 close:
-    if (s->iformat->read_close)
-        s->iformat->read_close(s);
+    if (ffifmt(s->iformat)->read_close)
+        ffifmt(s->iformat)->read_close(s);
 fail:
     ff_id3v2_free_extra_meta(&id3v2_extra_meta);
     av_dict_free(&tmp);
@@ -375,8 +375,8 @@ void avformat_close_input(AVFormatContext **ps)
         pb = NULL;
 
     if (s->iformat)
-        if (s->iformat->read_close)
-            s->iformat->read_close(s);
+        if (ffifmt(s->iformat)->read_close)
+            ffifmt(s->iformat)->read_close(s);
 
     avformat_free_context(s);
 
@@ -561,7 +561,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
             }
         }
 
-        err = s->iformat->read_packet(s, pkt);
+        err = ffifmt(s->iformat)->read_packet(s, pkt);
         if (err < 0) {
             av_packet_unref(pkt);
 
diff --git a/libavformat/demux.h b/libavformat/demux.h
index d65eb16ff8..41d1318f75 100644
--- a/libavformat/demux.h
+++ b/libavformat/demux.h
@@ -26,6 +26,109 @@
 #include "libavcodec/packet.h"
 #include "avformat.h"
 
+struct AVDeviceInfoList;
+
+typedef struct FFInputFormat {
+    /**
+     * The public AVInputFormat. See avformat.h for it.
+     */
+    AVInputFormat p;
+
+    /**
+     * Raw demuxers store their codec ID here.
+     */
+    int raw_codec_id;
+
+    /**
+     * Size of private data so that it can be allocated in the wrapper.
+     */
+    int priv_data_size;
+
+    /**
+     * Internal flags. See FF_FMT_FLAG_* in internal.h.
+     */
+    int flags_internal;
+
+    /**
+     * Tell if a given file has a chance of being parsed as this format.
+     * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes
+     * big so you do not have to check for that unless you need more.
+     */
+    int (*read_probe)(const AVProbeData *);
+
+    /**
+     * Read the format header and initialize the AVFormatContext
+     * structure. Return 0 if OK. 'avformat_new_stream' should be
+     * called to create new streams.
+     */
+    int (*read_header)(struct AVFormatContext *);
+
+    /**
+     * Read one packet and put it in 'pkt'. pts and flags are also
+     * set. 'avformat_new_stream' can be called only if the flag
+     * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a
+     * background thread).
+     * @return 0 on success, < 0 on error.
+     *         Upon returning an error, pkt must be unreferenced by the caller.
+     */
+    int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
+
+    /**
+     * Close the stream. The AVFormatContext and AVStreams are not
+     * freed by this function
+     */
+    int (*read_close)(struct AVFormatContext *);
+
+    /**
+     * Seek to a given timestamp relative to the frames in
+     * stream component stream_index.
+     * @param stream_index Must not be -1.
+     * @param flags Selects which direction should be preferred if no exact
+     *              match is available.
+     * @return >= 0 on success (but not necessarily the new offset)
+     */
+    int (*read_seek)(struct AVFormatContext *,
+                     int stream_index, int64_t timestamp, int flags);
+
+    /**
+     * Get the next timestamp in stream[stream_index].time_base units.
+     * @return the timestamp or AV_NOPTS_VALUE if an error occurred
+     */
+    int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
+                              int64_t *pos, int64_t pos_limit);
+
+    /**
+     * Start/resume playing - only meaningful if using a network-based format
+     * (RTSP).
+     */
+    int (*read_play)(struct AVFormatContext *);
+
+    /**
+     * Pause playing - only meaningful if using a network-based format
+     * (RTSP).
+     */
+    int (*read_pause)(struct AVFormatContext *);
+
+    /**
+     * Seek to timestamp ts.
+     * Seeking will be done so that the point from which all active streams
+     * can be presented successfully will be closest to ts and within min/max_ts.
+     * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
+     */
+    int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
+
+    /**
+     * Returns device list with it properties.
+     * @see avdevice_list_devices() for more details.
+     */
+    int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
+} FFInputFormat;
+
+static inline const FFInputFormat *ffifmt(const AVInputFormat *fmt)
+{
+    return (const FFInputFormat*)fmt;
+}
+
 #define MAX_STD_TIMEBASES (30*12+30+3+6)
 typedef struct FFStreamInfo {
     int64_t last_dts;
@@ -90,7 +193,7 @@ void ff_read_frame_flush(AVFormatContext *s);
 
 /**
  * Perform a binary search using av_index_search_timestamp() and
- * AVInputFormat.read_timestamp().
+ * FFInputFormat.read_timestamp().
  *
  * @param target_ts target timestamp in the time base of the given stream
  * @param stream_index stream number
@@ -166,7 +269,7 @@ void ff_rfps_calculate(AVFormatContext *ic);
  * rounded to the nearest integer and halfway cases away from zero, and can
  * therefore fall outside of the output interval.
  *
- * Useful to simplify the rescaling of the arguments of AVInputFormat::read_seek2()
+ * Useful to simplify the rescaling of the arguments of FFInputFormat::read_seek2()
  *
  * @param[in] tb_in      Timebase of the input `min_ts`, `ts` and `max_ts`
  * @param[in] tb_out     Timebase of the output `min_ts`, `ts` and `max_ts`
diff --git a/libavformat/demux_utils.c b/libavformat/demux_utils.c
index b16bc47a96..171a07107b 100644
--- a/libavformat/demux_utils.c
+++ b/libavformat/demux_utils.c
@@ -181,8 +181,8 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
 
 int av_read_play(AVFormatContext *s)
 {
-    if (s->iformat->read_play)
-        return s->iformat->read_play(s);
+    if (ffifmt(s->iformat)->read_play)
+        return ffifmt(s->iformat)->read_play(s);
     if (s->pb)
         return avio_pause(s->pb, 0);
     return AVERROR(ENOSYS);
@@ -190,8 +190,8 @@ int av_read_play(AVFormatContext *s)
 
 int av_read_pause(AVFormatContext *s)
 {
-    if (s->iformat->read_pause)
-        return s->iformat->read_pause(s);
+    if (ffifmt(s->iformat)->read_pause)
+        return ffifmt(s->iformat)->read_pause(s);
     if (s->pb)
         return avio_pause(s->pb, 1);
     return AVERROR(ENOSYS);
diff --git a/libavformat/derf.c b/libavformat/derf.c
index 9da7fc4f19..f0077e9f06 100644
--- a/libavformat/derf.c
+++ b/libavformat/derf.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -67,12 +68,12 @@ static int derf_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_derf_demuxer = {
-    .name           = "derf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Xilam DERF"),
+const FFInputFormat ff_derf_demuxer = {
+    .p.name         = "derf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Xilam DERF"),
+    .p.extensions   = "adp",
     .read_probe     = derf_probe,
     .read_header    = derf_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "adp",
 };
diff --git a/libavformat/dfa.c b/libavformat/dfa.c
index 9808c9b617..1d78c348b1 100644
--- a/libavformat/dfa.c
+++ b/libavformat/dfa.c
@@ -23,6 +23,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int dfa_probe(const AVProbeData *p)
@@ -120,11 +121,11 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_dfa_demuxer = {
-    .name           = "dfa",
-    .long_name      = NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
+const FFInputFormat ff_dfa_demuxer = {
+    .p.name         = "dfa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = dfa_probe,
     .read_header    = dfa_read_header,
     .read_packet    = dfa_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c
index 4c998bea48..52ed33b8cf 100644
--- a/libavformat/dfpwmdec.c
+++ b/libavformat/dfpwmdec.c
@@ -22,6 +22,7 @@
 
 #include "libavutil/avstring.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 #include "libavutil/log.h"
@@ -71,15 +72,15 @@ static const AVClass dfpwm_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_dfpwm_demuxer = {
-    .name           = "dfpwm",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw DFPWM1a"),
+const FFInputFormat ff_dfpwm_demuxer = {
+    .p.name         = "dfpwm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw DFPWM1a"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "dfpwm",
+    .p.priv_class   = &dfpwm_demuxer_class,
     .priv_data_size = sizeof(DFPWMAudioDemuxerContext),
     .read_header    = dfpwm_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "dfpwm",
     .raw_codec_id   = AV_CODEC_ID_DFPWM,
-    .priv_class     = &dfpwm_demuxer_class,
 };
diff --git a/libavformat/dhav.c b/libavformat/dhav.c
index 2ec4857f29..997875eff6 100644
--- a/libavformat/dhav.c
+++ b/libavformat/dhav.c
@@ -25,6 +25,7 @@
 #include "libavutil/parseutils.h"
 #include "avio_internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct DHAVContext {
@@ -462,14 +463,14 @@ static int dhav_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_dhav_demuxer = {
-    .name           = "dhav",
-    .long_name      = NULL_IF_CONFIG_SMALL("Video DAV"),
+const FFInputFormat ff_dhav_demuxer = {
+    .p.name         = "dhav",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Video DAV"),
+    .p.extensions   = "dav",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_TS_DISCONT | AVFMT_TS_NONSTRICT | AVFMT_SEEK_TO_PTS,
     .priv_data_size = sizeof(DHAVContext),
     .read_probe     = dhav_probe,
     .read_header    = dhav_read_header,
     .read_packet    = dhav_read_packet,
     .read_seek      = dhav_read_seek,
-    .extensions     = "dav",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_TS_DISCONT | AVFMT_TS_NONSTRICT | AVFMT_SEEK_TO_PTS,
 };
diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c
index 3d3a82956e..17e109e345 100644
--- a/libavformat/dsfdec.c
+++ b/libavformat/dsfdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "id3v2.h"
 
@@ -209,12 +210,12 @@ static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_dsf_demuxer = {
-    .name           = "dsf",
-    .long_name      = NULL_IF_CONFIG_SMALL("DSD Stream File (DSF)"),
+const FFInputFormat ff_dsf_demuxer = {
+    .p.name         = "dsf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("DSD Stream File (DSF)"),
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
     .priv_data_size = sizeof(DSFContext),
     .read_probe     = dsf_probe,
     .read_header    = dsf_read_header,
     .read_packet    = dsf_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
 };
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index 13ee9f87bb..6eff38e010 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -27,6 +27,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -227,9 +228,9 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_dsicin_demuxer = {
-    .name           = "dsicin",
-    .long_name      = NULL_IF_CONFIG_SMALL("Delphine Software International CIN"),
+const FFInputFormat ff_dsicin_demuxer = {
+    .p.name         = "dsicin",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Delphine Software International CIN"),
     .priv_data_size = sizeof(CinDemuxContext),
     .read_probe     = cin_probe,
     .read_header    = cin_read_header,
diff --git a/libavformat/dss.c b/libavformat/dss.c
index d619ea00d7..510b1bd60c 100644
--- a/libavformat/dss.c
+++ b/libavformat/dss.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define DSS_HEAD_OFFSET_AUTHOR        0xc
@@ -353,13 +354,13 @@ static int dss_read_seek(AVFormatContext *s, int stream_index,
 }
 
 
-const AVInputFormat ff_dss_demuxer = {
-    .name           = "dss",
-    .long_name      = NULL_IF_CONFIG_SMALL("Digital Speech Standard (DSS)"),
+const FFInputFormat ff_dss_demuxer = {
+    .p.name         = "dss",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Digital Speech Standard (DSS)"),
+    .p.extensions   = "dss",
     .priv_data_size = sizeof(DSSDemuxContext),
     .read_probe     = dss_probe,
     .read_header    = dss_read_header,
     .read_packet    = dss_read_packet,
     .read_seek      = dss_read_seek,
-    .extensions     = "dss"
 };
diff --git a/libavformat/dtsdec.c b/libavformat/dtsdec.c
index ceedb2eb49..38ba3e73d4 100644
--- a/libavformat/dtsdec.c
+++ b/libavformat/dtsdec.c
@@ -27,6 +27,7 @@
 #include "libavcodec/get_bits.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "rawdec.h"
 
 static int dts_probe(const AVProbeData *p)
@@ -132,15 +133,15 @@ static int dts_probe(const AVProbeData *p)
     return 0;
 }
 
-const AVInputFormat ff_dts_demuxer = {
-    .name           = "dts",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw DTS"),
+const FFInputFormat ff_dts_demuxer = {
+    .p.name         = "dts",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw DTS"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "dts",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = dts_probe,
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "dts",
     .raw_codec_id   = AV_CODEC_ID_DTS,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/dtshddec.c b/libavformat/dtshddec.c
index a3dea0668f..9939724ac7 100644
--- a/libavformat/dtshddec.c
+++ b/libavformat/dtshddec.c
@@ -23,6 +23,7 @@
 #include "libavutil/dict.h"
 #include "libavcodec/dca.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define AUPR_HDR 0x415550522D484452
@@ -162,14 +163,14 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_dtshd_demuxer = {
-    .name           = "dtshd",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw DTS-HD"),
+const FFInputFormat ff_dtshd_demuxer = {
+    .p.name         = "dtshd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw DTS-HD"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "dtshd",
     .priv_data_size = sizeof(DTSHDDemuxContext),
     .read_probe     = dtshd_probe,
     .read_header    = dtshd_read_header,
     .read_packet    = raw_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "dtshd",
     .raw_codec_id   = AV_CODEC_ID_DTS,
 };
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 6df93fe416..c0d3343e37 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -710,15 +710,15 @@ static int dv_probe(const AVProbeData *p)
     return 0;
 }
 
-const AVInputFormat ff_dv_demuxer = {
-    .name           = "dv",
-    .long_name      = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
+const FFInputFormat ff_dv_demuxer = {
+    .p.name         = "dv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
+    .p.extensions   = "dv,dif",
     .priv_data_size = sizeof(RawDVContext),
     .read_probe     = dv_probe,
     .read_header    = dv_read_header,
     .read_packet    = dv_read_packet,
     .read_seek      = dv_read_seek,
-    .extensions     = "dv,dif",
 };
 
 #else // CONFIG_DV_DEMUXER
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 474b85270a..58757e8358 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -23,6 +23,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "riff.h"
 
@@ -229,9 +230,9 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
     return AVERROR_EOF;
 }
 
-const AVInputFormat ff_dxa_demuxer = {
-    .name           = "dxa",
-    .long_name      = NULL_IF_CONFIG_SMALL("DXA"),
+const FFInputFormat ff_dxa_demuxer = {
+    .p.name         = "dxa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("DXA"),
     .priv_data_size = sizeof(DXAContext),
     .read_probe     = dxa_probe,
     .read_header    = dxa_read_header,
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
index ebc98d274f..381f93dc71 100644
--- a/libavformat/eacdata.c
+++ b/libavformat/eacdata.c
@@ -30,6 +30,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #include "libavutil/channel_layout.h"
@@ -103,12 +104,12 @@ static int cdata_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_ea_cdata_demuxer = {
-    .name           = "ea_cdata",
-    .long_name      = NULL_IF_CONFIG_SMALL("Electronic Arts cdata"),
+const FFInputFormat ff_ea_cdata_demuxer = {
+    .p.name         = "ea_cdata",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Electronic Arts cdata"),
+    .p.extensions   = "cdata",
     .priv_data_size = sizeof(CdataDemuxContext),
     .read_probe     = cdata_probe,
     .read_header    = cdata_read_header,
     .read_packet    = cdata_read_packet,
-    .extensions = "cdata",
 };
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index e7f574aede..f7f6fd4cab 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -30,6 +30,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define SCHl_TAG MKTAG('S', 'C', 'H', 'l')
@@ -783,12 +784,12 @@ static const AVClass ea_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_ea_demuxer = {
-    .name           = "ea",
-    .long_name      = NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia"),
+const FFInputFormat ff_ea_demuxer = {
+    .p.name         = "ea",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia"),
+    .p.priv_class   = &ea_class,
     .priv_data_size = sizeof(EaDemuxContext),
     .read_probe     = ea_probe,
     .read_header    = ea_read_header,
     .read_packet    = ea_read_packet,
-    .priv_class     = &ea_class,
 };
diff --git a/libavformat/epafdec.c b/libavformat/epafdec.c
index a132360ebf..f2701b60ca 100644
--- a/libavformat/epafdec.c
+++ b/libavformat/epafdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -94,13 +95,13 @@ static int epaf_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_epaf_demuxer = {
-    .name           = "epaf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Ensoniq Paris Audio File"),
+const FFInputFormat ff_epaf_demuxer = {
+    .p.name         = "epaf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Ensoniq Paris Audio File"),
+    .p.extensions   = "paf,fap",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = epaf_probe,
     .read_header    = epaf_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "paf,fap",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/evcdec.c b/libavformat/evcdec.c
index 5ace604db6..5e565809ec 100644
--- a/libavformat/evcdec.c
+++ b/libavformat/evcdec.c
@@ -27,6 +27,7 @@
 
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "evc.h"
 #include "internal.h"
 
@@ -201,17 +202,17 @@ static int evc_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_evc_demuxer = {
-    .name           = "evc",
-    .long_name      = NULL_IF_CONFIG_SMALL("EVC Annex B"),
+const FFInputFormat ff_evc_demuxer = {
+    .p.name         = "evc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("EVC Annex B"),
+    .p.extensions   = "evc",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &evc_demuxer_class,
     .read_probe     = annexb_probe,
     .read_header    = evc_read_header, // annexb_read_header
     .read_packet    = evc_read_packet, // annexb_read_packet
     .read_close     = evc_read_close,
-    .extensions     = "evc",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .raw_codec_id   = AV_CODEC_ID_EVC,
     .priv_data_size = sizeof(EVCDemuxContext),
-    .priv_class     = &evc_demuxer_class,
 };
diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c
index 90f2e2b861..ab62b7006e 100644
--- a/libavformat/ffmetadec.c
+++ b/libavformat/ffmetadec.c
@@ -222,9 +222,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return AVERROR_EOF;
 }
 
-const AVInputFormat ff_ffmetadata_demuxer = {
-    .name        = "ffmetadata",
-    .long_name   = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text"),
+const FFInputFormat ff_ffmetadata_demuxer = {
+    .p.name      = "ffmetadata",
+    .p.long_name = NULL_IF_CONFIG_SMALL("FFmpeg metadata in text"),
     .read_probe  = probe,
     .read_header = read_header,
     .read_packet = read_packet,
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 000f807181..5ce0af234c 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -27,6 +27,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/imgutils.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define RAND_TAG MKBETAG('R','a','n','d')
@@ -104,12 +105,12 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
     return 0;
 }
 
-const AVInputFormat ff_filmstrip_demuxer = {
-    .name           = "filmstrip",
-    .long_name      = NULL_IF_CONFIG_SMALL("Adobe Filmstrip"),
+const FFInputFormat ff_filmstrip_demuxer = {
+    .p.name         = "filmstrip",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Adobe Filmstrip"),
+    .p.extensions   = "flm",
     .priv_data_size = sizeof(FilmstripDemuxContext),
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_seek      = read_seek,
-    .extensions     = "flm",
 };
diff --git a/libavformat/fitsdec.c b/libavformat/fitsdec.c
index e0f502e4e3..fe2dd5ad5d 100644
--- a/libavformat/fitsdec.c
+++ b/libavformat/fitsdec.c
@@ -26,6 +26,7 @@
 
 #include "libavutil/avassert.h"
 #include "libavutil/intreadwrite.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/opt.h"
 #include "libavcodec/fits.h"
@@ -220,13 +221,13 @@ static const AVClass fits_demuxer_class = {
     .category   = AV_CLASS_CATEGORY_DEMUXER,
 };
 
-const AVInputFormat ff_fits_demuxer = {
-    .name           = "fits",
-    .long_name      = NULL_IF_CONFIG_SMALL("Flexible Image Transport System"),
+const FFInputFormat ff_fits_demuxer = {
+    .p.name         = "fits",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Flexible Image Transport System"),
+    .p.priv_class   = &fits_demuxer_class,
+    .p.flags        = AVFMT_NOTIMESTAMPS,
     .priv_data_size = sizeof(FITSContext),
     .read_probe     = fits_probe,
     .read_header    = fits_read_header,
     .read_packet    = fits_read_packet,
-    .priv_class     = &fits_demuxer_class,
-    .flags          = AVFMT_NOTIMESTAMPS,
 };
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index bbb205078a..4ce6251137 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -364,18 +364,18 @@ static int flac_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
     return -1;
 }
 
-const AVInputFormat ff_flac_demuxer = {
-    .name           = "flac",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw FLAC"),
+const FFInputFormat ff_flac_demuxer = {
+    .p.name         = "flac",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw FLAC"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "flac",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = flac_probe,
     .read_header    = flac_read_header,
     .read_close     = flac_close,
     .read_packet    = ff_raw_read_partial_packet,
     .read_seek      = flac_seek,
     .read_timestamp = flac_read_timestamp,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "flac",
     .raw_codec_id   = AV_CODEC_ID_FLAC,
     .priv_data_size = sizeof(FLACDecContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/flic.c b/libavformat/flic.c
index 222452eac8..41dfb4f39e 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -34,6 +34,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define FLIC_FILE_MAGIC_1 0xAF11
@@ -285,9 +286,9 @@ static int flic_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_flic_demuxer = {
-    .name           = "flic",
-    .long_name      = NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation"),
+const FFInputFormat ff_flic_demuxer = {
+    .p.name         = "flic",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation"),
     .priv_data_size = sizeof(FlicDemuxContext),
     .read_probe     = flic_probe,
     .read_header    = flic_read_header,
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index e25b5bd163..31dcb41b06 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -1412,42 +1412,42 @@ static const AVClass flv_kux_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_flv_demuxer = {
-    .name           = "flv",
-    .long_name      = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),
+const FFInputFormat ff_flv_demuxer = {
+    .p.name         = "flv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("FLV (Flash Video)"),
+    .p.extensions   = "flv",
+    .p.priv_class   = &flv_kux_class,
     .priv_data_size = sizeof(FLVContext),
     .read_probe     = flv_probe,
     .read_header    = flv_read_header,
     .read_packet    = flv_read_packet,
     .read_seek      = flv_read_seek,
     .read_close     = flv_read_close,
-    .extensions     = "flv",
-    .priv_class     = &flv_kux_class,
 };
 
-const AVInputFormat ff_live_flv_demuxer = {
-    .name           = "live_flv",
-    .long_name      = NULL_IF_CONFIG_SMALL("live RTMP FLV (Flash Video)"),
+const FFInputFormat ff_live_flv_demuxer = {
+    .p.name         = "live_flv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("live RTMP FLV (Flash Video)"),
+    .p.extensions   = "flv",
+    .p.priv_class   = &flv_kux_class,
+    .p.flags        = AVFMT_TS_DISCONT,
     .priv_data_size = sizeof(FLVContext),
     .read_probe     = live_flv_probe,
     .read_header    = flv_read_header,
     .read_packet    = flv_read_packet,
     .read_seek      = flv_read_seek,
     .read_close     = flv_read_close,
-    .extensions     = "flv",
-    .priv_class     = &flv_kux_class,
-    .flags          = AVFMT_TS_DISCONT
 };
 
-const AVInputFormat ff_kux_demuxer = {
-    .name           = "kux",
-    .long_name      = NULL_IF_CONFIG_SMALL("KUX (YouKu)"),
+const FFInputFormat ff_kux_demuxer = {
+    .p.name         = "kux",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("KUX (YouKu)"),
+    .p.extensions   = "kux",
+    .p.priv_class   = &flv_kux_class,
     .priv_data_size = sizeof(FLVContext),
     .read_probe     = kux_probe,
     .read_header    = flv_read_header,
     .read_packet    = flv_read_packet,
     .read_seek      = flv_read_seek,
     .read_close     = flv_read_close,
-    .extensions     = "kux",
-    .priv_class     = &flv_kux_class,
 };
diff --git a/libavformat/format.c b/libavformat/format.c
index 4738e69a1c..0cdfd85c22 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -28,6 +28,7 @@
 
 #include "avio_internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "id3v2.h"
 #include "internal.h"
 #include "url.h"
@@ -189,8 +190,8 @@ const AVInputFormat *av_probe_input_format3(const AVProbeData *pd,
         if (!is_opened == !(fmt1->flags & AVFMT_NOFILE) && strcmp(fmt1->name, "image2"))
             continue;
         score = 0;
-        if (fmt1->read_probe) {
-            score = fmt1->read_probe(&lpd);
+        if (ffifmt(fmt1)->read_probe) {
+            score = ffifmt(fmt1)->read_probe(&lpd);
             if (score)
                 av_log(NULL, AV_LOG_TRACE, "Probing %s score:%d size:%d\n", fmt1->name, score, lpd.buf_size);
             if (fmt1->extensions && av_match_ext(lpd.filename, fmt1->extensions)) {
diff --git a/libavformat/frmdec.c b/libavformat/frmdec.c
index e6c1179dcd..412430e4fc 100644
--- a/libavformat/frmdec.c
+++ b/libavformat/frmdec.c
@@ -27,6 +27,7 @@
 #include "libavutil/imgutils.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 
 static const enum AVPixelFormat frm_pix_fmt_tags[] = {
     AV_PIX_FMT_RGB555,
@@ -102,10 +103,10 @@ static int frm_read_packet(AVFormatContext *avctx, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_frm_demuxer = {
-    .name           = "frm",
+const FFInputFormat ff_frm_demuxer = {
+    .p.name         = "frm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Megalux Frame"),
     .priv_data_size = sizeof(FrmContext),
-    .long_name      = NULL_IF_CONFIG_SMALL("Megalux Frame"),
     .read_probe     = frm_read_probe,
     .read_header    = frm_read_header,
     .read_packet    = frm_read_packet,
diff --git a/libavformat/fsb.c b/libavformat/fsb.c
index 12b67f631c..4189822d8e 100644
--- a/libavformat/fsb.c
+++ b/libavformat/fsb.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "avio.h"
+#include "demux.h"
 #include "internal.h"
 
 static int fsb_probe(const AVProbeData *p)
@@ -200,12 +201,12 @@ static int fsb_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_fsb_demuxer = {
-    .name        = "fsb",
-    .long_name   = NULL_IF_CONFIG_SMALL("FMOD Sample Bank"),
+const FFInputFormat ff_fsb_demuxer = {
+    .p.name         = "fsb",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("FMOD Sample Bank"),
+    .p.extensions   = "fsb",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe  = fsb_probe,
     .read_header = fsb_read_header,
     .read_packet = fsb_read_packet,
-    .extensions  = "fsb",
-    .flags       = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/fwse.c b/libavformat/fwse.c
index 28a322d9d6..6c1103da14 100644
--- a/libavformat/fwse.c
+++ b/libavformat/fwse.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -77,11 +78,11 @@ static int fwse_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_fwse_demuxer = {
-    .name           = "fwse",
-    .long_name      = NULL_IF_CONFIG_SMALL("Capcom's MT Framework sound"),
+const FFInputFormat ff_fwse_demuxer = {
+    .p.name         = "fwse",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Capcom's MT Framework sound"),
+    .p.extensions   = "fwse",
     .read_probe     = fwse_probe,
     .read_header    = fwse_read_header,
     .read_packet    = ff_pcm_read_packet,
-    .extensions     = "fwse",
 };
diff --git a/libavformat/g722.c b/libavformat/g722.c
index 08cd2cbc87..15519d90b5 100644
--- a/libavformat/g722.c
+++ b/libavformat/g722.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/avassert.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "rawdec.h"
 
@@ -46,14 +47,14 @@ static int g722_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_g722_demuxer = {
-    .name           = "g722",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw G.722"),
+const FFInputFormat ff_g722_demuxer = {
+    .p.name         = "g722",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw G.722"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "g722,722",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_header    = g722_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "g722,722",
     .raw_codec_id   = AV_CODEC_ID_ADPCM_G722,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/g723_1.c b/libavformat/g723_1.c
index e35b4ed503..17c7a13d38 100644
--- a/libavformat/g723_1.c
+++ b/libavformat/g723_1.c
@@ -27,6 +27,7 @@
 #include "libavutil/attributes.h"
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static const uint8_t frame_size[4] = { 24, 20, 4, 1 };
@@ -74,11 +75,11 @@ static int g723_1_read_packet(AVFormatContext *s, AVPacket *pkt)
     return pkt->size;
 }
 
-const AVInputFormat ff_g723_1_demuxer = {
-    .name        = "g723_1",
-    .long_name   = NULL_IF_CONFIG_SMALL("G.723.1"),
+const FFInputFormat ff_g723_1_demuxer = {
+    .p.name         = "g723_1",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("G.723.1"),
+    .p.extensions   = "tco,rco,g723_1",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_header = g723_1_init,
     .read_packet = g723_1_read_packet,
-    .extensions  = "tco,rco,g723_1",
-    .flags       = AVFMT_GENERIC_INDEX
 };
diff --git a/libavformat/g726.c b/libavformat/g726.c
index 97580a74f8..e783fa4123 100644
--- a/libavformat/g726.c
+++ b/libavformat/g726.c
@@ -22,6 +22,7 @@
 #include "config_components.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/opt.h"
 
@@ -39,7 +40,7 @@ static int g726_read_header(AVFormatContext *s)
         return AVERROR(ENOMEM);
 
     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codecpar->codec_id   = s->iformat->raw_codec_id;
+    st->codecpar->codec_id   = ffifmt(s->iformat)->raw_codec_id;
 
     st->codecpar->sample_rate           = c->sample_rate;
     st->codecpar->bits_per_coded_sample = c->code_size;
@@ -75,25 +76,25 @@ static const AVClass g726_demuxer_class = {
 };
 
 #if CONFIG_G726_DEMUXER
-const AVInputFormat ff_g726_demuxer = {
-    .name           = "g726",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw big-endian G.726 (\"left aligned\")"),
+const FFInputFormat ff_g726_demuxer = {
+    .p.name         = "g726",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw big-endian G.726 (\"left aligned\")"),
+    .p.priv_class   = &g726_demuxer_class,
     .read_header    = g726_read_header,
     .read_packet    = g726_read_packet,
     .priv_data_size = sizeof(G726Context),
-    .priv_class     = &g726_demuxer_class,
     .raw_codec_id   = AV_CODEC_ID_ADPCM_G726,
 };
 #endif
 
 #if CONFIG_G726LE_DEMUXER
-const AVInputFormat ff_g726le_demuxer = {
-    .name           = "g726le",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw little-endian G.726 (\"right aligned\")"),
+const FFInputFormat ff_g726le_demuxer = {
+    .p.name         = "g726le",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw little-endian G.726 (\"right aligned\")"),
+    .p.priv_class   = &g726_demuxer_class,
     .read_header    = g726_read_header,
     .read_packet    = g726_read_packet,
     .priv_data_size = sizeof(G726Context),
-    .priv_class     = &g726_demuxer_class,
     .raw_codec_id   = AV_CODEC_ID_ADPCM_G726LE,
 };
 #endif
diff --git a/libavformat/g729dec.c b/libavformat/g729dec.c
index 9c92ea4fcf..d6f55b70de 100644
--- a/libavformat/g729dec.c
+++ b/libavformat/g729dec.c
@@ -23,6 +23,7 @@
 #include "libavutil/opt.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct G729DemuxerContext {
@@ -93,13 +94,13 @@ static const AVClass g729_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_g729_demuxer = {
-    .name           = "g729",
-    .long_name      = NULL_IF_CONFIG_SMALL("G.729 raw format demuxer"),
+const FFInputFormat ff_g729_demuxer = {
+    .p.name         = "g729",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("G.729 raw format demuxer"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "g729",
+    .p.priv_class   = &g729_demuxer_class,
     .priv_data_size = sizeof(G729DemuxerContext),
     .read_header    = g729_read_header,
     .read_packet    = g729_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "g729",
-    .priv_class     = &g729_demuxer_class,
 };
diff --git a/libavformat/gdv.c b/libavformat/gdv.c
index f8a8f50351..9a042a1fc8 100644
--- a/libavformat/gdv.c
+++ b/libavformat/gdv.c
@@ -23,6 +23,7 @@
 
 #include "avformat.h"
 #include "avio.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct GDVContext {
@@ -194,9 +195,9 @@ static int gdv_read_packet(AVFormatContext *ctx, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_gdv_demuxer = {
-    .name           = "gdv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"),
+const FFInputFormat ff_gdv_demuxer = {
+    .p.name         = "gdv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"),
     .priv_data_size = sizeof(GDVContext),
     .read_probe     = gdv_read_probe,
     .read_header    = gdv_read_header,
diff --git a/libavformat/genh.c b/libavformat/genh.c
index 1f707b5555..deecca4a4c 100644
--- a/libavformat/genh.c
+++ b/libavformat/genh.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct GENHDemuxContext {
@@ -195,12 +196,12 @@ static int genh_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_genh_demuxer = {
-    .name           = "genh",
-    .long_name      = NULL_IF_CONFIG_SMALL("GENeric Header"),
+const FFInputFormat ff_genh_demuxer = {
+    .p.name         = "genh",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("GENeric Header"),
+    .p.extensions   = "genh",
     .priv_data_size = sizeof(GENHDemuxContext),
     .read_probe     = genh_probe,
     .read_header    = genh_read_header,
     .read_packet    = genh_read_packet,
-    .extensions     = "genh",
 };
diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c
index 32286adafe..294007682b 100644
--- a/libavformat/gifdec.c
+++ b/libavformat/gifdec.c
@@ -25,6 +25,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/opt.h"
@@ -278,14 +279,14 @@ static const AVClass demuxer_class = {
     .category   = AV_CLASS_CATEGORY_DEMUXER,
 };
 
-const AVInputFormat ff_gif_demuxer = {
-    .name           = "gif",
-    .long_name      = NULL_IF_CONFIG_SMALL("CompuServe Graphics Interchange Format (GIF)"),
+const FFInputFormat ff_gif_demuxer = {
+    .p.name         = "gif",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("CompuServe Graphics Interchange Format (GIF)"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "gif",
+    .p.priv_class   = &demuxer_class,
     .priv_data_size = sizeof(GIFDemuxContext),
     .read_probe     = gif_probe,
     .read_header    = gif_read_header,
     .read_packet    = gif_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "gif",
-    .priv_class     = &demuxer_class,
 };
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
index 7150daa510..10fba212e9 100644
--- a/libavformat/gsmdec.c
+++ b/libavformat/gsmdec.c
@@ -23,6 +23,7 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define GSM_BLOCK_SIZE    33
@@ -102,15 +103,15 @@ static const AVClass gsm_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_gsm_demuxer = {
-    .name           = "gsm",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw GSM"),
+const FFInputFormat ff_gsm_demuxer = {
+    .p.name         = "gsm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw GSM"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "gsm",
+    .p.priv_class   = &gsm_class,
     .priv_data_size = sizeof(GSMDemuxerContext),
     .read_probe     = gsm_probe,
     .read_header    = gsm_read_header,
     .read_packet    = gsm_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "gsm",
     .raw_codec_id   = AV_CODEC_ID_GSM,
-    .priv_class     = &gsm_class,
 };
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index f720521c1b..1a9f0d75b0 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -599,9 +599,9 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
     return res;
 }
 
-const AVInputFormat ff_gxf_demuxer = {
-    .name           = "gxf",
-    .long_name      = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"),
+const FFInputFormat ff_gxf_demuxer = {
+    .p.name         = "gxf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("GXF (General eXchange Format)"),
     .priv_data_size = sizeof(struct gxf_stream_info),
     .read_probe     = gxf_probe,
     .read_header    = gxf_header,
diff --git a/libavformat/hca.c b/libavformat/hca.c
index e796512a62..713082f8b0 100644
--- a/libavformat/hca.c
+++ b/libavformat/hca.c
@@ -24,6 +24,7 @@
 #include "libavcodec/bytestream.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define HCA_MASK 0x7f7f7f7f
@@ -148,14 +149,14 @@ static const AVClass hca_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_hca_demuxer = {
-    .name           = "hca",
-    .long_name      = NULL_IF_CONFIG_SMALL("CRI HCA"),
-    .priv_class     = &hca_class,
+const FFInputFormat ff_hca_demuxer = {
+    .p.name         = "hca",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("CRI HCA"),
+    .p.priv_class   = &hca_class,
+    .p.extensions   = "hca",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(HCADemuxContext),
     .read_probe     = hca_probe,
     .read_header    = hca_read_header,
     .read_packet    = hca_read_packet,
-    .extensions     = "hca",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/hcom.c b/libavformat/hcom.c
index 5031f00297..2a8c524496 100644
--- a/libavformat/hcom.c
+++ b/libavformat/hcom.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -81,9 +82,9 @@ static int hcom_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_hcom_demuxer = {
-    .name           = "hcom",
-    .long_name      = NULL_IF_CONFIG_SMALL("Macintosh HCOM"),
+const FFInputFormat ff_hcom_demuxer = {
+    .p.name         = "hcom",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Macintosh HCOM"),
     .read_probe     = hcom_probe,
     .read_header    = hcom_read_header,
     .read_packet    = ff_pcm_read_packet,
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 61e2d67588..f6b44c2e35 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2102,7 +2102,7 @@ static int hls_read_header(AVFormatContext *s)
             pls->audio_setup_info.codec_id != AV_CODEC_ID_NONE) {
             void *iter = NULL;
             while ((in_fmt = av_demuxer_iterate(&iter)))
-                if (in_fmt->raw_codec_id == pls->audio_setup_info.codec_id)
+                if (ffifmt(in_fmt)->raw_codec_id == pls->audio_setup_info.codec_id)
                     break;
         } else {
             pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
@@ -2594,12 +2594,12 @@ static const AVClass hls_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_hls_demuxer = {
-    .name           = "hls",
-    .long_name      = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
-    .priv_class     = &hls_class,
+const FFInputFormat ff_hls_demuxer = {
+    .p.name         = "hls",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"),
+    .p.priv_class   = &hls_class,
+    .p.flags        = AVFMT_NOGENSEARCH | AVFMT_TS_DISCONT | AVFMT_NO_BYTE_SEEK,
     .priv_data_size = sizeof(HLSContext),
-    .flags          = AVFMT_NOGENSEARCH | AVFMT_TS_DISCONT | AVFMT_NO_BYTE_SEEK,
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = hls_probe,
     .read_header    = hls_read_header,
diff --git a/libavformat/hnm.c b/libavformat/hnm.c
index 97990b2673..42efaaa3e8 100644
--- a/libavformat/hnm.c
+++ b/libavformat/hnm.c
@@ -24,6 +24,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define HNM4_TAG MKTAG('H', 'N', 'M', '4')
@@ -158,12 +159,12 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_hnm_demuxer = {
-    .name           = "hnm",
-    .long_name      = NULL_IF_CONFIG_SMALL("Cryo HNM v4"),
+const FFInputFormat ff_hnm_demuxer = {
+    .p.name         = "hnm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Cryo HNM v4"),
+    .p.flags        = AVFMT_NO_BYTE_SEEK | AVFMT_NOGENSEARCH | AVFMT_NOBINSEARCH,
     .priv_data_size = sizeof(Hnm4DemuxContext),
     .read_probe     = hnm_probe,
     .read_header    = hnm_read_header,
     .read_packet    = hnm_read_packet,
-    .flags          = AVFMT_NO_BYTE_SEEK | AVFMT_NOGENSEARCH | AVFMT_NOBINSEARCH
 };
diff --git a/libavformat/iamfdec.c b/libavformat/iamfdec.c
index 99622f697b..900e8a450b 100644
--- a/libavformat/iamfdec.c
+++ b/libavformat/iamfdec.c
@@ -26,6 +26,7 @@
 #include "libavcodec/mathops.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "iamf.h"
 #include "iamf_parse.h"
 #include "internal.h"
@@ -490,15 +491,15 @@ static int iamf_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_iamf_demuxer = {
-    .name           = "iamf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Raw Immersive Audio Model and Formats"),
+const FFInputFormat ff_iamf_demuxer = {
+    .p.name         = "iamf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Raw Immersive Audio Model and Formats"),
+    .p.extensions   = "iamf",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS | AVFMT_SHOW_IDS,
     .priv_data_size = sizeof(IAMFDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = iamf_probe,
     .read_header    = iamf_read_header,
     .read_packet    = iamf_read_packet,
     .read_close     = iamf_read_close,
-    .extensions     = "iamf",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS | AVFMT_SHOW_IDS,
 };
diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index 85dab3bca0..0ec6e0b258 100644
--- a/libavformat/icodec.c
+++ b/libavformat/icodec.c
@@ -28,6 +28,7 @@
 #include "libavcodec/bytestream.h"
 #include "libavcodec/png.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct {
@@ -216,14 +217,14 @@ static int ico_read_close(AVFormatContext * s)
     return 0;
 }
 
-const AVInputFormat ff_ico_demuxer = {
-    .name           = "ico",
-    .long_name      = NULL_IF_CONFIG_SMALL("Microsoft Windows ICO"),
+const FFInputFormat ff_ico_demuxer = {
+    .p.name         = "ico",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Microsoft Windows ICO"),
+    .p.flags        = AVFMT_NOTIMESTAMPS,
     .priv_data_size = sizeof(IcoDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_close     = ico_read_close,
-    .flags          = AVFMT_NOTIMESTAMPS,
 };
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 1560d58e39..561715d3d9 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -365,13 +365,13 @@ static int idcin_read_seek(AVFormatContext *s, int stream_index,
     return -1;
 }
 
-const AVInputFormat ff_idcin_demuxer = {
-    .name           = "idcin",
-    .long_name      = NULL_IF_CONFIG_SMALL("id Cinematic"),
+const FFInputFormat ff_idcin_demuxer = {
+    .p.name         = "idcin",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("id Cinematic"),
+    .p.flags        = AVFMT_NO_BYTE_SEEK,
     .priv_data_size = sizeof(IdcinDemuxContext),
     .read_probe     = idcin_probe,
     .read_header    = idcin_read_header,
     .read_packet    = idcin_read_packet,
     .read_seek      = idcin_read_seek,
-    .flags          = AVFMT_NO_BYTE_SEEK,
 };
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 01ea2bb77b..67bc1246e6 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -30,6 +30,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -237,9 +238,9 @@ static int roq_read_packet(AVFormatContext *s,
     return ret;
 }
 
-const AVInputFormat ff_roq_demuxer = {
-    .name           = "roq",
-    .long_name      = NULL_IF_CONFIG_SMALL("id RoQ"),
+const FFInputFormat ff_roq_demuxer = {
+    .p.name         = "roq",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("id RoQ"),
     .priv_data_size = sizeof(RoqDemuxContext),
     .read_probe     = roq_probe,
     .read_header    = roq_read_header,
diff --git a/libavformat/iff.c b/libavformat/iff.c
index b8e8bffe03..633e0c11fd 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -36,6 +36,7 @@
 #include "libavutil/dict.h"
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
+#include "demux.h"
 #include "id3v2.h"
 #include "internal.h"
 
@@ -901,12 +902,12 @@ static int iff_read_packet(AVFormatContext *s,
     return ret;
 }
 
-const AVInputFormat ff_iff_demuxer = {
-    .name           = "iff",
-    .long_name      = NULL_IF_CONFIG_SMALL("IFF (Interchange File Format)"),
+const FFInputFormat ff_iff_demuxer = {
+    .p.name         = "iff",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("IFF (Interchange File Format)"),
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
     .priv_data_size = sizeof(IffDemuxContext),
     .read_probe     = iff_probe,
     .read_header    = iff_read_header,
     .read_packet    = iff_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
 };
diff --git a/libavformat/ifv.c b/libavformat/ifv.c
index 694abd951b..0cfd2763a9 100644
--- a/libavformat/ifv.c
+++ b/libavformat/ifv.c
@@ -23,6 +23,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/dict_internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -309,11 +310,11 @@ static int ifv_read_seek(AVFormatContext *s, int stream_index, int64_t ts, int f
     return 0;
 }
 
-const AVInputFormat ff_ifv_demuxer = {
-    .name           = "ifv",
-    .long_name      = NULL_IF_CONFIG_SMALL("IFV CCTV DVR"),
+const FFInputFormat ff_ifv_demuxer = {
+    .p.name         = "ifv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("IFV CCTV DVR"),
+    .p.extensions   = "ifv",
     .priv_data_size = sizeof(IFVContext),
-    .extensions     = "ifv",
     .read_probe     = ifv_probe,
     .read_header    = ifv_read_header,
     .read_packet    = ifv_read_packet,
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index 6b5bb33b62..bb98d0e62a 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -22,6 +22,7 @@
 #include "config_components.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "rawenc.h"
@@ -111,13 +112,13 @@ static int ilbc_read_packet(AVFormatContext *s,
     return 0;
 }
 
-const AVInputFormat ff_ilbc_demuxer = {
-    .name         = "ilbc",
-    .long_name    = NULL_IF_CONFIG_SMALL("iLBC storage"),
+const FFInputFormat ff_ilbc_demuxer = {
+    .p.name       = "ilbc",
+    .p.long_name  = NULL_IF_CONFIG_SMALL("iLBC storage"),
+    .p.flags      = AVFMT_GENERIC_INDEX,
     .read_probe   = ilbc_probe,
     .read_header  = ilbc_read_header,
     .read_packet  = ilbc_read_packet,
-    .flags        = AVFMT_GENERIC_INDEX,
 };
 
 #if CONFIG_ILBC_MUXER
diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index 901080555a..b57c54bd14 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -1014,12 +1014,12 @@ static const AVClass imf_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_imf_demuxer = {
-    .name           = "imf",
-    .long_name      = NULL_IF_CONFIG_SMALL("IMF (Interoperable Master Format)"),
-    .flags          = AVFMT_NO_BYTE_SEEK,
+const FFInputFormat ff_imf_demuxer = {
+    .p.name         = "imf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("IMF (Interoperable Master Format)"),
+    .p.flags        = AVFMT_NO_BYTE_SEEK,
+    .p.priv_class   = &imf_class,
     .flags_internal = FF_FMT_INIT_CLEANUP,
-    .priv_class     = &imf_class,
     .priv_data_size = sizeof(IMFContext),
     .read_probe     = imf_probe,
     .read_header    = imf_read_header,
diff --git a/libavformat/img2_alias_pix.c b/libavformat/img2_alias_pix.c
index d0aac83924..d96c0ccf55 100644
--- a/libavformat/img2_alias_pix.c
+++ b/libavformat/img2_alias_pix.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "demux.h"
 #include "img2.h"
 #include "libavcodec/bytestream.h"
 
@@ -61,13 +62,13 @@ static const AVClass image2_alias_pix_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_image2_alias_pix_demuxer = {
-    .name           = "alias_pix",
-    .long_name      = NULL_IF_CONFIG_SMALL("Alias/Wavefront PIX image"),
+const FFInputFormat ff_image2_alias_pix_demuxer = {
+    .p.name         = "alias_pix",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Alias/Wavefront PIX image"),
+    .p.priv_class   = &image2_alias_pix_class,
     .priv_data_size = sizeof(VideoDemuxData),
     .read_probe     = alias_pix_read_probe,
     .read_header    = ff_img_read_header,
     .read_packet    = ff_img_read_packet,
     .raw_codec_id   = AV_CODEC_ID_ALIAS_PIX,
-    .priv_class     = &image2_alias_pix_class,
 };
diff --git a/libavformat/img2_brender_pix.c b/libavformat/img2_brender_pix.c
index 9d9a7c0819..9e9335eafe 100644
--- a/libavformat/img2_brender_pix.c
+++ b/libavformat/img2_brender_pix.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "demux.h"
 #include "img2.h"
 #include "libavutil/intreadwrite.h"
 
@@ -45,13 +46,13 @@ static const AVClass image2_brender_pix_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_image2_brender_pix_demuxer = {
-    .name           = "brender_pix",
-    .long_name      = NULL_IF_CONFIG_SMALL("BRender PIX image"),
+const FFInputFormat ff_image2_brender_pix_demuxer = {
+    .p.name         = "brender_pix",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("BRender PIX image"),
+    .p.priv_class   = &image2_brender_pix_class,
     .priv_data_size = sizeof(VideoDemuxData),
     .read_probe     = brender_read_probe,
     .read_header    = ff_img_read_header,
     .read_packet    = ff_img_read_packet,
     .raw_codec_id   = AV_CODEC_ID_BRENDER_PIX,
-    .priv_class     = &image2_brender_pix_class,
 };
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 2761cb37a4..ead92f22c4 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -34,6 +34,7 @@
 #include "libavcodec/gif.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "img2.h"
 #include "os_support.h"
@@ -322,9 +323,9 @@ int ff_img_read_header(AVFormatContext *s1)
     } else if (s1->audio_codec_id) {
         st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
         st->codecpar->codec_id   = s1->audio_codec_id;
-    } else if (s1->iformat->raw_codec_id) {
+    } else if (ffifmt(s1->iformat)->raw_codec_id) {
         st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
-        st->codecpar->codec_id   = s1->iformat->raw_codec_id;
+        st->codecpar->codec_id   = ffifmt(s1->iformat)->raw_codec_id;
     } else {
         const char *str = strrchr(s->path, '.');
         s->split_planes       = str && !av_strcasecmp(str + 1, "y");
@@ -351,13 +352,14 @@ int ff_img_read_header(AVFormatContext *s1)
             pd.filename = s1->url;
 
             while ((fmt = av_demuxer_iterate(&fmt_iter))) {
-                if (fmt->read_header != ff_img_read_header ||
-                    !fmt->read_probe ||
+                const FFInputFormat *fmt2 = ffifmt(fmt);
+                if (fmt2->read_header != ff_img_read_header ||
+                    !fmt2->read_probe ||
                     (fmt->flags & AVFMT_NOFILE) ||
-                    !fmt->raw_codec_id)
+                    !fmt2->raw_codec_id)
                     continue;
-                if (fmt->read_probe(&pd) > 0) {
-                    st->codecpar->codec_id = fmt->raw_codec_id;
+                if (fmt2->read_probe(&pd) > 0) {
+                    st->codecpar->codec_id = fmt2->raw_codec_id;
                     break;
                 }
             }
@@ -458,7 +460,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
 
         if (par->codec_id == AV_CODEC_ID_NONE) {
             AVProbeData pd = { 0 };
-            const AVInputFormat *ifmt;
+            const FFInputFormat *ifmt;
             uint8_t header[PROBE_BUF_MIN + AVPROBE_PADDING_SIZE];
             int ret;
             int score = 0;
@@ -472,7 +474,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
             pd.buf_size = ret;
             pd.filename = filename;
 
-            ifmt = av_probe_input_format3(&pd, 1, &score);
+            ifmt = ffifmt(av_probe_input_format3(&pd, 1, &score));
             if (ifmt && ifmt->read_packet == ff_img_read_packet && ifmt->raw_codec_id)
                 par->codec_id = ifmt->raw_codec_id;
         }
@@ -638,17 +640,17 @@ static const AVClass img2_class = {
     .option     = ff_img_options,
     .version    = LIBAVUTIL_VERSION_INT,
 };
-const AVInputFormat ff_image2_demuxer = {
-    .name           = "image2",
-    .long_name      = NULL_IF_CONFIG_SMALL("image2 sequence"),
+const FFInputFormat ff_image2_demuxer = {
+    .p.name         = "image2",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("image2 sequence"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &img2_class,
     .priv_data_size = sizeof(VideoDemuxData),
     .read_probe     = img_read_probe,
     .read_header    = ff_img_read_header,
     .read_packet    = ff_img_read_packet,
     .read_close     = img_read_close,
     .read_seek      = img_read_seek,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &img2_class,
 };
 #endif
 
@@ -664,13 +666,13 @@ static const AVClass imagepipe_class = {
 };
 
 #if CONFIG_IMAGE2PIPE_DEMUXER
-const AVInputFormat ff_image2pipe_demuxer = {
-    .name           = "image2pipe",
-    .long_name      = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
+const FFInputFormat ff_image2pipe_demuxer = {
+    .p.name         = "image2pipe",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("piped image2 sequence"),
+    .p.priv_class   = &imagepipe_class,
     .priv_data_size = sizeof(VideoDemuxData),
     .read_header    = ff_img_read_header,
     .read_packet    = ff_img_read_packet,
-    .priv_class     = &imagepipe_class,
 };
 #endif
 
@@ -1205,15 +1207,15 @@ static int vbn_probe(const AVProbeData *p)
 
 #define IMAGEAUTO_DEMUXER_0(imgname, codecid)
 #define IMAGEAUTO_DEMUXER_1(imgname, codecid)\
-const AVInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
-    .name           = AV_STRINGIFY(imgname) "_pipe",\
-    .long_name      = NULL_IF_CONFIG_SMALL("piped " AV_STRINGIFY(imgname) " sequence"),\
+const FFInputFormat ff_image_ ## imgname ## _pipe_demuxer = {\
+    .p.name         = AV_STRINGIFY(imgname) "_pipe",\
+    .p.long_name    = NULL_IF_CONFIG_SMALL("piped " AV_STRINGIFY(imgname) " sequence"),\
+    .p.priv_class   = &imagepipe_class,\
+    .p.flags        = AVFMT_GENERIC_INDEX,\
     .priv_data_size = sizeof(VideoDemuxData),\
     .read_probe     = imgname ## _probe,\
     .read_header    = ff_img_read_header,\
     .read_packet    = ff_img_read_packet,\
-    .priv_class     = &imagepipe_class,\
-    .flags          = AVFMT_GENERIC_INDEX, \
     .raw_codec_id   = codecid,\
 };
 
diff --git a/libavformat/imx.c b/libavformat/imx.c
index c8b1a3b2ad..70b62b63d7 100644
--- a/libavformat/imx.c
+++ b/libavformat/imx.c
@@ -21,6 +21,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/channel_layout.h"
@@ -155,13 +156,13 @@ retry:
     return ret;
 }
 
-const AVInputFormat ff_simbiosis_imx_demuxer = {
-    .name           = "simbiosis_imx",
-    .long_name      = NULL_IF_CONFIG_SMALL("Simbiosis Interactive IMX"),
+const FFInputFormat ff_simbiosis_imx_demuxer = {
+    .p.name         = "simbiosis_imx",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Simbiosis Interactive IMX"),
+    .p.extensions   = "imx",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(SimbiosisIMXDemuxContext),
     .read_probe     = simbiosis_imx_probe,
     .read_header    = simbiosis_imx_read_header,
     .read_packet    = simbiosis_imx_read_packet,
-    .extensions     = "imx",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c
index 7a9cce155f..63624372a6 100644
--- a/libavformat/ingenientdec.c
+++ b/libavformat/ingenientdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "rawdec.h"
 #include "libavutil/intreadwrite.h"
 
@@ -61,15 +62,15 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_ingenient_demuxer = {
-    .name           = "ingenient",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"),
+const FFInputFormat ff_ingenient_demuxer = {
+    .p.name         = "ingenient",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "cgi", // FIXME
+    .p.priv_class   = &ff_rawvideo_demuxer_class,
     .priv_data_size = sizeof(FFRawVideoDemuxerContext),
     .read_probe     = ingenient_probe,
     .read_header    = ff_raw_video_read_header,
     .read_packet    = ingenient_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "cgi", // FIXME
     .raw_codec_id   = AV_CODEC_ID_MJPEG,
-    .priv_class     = &ff_rawvideo_demuxer_class,
 };
diff --git a/libavformat/internal.h b/libavformat/internal.h
index c66f959e9f..350762def7 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -40,7 +40,7 @@
 #endif
 
 /**
- * For an AVInputFormat with this flag set read_close() needs to be called
+ * For an FFInputFormat with this flag set read_close() needs to be called
  * by the caller upon read_header() failure.
  */
 #define FF_FMT_INIT_CLEANUP                             (1 << 0)
@@ -752,6 +752,8 @@ void ff_format_set_url(AVFormatContext *s, char *url);
 int ff_match_url_ext(const char *url, const char *extensions);
 
 struct FFOutputFormat;
-void avpriv_register_devices(const struct FFOutputFormat * const o[], const AVInputFormat * const i[]);
+struct FFInputFormat;
+void avpriv_register_devices(const struct FFOutputFormat * const o[],
+                             const struct FFInputFormat * const i[]);
 
 #endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 4f5c164d3f..5d1748953a 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -700,9 +700,9 @@ static int ipmovie_read_packet(AVFormatContext *s,
     }
 }
 
-const AVInputFormat ff_ipmovie_demuxer = {
-    .name           = "ipmovie",
-    .long_name      = NULL_IF_CONFIG_SMALL("Interplay MVE"),
+const FFInputFormat ff_ipmovie_demuxer = {
+    .p.name         = "ipmovie",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Interplay MVE"),
     .priv_data_size = sizeof(IPMVEContext),
     .read_probe     = ipmovie_probe,
     .read_header    = ipmovie_read_header,
diff --git a/libavformat/ipudec.c b/libavformat/ipudec.c
index 4e346f9638..770eb8a3d1 100644
--- a/libavformat/ipudec.c
+++ b/libavformat/ipudec.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 #include "rawdec.h"
@@ -67,15 +68,15 @@ static int ipu_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_ipu_demuxer = {
-    .name           = "ipu",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw IPU Video"),
+const FFInputFormat ff_ipu_demuxer = {
+    .p.name         = "ipu",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw IPU Video"),
+    .p.extensions   = "ipu",
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = ipu_read_probe,
     .read_header    = ipu_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .extensions     = "ipu",
-    .flags          = AVFMT_GENERIC_INDEX,
     .raw_codec_id   = AV_CODEC_ID_IPU,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/ircamdec.c b/libavformat/ircamdec.c
index eb59c95e14..03a61e9f13 100644
--- a/libavformat/ircamdec.c
+++ b/libavformat/ircamdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 #include "ircam.h"
@@ -107,13 +108,13 @@ static int ircam_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_ircam_demuxer = {
-    .name           = "ircam",
-    .long_name      = NULL_IF_CONFIG_SMALL("Berkeley/IRCAM/CARL Sound Format"),
+const FFInputFormat ff_ircam_demuxer = {
+    .p.name         = "ircam",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Berkeley/IRCAM/CARL Sound Format"),
+    .p.extensions   = "sf,ircam",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = ircam_probe,
     .read_header    = ircam_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "sf,ircam",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/iss.c b/libavformat/iss.c
index f54ff8b0de..7a68fcaf63 100644
--- a/libavformat/iss.c
+++ b/libavformat/iss.c
@@ -28,6 +28,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/avstring.h"
 
@@ -144,9 +145,9 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_iss_demuxer = {
-    .name           = "iss",
-    .long_name      = NULL_IF_CONFIG_SMALL("Funcom ISS"),
+const FFInputFormat ff_iss_demuxer = {
+    .p.name         = "iss",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Funcom ISS"),
     .priv_data_size = sizeof(IssDemuxContext),
     .read_probe     = iss_probe,
     .read_header    = iss_read_header,
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index a3954ca1ed..635675cdc7 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -19,6 +19,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 
@@ -107,11 +108,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_iv8_demuxer = {
-    .name           = "iv8",
-    .long_name      = NULL_IF_CONFIG_SMALL("IndigoVision 8000 video"),
+const FFInputFormat ff_iv8_demuxer = {
+    .p.name         = "iv8",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("IndigoVision 8000 video"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 141ce4f1be..9e34fb014e 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -19,6 +19,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "riff.h"
 #include "libavutil/intreadwrite.h"
@@ -88,12 +89,12 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_ivf_demuxer = {
-    .name           = "ivf",
-    .long_name      = NULL_IF_CONFIG_SMALL("On2 IVF"),
+const FFInputFormat ff_ivf_demuxer = {
+    .p.name         = "ivf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("On2 IVF"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.codec_tag    = (const AVCodecTag* const []){ ff_codec_bmp_tags, 0 },
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .codec_tag      = (const AVCodecTag* const []){ ff_codec_bmp_tags, 0 },
 };
diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index c6e5b4aa6d..8b0aa312fc 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -26,6 +26,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavcodec/jacosub.h"
@@ -256,9 +257,9 @@ static int jacosub_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_jacosub_demuxer = {
-    .name           = "jacosub",
-    .long_name      = NULL_IF_CONFIG_SMALL("JACOsub subtitle format"),
+const FFInputFormat ff_jacosub_demuxer = {
+    .p.name         = "jacosub",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("JACOsub subtitle format"),
     .priv_data_size = sizeof(JACOsubContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = jacosub_probe,
diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c
index 54cd6e4e9d..f749b378b3 100644
--- a/libavformat/jpegxl_anim_dec.c
+++ b/libavformat/jpegxl_anim_dec.c
@@ -34,6 +34,7 @@
 #include "libavutil/opt.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct JXLAnimDemuxContext {
@@ -188,16 +189,16 @@ static int jpegxl_anim_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_jpegxl_anim_demuxer = {
-    .name           = "jpegxl_anim",
-    .long_name      = NULL_IF_CONFIG_SMALL("Animated JPEG XL"),
+const FFInputFormat ff_jpegxl_anim_demuxer = {
+    .p.name         = "jpegxl_anim",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Animated JPEG XL"),
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
+    .p.mime_type    = "image/jxl",
+    .p.extensions   = "jxl",
     .priv_data_size = sizeof(JXLAnimDemuxContext),
     .read_probe     = jpegxl_anim_probe,
     .read_header    = jpegxl_anim_read_header,
     .read_packet    = jpegxl_anim_read_packet,
     .read_close     = jpegxl_anim_close,
     .flags_internal = FF_FMT_INIT_CLEANUP,
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
-    .mime_type      = "image/jxl",
-    .extensions     = "jxl",
 };
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 5e0e2239f5..89c82483aa 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -29,6 +29,7 @@
 #include "libavutil/intreadwrite.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define JV_PREAMBLE_SIZE 5
@@ -250,9 +251,9 @@ static int read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_jv_demuxer = {
-    .name           = "jv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV"),
+const FFInputFormat ff_jv_demuxer = {
+    .p.name         = "jv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV"),
     .priv_data_size = sizeof(JVDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = read_probe,
diff --git a/libavformat/kvag.c b/libavformat/kvag.c
index 9487e7dd0e..bea1dda3e5 100644
--- a/libavformat/kvag.c
+++ b/libavformat/kvag.c
@@ -25,6 +25,7 @@
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "rawenc.h"
@@ -115,9 +116,9 @@ static int kvag_seek(AVFormatContext *s, int stream_index,
     return avio_seek(s->pb, KVAG_HEADER_SIZE, SEEK_SET);
 }
 
-const AVInputFormat ff_kvag_demuxer = {
-    .name           = "kvag",
-    .long_name      = NULL_IF_CONFIG_SMALL("Simon & Schuster Interactive VAG"),
+const FFInputFormat ff_kvag_demuxer = {
+    .p.name         = "kvag",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Simon & Schuster Interactive VAG"),
     .read_probe     = kvag_probe,
     .read_header    = kvag_read_header,
     .read_packet    = kvag_read_packet,
diff --git a/libavformat/lafdec.c b/libavformat/lafdec.c
index b867f106ae..05f30691ba 100644
--- a/libavformat/lafdec.c
+++ b/libavformat/lafdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 
 #define MAX_STREAMS 4096
@@ -277,16 +278,16 @@ static int laf_read_seek(AVFormatContext *ctx, int stream_index,
     return -1;
 }
 
-const AVInputFormat ff_laf_demuxer = {
-    .name           = "laf",
-    .long_name      = NULL_IF_CONFIG_SMALL("LAF (Limitless Audio Format)"),
+const FFInputFormat ff_laf_demuxer = {
+    .p.name         = "laf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("LAF (Limitless Audio Format)"),
+    .p.extensions   = "laf",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(LAFContext),
     .read_probe     = laf_probe,
     .read_header    = laf_read_header,
     .read_packet    = laf_read_packet,
     .read_close     = laf_read_close,
     .read_seek      = laf_read_seek,
-    .extensions     = "laf",
-    .flags          = AVFMT_GENERIC_INDEX,
     .flags_internal = FF_FMT_INIT_CLEANUP,
 };
diff --git a/libavformat/libgme.c b/libavformat/libgme.c
index 695155c9ac..c2baa9c3ff 100644
--- a/libavformat/libgme.c
+++ b/libavformat/libgme.c
@@ -26,6 +26,7 @@
 #include "libavutil/eval.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct GMEContext {
@@ -193,9 +194,10 @@ static const AVClass class_gme = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_libgme_demuxer = {
-    .name           = "libgme",
-    .long_name      = NULL_IF_CONFIG_SMALL("Game Music Emu demuxer"),
+const FFInputFormat ff_libgme_demuxer = {
+    .p.name         = "libgme",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Game Music Emu demuxer"),
+    .p.priv_class   = &class_gme,
     .priv_data_size = sizeof(GMEContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = probe_gme,
@@ -203,5 +205,4 @@ const AVInputFormat ff_libgme_demuxer = {
     .read_packet    = read_packet_gme,
     .read_close     = read_close_gme,
     .read_seek      = read_seek_gme,
-    .priv_class     = &class_gme,
 };
diff --git a/libavformat/libmodplug.c b/libavformat/libmodplug.c
index 0cae13bd2e..8c6569f778 100644
--- a/libavformat/libmodplug.c
+++ b/libavformat/libmodplug.c
@@ -28,6 +28,7 @@
 #include "libavutil/eval.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct ModPlugContext {
@@ -380,15 +381,15 @@ static const AVClass modplug_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_libmodplug_demuxer = {
-    .name           = "libmodplug",
-    .long_name      = NULL_IF_CONFIG_SMALL("ModPlug demuxer"),
+const FFInputFormat ff_libmodplug_demuxer = {
+    .p.name         = "libmodplug",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("ModPlug demuxer"),
+    .p.extensions   = modplug_extensions,
+    .p.priv_class   = &modplug_class,
     .priv_data_size = sizeof(ModPlugContext),
     .read_probe     = modplug_probe,
     .read_header    = modplug_read_header,
     .read_packet    = modplug_read_packet,
     .read_close     = modplug_read_close,
     .read_seek      = modplug_read_seek,
-    .extensions     = modplug_extensions,
-    .priv_class     = &modplug_class,
 };
diff --git a/libavformat/libopenmpt.c b/libavformat/libopenmpt.c
index 3ca59f506f..bba1c38521 100644
--- a/libavformat/libopenmpt.c
+++ b/libavformat/libopenmpt.c
@@ -34,6 +34,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct OpenMPTContext {
@@ -278,9 +279,15 @@ static const AVClass class_openmpt = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_libopenmpt_demuxer = {
-    .name           = "libopenmpt",
-    .long_name      = NULL_IF_CONFIG_SMALL("Tracker formats (libopenmpt)"),
+const FFInputFormat ff_libopenmpt_demuxer = {
+    .p.name         = "libopenmpt",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Tracker formats (libopenmpt)"),
+    .p.priv_class   = &class_openmpt,
+#if OPENMPT_API_VERSION_AT_LEAST(0,3,0)
+    .p.extensions   = "669,amf,ams,dbm,digi,dmf,dsm,dtm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,stp,ult,umx,wow,xm,xpk",
+#else
+    .p.extensions   = "669,amf,ams,dbm,digi,dmf,dsm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,ult,umx,wow,xm,xpk",
+#endif
     .priv_data_size = sizeof(OpenMPTContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = read_probe_openmpt,
@@ -288,10 +295,4 @@ const AVInputFormat ff_libopenmpt_demuxer = {
     .read_packet    = read_packet_openmpt,
     .read_close     = read_close_openmpt,
     .read_seek      = read_seek_openmpt,
-    .priv_class     = &class_openmpt,
-#if OPENMPT_API_VERSION_AT_LEAST(0,3,0)
-    .extensions     = "669,amf,ams,dbm,digi,dmf,dsm,dtm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,stp,ult,umx,wow,xm,xpk",
-#else
-    .extensions     = "669,amf,ams,dbm,digi,dmf,dsm,far,gdm,ice,imf,it,j2b,m15,mdl,med,mmcmp,mms,mo3,mod,mptm,mt2,mtm,nst,okt,plm,ppm,psm,pt36,ptm,s3m,sfx,sfx2,st26,stk,stm,ult,umx,wow,xm,xpk",
-#endif
 };
diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
index b0bfad001b..209b544ccd 100644
--- a/libavformat/lmlm4.c
+++ b/libavformat/lmlm4.c
@@ -25,6 +25,7 @@
 #include "libavutil/intreadwrite.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define LMLM4_I_FRAME   0x00
@@ -121,9 +122,9 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_lmlm4_demuxer = {
-    .name           = "lmlm4",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw lmlm4"),
+const FFInputFormat ff_lmlm4_demuxer = {
+    .p.name         = "lmlm4",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw lmlm4"),
     .read_probe     = lmlm4_probe,
     .read_header    = lmlm4_read_header,
     .read_packet    = lmlm4_read_packet,
diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c
index 7b8b2ea4bc..fcb812f5ca 100644
--- a/libavformat/loasdec.c
+++ b/libavformat/loasdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "rawdec.h"
 
@@ -83,14 +84,14 @@ static int loas_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_loas_demuxer = {
-    .name           = "loas",
-    .long_name      = NULL_IF_CONFIG_SMALL("LOAS AudioSyncStream"),
+const FFInputFormat ff_loas_demuxer = {
+    .p.name         = "loas",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("LOAS AudioSyncStream"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = loas_probe,
     .read_header    = loas_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
     .raw_codec_id = AV_CODEC_ID_AAC_LATM,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c
index f43e9dccf5..216bcc42eb 100644
--- a/libavformat/lrcdec.c
+++ b/libavformat/lrcdec.c
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "lrc.h"
 #include "metadata.h"
@@ -224,9 +225,9 @@ err_nomem_out:
     return AVERROR(ENOMEM);
 }
 
-const AVInputFormat ff_lrc_demuxer = {
-    .name           = "lrc",
-    .long_name      = NULL_IF_CONFIG_SMALL("LRC lyrics"),
+const FFInputFormat ff_lrc_demuxer = {
+    .p.name         = "lrc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("LRC lyrics"),
     .priv_data_size = sizeof (LRCContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = lrc_probe,
diff --git a/libavformat/luodatdec.c b/libavformat/luodatdec.c
index fbd621dae6..c166ad71f0 100644
--- a/libavformat/luodatdec.c
+++ b/libavformat/luodatdec.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avio_internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int dat_probe(const AVProbeData *p)
@@ -115,12 +116,12 @@ static int dat_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_luodat_demuxer = {
-    .name           = "luodat",
-    .long_name      = NULL_IF_CONFIG_SMALL("Video CCTV DAT"),
+const FFInputFormat ff_luodat_demuxer = {
+    .p.name         = "luodat",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Video CCTV DAT"),
+    .p.extensions   = "dat",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = dat_probe,
     .read_header    = dat_read_header,
     .read_packet    = dat_read_packet,
-    .extensions     = "dat",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/lvfdec.c b/libavformat/lvfdec.c
index cc1e9be58c..cd013844fb 100644
--- a/libavformat/lvfdec.c
+++ b/libavformat/lvfdec.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "riff.h"
 
 static int lvf_probe(const AVProbeData *p)
@@ -145,12 +146,12 @@ static int lvf_read_packet(AVFormatContext *s, AVPacket *pkt)
     return AVERROR_EOF;
 }
 
-const AVInputFormat ff_lvf_demuxer = {
-    .name        = "lvf",
-    .long_name   = NULL_IF_CONFIG_SMALL("LVF"),
+const FFInputFormat ff_lvf_demuxer = {
+    .p.name         = "lvf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("LVF"),
+    .p.extensions   = "lvf",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe  = lvf_probe,
     .read_header = lvf_read_header,
     .read_packet = lvf_read_packet,
-    .extensions  = "lvf",
-    .flags       = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 8003ae98b7..00a7813984 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -335,12 +335,12 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_lxf_demuxer = {
-    .name           = "lxf",
-    .long_name      = NULL_IF_CONFIG_SMALL("VR native stream (LXF)"),
+const FFInputFormat ff_lxf_demuxer = {
+    .p.name         = "lxf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("VR native stream (LXF)"),
+    .p.codec_tag    = (const AVCodecTag* const []){lxf_tags, 0},
     .priv_data_size = sizeof(LXFDemuxContext),
     .read_probe     = lxf_probe,
     .read_header    = lxf_read_header,
     .read_packet    = lxf_read_packet,
-    .codec_tag      = (const AVCodecTag* const []){lxf_tags, 0},
 };
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8f000f86be..75768d429b 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -4777,10 +4777,10 @@ static const AVClass webm_dash_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_webm_dash_manifest_demuxer = {
-    .name           = "webm_dash_manifest",
-    .long_name      = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
-    .priv_class     = &webm_dash_class,
+const FFInputFormat ff_webm_dash_manifest_demuxer = {
+    .p.name         = "webm_dash_manifest",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("WebM DASH Manifest"),
+    .p.priv_class   = &webm_dash_class,
     .priv_data_size = sizeof(MatroskaDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_header    = webm_dash_manifest_read_header,
@@ -4789,10 +4789,11 @@ const AVInputFormat ff_webm_dash_manifest_demuxer = {
 };
 #endif
 
-const AVInputFormat ff_matroska_demuxer = {
-    .name           = "matroska,webm",
-    .long_name      = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
-    .extensions     = "mkv,mk3d,mka,mks,webm",
+const FFInputFormat ff_matroska_demuxer = {
+    .p.name         = "matroska,webm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Matroska / WebM"),
+    .p.extensions   = "mkv,mk3d,mka,mks,webm",
+    .p.mime_type    = "audio/webm,audio/x-matroska,video/webm,video/x-matroska",
     .priv_data_size = sizeof(MatroskaDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = matroska_probe,
@@ -4800,5 +4801,4 @@ const AVInputFormat ff_matroska_demuxer = {
     .read_packet    = matroska_read_packet,
     .read_close     = matroska_read_close,
     .read_seek      = matroska_read_seek,
-    .mime_type      = "audio/webm,audio/x-matroska,video/webm,video/x-matroska"
 };
diff --git a/libavformat/mca.c b/libavformat/mca.c
index 74654c3b39..e707de3c3b 100644
--- a/libavformat/mca.c
+++ b/libavformat/mca.c
@@ -218,13 +218,13 @@ static int read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_mca_demuxer = {
-    .name           = "mca",
-    .long_name      = NULL_IF_CONFIG_SMALL("MCA Audio Format"),
+const FFInputFormat ff_mca_demuxer = {
+    .p.name         = "mca",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MCA Audio Format"),
+    .p.extensions   = "mca",
     .priv_data_size = sizeof(MCADemuxContext),
     .read_probe     = probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_seek      = read_seek,
-    .extensions     = "mca",
 };
diff --git a/libavformat/mccdec.c b/libavformat/mccdec.c
index 8c36b27f12..d20724b879 100644
--- a/libavformat/mccdec.c
+++ b/libavformat/mccdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/avstring.h"
@@ -200,14 +201,14 @@ static int mcc_read_header(AVFormatContext *s)
     return ret;
 }
 
-const AVInputFormat ff_mcc_demuxer = {
-    .name           = "mcc",
-    .long_name      = NULL_IF_CONFIG_SMALL("MacCaption"),
+const FFInputFormat ff_mcc_demuxer = {
+    .p.name         = "mcc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MacCaption"),
+    .p.extensions   = "mcc",
     .priv_data_size = sizeof(MCCContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = mcc_probe,
     .read_header    = mcc_read_header,
-    .extensions     = "mcc",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/mgsts.c b/libavformat/mgsts.c
index b5c704829d..07ea66163c 100644
--- a/libavformat/mgsts.c
+++ b/libavformat/mgsts.c
@@ -22,6 +22,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/intfloat.h"
 #include "avformat.h"
+#include "demux.h"
 #include "riff.h"
 
 static int read_probe(const AVProbeData *p)
@@ -96,11 +97,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_mgsts_demuxer = {
-    .name        = "mgsts",
-    .long_name   = NULL_IF_CONFIG_SMALL("Metal Gear Solid: The Twin Snakes"),
+const FFInputFormat ff_mgsts_demuxer = {
+    .p.name      = "mgsts",
+    .p.long_name = NULL_IF_CONFIG_SMALL("Metal Gear Solid: The Twin Snakes"),
+    .p.flags     = AVFMT_GENERIC_INDEX,
     .read_probe  = read_probe,
     .read_header = read_header,
     .read_packet = read_packet,
-    .flags       = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/microdvddec.c b/libavformat/microdvddec.c
index e536d12b85..8660c43ef9 100644
--- a/libavformat/microdvddec.c
+++ b/libavformat/microdvddec.c
@@ -21,6 +21,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/intreadwrite.h"
@@ -198,9 +199,10 @@ static const AVClass microdvd_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_microdvd_demuxer = {
-    .name           = "microdvd",
-    .long_name      = NULL_IF_CONFIG_SMALL("MicroDVD subtitle format"),
+const FFInputFormat ff_microdvd_demuxer = {
+    .p.name         = "microdvd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MicroDVD subtitle format"),
+    .p.priv_class   = &microdvd_class,
     .priv_data_size = sizeof(MicroDVDContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = microdvd_probe,
@@ -208,5 +210,4 @@ const AVInputFormat ff_microdvd_demuxer = {
     .read_packet    = microdvd_read_packet,
     .read_seek2     = microdvd_read_seek,
     .read_close     = microdvd_read_close,
-    .priv_class     = &microdvd_class,
 };
diff --git a/libavformat/mlpdec.c b/libavformat/mlpdec.c
index f4fed65851..4927f9d351 100644
--- a/libavformat/mlpdec.c
+++ b/libavformat/mlpdec.c
@@ -25,6 +25,7 @@
 
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "rawdec.h"
 #include "libavutil/intreadwrite.h"
@@ -95,17 +96,17 @@ static int mlp_probe(const AVProbeData *p)
     return mlp_thd_probe(p, 0xf8726fbb);
 }
 
-const AVInputFormat ff_mlp_demuxer = {
-    .name           = "mlp",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw MLP"),
+const FFInputFormat ff_mlp_demuxer = {
+    .p.name         = "mlp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw MLP"),
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
+    .p.extensions   = "mlp",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = mlp_probe,
     .read_header    = mlp_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
-    .extensions     = "mlp",
     .raw_codec_id   = AV_CODEC_ID_MLP,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
 
@@ -115,16 +116,16 @@ static int thd_probe(const AVProbeData *p)
     return mlp_thd_probe(p, 0xf8726fba);
 }
 
-const AVInputFormat ff_truehd_demuxer = {
-    .name           = "truehd",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw TrueHD"),
+const FFInputFormat ff_truehd_demuxer = {
+    .p.name         = "truehd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw TrueHD"),
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
+    .p.extensions   = "thd",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = thd_probe,
     .read_header    = mlp_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
-    .extensions     = "thd",
     .raw_codec_id   = AV_CODEC_ID_TRUEHD,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index b706898cb3..b969a45550 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -488,9 +488,9 @@ static int read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_mlv_demuxer = {
-    .name           = "mlv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Magic Lantern Video (MLV)"),
+const FFInputFormat ff_mlv_demuxer = {
+    .p.name         = "mlv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Magic Lantern Video (MLV)"),
     .priv_data_size = sizeof(MlvContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = probe,
diff --git a/libavformat/mm.c b/libavformat/mm.c
index 1d44f41a94..23c025d852 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -34,6 +34,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define MM_PREAMBLE_SIZE    6
@@ -189,9 +190,9 @@ static int read_packet(AVFormatContext *s,
     }
 }
 
-const AVInputFormat ff_mm_demuxer = {
-    .name           = "mm",
-    .long_name      = NULL_IF_CONFIG_SMALL("American Laser Games MM"),
+const FFInputFormat ff_mm_demuxer = {
+    .p.name         = "mm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("American Laser Games MM"),
     .priv_data_size = sizeof(MmDemuxContext),
     .read_probe     = probe,
     .read_header    = read_header,
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 5cac4381f4..b3e257616d 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -24,6 +24,7 @@
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "mux.h"
 #include "pcm.h"
@@ -298,14 +299,14 @@ static int mmf_read_packet(AVFormatContext *s, AVPacket *pkt)
 }
 
 #if CONFIG_MMF_DEMUXER
-const AVInputFormat ff_mmf_demuxer = {
-    .name           = "mmf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Yamaha SMAF"),
+const FFInputFormat ff_mmf_demuxer = {
+    .p.name         = "mmf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Yamaha SMAF"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(MMFContext),
     .read_probe     = mmf_probe,
     .read_header    = mmf_read_header,
     .read_packet    = mmf_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
 #endif
 
diff --git a/libavformat/mods.c b/libavformat/mods.c
index 34524a19d8..7f76124821 100644
--- a/libavformat/mods.c
+++ b/libavformat/mods.c
@@ -24,6 +24,7 @@
 #include "libavutil/intreadwrite.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int mods_probe(const AVProbeData *p)
@@ -91,12 +92,12 @@ static int mods_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_mods_demuxer = {
-    .name           = "mods",
-    .long_name      = NULL_IF_CONFIG_SMALL("MobiClip MODS"),
+const FFInputFormat ff_mods_demuxer = {
+    .p.name         = "mods",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MobiClip MODS"),
+    .p.extensions   = "mods",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = mods_probe,
     .read_header    = mods_read_header,
     .read_packet    = mods_read_packet,
-    .extensions     = "mods",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/moflex.c b/libavformat/moflex.c
index 2ea7c1f994..44fdaf3269 100644
--- a/libavformat/moflex.c
+++ b/libavformat/moflex.c
@@ -24,6 +24,7 @@
 #include "libavcodec/bytestream.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct BitReader {
@@ -371,16 +372,16 @@ static int moflex_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_moflex_demuxer = {
-    .name           = "moflex",
-    .long_name      = NULL_IF_CONFIG_SMALL("MobiClip MOFLEX"),
+const FFInputFormat ff_moflex_demuxer = {
+    .p.name         = "moflex",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MobiClip MOFLEX"),
+    .p.extensions   = "moflex",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(MOFLEXDemuxContext),
     .read_probe     = moflex_probe,
     .read_header    = moflex_read_header,
     .read_packet    = moflex_read_packet,
     .read_seek      = moflex_read_seek,
     .read_close     = moflex_read_close,
-    .extensions     = "moflex",
-    .flags          = AVFMT_GENERIC_INDEX,
     .flags_internal = FF_FMT_INIT_CLEANUP,
 };
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 42b0135987..f8c0fe9151 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -9641,17 +9641,17 @@ static const AVClass mov_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_mov_demuxer = {
-    .name           = "mov,mp4,m4a,3gp,3g2,mj2",
-    .long_name      = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
-    .priv_class     = &mov_class,
+const FFInputFormat ff_mov_demuxer = {
+    .p.name         = "mov,mp4,m4a,3gp,3g2,mj2",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("QuickTime / MOV"),
+    .p.priv_class   = &mov_class,
+    .p.extensions   = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v,avif,heic,heif",
+    .p.flags        = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS | AVFMT_SHOW_IDS,
     .priv_data_size = sizeof(MOVContext),
-    .extensions     = "mov,mp4,m4a,3gp,3g2,mj2,psp,m4b,ism,ismv,isma,f4v,avif,heic,heif",
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = mov_probe,
     .read_header    = mov_read_header,
     .read_packet    = mov_read_packet,
     .read_close     = mov_read_close,
     .read_seek      = mov_read_seek,
-    .flags          = AVFMT_NO_BYTE_SEEK | AVFMT_SEEK_TO_PTS | AVFMT_SHOW_IDS,
 };
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 05c13228bc..ec6cf567bc 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -610,15 +610,15 @@ static const AVClass demuxer_class = {
     .category   = AV_CLASS_CATEGORY_DEMUXER,
 };
 
-const AVInputFormat ff_mp3_demuxer = {
-    .name           = "mp3",
-    .long_name      = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"),
+const FFInputFormat ff_mp3_demuxer = {
+    .p.name         = "mp3",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "mp2,mp3,m2a,mpa", /* XXX: use probe */
+    .p.priv_class   = &demuxer_class,
     .read_probe     = mp3_read_probe,
     .read_header    = mp3_read_header,
     .read_packet    = mp3_read_packet,
     .read_seek      = mp3_seek,
     .priv_data_size = sizeof(MP3DecContext),
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "mp2,mp3,m2a,mpa", /* XXX: use probe */
-    .priv_class     = &demuxer_class,
 };
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index ef16237ab6..89130d5a7e 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -219,13 +219,13 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
 }
 
 
-const AVInputFormat ff_mpc_demuxer = {
-    .name           = "mpc",
-    .long_name      = NULL_IF_CONFIG_SMALL("Musepack"),
+const FFInputFormat ff_mpc_demuxer = {
+    .p.name         = "mpc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Musepack"),
+    .p.extensions   = "mpc",
     .priv_data_size = sizeof(MPCContext),
     .read_probe     = mpc_probe,
     .read_header    = mpc_read_header,
     .read_packet    = mpc_read_packet,
     .read_seek      = mpc_read_seek,
-    .extensions     = "mpc",
 };
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 95a1529c5d..42a34a3255 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -348,9 +348,9 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
 }
 
 
-const AVInputFormat ff_mpc8_demuxer = {
-    .name           = "mpc8",
-    .long_name      = NULL_IF_CONFIG_SMALL("Musepack SV8"),
+const FFInputFormat ff_mpc8_demuxer = {
+    .p.name         = "mpc8",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Musepack SV8"),
     .priv_data_size = sizeof(MPCContext),
     .read_probe     = mpc8_probe,
     .read_header    = mpc8_read_header,
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index a0f2c6da05..8399ad7062 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -692,15 +692,15 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
     return dts;
 }
 
-const AVInputFormat ff_mpegps_demuxer = {
-    .name           = "mpeg",
-    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-PS (MPEG-2 Program Stream)"),
+const FFInputFormat ff_mpegps_demuxer = {
+    .p.name         = "mpeg",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MPEG-PS (MPEG-2 Program Stream)"),
+    .p.flags        = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
     .priv_data_size = sizeof(MpegDemuxContext),
     .read_probe     = mpegps_probe,
     .read_header    = mpegps_read_header,
     .read_packet    = mpegps_read_packet,
     .read_timestamp = mpegps_read_dts,
-    .flags          = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
 };
 
 #if CONFIG_VOBSUB_DEMUXER
@@ -1048,9 +1048,12 @@ static const AVClass vobsub_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_vobsub_demuxer = {
-    .name           = "vobsub",
-    .long_name      = NULL_IF_CONFIG_SMALL("VobSub subtitle format"),
+const FFInputFormat ff_vobsub_demuxer = {
+    .p.name         = "vobsub",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("VobSub subtitle format"),
+    .p.flags        = AVFMT_SHOW_IDS,
+    .p.extensions   = "idx",
+    .p.priv_class   = &vobsub_demuxer_class,
     .priv_data_size = sizeof(VobSubDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = vobsub_probe,
@@ -1058,8 +1061,5 @@ const AVInputFormat ff_vobsub_demuxer = {
     .read_packet    = vobsub_read_packet,
     .read_seek2     = vobsub_read_seek,
     .read_close     = vobsub_read_close,
-    .flags          = AVFMT_SHOW_IDS,
-    .extensions     = "idx",
-    .priv_class     = &vobsub_demuxer_class,
 };
 #endif
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 1cf390e98e..401e2cbb78 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -272,7 +272,7 @@ typedef struct PESContext {
     int merged_st;
 } PESContext;
 
-extern const AVInputFormat ff_mpegts_demuxer;
+extern const FFInputFormat ff_mpegts_demuxer;
 
 static struct Program * get_program(MpegTSContext *ts, unsigned int programid)
 {
@@ -3117,7 +3117,7 @@ static int mpegts_read_header(AVFormatContext *s)
     ts->stream     = s;
     ts->auto_guess = 0;
 
-    if (s->iformat == &ff_mpegts_demuxer) {
+    if (s->iformat == &ff_mpegts_demuxer.p) {
         /* normal demux */
 
         /* first do a scan to get all the services */
@@ -3425,27 +3425,27 @@ void avpriv_mpegts_parse_close(MpegTSContext *ts)
     av_free(ts);
 }
 
-const AVInputFormat ff_mpegts_demuxer = {
-    .name           = "mpegts",
-    .long_name      = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"),
+const FFInputFormat ff_mpegts_demuxer = {
+    .p.name         = "mpegts",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"),
+    .p.flags        = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
+    .p.priv_class   = &mpegts_class,
     .priv_data_size = sizeof(MpegTSContext),
     .read_probe     = mpegts_probe,
     .read_header    = mpegts_read_header,
     .read_packet    = mpegts_read_packet,
     .read_close     = mpegts_read_close,
     .read_timestamp = mpegts_get_dts,
-    .flags          = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
-    .priv_class     = &mpegts_class,
 };
 
-const AVInputFormat ff_mpegtsraw_demuxer = {
-    .name           = "mpegtsraw",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw MPEG-TS (MPEG-2 Transport Stream)"),
+const FFInputFormat ff_mpegtsraw_demuxer = {
+    .p.name         = "mpegtsraw",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw MPEG-TS (MPEG-2 Transport Stream)"),
+    .p.flags        = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
+    .p.priv_class   = &mpegtsraw_class,
     .priv_data_size = sizeof(MpegTSContext),
     .read_header    = mpegts_read_header,
     .read_packet    = mpegts_raw_read_packet,
     .read_close     = mpegts_read_close,
     .read_timestamp = mpegts_get_dts,
-    .flags          = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
-    .priv_class     = &mpegtsraw_class,
 };
diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index 236aed716a..e20c61be9b 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -23,6 +23,7 @@
 #include "libavutil/opt.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -368,16 +369,16 @@ static const AVClass mpjpeg_demuxer_class = {
     .version        = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_mpjpeg_demuxer = {
-    .name              = "mpjpeg",
-    .long_name         = NULL_IF_CONFIG_SMALL("MIME multipart JPEG"),
-    .mime_type         = "multipart/x-mixed-replace",
-    .extensions        = "mjpg",
+const FFInputFormat ff_mpjpeg_demuxer = {
+    .p.name            = "mpjpeg",
+    .p.long_name       = NULL_IF_CONFIG_SMALL("MIME multipart JPEG"),
+    .p.mime_type       = "multipart/x-mixed-replace",
+    .p.extensions      = "mjpg",
+    .p.priv_class      = &mpjpeg_demuxer_class,
+    .p.flags           = AVFMT_NOTIMESTAMPS,
     .priv_data_size    = sizeof(MPJPEGDemuxContext),
     .read_probe        = mpjpeg_read_probe,
     .read_header       = mpjpeg_read_header,
     .read_packet       = mpjpeg_read_packet,
     .read_close        = mpjpeg_read_close,
-    .priv_class        = &mpjpeg_demuxer_class,
-    .flags             = AVFMT_NOTIMESTAMPS,
 };
diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c
index 912a707d1a..6c3dba2d8f 100644
--- a/libavformat/mpl2dec.c
+++ b/libavformat/mpl2dec.c
@@ -26,6 +26,7 @@
 #include "libavutil/intreadwrite.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 
@@ -122,14 +123,14 @@ static int mpl2_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_mpl2_demuxer = {
-    .name           = "mpl2",
-    .long_name      = NULL_IF_CONFIG_SMALL("MPL2 subtitles"),
+const FFInputFormat ff_mpl2_demuxer = {
+    .p.name         = "mpl2",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MPL2 subtitles"),
+    .p.extensions   = "txt,mpl2",
     .priv_data_size = sizeof(MPL2Context),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = mpl2_probe,
     .read_header    = mpl2_read_header,
-    .extensions     = "txt,mpl2",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c
index 0374563575..b5abe296f1 100644
--- a/libavformat/mpsubdec.c
+++ b/libavformat/mpsubdec.c
@@ -24,6 +24,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 
@@ -170,14 +171,14 @@ end:
     return res;
 }
 
-const AVInputFormat ff_mpsub_demuxer = {
-    .name           = "mpsub",
-    .long_name      = NULL_IF_CONFIG_SMALL("MPlayer subtitles"),
+const FFInputFormat ff_mpsub_demuxer = {
+    .p.name         = "mpsub",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MPlayer subtitles"),
+    .p.extensions   = "sub",
     .priv_data_size = sizeof(MPSubContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = mpsub_probe,
     .read_header    = mpsub_read_header,
-    .extensions     = "sub",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/msf.c b/libavformat/msf.c
index 354758971a..37e05b538b 100644
--- a/libavformat/msf.c
+++ b/libavformat/msf.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int msf_probe(const AVProbeData *p)
@@ -103,11 +104,11 @@ static int msf_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align ? par->block_align : 1024 * par->ch_layout.nb_channels);
 }
 
-const AVInputFormat ff_msf_demuxer = {
-    .name           = "msf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony PS3 MSF"),
+const FFInputFormat ff_msf_demuxer = {
+    .p.name         = "msf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony PS3 MSF"),
+    .p.extensions   = "msf",
     .read_probe     = msf_probe,
     .read_header    = msf_read_header,
     .read_packet    = msf_read_packet,
-    .extensions     = "msf",
 };
diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index 95d4e2bd33..c0b775e0e5 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -20,6 +20,7 @@
 
 #include "libavcodec/bytestream.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define HEADER_SIZE         24
@@ -136,9 +137,9 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
     return HEADER_SIZE + size;
 }
 
-const AVInputFormat ff_msnwc_tcp_demuxer = {
-    .name        = "msnwctcp",
-    .long_name   = NULL_IF_CONFIG_SMALL("MSN TCP Webcam stream"),
+const FFInputFormat ff_msnwc_tcp_demuxer = {
+    .p.name      = "msnwctcp",
+    .p.long_name = NULL_IF_CONFIG_SMALL("MSN TCP Webcam stream"),
     .read_probe  = msnwc_tcp_probe,
     .read_header = msnwc_tcp_read_header,
     .read_packet = msnwc_tcp_read_packet,
diff --git a/libavformat/mspdec.c b/libavformat/mspdec.c
index 44854e99c2..6b3926f4cd 100644
--- a/libavformat/mspdec.c
+++ b/libavformat/mspdec.c
@@ -27,6 +27,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/imgutils.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct {
@@ -106,12 +107,12 @@ static int msp_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_msp_demuxer = {
-    .name         = "msp",
-    .long_name    = NULL_IF_CONFIG_SMALL("Microsoft Paint (MSP))"),
+const FFInputFormat ff_msp_demuxer = {
+    .p.name       = "msp",
+    .p.long_name  = NULL_IF_CONFIG_SMALL("Microsoft Paint (MSP))"),
+    .p.flags      = AVFMT_NOTIMESTAMPS,
     .read_probe   = msp_probe,
     .read_header  = msp_read_header,
     .read_packet  = msp_read_packet,
-    .flags        = AVFMT_NOTIMESTAMPS,
     .priv_data_size = sizeof(MSPContext),
 };
diff --git a/libavformat/mtaf.c b/libavformat/mtaf.c
index 954ffaa8ba..251da54963 100644
--- a/libavformat/mtaf.c
+++ b/libavformat/mtaf.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int mtaf_probe(const AVProbeData *p)
@@ -71,11 +72,11 @@ static int mtaf_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align);
 }
 
-const AVInputFormat ff_mtaf_demuxer = {
-    .name           = "mtaf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Konami PS2 MTAF"),
+const FFInputFormat ff_mtaf_demuxer = {
+    .p.name         = "mtaf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Konami PS2 MTAF"),
+    .p.extensions   = "mtaf",
     .read_probe     = mtaf_probe,
     .read_header    = mtaf_read_header,
     .read_packet    = mtaf_read_packet,
-    .extensions     = "mtaf",
 };
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index b6ed43d444..9f52cb6c67 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -27,6 +27,7 @@
 #include "libavutil/bswap.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define MTV_ASUBCHUNK_DATA_SIZE 500
@@ -225,9 +226,9 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_mtv_demuxer = {
-    .name           = "mtv",
-    .long_name      = NULL_IF_CONFIG_SMALL("MTV"),
+const FFInputFormat ff_mtv_demuxer = {
+    .p.name         = "mtv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MTV"),
     .priv_data_size = sizeof(MTVDemuxContext),
     .read_probe     = mtv_probe,
     .read_header    = mtv_read_header,
diff --git a/libavformat/musx.c b/libavformat/musx.c
index 5bf793f882..c87ee3c4ec 100644
--- a/libavformat/musx.c
+++ b/libavformat/musx.c
@@ -22,6 +22,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int musx_probe(const AVProbeData *p)
@@ -178,11 +179,11 @@ static int musx_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align);
 }
 
-const AVInputFormat ff_musx_demuxer = {
-    .name           = "musx",
-    .long_name      = NULL_IF_CONFIG_SMALL("Eurocom MUSX"),
+const FFInputFormat ff_musx_demuxer = {
+    .p.name         = "musx",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Eurocom MUSX"),
+    .p.extensions   = "musx",
     .read_probe     = musx_probe,
     .read_header    = musx_read_header,
     .read_packet    = musx_read_packet,
-    .extensions     = "musx",
 };
diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index b37fe2ce69..31640f7590 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -31,6 +31,7 @@
 #include "libavutil/rational.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct MvContext {
@@ -539,9 +540,9 @@ static int mv_read_seek(AVFormatContext *avctx, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_mv_demuxer = {
-    .name           = "mv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Silicon Graphics Movie"),
+const FFInputFormat ff_mv_demuxer = {
+    .p.name         = "mv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Silicon Graphics Movie"),
     .priv_data_size = sizeof(MvContext),
     .read_probe     = mv_probe,
     .read_header    = mv_read_header,
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index b2d6a92a4b..05aa25f348 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -23,6 +23,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define MVI_FRAC_BITS 10
@@ -142,11 +143,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_mvi_demuxer = {
-    .name           = "mvi",
-    .long_name      = NULL_IF_CONFIG_SMALL("Motion Pixels MVI"),
+const FFInputFormat ff_mvi_demuxer = {
+    .p.name         = "mvi",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Motion Pixels MVI"),
+    .p.extensions   = "mvi",
     .priv_data_size = sizeof(MviDemuxContext),
     .read_header    = read_header,
     .read_packet    = read_packet,
-    .extensions     = "mvi",
 };
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index e42975e7fd..a0e53b8ef5 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -4314,10 +4314,11 @@ static const AVClass demuxer_class = {
     .category   = AV_CLASS_CATEGORY_DEMUXER,
 };
 
-const AVInputFormat ff_mxf_demuxer = {
-    .name           = "mxf",
-    .long_name      = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"),
-    .flags          = AVFMT_SEEK_TO_PTS,
+const FFInputFormat ff_mxf_demuxer = {
+    .p.name         = "mxf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MXF (Material eXchange Format)"),
+    .p.flags        = AVFMT_SEEK_TO_PTS,
+    .p.priv_class   = &demuxer_class,
     .priv_data_size = sizeof(MXFContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = mxf_probe,
@@ -4325,5 +4326,4 @@ const AVInputFormat ff_mxf_demuxer = {
     .read_packet    = mxf_read_packet,
     .read_close     = mxf_read_close,
     .read_seek      = mxf_read_seek,
-    .priv_class     = &demuxer_class,
 };
diff --git a/libavformat/mxg.c b/libavformat/mxg.c
index b160ccb9f9..23d72ad23b 100644
--- a/libavformat/mxg.c
+++ b/libavformat/mxg.c
@@ -24,6 +24,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/mjpeg.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio.h"
 
@@ -248,12 +249,12 @@ static int mxg_close(struct AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_mxg_demuxer = {
-    .name           = "mxg",
-    .long_name      = NULL_IF_CONFIG_SMALL("MxPEG clip"),
+const FFInputFormat ff_mxg_demuxer = {
+    .p.name         = "mxg",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MxPEG clip"),
+    .p.extensions   = "mxg",
     .priv_data_size = sizeof(MXGContext),
     .read_header    = mxg_read_header,
     .read_packet    = mxg_read_packet,
     .read_close     = mxg_close,
-    .extensions     = "mxg",
 };
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
index b2f4dfe282..050d98bf5d 100644
--- a/libavformat/ncdec.c
+++ b/libavformat/ncdec.c
@@ -22,6 +22,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define NC_VIDEO_FLAG 0x1A5
@@ -90,11 +91,11 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
     return size;
 }
 
-const AVInputFormat ff_nc_demuxer = {
-    .name           = "nc",
-    .long_name      = NULL_IF_CONFIG_SMALL("NC camera feed"),
+const FFInputFormat ff_nc_demuxer = {
+    .p.name         = "nc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("NC camera feed"),
+    .p.extensions   = "v",
     .read_probe     = nc_probe,
     .read_header    = nc_read_header,
     .read_packet    = nc_read_packet,
-    .extensions     = "v",
 };
diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
index 85aa5e2cbf..1e6c567e01 100644
--- a/libavformat/nistspheredec.c
+++ b/libavformat/nistspheredec.c
@@ -22,6 +22,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -133,13 +134,13 @@ static int nist_read_header(AVFormatContext *s)
     return AVERROR_EOF;
 }
 
-const AVInputFormat ff_nistsphere_demuxer = {
-    .name           = "nistsphere",
-    .long_name      = NULL_IF_CONFIG_SMALL("NIST SPeech HEader REsources"),
+const FFInputFormat ff_nistsphere_demuxer = {
+    .p.name         = "nistsphere",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("NIST SPeech HEader REsources"),
+    .p.extensions   = "nist,sph",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = nist_probe,
     .read_header    = nist_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "nist,sph",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/nspdec.c b/libavformat/nspdec.c
index 923432ac92..bb605426f6 100644
--- a/libavformat/nspdec.c
+++ b/libavformat/nspdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -96,13 +97,13 @@ static int nsp_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_nsp_demuxer = {
-    .name           = "nsp",
-    .long_name      = NULL_IF_CONFIG_SMALL("Computerized Speech Lab NSP"),
+const FFInputFormat ff_nsp_demuxer = {
+    .p.name         = "nsp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Computerized Speech Lab NSP"),
+    .p.extensions   = "nsp",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = nsp_probe,
     .read_header    = nsp_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "nsp",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index b28576ea11..d6a39730cc 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -24,6 +24,7 @@
 #include "libavutil/attributes.h"
 #include "libavutil/mathematics.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/dict.h"
 #include "libavutil/intreadwrite.h"
@@ -747,9 +748,9 @@ static int nsv_probe(const AVProbeData *p)
     return score;
 }
 
-const AVInputFormat ff_nsv_demuxer = {
-    .name           = "nsv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Nullsoft Streaming Video"),
+const FFInputFormat ff_nsv_demuxer = {
+    .p.name         = "nsv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Nullsoft Streaming Video"),
     .priv_data_size = sizeof(NSVContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = nsv_probe,
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index e2b39ccffb..670964fab3 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -1306,10 +1306,12 @@ static int read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_nut_demuxer = {
-    .name           = "nut",
-    .long_name      = NULL_IF_CONFIG_SMALL("NUT"),
-    .flags          = AVFMT_SEEK_TO_PTS,
+const FFInputFormat ff_nut_demuxer = {
+    .p.name         = "nut",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("NUT"),
+    .p.flags        = AVFMT_SEEK_TO_PTS,
+    .p.extensions   = "nut",
+    .p.codec_tag    = ff_nut_codec_tags,
     .priv_data_size = sizeof(NUTContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = nut_probe,
@@ -1317,6 +1319,4 @@ const AVInputFormat ff_nut_demuxer = {
     .read_packet    = nut_read_packet,
     .read_close     = nut_read_close,
     .read_seek      = read_seek,
-    .extensions     = "nut",
-    .codec_tag      = ff_nut_codec_tags,
 };
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 12c6c691ee..507a73b0fe 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -396,13 +396,13 @@ static int64_t nuv_read_dts(AVFormatContext *s, int stream_index,
 }
 
 
-const AVInputFormat ff_nuv_demuxer = {
-    .name           = "nuv",
-    .long_name      = NULL_IF_CONFIG_SMALL("NuppelVideo"),
+const FFInputFormat ff_nuv_demuxer = {
+    .p.name         = "nuv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("NuppelVideo"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(NUVContext),
     .read_probe     = nuv_probe,
     .read_header    = nuv_header,
     .read_packet    = nuv_packet,
     .read_timestamp = nuv_read_dts,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 3b19e0bd89..e473683aeb 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -960,9 +960,11 @@ static int ogg_probe(const AVProbeData *p)
     return 0;
 }
 
-const AVInputFormat ff_ogg_demuxer = {
-    .name           = "ogg",
-    .long_name      = NULL_IF_CONFIG_SMALL("Ogg"),
+const FFInputFormat ff_ogg_demuxer = {
+    .p.name         = "ogg",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Ogg"),
+    .p.extensions   = "ogg",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_TS_DISCONT | AVFMT_NOBINSEARCH,
     .priv_data_size = sizeof(struct ogg),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = ogg_probe,
@@ -971,6 +973,4 @@ const AVInputFormat ff_ogg_demuxer = {
     .read_close     = ogg_read_close,
     .read_seek      = ogg_read_seek,
     .read_timestamp = ogg_read_timestamp,
-    .extensions     = "ogg",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_TS_DISCONT | AVFMT_NOBINSEARCH,
 };
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index 066b2d85bd..f4bd6fb964 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -44,6 +44,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/des.h"
@@ -607,9 +608,12 @@ wipe:
     return err;
 }
 
-const AVInputFormat ff_oma_demuxer = {
-    .name           = "oma",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
+const FFInputFormat ff_oma_demuxer = {
+    .p.name         = "oma",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "oma,omg,aa3",
+    .p.codec_tag    = ff_oma_codec_tags_list,
     .priv_data_size = sizeof(OMAContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = oma_read_probe,
@@ -617,7 +621,4 @@ const AVInputFormat ff_oma_demuxer = {
     .read_packet    = oma_read_packet,
     .read_seek      = oma_read_seek,
     .read_close     = oma_read_close,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "oma,omg,aa3",
-    .codec_tag      = ff_oma_codec_tags_list,
 };
diff --git a/libavformat/osq.c b/libavformat/osq.c
index c5a63d3398..9e9dbfdbe1 100644
--- a/libavformat/osq.c
+++ b/libavformat/osq.c
@@ -104,15 +104,15 @@ static int osq_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_osq_demuxer = {
-    .name           = "osq",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw OSQ"),
+const FFInputFormat ff_osq_demuxer = {
+    .p.name         = "osq",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw OSQ"),
+    .p.extensions   = "osq",
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = osq_probe,
     .read_header    = osq_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .extensions     = "osq",
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
     .raw_codec_id   = AV_CODEC_ID_OSQ,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/paf.c b/libavformat/paf.c
index d48cf57645..c99acbd3e7 100644
--- a/libavformat/paf.c
+++ b/libavformat/paf.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavcodec/paf.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define MAGIC "Packed Animation File V1.0\n(c) 1992-96 Amazing Studio\x0a\x1a"
@@ -265,9 +266,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     return pkt->size;
 }
 
-const AVInputFormat ff_paf_demuxer = {
-    .name           = "paf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File"),
+const FFInputFormat ff_paf_demuxer = {
+    .p.name         = "paf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File"),
     .priv_data_size = sizeof(PAFDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = read_probe,
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 377e6d80a1..e9c97f7959 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -24,6 +24,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 #include "libavutil/log.h"
@@ -50,7 +51,7 @@ static int pcm_read_header(AVFormatContext *s)
     par = st->codecpar;
 
     par->codec_type  = AVMEDIA_TYPE_AUDIO;
-    par->codec_id    = s->iformat->raw_codec_id;
+    par->codec_id    = ffifmt(s->iformat)->raw_codec_id;
     par->sample_rate = s1->sample_rate;
     ret = av_channel_layout_copy(&par->ch_layout, &s1->ch_layout);
     if (ret < 0)
@@ -116,17 +117,17 @@ static const AVClass pcm_demuxer_class = {
 
 #define PCMDEF_0(name_, long_name_, ext, codec, ...)
 #define PCMDEF_1(name_, long_name_, ext, codec, ...)        \
-const AVInputFormat ff_pcm_ ## name_ ## _demuxer = {        \
-    .name           = #name_,                               \
-    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
+const FFInputFormat ff_pcm_ ## name_ ## _demuxer = {        \
+    .p.name         = #name_,                               \
+    .p.long_name    = NULL_IF_CONFIG_SMALL(long_name_),     \
+    .p.flags        = AVFMT_GENERIC_INDEX,                  \
+    .p.extensions   = ext,                                  \
+    .p.priv_class   = &pcm_demuxer_class,                   \
     .priv_data_size = sizeof(PCMAudioDemuxerContext),       \
     .read_header    = pcm_read_header,                      \
     .read_packet    = ff_pcm_read_packet,                   \
     .read_seek      = ff_pcm_read_seek,                     \
-    .flags          = AVFMT_GENERIC_INDEX,                  \
-    .extensions     = ext,                                  \
     .raw_codec_id   = codec,                                \
-    .priv_class     = &pcm_demuxer_class,                   \
     __VA_ARGS__                                             \
 };
 #define PCMDEF_2(name, long_name, ext, codec, enabled, ...) \
@@ -148,7 +149,7 @@ PCMDEF(s32le, "PCM signed 32-bit little-endian",                NULL, S32LE)
 PCMDEF(s24be, "PCM signed 24-bit big-endian",                   NULL, S24BE)
 PCMDEF(s24le, "PCM signed 24-bit little-endian",                NULL, S24LE)
 PCMDEF_EXT(s16be, "PCM signed 16-bit big-endian",
-           AV_NE("sw", NULL), S16BE, .mime_type = "audio/L16")
+           AV_NE("sw", NULL), S16BE, .p.mime_type = "audio/L16")
 PCMDEF(s16le, "PCM signed 16-bit little-endian",   AV_NE(NULL, "sw"), S16LE)
 PCMDEF(s8,    "PCM signed 8-bit",                               "sb",    S8)
 PCMDEF(u32be, "PCM unsigned 32-bit big-endian",                 NULL, U32BE)
@@ -176,16 +177,16 @@ static const AVClass sln_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_sln_demuxer = {
-    .name           = "sln",
-    .long_name      = NULL_IF_CONFIG_SMALL("Asterisk raw pcm"),
+const FFInputFormat ff_sln_demuxer = {
+    .p.name         = "sln",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Asterisk raw pcm"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "sln",
+    .p.priv_class   = &sln_demuxer_class,
     .priv_data_size = sizeof(PCMAudioDemuxerContext),
     .read_header    = pcm_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "sln",
     .raw_codec_id   = AV_CODEC_ID_PCM_S16LE,
-    .priv_class     = &sln_demuxer_class,
 };
 #endif
diff --git a/libavformat/pdvdec.c b/libavformat/pdvdec.c
index 9d3f386e40..79e09bd9d4 100644
--- a/libavformat/pdvdec.c
+++ b/libavformat/pdvdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define PDV_MAGIC "Playdate VID\x00\x00\x00\x00"
@@ -159,9 +160,10 @@ static int pdv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-const AVInputFormat ff_pdv_demuxer = {
-    .name           = "pdv",
-    .long_name      = NULL_IF_CONFIG_SMALL("PlayDate Video"),
+const FFInputFormat ff_pdv_demuxer = {
+    .p.name         = "pdv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("PlayDate Video"),
+    .p.extensions   = "pdv",
     .priv_data_size = sizeof(PDVDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = pdv_probe,
@@ -169,5 +171,4 @@ const AVInputFormat ff_pdv_demuxer = {
     .read_packet    = pdv_read_packet,
     .read_close     = pdv_read_close,
     .read_seek      = pdv_read_seek,
-    .extensions     = "pdv",
 };
diff --git a/libavformat/pjsdec.c b/libavformat/pjsdec.c
index 5b2111f726..22ddea3596 100644
--- a/libavformat/pjsdec.c
+++ b/libavformat/pjsdec.c
@@ -26,6 +26,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 
@@ -105,14 +106,14 @@ static int pjs_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_pjs_demuxer = {
-    .name           = "pjs",
-    .long_name      = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitles"),
+const FFInputFormat ff_pjs_demuxer = {
+    .p.name         = "pjs",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitles"),
+    .p.extensions   = "pjs",
     .priv_data_size = sizeof(PJSContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = pjs_probe,
     .read_header    = pjs_read_header,
-    .extensions     = "pjs",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
index 554f1a776d..06ef53d277 100644
--- a/libavformat/pmpdec.c
+++ b/libavformat/pmpdec.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct {
@@ -183,9 +184,9 @@ static int pmp_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_pmp_demuxer = {
-    .name           = "pmp",
-    .long_name      = NULL_IF_CONFIG_SMALL("Playstation Portable PMP"),
+const FFInputFormat ff_pmp_demuxer = {
+    .p.name         = "pmp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Playstation Portable PMP"),
     .priv_data_size = sizeof(PMPContext),
     .read_probe     = pmp_probe,
     .read_header    = pmp_header,
diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c
index c4172e2260..d545694bef 100644
--- a/libavformat/pp_bnk.c
+++ b/libavformat/pp_bnk.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/avassert.h"
@@ -315,9 +316,9 @@ static int pp_bnk_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_pp_bnk_demuxer = {
-    .name           = "pp_bnk",
-    .long_name      = NULL_IF_CONFIG_SMALL("Pro Pinball Series Soundbank"),
+const FFInputFormat ff_pp_bnk_demuxer = {
+    .p.name         = "pp_bnk",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Pro Pinball Series Soundbank"),
     .priv_data_size = sizeof(PPBnkCtx),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = pp_bnk_probe,
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 009699e288..0dd4e8d377 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -33,6 +33,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
@@ -302,13 +303,13 @@ static int str_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_str_demuxer = {
-    .name           = "psxstr",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony Playstation STR"),
+const FFInputFormat ff_str_demuxer = {
+    .p.name         = "psxstr",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony Playstation STR"),
+    .p.flags        = AVFMT_NO_BYTE_SEEK,
     .priv_data_size = sizeof(StrDemuxContext),
     .read_probe     = str_probe,
     .read_header    = str_read_header,
     .read_packet    = str_read_packet,
     .read_close     = str_read_close,
-    .flags          = AVFMT_NO_BYTE_SEEK,
 };
diff --git a/libavformat/pva.c b/libavformat/pva.c
index da54b30bfc..047c93c9c4 100644
--- a/libavformat/pva.c
+++ b/libavformat/pva.c
@@ -21,6 +21,7 @@
 
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "mpeg.h"
 
@@ -228,9 +229,9 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
     return res;
 }
 
-const AVInputFormat ff_pva_demuxer = {
-    .name           = "pva",
-    .long_name      = NULL_IF_CONFIG_SMALL("TechnoTrend PVA"),
+const FFInputFormat ff_pva_demuxer = {
+    .p.name         = "pva",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("TechnoTrend PVA"),
     .priv_data_size = sizeof(PVAContext),
     .read_probe     = pva_probe,
     .read_header    = pva_read_header,
diff --git a/libavformat/pvfdec.c b/libavformat/pvfdec.c
index 62c169a314..aaf60a853e 100644
--- a/libavformat/pvfdec.c
+++ b/libavformat/pvfdec.c
@@ -21,6 +21,7 @@
 
 #include "libavcodec/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -65,13 +66,13 @@ static int pvf_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_pvf_demuxer = {
-    .name           = "pvf",
-    .long_name      = NULL_IF_CONFIG_SMALL("PVF (Portable Voice Format)"),
+const FFInputFormat ff_pvf_demuxer = {
+    .p.name         = "pvf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("PVF (Portable Voice Format)"),
+    .p.extensions   = "pvf",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = pvf_probe,
     .read_header    = pvf_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "pvf",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/qcp.c b/libavformat/qcp.c
index 8d80b726a5..fdf18618d2 100644
--- a/libavformat/qcp.c
+++ b/libavformat/qcp.c
@@ -30,6 +30,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "riff.h"
 
 typedef struct QCPContext {
@@ -195,9 +196,9 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
     return AVERROR_EOF;
 }
 
-const AVInputFormat ff_qcp_demuxer = {
-    .name           = "qcp",
-    .long_name      = NULL_IF_CONFIG_SMALL("QCP"),
+const FFInputFormat ff_qcp_demuxer = {
+    .p.name         = "qcp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("QCP"),
     .priv_data_size = sizeof(QCPContext),
     .read_probe     = qcp_probe,
     .read_header    = qcp_read_header,
diff --git a/libavformat/qoadec.c b/libavformat/qoadec.c
index acf7c02741..9cce5157fc 100644
--- a/libavformat/qoadec.c
+++ b/libavformat/qoadec.c
@@ -20,6 +20,7 @@
 
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 
@@ -99,12 +100,12 @@ static int qoa_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_qoa_demuxer = {
-    .name           = "qoa",
-    .long_name      = NULL_IF_CONFIG_SMALL("QOA"),
+const FFInputFormat ff_qoa_demuxer = {
+    .p.name         = "qoa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("QOA"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "qoa",
     .read_probe     = qoa_probe,
     .read_header    = qoa_read_header,
     .read_packet    = qoa_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "qoa",
 };
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index be119b6b74..c83399b8fc 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -23,6 +23,7 @@
 #include "libavutil/dict.h"
 #include "libavutil/mathematics.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct R3DContext {
@@ -401,9 +402,9 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
     return 0;
 }
 
-const AVInputFormat ff_r3d_demuxer = {
-    .name           = "r3d",
-    .long_name      = NULL_IF_CONFIG_SMALL("REDCODE R3D"),
+const FFInputFormat ff_r3d_demuxer = {
+    .p.name         = "r3d",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("REDCODE R3D"),
     .priv_data_size = sizeof(R3DContext),
     .read_probe     = r3d_probe,
     .read_header    = r3d_read_header,
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 1dd7fafcf0..d0c829dc42 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -23,6 +23,7 @@
 #include "config_components.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "rawdec.h"
 #include "libavutil/opt.h"
@@ -56,7 +57,7 @@ int ff_raw_audio_read_header(AVFormatContext *s)
     if (!st)
         return AVERROR(ENOMEM);
     st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codecpar->codec_id = s->iformat->raw_codec_id;
+    st->codecpar->codec_id = ffifmt(s->iformat)->raw_codec_id;
     ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
     st->start_time = 0;
     /* the parameters will be extracted from the compressed bitstream */
@@ -81,7 +82,7 @@ int ff_raw_video_read_header(AVFormatContext *s)
     sti = ffstream(st);
 
     st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codecpar->codec_id = s->iformat->raw_codec_id;
+    st->codecpar->codec_id = ffifmt(s->iformat)->raw_codec_id;
     sti->need_parsing = AVSTREAM_PARSE_FULL_RAW;
 
     st->avg_frame_rate = s1->framerate;
@@ -97,7 +98,7 @@ int ff_raw_subtitle_read_header(AVFormatContext *s)
     if (!st)
         return AVERROR(ENOMEM);
     st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
-    st->codecpar->codec_id = s->iformat->raw_codec_id;
+    st->codecpar->codec_id = ffifmt(s->iformat)->raw_codec_id;
     st->start_time = 0;
     return 0;
 }
@@ -108,7 +109,7 @@ static int raw_data_read_header(AVFormatContext *s)
     if (!st)
         return AVERROR(ENOMEM);
     st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
-    st->codecpar->codec_id = s->iformat->raw_codec_id;
+    st->codecpar->codec_id = ffifmt(s->iformat)->raw_codec_id;
     st->start_time = 0;
     return 0;
 }
@@ -145,15 +146,15 @@ const AVClass ff_raw_demuxer_class = {
 };
 
 #if CONFIG_DATA_DEMUXER
-const AVInputFormat ff_data_demuxer = {
-    .name           = "data",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw data"),
+const FFInputFormat ff_data_demuxer = {
+    .p.name         = "data",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw data"),
+    .p.flags        = AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_header    = raw_data_read_header,
     .read_packet    = ff_raw_read_partial_packet,
     .raw_codec_id   = AV_CODEC_ID_NONE,
-    .flags          = AVFMT_NOTIMESTAMPS,
     .priv_data_size = sizeof(FFRawDemuxerContext),\
-    .priv_class     = &ff_raw_demuxer_class,
 };
 #endif
 
diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h
index 91d0b659af..2773b1a72b 100644
--- a/libavformat/rawdec.h
+++ b/libavformat/rawdec.h
@@ -23,6 +23,7 @@
 #define AVFORMAT_RAWDEC_H
 
 #include "avformat.h"
+#include "demux.h"
 #include "libavutil/log.h"
 
 typedef struct FFRawVideoDemuxerContext {
@@ -50,34 +51,34 @@ int ff_raw_video_read_header(AVFormatContext *s);
 int ff_raw_subtitle_read_header(AVFormatContext *s);
 
 #define FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, flag)\
-const AVInputFormat ff_ ## shortname ## _demuxer = {\
-    .name           = #shortname,\
-    .long_name      = NULL_IF_CONFIG_SMALL(longname),\
+const FFInputFormat ff_ ## shortname ## _demuxer = {\
+    .p.name         = #shortname,\
+    .p.long_name    = NULL_IF_CONFIG_SMALL(longname),\
+    .p.extensions   = ext,\
+    .p.flags        = flag | AVFMT_NOTIMESTAMPS,\
+    .p.priv_class   = &ff_rawvideo_demuxer_class,\
     .read_probe     = probe,\
     .read_header    = ff_raw_video_read_header,\
     .read_packet    = ff_raw_read_partial_packet,\
-    .extensions     = ext,\
-    .flags          = flag | AVFMT_NOTIMESTAMPS,\
     .raw_codec_id   = id,\
     .priv_data_size = sizeof(FFRawVideoDemuxerContext),\
-    .priv_class     = &ff_rawvideo_demuxer_class,\
 };
 
 #define FF_DEF_RAWVIDEO_DEMUXER(shortname, longname, probe, ext, id)\
 FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, AVFMT_GENERIC_INDEX)
 
 #define FF_DEF_RAWSUB_DEMUXER(shortname, longname, probe, ext, id, flag)\
-const AVInputFormat ff_ ## shortname ## _demuxer = {\
-    .name           = #shortname,\
-    .long_name      = NULL_IF_CONFIG_SMALL(longname),\
+const FFInputFormat ff_ ## shortname ## _demuxer = {\
+    .p.name         = #shortname,\
+    .p.long_name    = NULL_IF_CONFIG_SMALL(longname),\
+    .p.extensions   = ext,\
+    .p.flags        = flag,\
+    .p.priv_class   = &ff_raw_demuxer_class,\
     .read_probe     = probe,\
     .read_header    = ff_raw_subtitle_read_header,\
     .read_packet    = ff_raw_read_partial_packet,\
-    .extensions     = ext,\
-    .flags          = flag,\
     .raw_codec_id   = id,\
     .priv_data_size = sizeof(FFRawDemuxerContext),\
-    .priv_class     = &ff_raw_demuxer_class,\
 };
 
 #endif /* AVFORMAT_RAWDEC_H */
diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c
index 514e4e044f..0d0b8876e6 100644
--- a/libavformat/rawvideodec.c
+++ b/libavformat/rawvideodec.c
@@ -25,6 +25,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
+#include "demux.h"
 #include "internal.h"
 #include "avformat.h"
 
@@ -52,10 +53,10 @@ static int rawvideo_read_header(AVFormatContext *ctx)
 
     st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
 
-    st->codecpar->codec_id = ctx->iformat->raw_codec_id;
+    st->codecpar->codec_id = ffifmt(ctx->iformat)->raw_codec_id;
 
-    if ((ctx->iformat->raw_codec_id != AV_CODEC_ID_V210) &&
-        (ctx->iformat->raw_codec_id != AV_CODEC_ID_V210X)) {
+    if ((ffifmt(ctx->iformat)->raw_codec_id != AV_CODEC_ID_V210) &&
+        (ffifmt(ctx->iformat)->raw_codec_id != AV_CODEC_ID_V210X)) {
         if ((pix_fmt = av_get_pix_fmt(s->pixel_format)) == AV_PIX_FMT_NONE) {
             av_log(ctx, AV_LOG_ERROR, "No such pixel format: %s.\n",
                     s->pixel_format);
@@ -72,7 +73,7 @@ static int rawvideo_read_header(AVFormatContext *ctx)
     st->codecpar->width  = s->width;
     st->codecpar->height = s->height;
 
-    if (ctx->iformat->raw_codec_id == AV_CODEC_ID_BITPACKED) {
+    if (ffifmt(ctx->iformat)->raw_codec_id == AV_CODEC_ID_BITPACKED) {
         unsigned int pgroup; /* size of the pixel group in bytes */
         unsigned int xinc;
         const AVPixFmtDescriptor *desc;
@@ -96,9 +97,9 @@ static int rawvideo_read_header(AVFormatContext *ctx)
         }
         st->codecpar->codec_tag = tag;
         packet_size  = s->width * s->height * pgroup / xinc;
-    } else if ((ctx->iformat->raw_codec_id == AV_CODEC_ID_V210) ||
-               (ctx->iformat->raw_codec_id == AV_CODEC_ID_V210X)) {
-        pix_fmt = ctx->iformat->raw_codec_id == AV_CODEC_ID_V210 ?
+    } else if ((ffifmt(ctx->iformat)->raw_codec_id == AV_CODEC_ID_V210) ||
+               (ffifmt(ctx->iformat)->raw_codec_id == AV_CODEC_ID_V210X)) {
+        pix_fmt = ffifmt(ctx->iformat)->raw_codec_id == AV_CODEC_ID_V210 ?
                   AV_PIX_FMT_YUV422P10 : AV_PIX_FMT_YUV422P16;
 
         packet_size = GET_PACKET_SIZE(s->width, s->height);
@@ -149,16 +150,16 @@ static const AVClass rawvideo_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_rawvideo_demuxer = {
-    .name           = "rawvideo",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw video"),
+const FFInputFormat ff_rawvideo_demuxer = {
+    .p.name         = "rawvideo",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw video"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "yuv,cif,qcif,rgb",
+    .p.priv_class   = &rawvideo_demuxer_class,
     .priv_data_size = sizeof(RawVideoDemuxerContext),
     .read_header    = rawvideo_read_header,
     .read_packet    = rawvideo_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "yuv,cif,qcif,rgb",
     .raw_codec_id   = AV_CODEC_ID_RAWVIDEO,
-    .priv_class     = &rawvideo_demuxer_class,
 };
 
 static const AVClass bitpacked_demuxer_class = {
@@ -169,16 +170,16 @@ static const AVClass bitpacked_demuxer_class = {
 };
 
 #if CONFIG_BITPACKED_DEMUXER
-const AVInputFormat ff_bitpacked_demuxer = {
-    .name           = "bitpacked",
-    .long_name      = NULL_IF_CONFIG_SMALL("Bitpacked"),
+const FFInputFormat ff_bitpacked_demuxer = {
+    .p.name         = "bitpacked",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Bitpacked"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "bitpacked",
+    .p.priv_class   = &bitpacked_demuxer_class,
     .priv_data_size = sizeof(RawVideoDemuxerContext),
     .read_header    = rawvideo_read_header,
     .read_packet    = rawvideo_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "bitpacked",
     .raw_codec_id   = AV_CODEC_ID_BITPACKED,
-    .priv_class     = &bitpacked_demuxer_class,
 };
 #endif // CONFIG_BITPACKED_DEMUXER
 
@@ -190,29 +191,29 @@ static const AVClass v210_demuxer_class = {
 };
 
 #if CONFIG_V210_DEMUXER
-const AVInputFormat ff_v210_demuxer = {
-    .name           = "v210",
-    .long_name      = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+const FFInputFormat ff_v210_demuxer = {
+    .p.name         = "v210",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "v210",
+    .p.priv_class   = &v210_demuxer_class,
     .priv_data_size = sizeof(RawVideoDemuxerContext),
     .read_header    = rawvideo_read_header,
     .read_packet    = rawvideo_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "v210",
     .raw_codec_id   = AV_CODEC_ID_V210,
-    .priv_class     = &v210_demuxer_class,
 };
 #endif // CONFIG_V210_DEMUXER
 
 #if CONFIG_V210X_DEMUXER
-const AVInputFormat ff_v210x_demuxer = {
-    .name           = "v210x",
-    .long_name      = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+const FFInputFormat ff_v210x_demuxer = {
+    .p.name         = "v210x",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "yuv10",
+    .p.priv_class   = &v210_demuxer_class,
     .priv_data_size = sizeof(RawVideoDemuxerContext),
     .read_header    = rawvideo_read_header,
     .read_packet    = rawvideo_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "yuv10",
     .raw_codec_id   = AV_CODEC_ID_V210X,
-    .priv_class     = &v210_demuxer_class,
 };
 #endif // CONFIG_V210X_DEMUXER
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index b9b02a371f..4721f01ace 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -27,6 +27,7 @@
 
 #include "avformat.h"
 #include "libavutil/avstring.h"
+#include "demux.h"
 #include "rtpdec.h"
 #include "rdt.h"
 #include "libavutil/base64.h"
@@ -534,7 +535,7 @@ static av_cold int rdt_init(AVFormatContext *s, int st_index, PayloadContext *rd
     if ((ret = ff_copy_whiteblacklists(rdt->rmctx, s)) < 0)
         return ret;
 
-    return avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);
+    return avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer.p, NULL);
 }
 
 static void
diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c
index 7992a5b7fc..713e174b92 100644
--- a/libavformat/realtextdec.c
+++ b/libavformat/realtextdec.c
@@ -25,6 +25,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/avstring.h"
@@ -131,14 +132,14 @@ end:
     return res;
 }
 
-const AVInputFormat ff_realtext_demuxer = {
-    .name           = "realtext",
-    .long_name      = NULL_IF_CONFIG_SMALL("RealText subtitle format"),
+const FFInputFormat ff_realtext_demuxer = {
+    .p.name         = "realtext",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RealText subtitle format"),
+    .p.extensions   = "rt",
     .priv_data_size = sizeof(RealTextContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = realtext_probe,
     .read_header    = realtext_read_header,
-    .extensions     = "rt",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/redspark.c b/libavformat/redspark.c
index c6ee22678d..2642d7af67 100644
--- a/libavformat/redspark.c
+++ b/libavformat/redspark.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
 #include "avio.h"
+#include "demux.h"
 #include "internal.h"
 
 #define HEADER_SIZE 4096
@@ -150,12 +151,12 @@ static int redspark_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_redspark_demuxer = {
-    .name           =   "redspark",
-    .long_name      =   NULL_IF_CONFIG_SMALL("RedSpark"),
+const FFInputFormat ff_redspark_demuxer = {
+    .p.name         =   "redspark",
+    .p.long_name    =   NULL_IF_CONFIG_SMALL("RedSpark"),
+    .p.extensions   =   "rsd",
     .priv_data_size =   sizeof(RedSparkContext),
     .read_probe     =   redspark_probe,
     .read_header    =   redspark_read_header,
     .read_packet    =   redspark_read_packet,
-    .extensions     =   "rsd",
 };
diff --git a/libavformat/rka.c b/libavformat/rka.c
index 36e25ade01..954ec96509 100644
--- a/libavformat/rka.c
+++ b/libavformat/rka.c
@@ -161,13 +161,13 @@ static int rka_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-const AVInputFormat ff_rka_demuxer = {
-    .name           = "rka",
-    .long_name      = NULL_IF_CONFIG_SMALL("RKA (RK Audio)"),
+const FFInputFormat ff_rka_demuxer = {
+    .p.name         = "rka",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RKA (RK Audio)"),
+    .p.extensions   = "rka",
     .priv_data_size = sizeof(RKAContext),
     .read_probe     = rka_probe,
     .read_header    = rka_read_header,
     .read_packet    = rka_read_packet,
     .read_seek      = rka_read_seek,
-    .extensions     = "rka",
 };
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index 669cb0400b..d64c4b81d4 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -302,9 +302,9 @@ static int rl2_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-const AVInputFormat ff_rl2_demuxer = {
-    .name           = "rl2",
-    .long_name      = NULL_IF_CONFIG_SMALL("RL2"),
+const FFInputFormat ff_rl2_demuxer = {
+    .p.name         = "rl2",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RL2"),
     .priv_data_size = sizeof(Rl2DemuxContext),
     .read_probe     = rl2_probe,
     .read_header    = rl2_read_header,
diff --git a/libavformat/rm.h b/libavformat/rm.h
index 8f47559a36..91007f5ca2 100644
--- a/libavformat/rm.h
+++ b/libavformat/rm.h
@@ -34,7 +34,7 @@ RMStream *ff_rm_alloc_rmstream (void);
 void      ff_rm_free_rmstream  (RMStream *rms);
 
 /*< input format for Realmedia-style RTSP streams */
-extern const AVInputFormat ff_rdt_demuxer;
+extern const struct FFInputFormat ff_rdt_demuxer;
 
 /**
  * Read the MDPR chunk, which contains stream-specific codec initialization
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 0f1534b582..4219cc5636 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -1145,9 +1145,9 @@ static int rm_read_seek(AVFormatContext *s, int stream_index,
 }
 
 
-const AVInputFormat ff_rm_demuxer = {
-    .name           = "rm",
-    .long_name      = NULL_IF_CONFIG_SMALL("RealMedia"),
+const FFInputFormat ff_rm_demuxer = {
+    .p.name         = "rm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RealMedia"),
     .priv_data_size = sizeof(RMDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = rm_probe,
@@ -1158,12 +1158,12 @@ const AVInputFormat ff_rm_demuxer = {
     .read_seek      = rm_read_seek,
 };
 
-const AVInputFormat ff_rdt_demuxer = {
-    .name           = "rdt",
-    .long_name      = NULL_IF_CONFIG_SMALL("RDT demuxer"),
+const FFInputFormat ff_rdt_demuxer = {
+    .p.name         = "rdt",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RDT demuxer"),
+    .p.flags        = AVFMT_NOFILE,
     .priv_data_size = sizeof(RMDemuxContext),
     .read_close     = rm_read_close,
-    .flags          = AVFMT_NOFILE,
 };
 
 static int ivr_probe(const AVProbeData *p)
@@ -1398,14 +1398,14 @@ static int ivr_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_ivr_demuxer = {
-    .name           = "ivr",
-    .long_name      = NULL_IF_CONFIG_SMALL("IVR (Internet Video Recording)"),
+const FFInputFormat ff_ivr_demuxer = {
+    .p.name         = "ivr",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("IVR (Internet Video Recording)"),
+    .p.extensions   = "ivr",
     .priv_data_size = sizeof(RMDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = ivr_probe,
     .read_header    = ivr_read_header,
     .read_packet    = ivr_read_packet,
     .read_close     = rm_read_close,
-    .extensions     = "ivr",
 };
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index eae0da891b..3f10e51d48 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -25,6 +25,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/dict.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define RPL_SIGNATURE "ARMovie\x0A"
@@ -393,9 +394,9 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_rpl_demuxer = {
-    .name           = "rpl",
-    .long_name      = NULL_IF_CONFIG_SMALL("RPL / ARMovie"),
+const FFInputFormat ff_rpl_demuxer = {
+    .p.name         = "rpl",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RPL / ARMovie"),
     .priv_data_size = sizeof(RPLContext),
     .read_probe     = rpl_probe,
     .read_header    = rpl_read_header,
diff --git a/libavformat/rsd.c b/libavformat/rsd.c
index 33aa0e2c0d..b9098646f6 100644
--- a/libavformat/rsd.c
+++ b/libavformat/rsd.c
@@ -220,13 +220,13 @@ static int rsd_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_rsd_demuxer = {
-    .name           =   "rsd",
-    .long_name      =   NULL_IF_CONFIG_SMALL("GameCube RSD"),
+const FFInputFormat ff_rsd_demuxer = {
+    .p.name         =   "rsd",
+    .p.long_name    =   NULL_IF_CONFIG_SMALL("GameCube RSD"),
+    .p.extensions   =   "rsd",
+    .p.codec_tag    =   (const AVCodecTag* const []){rsd_tags, 0},
+    .p.flags        =   AVFMT_GENERIC_INDEX,
     .read_probe     =   rsd_probe,
     .read_header    =   rsd_read_header,
     .read_packet    =   rsd_read_packet,
-    .extensions     =   "rsd",
-    .codec_tag      =   (const AVCodecTag* const []){rsd_tags, 0},
-    .flags          =   AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c
index 569368b422..62a2964414 100644
--- a/libavformat/rsodec.c
+++ b/libavformat/rsodec.c
@@ -23,6 +23,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 #include "rso.h"
@@ -71,12 +72,12 @@ static int rso_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_rso_demuxer = {
-    .name           =   "rso",
-    .long_name      =   NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO"),
-    .extensions     =   "rso",
+const FFInputFormat ff_rso_demuxer = {
+    .p.name         =   "rso",
+    .p.long_name    =   NULL_IF_CONFIG_SMALL("Lego Mindstorms RSO"),
+    .p.extensions   =   "rso",
+    .p.codec_tag    =   ff_rso_codec_tags_list,
     .read_header    =   rso_read_header,
     .read_packet    =   ff_pcm_read_packet,
     .read_seek      =   ff_pcm_read_seek,
-    .codec_tag      =   ff_rso_codec_tags_list,
 };
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c7d9b48684..7d4a64f245 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -35,6 +35,7 @@
 #include "libavcodec/codec_desc.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 
 #if HAVE_POLL_H
 #include <poll.h>
@@ -2484,15 +2485,15 @@ static const AVClass sdp_demuxer_class = {
     .version        = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_sdp_demuxer = {
-    .name           = "sdp",
-    .long_name      = NULL_IF_CONFIG_SMALL("SDP"),
+const FFInputFormat ff_sdp_demuxer = {
+    .p.name         = "sdp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SDP"),
+    .p.priv_class   = &sdp_demuxer_class,
     .priv_data_size = sizeof(RTSPState),
     .read_probe     = sdp_probe,
     .read_header    = sdp_read_header,
     .read_packet    = ff_rtsp_fetch_packet,
     .read_close     = sdp_read_close,
-    .priv_class     = &sdp_demuxer_class,
 };
 #endif /* CONFIG_SDP_DEMUXER */
 
@@ -2643,15 +2644,15 @@ static const AVClass rtp_demuxer_class = {
     .version        = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_rtp_demuxer = {
-    .name           = "rtp",
-    .long_name      = NULL_IF_CONFIG_SMALL("RTP input"),
+const FFInputFormat ff_rtp_demuxer = {
+    .p.name         = "rtp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RTP input"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &rtp_demuxer_class,
     .priv_data_size = sizeof(RTSPState),
     .read_probe     = rtp_probe,
     .read_header    = rtp_read_header,
     .read_packet    = ff_rtsp_fetch_packet,
     .read_close     = sdp_read_close,
-    .flags          = AVFMT_NOFILE,
-    .priv_class     = &rtp_demuxer_class,
 };
 #endif /* CONFIG_RTP_DEMUXER */
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index b54ce4e597..8ca6f723e4 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -27,6 +27,7 @@
 #include "libavutil/random_seed.h"
 #include "libavutil/time.h"
 #include "avformat.h"
+#include "demux.h"
 
 #include "internal.h"
 #include "network.h"
@@ -992,17 +993,17 @@ static const AVClass rtsp_demuxer_class = {
     .version        = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_rtsp_demuxer = {
-    .name           = "rtsp",
-    .long_name      = NULL_IF_CONFIG_SMALL("RTSP input"),
+const FFInputFormat ff_rtsp_demuxer = {
+    .p.name         = "rtsp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("RTSP input"),
+    .p.flags        = AVFMT_NOFILE,
+    .p.priv_class   = &rtsp_demuxer_class,
     .priv_data_size = sizeof(RTSPState),
     .read_probe     = rtsp_probe,
     .read_header    = rtsp_read_header,
     .read_packet    = rtsp_read_packet,
     .read_close     = rtsp_read_close,
     .read_seek      = rtsp_read_seek,
-    .flags          = AVFMT_NOFILE,
     .read_play      = rtsp_read_play,
     .read_pause     = rtsp_read_pause,
-    .priv_class     = &rtsp_demuxer_class,
 };
diff --git a/libavformat/s337m.c b/libavformat/s337m.c
index 6fecfeffae..4518f032d2 100644
--- a/libavformat/s337m.c
+++ b/libavformat/s337m.c
@@ -20,6 +20,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "spdif.h"
 
@@ -187,11 +188,11 @@ static int s337m_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_s337m_demuxer = {
-    .name           = "s337m",
-    .long_name      = NULL_IF_CONFIG_SMALL("SMPTE 337M"),
+const FFInputFormat ff_s337m_demuxer = {
+    .p.name         = "s337m",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SMPTE 337M"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = s337m_probe,
     .read_header    = s337m_read_header,
     .read_packet    = s337m_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/samidec.c b/libavformat/samidec.c
index 070b623ebf..4abf7789d1 100644
--- a/libavformat/samidec.c
+++ b/libavformat/samidec.c
@@ -25,6 +25,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/avstring.h"
@@ -121,14 +122,14 @@ end:
     return res;
 }
 
-const AVInputFormat ff_sami_demuxer = {
-    .name           = "sami",
-    .long_name      = NULL_IF_CONFIG_SMALL("SAMI subtitle format"),
+const FFInputFormat ff_sami_demuxer = {
+    .p.name         = "sami",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SAMI subtitle format"),
+    .p.extensions   = "smi,sami",
     .priv_data_size = sizeof(SAMIContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = sami_probe,
     .read_header    = sami_read_header,
-    .extensions     = "smi,sami",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c
index 59141448f4..7480697f83 100644
--- a/libavformat/sapdec.c
+++ b/libavformat/sapdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "network.h"
@@ -232,13 +233,13 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_sap_demuxer = {
-    .name           = "sap",
-    .long_name      = NULL_IF_CONFIG_SMALL("SAP input"),
+const FFInputFormat ff_sap_demuxer = {
+    .p.name         = "sap",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SAP input"),
+    .p.flags        = AVFMT_NOFILE,
     .priv_data_size = sizeof(struct SAPState),
     .read_probe     = sap_probe,
     .read_header    = sap_read_header,
     .read_packet    = sap_fetch_packet,
     .read_close     = sap_read_close,
-    .flags          = AVFMT_NOFILE,
 };
diff --git a/libavformat/sbcdec.c b/libavformat/sbcdec.c
index c917743fa1..2fbee012c3 100644
--- a/libavformat/sbcdec.c
+++ b/libavformat/sbcdec.c
@@ -20,16 +20,17 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "rawdec.h"
 
-const AVInputFormat ff_sbc_demuxer = {
-    .name           = "sbc",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw SBC (low-complexity subband codec)"),
-    .extensions     = "sbc,msbc",
+const FFInputFormat ff_sbc_demuxer = {
+    .p.name         = "sbc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw SBC (low-complexity subband codec)"),
+    .p.extensions   = "sbc,msbc",
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .raw_codec_id   = AV_CODEC_ID_SBC,
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index b2662ea418..bc2469afd1 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -29,6 +29,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/time_internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define SBG_SCALE (1 << 16)
@@ -1529,15 +1530,15 @@ static const AVClass sbg_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_sbg_demuxer = {
-    .name           = "sbg",
-    .long_name      = NULL_IF_CONFIG_SMALL("SBaGen binaural beats script"),
+const FFInputFormat ff_sbg_demuxer = {
+    .p.name         = "sbg",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SBaGen binaural beats script"),
+    .p.extensions   = "sbg",
+    .p.priv_class   = &sbg_demuxer_class,
     .priv_data_size = sizeof(struct sbg_demuxer),
     .read_probe     = sbg_read_probe,
     .read_header    = sbg_read_header,
     .read_packet    = sbg_read_packet,
     .read_seek      = sbg_read_seek,
     .read_seek2     = sbg_read_seek2,
-    .extensions     = "sbg",
-    .priv_class     = &sbg_demuxer_class,
 };
diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c
index 720fd0434f..5f2f95d80e 100644
--- a/libavformat/sccdec.c
+++ b/libavformat/sccdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/avstring.h"
@@ -147,14 +148,14 @@ static int scc_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_scc_demuxer = {
-    .name           = "scc",
-    .long_name      = NULL_IF_CONFIG_SMALL("Scenarist Closed Captions"),
+const FFInputFormat ff_scc_demuxer = {
+    .p.name         = "scc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Scenarist Closed Captions"),
+    .p.extensions   = "scc",
     .priv_data_size = sizeof(SCCContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = scc_probe,
     .read_header    = scc_read_header,
-    .extensions     = "scc",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/scd.c b/libavformat/scd.c
index f0048bcc85..e34d60dcfb 100644
--- a/libavformat/scd.c
+++ b/libavformat/scd.c
@@ -28,6 +28,7 @@
 #include "libavutil/avassert.h"
 #include "libavformat/internal.h"
 #include "avformat.h"
+#include "demux.h"
 
 #define SCD_MAGIC              ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
                                           MKBETAG('S', 'S', 'C', 'F'))
@@ -365,9 +366,9 @@ static int scd_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_scd_demuxer = {
-    .name           = "scd",
-    .long_name      = NULL_IF_CONFIG_SMALL("Square Enix SCD"),
+const FFInputFormat ff_scd_demuxer = {
+    .p.name         = "scd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Square Enix SCD"),
     .priv_data_size = sizeof(SCDDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = scd_probe,
diff --git a/libavformat/sdns.c b/libavformat/sdns.c
index f00c6bcc49..9d1e356a23 100644
--- a/libavformat/sdns.c
+++ b/libavformat/sdns.c
@@ -85,12 +85,12 @@ static int sdns_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_sdns_demuxer = {
-    .name           = "sdns",
-    .long_name      = NULL_IF_CONFIG_SMALL("Xbox SDNS"),
+const FFInputFormat ff_sdns_demuxer = {
+    .p.name         = "sdns",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Xbox SDNS"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "sdns",
     .read_probe     = sdns_probe,
     .read_header    = sdns_read_header,
     .read_packet    = sdns_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "sdns",
 };
diff --git a/libavformat/sdr2.c b/libavformat/sdr2.c
index 3023d5f7d1..c7990bec3d 100644
--- a/libavformat/sdr2.c
+++ b/libavformat/sdr2.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int sdr2_probe(const AVProbeData *p)
@@ -109,12 +110,12 @@ static int sdr2_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_sdr2_demuxer = {
-    .name        = "sdr2",
-    .long_name   = NULL_IF_CONFIG_SMALL("SDR2"),
+const FFInputFormat ff_sdr2_demuxer = {
+    .p.name      = "sdr2",
+    .p.long_name = NULL_IF_CONFIG_SMALL("SDR2"),
+    .p.extensions= "sdr2",
+    .p.flags     = AVFMT_GENERIC_INDEX,
     .read_probe  = sdr2_probe,
     .read_header = sdr2_read_header,
     .read_packet = sdr2_read_packet,
-    .extensions  = "sdr2",
-    .flags       = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/sdsdec.c b/libavformat/sdsdec.c
index d296500bec..1b47f45504 100644
--- a/libavformat/sdsdec.c
+++ b/libavformat/sdsdec.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct SDSContext {
@@ -153,13 +154,13 @@ static int sds_read_packet(AVFormatContext *ctx, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_sds_demuxer = {
-    .name           = "sds",
-    .long_name      = NULL_IF_CONFIG_SMALL("MIDI Sample Dump Standard"),
+const FFInputFormat ff_sds_demuxer = {
+    .p.name         = "sds",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("MIDI Sample Dump Standard"),
+    .p.extensions   = "sds",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(SDSContext),
     .read_probe     = sds_probe,
     .read_header    = sds_read_header,
     .read_packet    = sds_read_packet,
-    .extensions     = "sds",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/sdxdec.c b/libavformat/sdxdec.c
index 5628278928..26ccd78ddd 100644
--- a/libavformat/sdxdec.c
+++ b/libavformat/sdxdec.c
@@ -22,6 +22,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -78,13 +79,13 @@ static int sdx_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_sdx_demuxer = {
-    .name           = "sdx",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sample Dump eXchange"),
+const FFInputFormat ff_sdx_demuxer = {
+    .p.name         = "sdx",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sample Dump eXchange"),
+    .p.extensions   = "sdx",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = sdx_probe,
     .read_header    = sdx_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .extensions     = "sdx",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/seek.c b/libavformat/seek.c
index 0180188595..9ac133bf23 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -288,7 +288,7 @@ static int64_t read_timestamp(AVFormatContext *s, int stream_index, int64_t *ppo
 int ff_seek_frame_binary(AVFormatContext *s, int stream_index,
                          int64_t target_ts, int flags)
 {
-    const AVInputFormat *const avif = s->iformat;
+    const FFInputFormat *const avif = ffifmt(s->iformat);
     int64_t pos_min = 0, pos_max = 0, pos, pos_limit;
     int64_t ts_min, ts_max, ts;
     int index;
@@ -580,8 +580,8 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index,
         return -1;
 
     ff_read_frame_flush(s);
-    if (s->iformat->read_seek)
-        if (s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0)
+    if (ffifmt(s->iformat)->read_seek)
+        if (ffifmt(s->iformat)->read_seek(s, stream_index, timestamp, flags) >= 0)
             return 0;
     ie = &sti->index_entries[index];
     if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0)
@@ -617,15 +617,15 @@ static int seek_frame_internal(AVFormatContext *s, int stream_index,
     }
 
     /* first, we try the format specific seek */
-    if (s->iformat->read_seek) {
+    if (ffifmt(s->iformat)->read_seek) {
         ff_read_frame_flush(s);
-        ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
+        ret = ffifmt(s->iformat)->read_seek(s, stream_index, timestamp, flags);
     } else
         ret = -1;
     if (ret >= 0)
         return 0;
 
-    if (s->iformat->read_timestamp &&
+    if (ffifmt(s->iformat)->read_timestamp &&
         !(s->iformat->flags & AVFMT_NOBINSEARCH)) {
         ff_read_frame_flush(s);
         return ff_seek_frame_binary(s, stream_index, timestamp, flags);
@@ -641,7 +641,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index,
 {
     int ret;
 
-    if (s->iformat->read_seek2 && !s->iformat->read_seek) {
+    if (ffifmt(s->iformat)->read_seek2 && !ffifmt(s->iformat)->read_seek) {
         int64_t min_ts = INT64_MIN, max_ts = INT64_MAX;
         if ((flags & AVSEEK_FLAG_BACKWARD))
             max_ts = timestamp;
@@ -671,7 +671,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
         flags |= AVSEEK_FLAG_ANY;
     flags &= ~AVSEEK_FLAG_BACKWARD;
 
-    if (s->iformat->read_seek2) {
+    if (ffifmt(s->iformat)->read_seek2) {
         int ret;
         ff_read_frame_flush(s);
 
@@ -687,7 +687,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
             stream_index = 0;
         }
 
-        ret = s->iformat->read_seek2(s, stream_index, min_ts,
+        ret = ffifmt(s->iformat)->read_seek2(s, stream_index, min_ts,
                                      ts, max_ts, flags);
 
         if (ret >= 0)
@@ -695,13 +695,13 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
         return ret;
     }
 
-    if (s->iformat->read_timestamp) {
+    if (ffifmt(s->iformat)->read_timestamp) {
         // try to seek via read_timestamp()
     }
 
     // Fall back on old API if new is not implemented but old is.
     // Note the old API has somewhat different semantics.
-    if (s->iformat->read_seek || 1) {
+    if (ffifmt(s->iformat)->read_seek || 1) {
         int dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0);
         int ret = av_seek_frame(s, stream_index, ts, flags | dir);
         if (ret < 0 && ts != min_ts && max_ts != ts) {
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 4c6b68426c..5cbeed6d91 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -29,6 +29,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -324,9 +325,9 @@ static int film_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
     return 0;
 }
 
-const AVInputFormat ff_segafilm_demuxer = {
-    .name           = "film_cpk",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sega FILM / CPK"),
+const FFInputFormat ff_segafilm_demuxer = {
+    .p.name         = "film_cpk",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sega FILM / CPK"),
     .priv_data_size = sizeof(FilmDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = film_probe,
diff --git a/libavformat/serdec.c b/libavformat/serdec.c
index 639c899249..a8b2375199 100644
--- a/libavformat/serdec.c
+++ b/libavformat/serdec.c
@@ -23,6 +23,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
+#include "demux.h"
 #include "internal.h"
 #include "avformat.h"
 
@@ -132,15 +133,15 @@ static const AVClass ser_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_ser_demuxer = {
-    .name           = "ser",
-    .long_name      = NULL_IF_CONFIG_SMALL("SER (Simple uncompressed video format for astronomical capturing)"),
+const FFInputFormat ff_ser_demuxer = {
+    .p.name         = "ser",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SER (Simple uncompressed video format for astronomical capturing)"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "ser",
+    .p.priv_class   = &ser_demuxer_class,
     .priv_data_size = sizeof(SERDemuxerContext),
     .read_probe     = ser_probe,
     .read_header    = ser_read_header,
     .read_packet    = ser_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "ser",
     .raw_codec_id   = AV_CODEC_ID_RAWVIDEO,
-    .priv_class     = &ser_demuxer_class,
 };
diff --git a/libavformat/sga.c b/libavformat/sga.c
index 12e9cc1441..23a18657cf 100644
--- a/libavformat/sga.c
+++ b/libavformat/sga.c
@@ -25,6 +25,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -466,14 +467,14 @@ static int sga_seek(AVFormatContext *s, int stream_index,
     return -1;
 }
 
-const AVInputFormat ff_sga_demuxer = {
-    .name           = "sga",
-    .long_name      = NULL_IF_CONFIG_SMALL("Digital Pictures SGA"),
+const FFInputFormat ff_sga_demuxer = {
+    .p.name         = "sga",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Digital Pictures SGA"),
+    .p.extensions   = "sga",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(SGADemuxContext),
     .read_probe     = sga_probe,
     .read_header    = sga_read_header,
     .read_packet    = sga_read_packet,
     .read_seek      = sga_seek,
-    .extensions     = "sga",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/shortendec.c b/libavformat/shortendec.c
index cd14b55d70..2bb4d9d0c5 100644
--- a/libavformat/shortendec.c
+++ b/libavformat/shortendec.c
@@ -22,6 +22,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "rawdec.h"
 #include "libavcodec/golomb.h"
 
@@ -65,15 +66,15 @@ static int shn_probe(const AVProbeData *p)
     return AVPROBE_SCORE_EXTENSION + 1;
 }
 
-const AVInputFormat ff_shorten_demuxer = {
-    .name           = "shn",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw Shorten"),
+const FFInputFormat ff_shorten_demuxer = {
+    .p.name         = "shn",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw Shorten"),
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
+    .p.extensions   = "shn",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe     = shn_probe,
     .read_header    = ff_raw_audio_read_header,
     .read_packet    = ff_raw_read_partial_packet,
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
-    .extensions     = "shn",
     .raw_codec_id   = AV_CODEC_ID_SHORTEN,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index d110457ec9..e7cc4075de 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -30,6 +30,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -313,9 +314,9 @@ static int vmd_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_vmd_demuxer = {
-    .name           = "vmd",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sierra VMD"),
+const FFInputFormat ff_vmd_demuxer = {
+    .p.name         = "vmd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sierra VMD"),
     .priv_data_size = sizeof(VmdDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = vmd_probe,
diff --git a/libavformat/siff.c b/libavformat/siff.c
index 99756574b4..5aad03d870 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "avio_internal.h"
 
@@ -248,12 +249,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
     return pkt->size;
 }
 
-const AVInputFormat ff_siff_demuxer = {
-    .name           = "siff",
-    .long_name      = NULL_IF_CONFIG_SMALL("Beam Software SIFF"),
+const FFInputFormat ff_siff_demuxer = {
+    .p.name         = "siff",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Beam Software SIFF"),
+    .p.extensions   = "vb,son",
     .priv_data_size = sizeof(SIFFContext),
     .read_probe     = siff_probe,
     .read_header    = siff_read_header,
     .read_packet    = siff_read_packet,
-    .extensions     = "vb,son",
 };
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index d04c8b91a6..c87174476b 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -404,9 +404,9 @@ static int smacker_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_smacker_demuxer = {
-    .name           = "smk",
-    .long_name      = NULL_IF_CONFIG_SMALL("Smacker"),
+const FFInputFormat ff_smacker_demuxer = {
+    .p.name         = "smk",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Smacker"),
     .priv_data_size = sizeof(SmackerContext),
     .read_probe     = smacker_probe,
     .read_header    = smacker_read_header,
diff --git a/libavformat/smjpegdec.c b/libavformat/smjpegdec.c
index 02d0f29b99..0003dbf0f5 100644
--- a/libavformat/smjpegdec.c
+++ b/libavformat/smjpegdec.c
@@ -27,6 +27,7 @@
 #include <inttypes.h>
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "riff.h"
 #include "smjpeg.h"
@@ -180,13 +181,13 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_smjpeg_demuxer = {
-    .name           = "smjpeg",
-    .long_name      = NULL_IF_CONFIG_SMALL("Loki SDL MJPEG"),
+const FFInputFormat ff_smjpeg_demuxer = {
+    .p.name         = "smjpeg",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Loki SDL MJPEG"),
+    .p.extensions   = "mjpg",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(SMJPEGContext),
     .read_probe     = smjpeg_probe,
     .read_header    = smjpeg_read_header,
     .read_packet    = smjpeg_read_packet,
-    .extensions     = "mjpg",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/smush.c b/libavformat/smush.c
index f133bbb02c..0877f7faff 100644
--- a/libavformat/smush.c
+++ b/libavformat/smush.c
@@ -23,6 +23,7 @@
 
 #include "avformat.h"
 #include "avio.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct SMUSHContext {
@@ -241,9 +242,9 @@ static int smush_read_packet(AVFormatContext *ctx, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_smush_demuxer = {
-    .name           = "smush",
-    .long_name      = NULL_IF_CONFIG_SMALL("LucasArts Smush"),
+const FFInputFormat ff_smush_demuxer = {
+    .p.name         = "smush",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("LucasArts Smush"),
     .priv_data_size = sizeof(SMUSHContext),
     .read_probe     = smush_read_probe,
     .read_header    = smush_read_header,
diff --git a/libavformat/sol.c b/libavformat/sol.c
index a276642728..145906c936 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -26,6 +26,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -137,9 +138,9 @@ static int sol_read_packet(AVFormatContext *s,
     return 0;
 }
 
-const AVInputFormat ff_sol_demuxer = {
-    .name           = "sol",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sierra SOL"),
+const FFInputFormat ff_sol_demuxer = {
+    .p.name         = "sol",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sierra SOL"),
     .read_probe     = sol_probe,
     .read_header    = sol_read_header,
     .read_packet    = sol_read_packet,
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index d47a8ba927..661d6b30e5 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -33,6 +33,7 @@
 #include "libavutil/intfloat.h"
 #include "libavutil/dict.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 #include "sox.h"
@@ -131,9 +132,9 @@ static int sox_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_sox_demuxer = {
-    .name           = "sox",
-    .long_name      = NULL_IF_CONFIG_SMALL("SoX (Sound eXchange) native"),
+const FFInputFormat ff_sox_demuxer = {
+    .p.name         = "sox",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SoX (Sound eXchange) native"),
     .read_probe     = sox_probe,
     .read_header    = sox_read_header,
     .read_packet    = ff_pcm_read_packet,
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index 7a6b77aae8..6a01f2ba29 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -31,6 +31,7 @@
 #include "libavcodec/adts_parser.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "spdif.h"
 
@@ -248,11 +249,11 @@ int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_spdif_demuxer = {
-    .name           = "spdif",
-    .long_name      = NULL_IF_CONFIG_SMALL("IEC 61937 (compressed data in S/PDIF)"),
+const FFInputFormat ff_spdif_demuxer = {
+    .p.name         = "spdif",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("IEC 61937 (compressed data in S/PDIF)"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = spdif_probe,
     .read_header    = spdif_read_header,
     .read_packet    = ff_spdif_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 635c1550b9..678796c9dd 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -21,6 +21,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/bprint.h"
@@ -213,9 +214,9 @@ end:
     return res;
 }
 
-const AVInputFormat ff_srt_demuxer = {
-    .name        = "srt",
-    .long_name   = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
+const FFInputFormat ff_srt_demuxer = {
+    .p.name      = "srt",
+    .p.long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
     .priv_data_size = sizeof(SRTContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe  = srt_probe,
diff --git a/libavformat/stldec.c b/libavformat/stldec.c
index b5c8439dc2..3b3b113827 100644
--- a/libavformat/stldec.c
+++ b/libavformat/stldec.c
@@ -25,6 +25,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/intreadwrite.h"
@@ -108,14 +109,14 @@ static int stl_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_stl_demuxer = {
-    .name           = "stl",
-    .long_name      = NULL_IF_CONFIG_SMALL("Spruce subtitle format"),
+const FFInputFormat ff_stl_demuxer = {
+    .p.name         = "stl",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Spruce subtitle format"),
+    .p.extensions   = "stl",
     .priv_data_size = sizeof(STLContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = stl_probe,
     .read_header    = stl_read_header,
-    .extensions     = "stl",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index f4993fe20d..88665663c5 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -140,7 +140,7 @@ int ff_subtitles_queue_read_packet(FFDemuxSubtitlesQueue *q, AVPacket *pkt);
 
 /**
  * Update current_sub_idx to emulate a seek. Except the first parameter, it
- * matches AVInputFormat->read_seek2 prototypes.
+ * matches FFInputFormat->read_seek2 prototypes.
  */
 int ff_subtitles_queue_seek(FFDemuxSubtitlesQueue *q, AVFormatContext *s, int stream_index,
                             int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
diff --git a/libavformat/subviewer1dec.c b/libavformat/subviewer1dec.c
index bdcbef30ef..5e7ed729ac 100644
--- a/libavformat/subviewer1dec.c
+++ b/libavformat/subviewer1dec.c
@@ -24,6 +24,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 
@@ -90,14 +91,14 @@ static int subviewer1_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_subviewer1_demuxer = {
-    .name           = "subviewer1",
-    .long_name      = NULL_IF_CONFIG_SMALL("SubViewer v1 subtitle format"),
+const FFInputFormat ff_subviewer1_demuxer = {
+    .p.name         = "subviewer1",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SubViewer v1 subtitle format"),
+    .p.extensions   = "sub",
     .priv_data_size = sizeof(SubViewer1Context),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = subviewer1_probe,
     .read_header    = subviewer1_read_header,
-    .extensions     = "sub",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/subviewerdec.c b/libavformat/subviewerdec.c
index 6ffdc98c39..1d1d99afa9 100644
--- a/libavformat/subviewerdec.c
+++ b/libavformat/subviewerdec.c
@@ -25,6 +25,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "avio_internal.h"
@@ -185,14 +186,14 @@ end:
     return res;
 }
 
-const AVInputFormat ff_subviewer_demuxer = {
-    .name           = "subviewer",
-    .long_name      = NULL_IF_CONFIG_SMALL("SubViewer subtitle format"),
+const FFInputFormat ff_subviewer_demuxer = {
+    .p.name         = "subviewer",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SubViewer subtitle format"),
+    .p.extensions   = "sub",
     .priv_data_size = sizeof(SubViewerContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = subviewer_probe,
     .read_header    = subviewer_read_header,
-    .extensions     = "sub",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/supdec.c b/libavformat/supdec.c
index fbcc744bb4..f69ef913b7 100644
--- a/libavformat/supdec.c
+++ b/libavformat/supdec.c
@@ -17,6 +17,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 
@@ -97,13 +98,13 @@ static int sup_probe(const AVProbeData *p)
     return AVPROBE_SCORE_MAX;
 }
 
-const AVInputFormat ff_sup_demuxer = {
-    .name           = "sup",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw HDMV Presentation Graphic Stream subtitles"),
-    .extensions     = "sup",
-    .mime_type      = "application/x-pgs",
+const FFInputFormat ff_sup_demuxer = {
+    .p.name         = "sup",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw HDMV Presentation Graphic Stream subtitles"),
+    .p.extensions   = "sup",
+    .p.mime_type    = "application/x-pgs",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = sup_probe,
     .read_header    = sup_read_header,
     .read_packet    = sup_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/svag.c b/libavformat/svag.c
index 45d04727fe..c92a5e12f2 100644
--- a/libavformat/svag.c
+++ b/libavformat/svag.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int svag_probe(const AVProbeData *p)
@@ -69,11 +70,11 @@ static int svag_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align);
 }
 
-const AVInputFormat ff_svag_demuxer = {
-    .name           = "svag",
-    .long_name      = NULL_IF_CONFIG_SMALL("Konami PS2 SVAG"),
+const FFInputFormat ff_svag_demuxer = {
+    .p.name         = "svag",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Konami PS2 SVAG"),
+    .p.extensions   = "svag",
     .read_probe     = svag_probe,
     .read_header    = svag_read_header,
     .read_packet    = svag_read_packet,
-    .extensions     = "svag",
 };
diff --git a/libavformat/svs.c b/libavformat/svs.c
index b91d29f5a6..03e0bfd6e7 100644
--- a/libavformat/svs.c
+++ b/libavformat/svs.c
@@ -22,6 +22,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int svs_probe(const AVProbeData *p)
@@ -84,11 +85,11 @@ static int svs_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_svs_demuxer = {
-    .name        = "svs",
-    .long_name   = NULL_IF_CONFIG_SMALL("Square SVS"),
+const FFInputFormat ff_svs_demuxer = {
+    .p.name         = "svs",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Square SVS"),
+    .p.extensions   = "svs",
     .read_probe  = svs_probe,
     .read_header = svs_read_header,
     .read_packet = svs_read_packet,
-    .extensions  = "svs",
 };
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index 716c95a743..6bba5fb7eb 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -562,9 +562,9 @@ static av_cold int swf_read_close(AVFormatContext *avctx)
 }
 #endif
 
-const AVInputFormat ff_swf_demuxer = {
-    .name           = "swf",
-    .long_name      = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash)"),
+const FFInputFormat ff_swf_demuxer = {
+    .p.name         = "swf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash)"),
     .priv_data_size = sizeof(SWFDecContext),
     .read_probe     = swf_probe,
     .read_header    = swf_read_header,
diff --git a/libavformat/takdec.c b/libavformat/takdec.c
index 08f6e6a257..5c405ebd24 100644
--- a/libavformat/takdec.c
+++ b/libavformat/takdec.c
@@ -27,6 +27,7 @@
 #include "apetag.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "rawdec.h"
 
@@ -213,15 +214,15 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_tak_demuxer = {
-    .name           = "tak",
-    .long_name      = NULL_IF_CONFIG_SMALL("raw TAK"),
+const FFInputFormat ff_tak_demuxer = {
+    .p.name         = "tak",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("raw TAK"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "tak",
+    .p.priv_class   = &ff_raw_demuxer_class,
     .priv_data_size = sizeof(TAKDemuxContext),
     .read_probe     = tak_probe,
     .read_header    = tak_read_header,
     .read_packet    = raw_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "tak",
     .raw_codec_id   = AV_CODEC_ID_TAK,
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/tedcaptionsdec.c b/libavformat/tedcaptionsdec.c
index a8aa9d9cf9..4dbbe5a5b1 100644
--- a/libavformat/tedcaptionsdec.c
+++ b/libavformat/tedcaptionsdec.c
@@ -23,6 +23,7 @@
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 
@@ -355,12 +356,12 @@ static int tedcaptions_read_seek(AVFormatContext *avf, int stream_index,
                                    min_ts, ts, max_ts, flags);
 }
 
-const AVInputFormat ff_tedcaptions_demuxer = {
-    .name           = "tedcaptions",
-    .long_name      = NULL_IF_CONFIG_SMALL("TED Talks captions"),
+const FFInputFormat ff_tedcaptions_demuxer = {
+    .p.name         = "tedcaptions",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("TED Talks captions"),
+    .p.priv_class   = &tedcaptions_demuxer_class,
     .priv_data_size = sizeof(TEDCaptionsDemuxer),
     .flags_internal = FF_FMT_INIT_CLEANUP,
-    .priv_class     = &tedcaptions_demuxer_class,
     .read_header    = tedcaptions_read_header,
     .read_packet    = tedcaptions_read_packet,
     .read_close     = tedcaptions_read_close,
diff --git a/libavformat/thp.c b/libavformat/thp.c
index fdb499bf42..76db7fc581 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -23,6 +23,7 @@
 #include "libavutil/intfloat.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct ThpDemuxContext {
@@ -215,9 +216,9 @@ static int thp_read_packet(AVFormatContext *s,
     return 0;
 }
 
-const AVInputFormat ff_thp_demuxer = {
-    .name           = "thp",
-    .long_name      = NULL_IF_CONFIG_SMALL("THP"),
+const FFInputFormat ff_thp_demuxer = {
+    .p.name         = "thp",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("THP"),
     .priv_data_size = sizeof(ThpDemuxContext),
     .read_probe     = thp_probe,
     .read_header    = thp_read_header,
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index d06853d0d6..9de3689720 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -26,6 +26,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define SEQ_FRAME_SIZE         6144
@@ -307,9 +308,9 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_tiertexseq_demuxer = {
-    .name           = "tiertexseq",
-    .long_name      = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ"),
+const FFInputFormat ff_tiertexseq_demuxer = {
+    .p.name         = "tiertexseq",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ"),
     .priv_data_size = sizeof(SeqDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = seq_probe,
diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index 18105f764e..ae4973f0f3 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -29,6 +29,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 enum {
@@ -185,13 +186,13 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_tmv_demuxer = {
-    .name           = "tmv",
-    .long_name      = NULL_IF_CONFIG_SMALL("8088flex TMV"),
+const FFInputFormat ff_tmv_demuxer = {
+    .p.name         = "tmv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("8088flex TMV"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(TMVContext),
     .read_probe     = tmv_probe,
     .read_header    = tmv_read_header,
     .read_packet    = tmv_read_packet,
     .read_seek      = tmv_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 5477654014..fdc18216c8 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -26,6 +26,7 @@
 #include "apetag.h"
 #include "avformat.h"
 #include "avio_internal.h"
+#include "demux.h"
 #include "internal.h"
 #include "id3v1.h"
 
@@ -187,13 +188,13 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-const AVInputFormat ff_tta_demuxer = {
-    .name           = "tta",
-    .long_name      = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
+const FFInputFormat ff_tta_demuxer = {
+    .p.name         = "tta",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
+    .p.extensions   = "tta",
     .priv_data_size = sizeof(TTAContext),
     .read_probe     = tta_probe,
     .read_header    = tta_read_header,
     .read_packet    = tta_read_packet,
     .read_seek      = tta_read_seek,
-    .extensions     = "tta",
 };
diff --git a/libavformat/tty.c b/libavformat/tty.c
index fbea3196fa..95b7200527 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -31,6 +31,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "sauce.h"
 
@@ -178,14 +179,14 @@ static const AVClass tty_demuxer_class = {
     .version        = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_tty_demuxer = {
-    .name           = "tty",
-    .long_name      = NULL_IF_CONFIG_SMALL("Tele-typewriter"),
+const FFInputFormat ff_tty_demuxer = {
+    .p.name         = "tty",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Tele-typewriter"),
+    .p.extensions   = tty_extensions,
+    .p.priv_class   = &tty_demuxer_class,
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(TtyDemuxContext),
     .read_probe     = read_probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
-    .extensions     = tty_extensions,
-    .priv_class     = &tty_demuxer_class,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/txd.c b/libavformat/txd.c
index 93db883087..4486db5e44 100644
--- a/libavformat/txd.c
+++ b/libavformat/txd.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define TXD_FILE            0x16
@@ -92,9 +93,9 @@ next_chunk:
     return 0;
 }
 
-const AVInputFormat ff_txd_demuxer = {
-    .name        = "txd",
-    .long_name   = NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
+const FFInputFormat ff_txd_demuxer = {
+    .p.name      = "txd",
+    .p.long_name = NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
     .read_probe  = txd_probe,
     .read_header = txd_read_header,
     .read_packet = txd_read_packet,
diff --git a/libavformat/ty.c b/libavformat/ty.c
index 760dfda54c..71707f750f 100644
--- a/libavformat/ty.c
+++ b/libavformat/ty.c
@@ -25,6 +25,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "mpeg.h"
 
@@ -710,14 +711,14 @@ static int ty_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_ty_demuxer = {
-    .name           = "ty",
-    .long_name      = NULL_IF_CONFIG_SMALL("TiVo TY Stream"),
+const FFInputFormat ff_ty_demuxer = {
+    .p.name         = "ty",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("TiVo TY Stream"),
+    .p.extensions   = "ty,ty+",
+    .p.flags        = AVFMT_TS_DISCONT,
     .priv_data_size = sizeof(TYDemuxContext),
     .read_probe     = ty_probe,
     .read_header    = ty_read_header,
     .read_packet    = ty_read_packet,
     .read_close     = ty_read_close,
-    .extensions     = "ty,ty+",
-    .flags          = AVFMT_TS_DISCONT,
 };
diff --git a/libavformat/usmdec.c b/libavformat/usmdec.c
index ee403e7a84..0c4e8d41be 100644
--- a/libavformat/usmdec.c
+++ b/libavformat/usmdec.c
@@ -414,14 +414,14 @@ static int usm_read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_usm_demuxer = {
-    .name           = "usm",
-    .long_name      = NULL_IF_CONFIG_SMALL("CRI USM"),
+const FFInputFormat ff_usm_demuxer = {
+    .p.name         = "usm",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("CRI USM"),
+    .p.extensions   = "usm",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOBINSEARCH,
     .priv_data_size = sizeof(USMDemuxContext),
     .read_probe     = usm_probe,
     .read_header    = usm_read_header,
     .read_packet    = usm_read_packet,
     .read_close     = usm_read_close,
-    .extensions     = "usm",
-    .flags          = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK | AVFMT_NOBINSEARCH,
 };
diff --git a/libavformat/vag.c b/libavformat/vag.c
index b3aa1c5b93..b5f2c7b5d9 100644
--- a/libavformat/vag.c
+++ b/libavformat/vag.c
@@ -21,6 +21,7 @@
 
 #include "libavutil/channel_layout.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int vag_probe(const AVProbeData *p)
@@ -73,11 +74,11 @@ static int vag_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align);
 }
 
-const AVInputFormat ff_vag_demuxer = {
-    .name           = "vag",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony PS2 VAG"),
+const FFInputFormat ff_vag_demuxer = {
+    .p.name         = "vag",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony PS2 VAG"),
+    .p.extensions   = "vag",
     .read_probe     = vag_probe,
     .read_header    = vag_read_header,
     .read_packet    = vag_read_packet,
-    .extensions     = "vag",
 };
diff --git a/libavformat/vapoursynth.c b/libavformat/vapoursynth.c
index b79ecfcf1b..e300392a8a 100644
--- a/libavformat/vapoursynth.c
+++ b/libavformat/vapoursynth.c
@@ -36,6 +36,7 @@
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 struct VSState {
@@ -480,9 +481,10 @@ static const AVClass class_vs = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_vapoursynth_demuxer = {
-    .name           = "vapoursynth",
-    .long_name      = NULL_IF_CONFIG_SMALL("VapourSynth demuxer"),
+const FFInputFormat ff_vapoursynth_demuxer = {
+    .p.name         = "vapoursynth",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("VapourSynth demuxer"),
+    .p.priv_class   = &class_vs,
     .priv_data_size = sizeof(VSContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = probe_vs,
@@ -490,5 +492,4 @@ const AVInputFormat ff_vapoursynth_demuxer = {
     .read_packet    = read_packet_vs,
     .read_close     = read_close_vs,
     .read_seek      = read_seek_vs,
-    .priv_class     = &class_vs,
 };
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index f63ffee69b..394a70c1ac 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -117,12 +117,12 @@ static int vc1t_read_packet(AVFormatContext *s,
     return pkt->size;
 }
 
-const AVInputFormat ff_vc1t_demuxer = {
-    .name           = "vc1test",
-    .long_name      = NULL_IF_CONFIG_SMALL("VC-1 test bitstream"),
+const FFInputFormat ff_vc1t_demuxer = {
+    .p.name         = "vc1test",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("VC-1 test bitstream"),
+    .p.extensions   = "rcv",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .read_probe     = vc1t_probe,
     .read_header    = vc1t_read_header,
     .read_packet    = vc1t_read_packet,
-    .extensions     = "rcv",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/vividas.c b/libavformat/vividas.c
index 2f47d65c7c..98bf134f25 100644
--- a/libavformat/vividas.c
+++ b/libavformat/vividas.c
@@ -32,6 +32,7 @@
 #include "libavutil/intreadwrite.h"
 #include "avio_internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define MAX_AUDIO_SUBPACKETS 100
@@ -790,9 +791,9 @@ static int viv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
     return 0;
 }
 
-const AVInputFormat ff_vividas_demuxer = {
-    .name           = "vividas",
-    .long_name      = NULL_IF_CONFIG_SMALL("Vividas VIV"),
+const FFInputFormat ff_vividas_demuxer = {
+    .p.name         = "vividas",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Vividas VIV"),
     .priv_data_size = sizeof(VividasDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = viv_probe,
diff --git a/libavformat/vivo.c b/libavformat/vivo.c
index 02df4f0013..76aa4a21c2 100644
--- a/libavformat/vivo.c
+++ b/libavformat/vivo.c
@@ -29,6 +29,7 @@
 #include "libavutil/avstring.h"
 #include "libavutil/parseutils.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 typedef struct VivoContext {
@@ -314,12 +315,12 @@ restart:
     return ret;
 }
 
-const AVInputFormat ff_vivo_demuxer = {
-    .name           = "vivo",
-    .long_name      = NULL_IF_CONFIG_SMALL("Vivo"),
+const FFInputFormat ff_vivo_demuxer = {
+    .p.name         = "vivo",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Vivo"),
+    .p.extensions   = "viv",
     .priv_data_size = sizeof(VivoContext),
     .read_probe     = vivo_probe,
     .read_header    = vivo_read_header,
     .read_packet    = vivo_read_packet,
-    .extensions     = "viv",
 };
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index f235d7635b..195f06b746 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -20,6 +20,7 @@
  */
 
 #include "libavutil/intreadwrite.h"
+#include "demux.h"
 #include "voc.h"
 #include "internal.h"
 
@@ -100,13 +101,13 @@ static int voc_read_seek(AVFormatContext *s, int stream_index,
     return -1;
 }
 
-const AVInputFormat ff_voc_demuxer = {
-    .name           = "voc",
-    .long_name      = NULL_IF_CONFIG_SMALL("Creative Voice"),
+const FFInputFormat ff_voc_demuxer = {
+    .p.name         = "voc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Creative Voice"),
+    .p.codec_tag    = ff_voc_codec_tags_list,
     .priv_data_size = sizeof(VocDecContext),
     .read_probe     = voc_probe,
     .read_header    = voc_read_header,
     .read_packet    = voc_read_packet,
     .read_seek      = voc_read_seek,
-    .codec_tag      = ff_voc_codec_tags_list,
 };
diff --git a/libavformat/vpk.c b/libavformat/vpk.c
index bfd49c6307..001ad33555 100644
--- a/libavformat/vpk.c
+++ b/libavformat/vpk.c
@@ -135,13 +135,13 @@ static int vpk_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_vpk_demuxer = {
-    .name           = "vpk",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony PS2 VPK"),
+const FFInputFormat ff_vpk_demuxer = {
+    .p.name         = "vpk",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony PS2 VPK"),
+    .p.extensions   = "vpk",
     .priv_data_size = sizeof(VPKDemuxContext),
     .read_probe     = vpk_probe,
     .read_header    = vpk_read_header,
     .read_packet    = vpk_read_packet,
     .read_seek      = vpk_read_seek,
-    .extensions     = "vpk",
 };
diff --git a/libavformat/vplayerdec.c b/libavformat/vplayerdec.c
index b37f6c8f64..cd6b3d6c3a 100644
--- a/libavformat/vplayerdec.c
+++ b/libavformat/vplayerdec.c
@@ -24,6 +24,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 
@@ -95,14 +96,14 @@ static int vplayer_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_vplayer_demuxer = {
-    .name           = "vplayer",
-    .long_name      = NULL_IF_CONFIG_SMALL("VPlayer subtitles"),
+const FFInputFormat ff_vplayer_demuxer = {
+    .p.name         = "vplayer",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("VPlayer subtitles"),
+    .p.extensions   = "txt",
     .priv_data_size = sizeof(VPlayerContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = vplayer_probe,
     .read_header    = vplayer_read_header,
-    .extensions     = "txt",
     .read_packet    = ff_subtitles_read_packet,
     .read_seek2     = ff_subtitles_read_seek,
     .read_close     = ff_subtitles_read_close,
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 1671d03b2c..4c7f5aa22e 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -20,6 +20,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
@@ -287,13 +288,13 @@ static int vqf_read_seek(AVFormatContext *s,
     return 0;
 }
 
-const AVInputFormat ff_vqf_demuxer = {
-    .name           = "vqf",
-    .long_name      = NULL_IF_CONFIG_SMALL("Nippon Telegraph and Telephone Corporation (NTT) TwinVQ"),
+const FFInputFormat ff_vqf_demuxer = {
+    .p.name         = "vqf",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Nippon Telegraph and Telephone Corporation (NTT) TwinVQ"),
+    .p.extensions   = "vqf,vql,vqe",
     .priv_data_size = sizeof(VqfContext),
     .read_probe     = vqf_probe,
     .read_header    = vqf_read_header,
     .read_packet    = vqf_read_packet,
     .read_seek      = vqf_read_seek,
-    .extensions     = "vqf,vql,vqe",
 };
diff --git a/libavformat/wady.c b/libavformat/wady.c
index bd9b64f514..6dcc0018f3 100644
--- a/libavformat/wady.c
+++ b/libavformat/wady.c
@@ -75,13 +75,13 @@ static int wady_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_wady_demuxer = {
-    .name           = "wady",
-    .long_name      = NULL_IF_CONFIG_SMALL("Marble WADY"),
+const FFInputFormat ff_wady_demuxer = {
+    .p.name         = "wady",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Marble WADY"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "way",
     .read_probe     = wady_probe,
     .read_header    = wady_read_header,
     .read_packet    = ff_pcm_read_packet,
     .read_seek      = ff_pcm_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "way",
 };
diff --git a/libavformat/wavarc.c b/libavformat/wavarc.c
index 542a2abbc1..9d7029f209 100644
--- a/libavformat/wavarc.c
+++ b/libavformat/wavarc.c
@@ -133,14 +133,14 @@ static int wavarc_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_wavarc_demuxer = {
-    .name           = "wavarc",
-    .long_name      = NULL_IF_CONFIG_SMALL("Waveform Archiver"),
+const FFInputFormat ff_wavarc_demuxer = {
+    .p.name         = "wavarc",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Waveform Archiver"),
+    .p.flags        = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
+    .p.extensions   = "wa",
     .priv_data_size = sizeof(WavArcContext),
     .read_probe     = wavarc_probe,
     .read_packet    = wavarc_read_packet,
-    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK | AVFMT_NOTIMESTAMPS,
     .read_header    = wavarc_read_header,
-    .extensions     = "wa",
     .raw_codec_id   = AV_CODEC_ID_WAVARC,
 };
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 0c6629b157..8cd4beec26 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -828,17 +828,17 @@ static const AVClass wav_demuxer_class = {
     .option     = demux_options,
     .version    = LIBAVUTIL_VERSION_INT,
 };
-const AVInputFormat ff_wav_demuxer = {
-    .name           = "wav",
-    .long_name      = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"),
+const FFInputFormat ff_wav_demuxer = {
+    .p.name         = "wav",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.codec_tag    = ff_wav_codec_tags_list,
+    .p.priv_class   = &wav_demuxer_class,
     .priv_data_size = sizeof(WAVDemuxContext),
     .read_probe     = wav_probe,
     .read_header    = wav_read_header,
     .read_packet    = wav_read_packet,
     .read_seek      = wav_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .codec_tag      = ff_wav_codec_tags_list,
-    .priv_class     = &wav_demuxer_class,
 };
 #endif /* CONFIG_WAV_DEMUXER */
 
@@ -992,16 +992,16 @@ static const AVClass w64_demuxer_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_w64_demuxer = {
-    .name           = "w64",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony Wave64"),
+const FFInputFormat ff_w64_demuxer = {
+    .p.name         = "w64",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony Wave64"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.codec_tag    = ff_wav_codec_tags_list,
+    .p.priv_class   = &w64_demuxer_class,
     .priv_data_size = sizeof(WAVDemuxContext),
     .read_probe     = w64_probe,
     .read_header    = w64_read_header,
     .read_packet    = wav_read_packet,
     .read_seek      = wav_read_seek,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .codec_tag      = ff_wav_codec_tags_list,
-    .priv_class     = &w64_demuxer_class,
 };
 #endif /* CONFIG_W64_DEMUXER */
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 8f5c2f18cd..022b276fbd 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -32,6 +32,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define FORM_TAG MKTAG('F', 'O', 'R', 'M')
@@ -293,9 +294,9 @@ static int wc3_read_packet(AVFormatContext *s,
     return ret;
 }
 
-const AVInputFormat ff_wc3_demuxer = {
-    .name           = "wc3movie",
-    .long_name      = NULL_IF_CONFIG_SMALL("Wing Commander III movie"),
+const FFInputFormat ff_wc3_demuxer = {
+    .p.name         = "wc3movie",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Wing Commander III movie"),
     .priv_data_size = sizeof(Wc3DemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = wc3_probe,
diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c
index 0b2fc77168..661cbdb30f 100644
--- a/libavformat/webvttdec.c
+++ b/libavformat/webvttdec.c
@@ -25,6 +25,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "subtitles.h"
 #include "libavutil/bprint.h"
@@ -210,9 +211,11 @@ static const AVClass webvtt_demuxer_class = {
     .version     = LIBAVUTIL_VERSION_INT,
 };
 
-const AVInputFormat ff_webvtt_demuxer = {
-    .name           = "webvtt",
-    .long_name      = NULL_IF_CONFIG_SMALL("WebVTT subtitle"),
+const FFInputFormat ff_webvtt_demuxer = {
+    .p.name         = "webvtt",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("WebVTT subtitle"),
+    .p.extensions   = "vtt",
+    .p.priv_class   = &webvtt_demuxer_class,
     .priv_data_size = sizeof(WebVTTContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = webvtt_probe,
@@ -220,6 +223,4 @@ const AVInputFormat ff_webvtt_demuxer = {
     .read_packet    = webvtt_read_packet,
     .read_seek2     = webvtt_read_seek,
     .read_close     = webvtt_read_close,
-    .extensions     = "vtt",
-    .priv_class     = &webvtt_demuxer_class,
 };
diff --git a/libavformat/westwood_aud.c b/libavformat/westwood_aud.c
index 9896bd46df..f83913a22f 100644
--- a/libavformat/westwood_aud.c
+++ b/libavformat/westwood_aud.c
@@ -36,6 +36,7 @@
 #include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define AUD_HEADER_SIZE 12
@@ -176,9 +177,9 @@ static int wsaud_read_packet(AVFormatContext *s,
     return ret;
 }
 
-const AVInputFormat ff_wsaud_demuxer = {
-    .name           = "wsaud",
-    .long_name      = NULL_IF_CONFIG_SMALL("Westwood Studios audio"),
+const FFInputFormat ff_wsaud_demuxer = {
+    .p.name         = "wsaud",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Westwood Studios audio"),
     .read_probe     = wsaud_probe,
     .read_header    = wsaud_read_header,
     .read_packet    = wsaud_read_packet,
diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index 03b2d9e03c..954710a6f0 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -317,9 +317,9 @@ static int wsvqa_read_packet(AVFormatContext *s,
     return ret;
 }
 
-const AVInputFormat ff_wsvqa_demuxer = {
-    .name           = "wsvqa",
-    .long_name      = NULL_IF_CONFIG_SMALL("Westwood Studios VQA"),
+const FFInputFormat ff_wsvqa_demuxer = {
+    .p.name         = "wsvqa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Westwood Studios VQA"),
     .priv_data_size = sizeof(WsVqaDemuxContext),
     .read_probe     = wsvqa_probe,
     .read_header    = wsvqa_read_header,
diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c
index 8153d898dd..f9408be5ec 100644
--- a/libavformat/wsddec.c
+++ b/libavformat/wsddec.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/timecode.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "rawdec.h"
 
@@ -165,15 +166,15 @@ static int wsd_read_header(AVFormatContext *s)
     return avio_seek(pb, data_offset, SEEK_SET);
 }
 
-const AVInputFormat ff_wsd_demuxer = {
-    .name         = "wsd",
-    .long_name    = NULL_IF_CONFIG_SMALL("Wideband Single-bit Data (WSD)"),
+const FFInputFormat ff_wsd_demuxer = {
+    .p.name         = "wsd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Wideband Single-bit Data (WSD)"),
+    .p.extensions   = "wsd",
+    .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
+    .p.priv_class   = &ff_raw_demuxer_class,
     .read_probe   = wsd_probe,
     .read_header  = wsd_read_header,
     .read_packet  = ff_raw_read_partial_packet,
-    .extensions   = "wsd",
-    .flags        = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK,
     .raw_codec_id = AV_CODEC_ID_DSD_MSBF,
     .priv_data_size = sizeof(FFRawDemuxerContext),
-    .priv_class     = &ff_raw_demuxer_class,
 };
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index e70470f79b..f41b0f2c68 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -1117,14 +1117,14 @@ static int read_close(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_wtv_demuxer = {
-    .name           = "wtv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Windows Television (WTV)"),
+const FFInputFormat ff_wtv_demuxer = {
+    .p.name         = "wtv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Windows Television (WTV)"),
+    .p.flags        = AVFMT_SHOW_IDS,
     .priv_data_size = sizeof(WtvContext),
     .read_probe     = read_probe,
     .read_header    = read_header,
     .read_packet    = read_packet,
     .read_seek      = read_seek,
     .read_close     = read_close,
-    .flags          = AVFMT_SHOW_IDS,
 };
diff --git a/libavformat/wvdec.c b/libavformat/wvdec.c
index 61a683a85e..b25c1eee83 100644
--- a/libavformat/wvdec.c
+++ b/libavformat/wvdec.c
@@ -23,6 +23,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/dict.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "apetag.h"
 #include "id3v1.h"
@@ -328,12 +329,12 @@ static int wv_read_packet(AVFormatContext *s, AVPacket *pkt)
     return 0;
 }
 
-const AVInputFormat ff_wv_demuxer = {
-    .name           = "wv",
-    .long_name      = NULL_IF_CONFIG_SMALL("WavPack"),
+const FFInputFormat ff_wv_demuxer = {
+    .p.name         = "wv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("WavPack"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(WVContext),
     .read_probe     = wv_probe,
     .read_header    = wv_read_header,
     .read_packet    = wv_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/wvedec.c b/libavformat/wvedec.c
index 52b3099f73..43e6359892 100644
--- a/libavformat/wvedec.c
+++ b/libavformat/wvedec.c
@@ -19,6 +19,7 @@
  */
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "pcm.h"
 
@@ -53,9 +54,9 @@ static int wve_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_wve_demuxer = {
-    .name           = "wve",
-    .long_name      = NULL_IF_CONFIG_SMALL("Psion 3 audio"),
+const FFInputFormat ff_wve_demuxer = {
+    .p.name         = "wve",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Psion 3 audio"),
     .read_probe     = wve_probe,
     .read_header    = wve_read_header,
     .read_packet    = ff_pcm_read_packet,
diff --git a/libavformat/xa.c b/libavformat/xa.c
index ec9fcbc94c..395af54afc 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -29,6 +29,7 @@
 
 #include "libavutil/intreadwrite.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 #define XA00_TAG MKTAG('X', 'A', 0, 0)
@@ -121,9 +122,9 @@ static int xa_read_packet(AVFormatContext *s,
     return ret;
 }
 
-const AVInputFormat ff_xa_demuxer = {
-    .name           = "xa",
-    .long_name      = NULL_IF_CONFIG_SMALL("Maxis XA"),
+const FFInputFormat ff_xa_demuxer = {
+    .p.name         = "xa",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Maxis XA"),
     .priv_data_size = sizeof(MaxisXADemuxContext),
     .read_probe     = xa_probe,
     .read_header    = xa_read_header,
diff --git a/libavformat/xmd.c b/libavformat/xmd.c
index f9c8138d72..d8368cd882 100644
--- a/libavformat/xmd.c
+++ b/libavformat/xmd.c
@@ -69,12 +69,12 @@ static int xmd_read_header(AVFormatContext *s)
     return 0;
 }
 
-const AVInputFormat ff_xmd_demuxer = {
-    .name           = "xmd",
-    .long_name      = NULL_IF_CONFIG_SMALL("Konami XMD"),
+const FFInputFormat ff_xmd_demuxer = {
+    .p.name         = "xmd",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Konami XMD"),
+    .p.flags        = AVFMT_GENERIC_INDEX,
+    .p.extensions   = "xmd",
     .read_probe     = xmd_probe,
     .read_header    = xmd_read_header,
     .read_packet    = ff_pcm_read_packet,
-    .flags          = AVFMT_GENERIC_INDEX,
-    .extensions     = "xmd",
 };
diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index 4bff63297a..e2c4c7f93e 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -30,6 +30,7 @@
 #include "libavutil/intreadwrite.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "riff.h"
 #include "libavutil/avassert.h"
@@ -575,10 +576,10 @@ static int xmv_read_packet(AVFormatContext *s,
     return 0;
 }
 
-const AVInputFormat ff_xmv_demuxer = {
-    .name           = "xmv",
-    .long_name      = NULL_IF_CONFIG_SMALL("Microsoft XMV"),
-    .extensions     = "xmv",
+const FFInputFormat ff_xmv_demuxer = {
+    .p.name         = "xmv",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Microsoft XMV"),
+    .p.extensions   = "xmv",
     .priv_data_size = sizeof(XMVDemuxContext),
     .flags_internal = FF_FMT_INIT_CLEANUP,
     .read_probe     = xmv_probe,
diff --git a/libavformat/xvag.c b/libavformat/xvag.c
index f8a83f258c..c3c39490e6 100644
--- a/libavformat/xvag.c
+++ b/libavformat/xvag.c
@@ -22,6 +22,7 @@
 #include "libavutil/bswap.h"
 #include "libavcodec/internal.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 
 static int xvag_probe(const AVProbeData *p)
@@ -104,11 +105,11 @@ static int xvag_read_packet(AVFormatContext *s, AVPacket *pkt)
     return av_get_packet(s->pb, pkt, par->block_align);
 }
 
-const AVInputFormat ff_xvag_demuxer = {
-    .name           = "xvag",
-    .long_name      = NULL_IF_CONFIG_SMALL("Sony PS3 XVAG"),
+const FFInputFormat ff_xvag_demuxer = {
+    .p.name         = "xvag",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Sony PS3 XVAG"),
+    .p.extensions   = "xvag",
     .read_probe     = xvag_probe,
     .read_header    = xvag_read_header,
     .read_packet    = xvag_read_packet,
-    .extensions     = "xvag",
 };
diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index b830f9ed75..525baee6f5 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -23,6 +23,7 @@
 #include <stdint.h>
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "riff.h"
 
@@ -313,9 +314,9 @@ static int xwma_read_packet(AVFormatContext *s, AVPacket *pkt)
     return ret;
 }
 
-const AVInputFormat ff_xwma_demuxer = {
-    .name           = "xwma",
-    .long_name      = NULL_IF_CONFIG_SMALL("Microsoft xWMA"),
+const FFInputFormat ff_xwma_demuxer = {
+    .p.name         = "xwma",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Microsoft xWMA"),
     .priv_data_size = sizeof(XWMAContext),
     .read_probe     = xwma_probe,
     .read_header    = xwma_read_header,
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 8fdad6899b..fd11acafc1 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -204,15 +204,15 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
     return 0;
 }
 
-const AVInputFormat ff_yop_demuxer = {
-    .name           = "yop",
-    .long_name      = NULL_IF_CONFIG_SMALL("Psygnosis YOP"),
+const FFInputFormat ff_yop_demuxer = {
+    .p.name         = "yop",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("Psygnosis YOP"),
+    .p.extensions   = "yop",
+    .p.flags        = AVFMT_GENERIC_INDEX,
     .priv_data_size = sizeof(YopDecContext),
     .read_probe     = yop_probe,
     .read_header    = yop_read_header,
     .read_packet    = yop_read_packet,
     .read_close     = yop_read_close,
     .read_seek      = yop_read_seek,
-    .extensions     = "yop",
-    .flags          = AVFMT_GENERIC_INDEX,
 };
diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index c0972af7de..2b66a1e596 100644
--- a/libavformat/yuv4mpegdec.c
+++ b/libavformat/yuv4mpegdec.c
@@ -23,6 +23,7 @@
 #include "libavutil/imgutils.h"
 
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "yuv4mpeg.h"
 
@@ -323,12 +324,12 @@ static int yuv4_probe(const AVProbeData *pd)
         return 0;
 }
 
-const AVInputFormat ff_yuv4mpegpipe_demuxer = {
-    .name           = "yuv4mpegpipe",
-    .long_name      = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
+const FFInputFormat ff_yuv4mpegpipe_demuxer = {
+    .p.name         = "yuv4mpegpipe",
+    .p.long_name    = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
+    .p.extensions   = "y4m",
     .read_probe     = yuv4_probe,
     .read_header    = yuv4_read_header,
     .read_packet    = yuv4_read_packet,
     .read_seek      = yuv4_read_seek,
-    .extensions     = "y4m",
 };
diff --git a/tools/probetest.c b/tools/probetest.c
index 6f0e002b74..e742d598b1 100644
--- a/tools/probetest.c
+++ b/tools/probetest.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 
 #include "libavformat/avformat.h"
+#include "libavformat/demux.h"
 #include "libavcodec/put_bits.h"
 #include "libavutil/lfg.h"
 #include "libavutil/timer.h"
@@ -44,12 +45,12 @@ static void probe(AVProbeData *pd, int type, int p, int size)
     while ((fmt = av_demuxer_iterate(&fmt_opaque))) {
         if (fmt->flags & AVFMT_NOFILE)
             continue;
-        if (fmt->read_probe &&
+        if (ffifmt(fmt)->read_probe &&
             (!single_format || !strcmp(single_format, fmt->name))
         ) {
             int score;
             int64_t start = AV_READ_TIME();
-            score = fmt->read_probe(pd);
+            score = ffifmt(fmt)->read_probe(pd);
             time_array[i] += AV_READ_TIME() - start;
             if (score > score_array[i] && score > AVPROBE_SCORE_MAX / 4) {
                 score_array[i] = score;
diff --git a/tools/target_dem_fuzzer.c b/tools/target_dem_fuzzer.c
index 32767a0182..76eed9f6a2 100644
--- a/tools/target_dem_fuzzer.c
+++ b/tools/target_dem_fuzzer.c
@@ -113,12 +113,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
     static int c;
     int seekable = 0;
     int ret;
-    AVInputFormat *fmt = NULL;
+    const AVInputFormat *fmt = NULL;
 #ifdef FFMPEG_DEMUXER
 #define DEMUXER_SYMBOL0(DEMUXER) ff_##DEMUXER##_demuxer
 #define DEMUXER_SYMBOL(DEMUXER) DEMUXER_SYMBOL0(DEMUXER)
-    extern AVInputFormat DEMUXER_SYMBOL(FFMPEG_DEMUXER);
-    fmt = &DEMUXER_SYMBOL(FFMPEG_DEMUXER);
+    extern const FFInputFormat DEMUXER_SYMBOL(FFMPEG_DEMUXER);
+    fmt = &DEMUXER_SYMBOL(FFMPEG_DEMUXER).p;
 #endif
 
     if (!c) {
-- 
2.34.1



More information about the ffmpeg-devel mailing list