Skip to content

Commit b800327

Browse files
mkverjamrial
authored andcommitted
avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat
This commit does for AVInputFormat what commit 59c9dc8 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 50f3417 (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 <[email protected]>
1 parent bb81c60 commit b800327

File tree

300 files changed

+2187
-1948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+2187
-1948
lines changed

configure

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4128,9 +4128,9 @@ find_filters_extern(){
41284128

41294129
FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
41304130
OUTDEV_LIST=$(find_things_extern muxer FFOutputFormat libavdevice/alldevices.c outdev)
4131-
INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
4131+
INDEV_LIST=$(find_things_extern demuxer FFInputFormat libavdevice/alldevices.c indev)
41324132
MUXER_LIST=$(find_things_extern muxer FFOutputFormat libavformat/allformats.c)
4133-
DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
4133+
DEMUXER_LIST=$(find_things_extern demuxer FFInputFormat libavformat/allformats.c)
41344134
ENCODER_LIST=$(find_things_extern encoder FFCodec libavcodec/allcodecs.c)
41354135
DECODER_LIST=$(find_things_extern decoder FFCodec libavcodec/allcodecs.c)
41364136
CODEC_LIST="
@@ -8202,9 +8202,9 @@ print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_
82028202
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $CODEC_LIST
82038203
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
82048204
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $BSF_LIST
8205-
print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
8205+
print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $DEMUXER_LIST
82068206
print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $MUXER_LIST
8207-
print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
8207+
print_enabled_components libavdevice/indev_list.c FFInputFormat indev_list $INDEV_LIST
82088208
print_enabled_components libavdevice/outdev_list.c FFOutputFormat outdev_list $OUTDEV_LIST
82098209
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
82108210

libavdevice/alldevices.c

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,47 @@
1818
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1919
*/
2020

21+
#include "libavformat/demux.h"
2122
#include "libavformat/internal.h"
2223
#include "libavformat/mux.h"
2324
#include "avdevice.h"
2425

2526
/* devices */
26-
extern const AVInputFormat ff_alsa_demuxer;
27+
extern const FFInputFormat ff_alsa_demuxer;
2728
extern const FFOutputFormat ff_alsa_muxer;
28-
extern const AVInputFormat ff_android_camera_demuxer;
29+
extern const FFInputFormat ff_android_camera_demuxer;
2930
extern const FFOutputFormat ff_audiotoolbox_muxer;
30-
extern const AVInputFormat ff_avfoundation_demuxer;
31-
extern const AVInputFormat ff_bktr_demuxer;
31+
extern const FFInputFormat ff_avfoundation_demuxer;
32+
extern const FFInputFormat ff_bktr_demuxer;
3233
extern const FFOutputFormat ff_caca_muxer;
33-
extern const AVInputFormat ff_decklink_demuxer;
34+
extern const FFInputFormat ff_decklink_demuxer;
3435
extern const FFOutputFormat ff_decklink_muxer;
35-
extern const AVInputFormat ff_dshow_demuxer;
36-
extern const AVInputFormat ff_fbdev_demuxer;
36+
extern const FFInputFormat ff_dshow_demuxer;
37+
extern const FFInputFormat ff_fbdev_demuxer;
3738
extern const FFOutputFormat ff_fbdev_muxer;
38-
extern const AVInputFormat ff_gdigrab_demuxer;
39-
extern const AVInputFormat ff_iec61883_demuxer;
40-
extern const AVInputFormat ff_jack_demuxer;
41-
extern const AVInputFormat ff_kmsgrab_demuxer;
42-
extern const AVInputFormat ff_lavfi_demuxer;
43-
extern const AVInputFormat ff_openal_demuxer;
39+
extern const FFInputFormat ff_gdigrab_demuxer;
40+
extern const FFInputFormat ff_iec61883_demuxer;
41+
extern const FFInputFormat ff_jack_demuxer;
42+
extern const FFInputFormat ff_kmsgrab_demuxer;
43+
extern const FFInputFormat ff_lavfi_demuxer;
44+
extern const FFInputFormat ff_openal_demuxer;
4445
extern const FFOutputFormat ff_opengl_muxer;
45-
extern const AVInputFormat ff_oss_demuxer;
46+
extern const FFInputFormat ff_oss_demuxer;
4647
extern const FFOutputFormat ff_oss_muxer;
47-
extern const AVInputFormat ff_pulse_demuxer;
48+
extern const FFInputFormat ff_pulse_demuxer;
4849
extern const FFOutputFormat ff_pulse_muxer;
4950
extern const FFOutputFormat ff_sdl2_muxer;
50-
extern const AVInputFormat ff_sndio_demuxer;
51+
extern const FFInputFormat ff_sndio_demuxer;
5152
extern const FFOutputFormat ff_sndio_muxer;
52-
extern const AVInputFormat ff_v4l2_demuxer;
53+
extern const FFInputFormat ff_v4l2_demuxer;
5354
extern const FFOutputFormat ff_v4l2_muxer;
54-
extern const AVInputFormat ff_vfwcap_demuxer;
55-
extern const AVInputFormat ff_xcbgrab_demuxer;
55+
extern const FFInputFormat ff_vfwcap_demuxer;
56+
extern const FFInputFormat ff_xcbgrab_demuxer;
5657
extern const FFOutputFormat ff_xv_muxer;
5758

5859
/* external libraries */
59-
extern const AVInputFormat ff_libcdio_demuxer;
60-
extern const AVInputFormat ff_libdc1394_demuxer;
60+
extern const FFInputFormat ff_libcdio_demuxer;
61+
extern const FFInputFormat ff_libdc1394_demuxer;
6162

6263
#include "libavdevice/outdev_list.c"
6364
#include "libavdevice/indev_list.c"
@@ -72,20 +73,20 @@ static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
7273
const AVClass *pc;
7374
const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT;
7475
AVClassCategory category = AV_CLASS_CATEGORY_NA;
75-
const AVInputFormat *fmt = NULL;
76+
const FFInputFormat *fmt = NULL;
7677
int i = 0;
7778

7879
while (prev && (fmt = indev_list[i])) {
7980
i++;
80-
if (prev == fmt)
81+
if (prev == &fmt->p)
8182
break;
8283
}
8384

8485
do {
8586
fmt = indev_list[i++];
8687
if (!fmt)
8788
break;
88-
pc = fmt->priv_class;
89+
pc = fmt->p.priv_class;
8990
if (!pc)
9091
continue;
9192
category = pc->category;

libavdevice/alsa_dec.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "libavutil/opt.h"
5353
#include "libavutil/time.h"
5454

55+
#include "libavformat/demux.h"
5556
#include "libavformat/internal.h"
5657

5758
#include "avdevice.h"
@@ -157,14 +158,14 @@ static const AVClass alsa_demuxer_class = {
157158
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
158159
};
159160

160-
const AVInputFormat ff_alsa_demuxer = {
161-
.name = "alsa",
162-
.long_name = NULL_IF_CONFIG_SMALL("ALSA audio input"),
161+
const FFInputFormat ff_alsa_demuxer = {
162+
.p.name = "alsa",
163+
.p.long_name = NULL_IF_CONFIG_SMALL("ALSA audio input"),
164+
.p.flags = AVFMT_NOFILE,
165+
.p.priv_class = &alsa_demuxer_class,
163166
.priv_data_size = sizeof(AlsaData),
164167
.read_header = audio_read_header,
165168
.read_packet = audio_read_packet,
166169
.read_close = ff_alsa_close,
167170
.get_device_list = audio_get_device_list,
168-
.flags = AVFMT_NOFILE,
169-
.priv_class = &alsa_demuxer_class,
170171
};

libavdevice/android_camera.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <media/NdkImageReader.h>
3434

3535
#include "libavformat/avformat.h"
36+
#include "libavformat/demux.h"
3637
#include "libavformat/internal.h"
3738
#include "libavutil/avstring.h"
3839
#include "libavutil/display.h"
@@ -860,13 +861,13 @@ static const AVClass android_camera_class = {
860861
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
861862
};
862863

863-
const AVInputFormat ff_android_camera_demuxer = {
864-
.name = "android_camera",
865-
.long_name = NULL_IF_CONFIG_SMALL("Android camera input device"),
864+
const FFInputFormat ff_android_camera_demuxer = {
865+
.p.name = "android_camera",
866+
.p.long_name = NULL_IF_CONFIG_SMALL("Android camera input device"),
867+
.p.flags = AVFMT_NOFILE,
868+
.p.priv_class = &android_camera_class,
866869
.priv_data_size = sizeof(AndroidCameraCtx),
867870
.read_header = android_camera_read_header,
868871
.read_packet = android_camera_read_packet,
869872
.read_close = android_camera_read_close,
870-
.flags = AVFMT_NOFILE,
871-
.priv_class = &android_camera_class,
872873
};

libavdevice/avdevice.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "libavutil/avassert.h"
2020
#include "avdevice.h"
2121
#include "internal.h"
22+
#include "libavformat/demux.h"
2223
#include "libavformat/mux.h"
2324

2425
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)
4445
av_assert0(device_list);
4546
av_assert0(s->oformat || s->iformat);
4647
if ((s->oformat && !ffofmt(s->oformat)->get_device_list) ||
47-
(s->iformat && !s->iformat->get_device_list)) {
48+
(s->iformat && !ffifmt(s->iformat)->get_device_list)) {
4849
*device_list = NULL;
4950
return AVERROR(ENOSYS);
5051
}
@@ -56,7 +57,7 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
5657
if (s->oformat)
5758
ret = ffofmt(s->oformat)->get_device_list(s, *device_list);
5859
else
59-
ret = s->iformat->get_device_list(s, *device_list);
60+
ret = ffifmt(s->iformat)->get_device_list(s, *device_list);
6061
if (ret < 0) {
6162
avdevice_free_list_devices(device_list);
6263
return ret;

libavdevice/bktr.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2525
*/
2626

27+
#include "libavformat/demux.h"
2728
#include "libavformat/internal.h"
2829
#include "libavutil/file_open.h"
2930
#include "libavutil/internal.h"
@@ -352,13 +353,13 @@ static const AVClass bktr_class = {
352353
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
353354
};
354355

355-
const AVInputFormat ff_bktr_demuxer = {
356-
.name = "bktr",
357-
.long_name = NULL_IF_CONFIG_SMALL("video grab"),
356+
const FFInputFormat ff_bktr_demuxer = {
357+
.p.name = "bktr",
358+
.p.long_name = NULL_IF_CONFIG_SMALL("video grab"),
359+
.p.flags = AVFMT_NOFILE,
360+
.p.priv_class = &bktr_class,
358361
.priv_data_size = sizeof(VideoData),
359362
.read_header = grab_read_header,
360363
.read_packet = grab_read_packet,
361364
.read_close = grab_read_close,
362-
.flags = AVFMT_NOFILE,
363-
.priv_class = &bktr_class,
364365
};

libavdevice/decklink_dec_c.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222

2323
#include "libavformat/avformat.h"
24+
#include "libavformat/demux.h"
2425
#include "libavutil/opt.h"
2526

2627
#include "decklink_common_c.h"
@@ -111,11 +112,11 @@ static const AVClass decklink_demuxer_class = {
111112
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
112113
};
113114

114-
const AVInputFormat ff_decklink_demuxer = {
115-
.name = "decklink",
116-
.long_name = NULL_IF_CONFIG_SMALL("Blackmagic DeckLink input"),
117-
.flags = AVFMT_NOFILE,
118-
.priv_class = &decklink_demuxer_class,
115+
const FFInputFormat ff_decklink_demuxer = {
116+
.p.name = "decklink",
117+
.p.long_name = NULL_IF_CONFIG_SMALL("Blackmagic DeckLink input"),
118+
.p.flags = AVFMT_NOFILE,
119+
.p.priv_class = &decklink_demuxer_class,
119120
.priv_data_size = sizeof(struct decklink_cctx),
120121
.get_device_list = ff_decklink_list_input_devices,
121122
.read_header = ff_decklink_read_header,

libavdevice/dshow.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "libavutil/pixdesc.h"
2525
#include "libavutil/opt.h"
2626
#include "libavutil/mem.h"
27+
#include "libavformat/demux.h"
2728
#include "libavformat/internal.h"
2829
#include "libavformat/riff.h"
2930
#include "avdevice.h"
@@ -1924,14 +1925,15 @@ static const AVClass dshow_class = {
19241925
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
19251926
};
19261927

1927-
const AVInputFormat ff_dshow_demuxer = {
1928-
.name = "dshow",
1929-
.long_name = NULL_IF_CONFIG_SMALL("DirectShow capture"),
1928+
const FFInputFormat ff_dshow_demuxer = {
1929+
.p.name = "dshow",
1930+
.p.long_name = NULL_IF_CONFIG_SMALL("DirectShow capture"),
1931+
.p.flags = AVFMT_NOFILE | AVFMT_NOBINSEARCH |
1932+
AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
1933+
.p.priv_class = &dshow_class,
19301934
.priv_data_size = sizeof(struct dshow_ctx),
19311935
.read_header = dshow_read_header,
19321936
.read_packet = dshow_read_packet,
19331937
.read_close = dshow_read_close,
19341938
.get_device_list= dshow_get_device_list,
1935-
.flags = AVFMT_NOFILE | AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
1936-
.priv_class = &dshow_class,
19371939
};

libavdevice/fbdev_dec.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "libavutil/time.h"
4242
#include "libavutil/parseutils.h"
4343
#include "libavutil/pixdesc.h"
44+
#include "libavformat/demux.h"
4445
#include "libavformat/internal.h"
4546
#include "avdevice.h"
4647
#include "fbdev_common.h"
@@ -232,14 +233,14 @@ static const AVClass fbdev_class = {
232233
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
233234
};
234235

235-
const AVInputFormat ff_fbdev_demuxer = {
236-
.name = "fbdev",
237-
.long_name = NULL_IF_CONFIG_SMALL("Linux framebuffer"),
236+
const FFInputFormat ff_fbdev_demuxer = {
237+
.p.name = "fbdev",
238+
.p.long_name = NULL_IF_CONFIG_SMALL("Linux framebuffer"),
239+
.p.flags = AVFMT_NOFILE,
240+
.p.priv_class = &fbdev_class,
238241
.priv_data_size = sizeof(FBDevContext),
239242
.read_header = fbdev_read_header,
240243
.read_packet = fbdev_read_packet,
241244
.read_close = fbdev_read_close,
242245
.get_device_list = fbdev_get_device_list,
243-
.flags = AVFMT_NOFILE,
244-
.priv_class = &fbdev_class,
245246
};

libavdevice/gdigrab.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030

3131
#include "config.h"
32+
#include "libavformat/demux.h"
3233
#include "libavformat/internal.h"
3334
#include "libavutil/opt.h"
3435
#include "libavutil/time.h"
@@ -677,13 +678,13 @@ static const AVClass gdigrab_class = {
677678
};
678679

679680
/** gdi grabber device demuxer declaration */
680-
const AVInputFormat ff_gdigrab_demuxer = {
681-
.name = "gdigrab",
682-
.long_name = NULL_IF_CONFIG_SMALL("GDI API Windows frame grabber"),
681+
const FFInputFormat ff_gdigrab_demuxer = {
682+
.p.name = "gdigrab",
683+
.p.long_name = NULL_IF_CONFIG_SMALL("GDI API Windows frame grabber"),
684+
.p.flags = AVFMT_NOFILE,
685+
.p.priv_class = &gdigrab_class,
683686
.priv_data_size = sizeof(struct gdigrab),
684687
.read_header = gdigrab_read_header,
685688
.read_packet = gdigrab_read_packet,
686689
.read_close = gdigrab_read_close,
687-
.flags = AVFMT_NOFILE,
688-
.priv_class = &gdigrab_class,
689690
};

libavdevice/iec61883.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <libavc1394/avc1394.h>
3131
#include <libavc1394/rom1394.h>
3232
#include <libiec61883/iec61883.h>
33+
#include "libavformat/demux.h"
3334
#include "libavformat/dv.h"
3435
#include "libavformat/mpegts.h"
3536
#include "libavutil/opt.h"
@@ -502,13 +503,13 @@ static const AVClass iec61883_class = {
502503
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
503504
};
504505

505-
const AVInputFormat ff_iec61883_demuxer = {
506-
.name = "iec61883",
507-
.long_name = NULL_IF_CONFIG_SMALL("libiec61883 (new DV1394) A/V input device"),
506+
const FFInputFormat ff_iec61883_demuxer = {
507+
.p.name = "iec61883",
508+
.p.long_name = NULL_IF_CONFIG_SMALL("libiec61883 (new DV1394) A/V input device"),
509+
.p.flags = AVFMT_NOFILE,
510+
.p.priv_class = &iec61883_class,
508511
.priv_data_size = sizeof(struct iec61883_data),
509512
.read_header = iec61883_read_header,
510513
.read_packet = iec61883_read_packet,
511514
.read_close = iec61883_close,
512-
.flags = AVFMT_NOFILE,
513-
.priv_class = &iec61883_class,
514515
};

libavdevice/jack.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "libavutil/opt.h"
3131
#include "libavutil/time.h"
3232
#include "libavformat/avformat.h"
33+
#include "libavformat/demux.h"
3334
#include "libavformat/internal.h"
3435
#include "timefilter.h"
3536
#include "avdevice.h"
@@ -341,13 +342,13 @@ static const AVClass jack_indev_class = {
341342
.category = AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT,
342343
};
343344

344-
const AVInputFormat ff_jack_demuxer = {
345-
.name = "jack",
346-
.long_name = NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
345+
const FFInputFormat ff_jack_demuxer = {
346+
.p.name = "jack",
347+
.p.long_name = NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
348+
.p.flags = AVFMT_NOFILE,
349+
.p.priv_class = &jack_indev_class,
347350
.priv_data_size = sizeof(JackData),
348351
.read_header = audio_read_header,
349352
.read_packet = audio_read_packet,
350353
.read_close = audio_read_close,
351-
.flags = AVFMT_NOFILE,
352-
.priv_class = &jack_indev_class,
353354
};

0 commit comments

Comments
 (0)