This reverts commit 0fd475704e871ef3a535947596a012894bae3cbd. Revert "lavd: fix iterating of input and output devices" This reverts commit ce1d77a5e7cebce11074bf6f9e38ad6da37338ff.
Unified · Split
| @@ -144,8 +144,7 @@ distclean:: clean · 143 unmodified lines | ||
| 144 | 144 | version.h libavutil/ffversion.h libavcodec/codec_names.h \ |
| 145 | 145 | libavcodec/bsf_list.c libavformat/protocol_list.c \ |
| 146 | 146 | libavcodec/codec_list.c libavcodec/parser_list.c \ |
| 147 | − libavformat/muxer_list.c libavformat/demuxer_list.c \ | |
| 148 | − libavdevice/indev_list.c libavdevice/outdev_list.c | |
| 147 | + libavformat/muxer_list.c libavformat/demuxer_list.c | |
| 149 | 148 | ifeq ($(SRC_LINK),src) |
| 150 | 149 | $(RM) src |
| 151 | 150 | endif |
| @@ -3622,12 +3622,21 @@ for v in "$@"; do · 3621 unmodified lines | ||
| 3622 | 3622 | FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}" |
| 3623 | 3623 | done |
| 3624 | 3624 | |
| 3625 | +find_things(){ | |
| 3626 | + thing=$1 | |
| 3627 | + pattern=$2 | |
| 3628 | + file=$source_path/$3 | |
| 3629 | + sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file" | |
| 3630 | +} | |
| 3631 | + | |
| 3632 | +OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c) | |
| 3633 | +INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c) | |
| 3634 | + | |
| 3625 | 3635 | find_things_extern(){ |
| 3626 | 3636 | thing=$1 |
| 3627 | 3637 | pattern=$2 |
| 3628 | 3638 | file=$source_path/$3 |
| 3629 | − out=${4:-$thing} | |
| 3630 | − sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file" | |
| 3639 | + sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file" | |
| 3631 | 3640 | } |
| 3632 | 3641 | |
| 3633 | 3642 | find_filters_extern(){ |
| @@ -3637,8 +3646,6 @@ find_filters_extern(){ · 3 unmodified lines | ||
| 3637 | 3646 | } |
| 3638 | 3647 | |
| 3639 | 3648 | FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c) |
| 3640 | −OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev) | |
| 3641 | −INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev) | |
| 3642 | 3649 | MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c) |
| 3643 | 3650 | DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c) |
| 3644 | 3651 | ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c) |
| @@ -7172,12 +7179,6 @@ print_enabled_components(){ · 3527 unmodified lines | ||
| 7172 | 7179 | filter_list) |
| 7173 | 7180 | c=$(full_filter_name $(remove_suffix _filter $c)) |
| 7174 | 7181 | ;; |
| 7175 | − indev_list) | |
| 7176 | − c=$(add_suffix _demuxer $(remove_suffix _indev $c)) | |
| 7177 | − ;; | |
| 7178 | − outdev_list) | |
| 7179 | − c=$(add_suffix _muxer $(remove_suffix _outdev $c)) | |
| 7180 | − ;; | |
| 7181 | 7182 | esac |
| 7182 | 7183 | printf " &ff_%s,\n" $c >> $TMPH |
| 7183 | 7184 | fi |
| @@ -7195,8 +7196,6 @@ print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_ · 11 unmodified lines | ||
| 7195 | 7196 | print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST |
| 7196 | 7197 | print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST |
| 7197 | 7198 | print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST |
| 7198 | −print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST | |
| 7199 | −print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list $OUTDEV_LIST | |
| 7200 | 7199 | print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST |
| 7201 | 7200 | print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $MUXER_LIST |
| 7202 | 7201 | print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST |
| @@ -56,11 +56,6 @@ API changes, most recent first: · 55 unmodified lines | ||
| 56 | 56 | 2018-02-xx - xxxxxxx - lavc 58.11.100 - avcodec.h |
| 57 | 57 | Add AVCodecContext.extra_hw_frames. |
| 58 | 58 | |
| 59 | −2018-02-06 - 0fd475704e - lavd 58.1.100 - avdevice.h | |
| 60 | − Deprecate use of av_input_audio_device_next(), av_input_video_device_next(), | |
| 61 | − av_output_audio_device_next(), av_output_video_device_next(). | |
| 62 | − Add av_indev_iterate(), and av_outdev_iterate(). | |
| 63 | − | |
| 64 | 59 | 2018-xx-xx - xxxxxxx - lavf 58.9.100 - avformat.h |
| 65 | 60 | Deprecate use of av_register_input_format(), av_register_output_format(), |
| 66 | 61 | av_register_all(), av_iformat_next(), av_oformat_next(). |
| @@ -1,2 +0,0 @@ | ||
| 1 | −/indev_list.c | |
| 2 | −/outdev_list.c | |
| @@ -22,150 +22,57 @@ · 21 unmodified lines | ||
| 22 | 22 | #include "libavutil/thread.h" |
| 23 | 23 | #include "avdevice.h" |
| 24 | 24 | |
| 25 | −#if FF_API_NEXT | |
| 26 | −#include "libavformat/internal.h" | |
| 27 | −#endif | |
| 28 | − | |
| 29 | −/* devices */ | |
| 30 | −extern AVInputFormat ff_alsa_demuxer; | |
| 31 | −extern AVOutputFormat ff_alsa_muxer; | |
| 32 | −extern AVInputFormat ff_android_camera_demuxer; | |
| 33 | −extern AVInputFormat ff_avfoundation_demuxer; | |
| 34 | −extern AVInputFormat ff_bktr_demuxer; | |
| 35 | −extern AVOutputFormat ff_caca_muxer; | |
| 36 | −extern AVInputFormat ff_decklink_demuxer; | |
| 37 | −extern AVOutputFormat ff_decklink_muxer; | |
| 38 | −extern AVInputFormat ff_libndi_newtek_demuxer; | |
| 39 | −extern AVOutputFormat ff_libndi_newtek_muxer; | |
| 40 | −extern AVInputFormat ff_dshow_demuxer; | |
| 41 | −extern AVInputFormat ff_fbdev_demuxer; | |
| 42 | −extern AVOutputFormat ff_fbdev_muxer; | |
| 43 | −extern AVInputFormat ff_gdigrab_demuxer; | |
| 44 | −extern AVInputFormat ff_iec61883_demuxer; | |
| 45 | −extern AVInputFormat ff_jack_demuxer; | |
| 46 | −extern AVInputFormat ff_kmsgrab_demuxer; | |
| 47 | −extern AVInputFormat ff_lavfi_demuxer; | |
| 48 | −extern AVInputFormat ff_openal_demuxer; | |
| 49 | −extern AVOutputFormat ff_opengl_muxer; | |
| 50 | −extern AVInputFormat ff_oss_demuxer; | |
| 51 | −extern AVOutputFormat ff_oss_muxer; | |
| 52 | −extern AVInputFormat ff_pulse_demuxer; | |
| 53 | −extern AVOutputFormat ff_pulse_muxer; | |
| 54 | −extern AVOutputFormat ff_sdl2_muxer; | |
| 55 | −extern AVInputFormat ff_sndio_demuxer; | |
| 56 | −extern AVOutputFormat ff_sndio_muxer; | |
| 57 | −extern AVInputFormat ff_v4l2_demuxer; | |
| 58 | −extern AVOutputFormat ff_v4l2_muxer; | |
| 59 | −extern AVInputFormat ff_vfwcap_demuxer; | |
| 60 | −extern AVInputFormat ff_xcbgrab_demuxer; | |
| 61 | −extern AVOutputFormat ff_xv_muxer; | |
| 62 | − | |
| 63 | −/* external libraries */ | |
| 64 | −extern AVInputFormat ff_libcdio_demuxer; | |
| 65 | −extern AVInputFormat ff_libdc1394_demuxer; | |
| 66 | − | |
| 67 | −#include "libavdevice/outdev_list.c" | |
| 68 | −#include "libavdevice/indev_list.c" | |
| 69 | − | |
| 70 | −const AVOutputFormat *av_outdev_iterate(void **opaque) | |
| 71 | −{ | |
| 72 | − uintptr_t i = (uintptr_t)*opaque; | |
| 73 | − const AVOutputFormat *f = outdev_list[i]; | |
| 74 | − | |
| 75 | − if (f) | |
| 76 | − *opaque = (void*)(i + 1); | |
| 77 | − return f; | |
| 78 | −} | |
| 79 | − | |
| 80 | −const AVInputFormat *av_indev_iterate(void **opaque) | |
| 81 | −{ | |
| 82 | − uintptr_t i = (uintptr_t)*opaque; | |
| 83 | − const AVInputFormat *f = indev_list[i]; | |
| 84 | − | |
| 85 | − if (f) | |
| 86 | − *opaque = (void*)(i + 1); | |
| 87 | − return f; | |
| 88 | −} | |
| 89 | − | |
| 90 | −#if FF_API_NEXT | |
| 91 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 92 | −static AVOnce av_device_next_init = AV_ONCE_INIT; | |
| 93 | − | |
| 94 | −static void av_device_init_next(void) | |
| 95 | −{ | |
| 96 | − AVOutputFormat *prevout = NULL, *out; | |
| 97 | − AVInputFormat *previn = NULL, *in; | |
| 98 | − void *i = 0; | |
| 99 | − | |
| 100 | − while ((out = (AVOutputFormat*)av_outdev_iterate(&i))) { | |
| 101 | − if (prevout) | |
| 102 | − prevout->next = out; | |
| 103 | − prevout = out; | |
| 25 | +#define REGISTER_OUTDEV(X, x) \ | |
| 26 | + { \ | |
| 27 | + extern AVOutputFormat ff_##x##_muxer; \ | |
| 28 | + if (CONFIG_##X##_OUTDEV) \ | |
| 29 | + av_register_output_format(&ff_##x##_muxer); \ | |
| 104 | 30 | } |
| 105 | 31 | |
| 106 | − i = 0; | |
| 107 | − while ((in = (AVInputFormat*)av_indev_iterate(&i))) { | |
| 108 | − if (previn) | |
| 109 | − previn->next = in; | |
| 110 | − previn = in; | |
| 32 | +#define REGISTER_INDEV(X, x) \ | |
| 33 | + { \ | |
| 34 | + extern AVInputFormat ff_##x##_demuxer; \ | |
| 35 | + if (CONFIG_##X##_INDEV) \ | |
| 36 | + av_register_input_format(&ff_##x##_demuxer); \ | |
| 111 | 37 | } |
| 112 | 38 | |
| 113 | − avpriv_register_devices(outdev_list, indev_list); | |
| 114 | −} | |
| 115 | − | |
| 116 | −void avdevice_register_all(void) | |
| 117 | −{ | |
| 118 | − ff_thread_once(&av_device_next_init, av_device_init_next); | |
| 119 | −} | |
| 120 | − | |
| 121 | −static void *device_next(void *prev, int output, | |
| 122 | − AVClassCategory c1, AVClassCategory c2) | |
| 123 | −{ | |
| 124 | − const AVClass *pc; | |
| 125 | − AVClassCategory category = AV_CLASS_CATEGORY_NA; | |
| 126 | − | |
| 127 | − ff_thread_once(&av_device_next_init, av_device_init_next); | |
| 128 | − | |
| 129 | − do { | |
| 130 | − if (output) { | |
| 131 | − if (!(prev = prev ? ((AVOutputFormat *)prev)->next : (void*)outdev_list[0])) | |
| 132 | − break; | |
| 133 | − pc = ((AVOutputFormat *)prev)->priv_class; | |
| 134 | − } else { | |
| 135 | − if (!(prev = prev ? ((AVInputFormat *)prev)->next : (void*)indev_list[0])) | |
| 136 | − break; | |
| 137 | − pc = ((AVInputFormat *)prev)->priv_class; | |
| 138 | − } | |
| 139 | − if (!pc) | |
| 140 | − continue; | |
| 141 | − category = pc->category; | |
| 142 | − } while (category != c1 && category != c2); | |
| 143 | − return prev; | |
| 144 | −} | |
| 145 | − | |
| 146 | −AVInputFormat *av_input_audio_device_next(AVInputFormat *d) | |
| 147 | −{ | |
| 148 | − return device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, | |
| 149 | − AV_CLASS_CATEGORY_DEVICE_INPUT); | |
| 150 | −} | |
| 39 | +#define REGISTER_INOUTDEV(X, x) REGISTER_OUTDEV(X, x); REGISTER_INDEV(X, x) | |
| 151 | 40 | |
| 152 | −AVInputFormat *av_input_video_device_next(AVInputFormat *d) | |
| 41 | +static void register_all(void) | |
| 153 | 42 | { |
| 154 | − return device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, | |
| 155 | − AV_CLASS_CATEGORY_DEVICE_INPUT); | |
| 43 | + /* devices */ | |
| 44 | + REGISTER_INOUTDEV(ALSA, alsa); | |
| 45 | + REGISTER_INDEV (AVFOUNDATION, avfoundation); | |
| 46 | + REGISTER_INDEV (BKTR, bktr); | |
| 47 | + REGISTER_OUTDEV (CACA, caca); | |
| 48 | + REGISTER_INOUTDEV(DECKLINK, decklink); | |
| 49 | + REGISTER_INOUTDEV(LIBNDI_NEWTEK, libndi_newtek); | |
| 50 | + REGISTER_INDEV (DSHOW, dshow); | |
| 51 | + REGISTER_INOUTDEV(FBDEV, fbdev); | |
| 52 | + REGISTER_INDEV (GDIGRAB, gdigrab); | |
| 53 | + REGISTER_INDEV (IEC61883, iec61883); | |
| 54 | + REGISTER_INDEV (JACK, jack); | |
| 55 | + REGISTER_INDEV (KMSGRAB, kmsgrab); | |
| 56 | + REGISTER_INDEV (LAVFI, lavfi); | |
| 57 | + REGISTER_INDEV (OPENAL, openal); | |
| 58 | + REGISTER_OUTDEV (OPENGL, opengl); | |
| 59 | + REGISTER_INOUTDEV(OSS, oss); | |
| 60 | + REGISTER_INOUTDEV(PULSE, pulse); | |
| 61 | + REGISTER_OUTDEV (SDL2, sdl2); | |
| 62 | + REGISTER_INOUTDEV(SNDIO, sndio); | |
| 63 | + REGISTER_INOUTDEV(V4L2, v4l2); | |
| 64 | + REGISTER_INDEV (VFWCAP, vfwcap); | |
| 65 | + REGISTER_INDEV (XCBGRAB, xcbgrab); | |
| 66 | + REGISTER_OUTDEV (XV, xv); | |
| 67 | + | |
| 68 | + /* external libraries */ | |
| 69 | + REGISTER_INDEV (LIBCDIO, libcdio); | |
| 70 | + REGISTER_INDEV (LIBDC1394, libdc1394); | |
| 156 | 71 | } |
| 157 | 72 | |
| 158 | −AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d) | |
| 73 | +void avdevice_register_all(void) | |
| 159 | 74 | { |
| 160 | − return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, | |
| 161 | − AV_CLASS_CATEGORY_DEVICE_OUTPUT); | |
| 162 | −} | |
| 75 | + static AVOnce control = AV_ONCE_INIT; | |
| 163 | 76 | |
| 164 | −AVOutputFormat *av_output_video_device_next(AVOutputFormat *d) | |
| 165 | −{ | |
| 166 | − return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, | |
| 167 | − AV_CLASS_CATEGORY_DEVICE_OUTPUT); | |
| 77 | + ff_thread_once(&control, register_all); | |
| 168 | 78 | } |
| 169 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 170 | −#endif | |
| 171 | − | |
| @@ -78,6 +78,52 @@ const char * avdevice_license(void) · 77 unmodified lines | ||
| 78 | 78 | return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | +static void *device_next(void *prev, int output, | |
| 82 | + AVClassCategory c1, AVClassCategory c2) | |
| 83 | +{ | |
| 84 | + const AVClass *pc; | |
| 85 | + AVClassCategory category = AV_CLASS_CATEGORY_NA; | |
| 86 | + do { | |
| 87 | + if (output) { | |
| 88 | + if (!(prev = av_oformat_next(prev))) | |
| 89 | + break; | |
| 90 | + pc = ((AVOutputFormat *)prev)->priv_class; | |
| 91 | + } else { | |
| 92 | + if (!(prev = av_iformat_next(prev))) | |
| 93 | + break; | |
| 94 | + pc = ((AVInputFormat *)prev)->priv_class; | |
| 95 | + } | |
| 96 | + if (!pc) | |
| 97 | + continue; | |
| 98 | + category = pc->category; | |
| 99 | + } while (category != c1 && category != c2); | |
| 100 | + return prev; | |
| 101 | +} | |
| 102 | + | |
| 103 | +AVInputFormat *av_input_audio_device_next(AVInputFormat *d) | |
| 104 | +{ | |
| 105 | + return device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, | |
| 106 | + AV_CLASS_CATEGORY_DEVICE_INPUT); | |
| 107 | +} | |
| 108 | + | |
| 109 | +AVInputFormat *av_input_video_device_next(AVInputFormat *d) | |
| 110 | +{ | |
| 111 | + return device_next(d, 0, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, | |
| 112 | + AV_CLASS_CATEGORY_DEVICE_INPUT); | |
| 113 | +} | |
| 114 | + | |
| 115 | +AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d) | |
| 116 | +{ | |
| 117 | + return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, | |
| 118 | + AV_CLASS_CATEGORY_DEVICE_OUTPUT); | |
| 119 | +} | |
| 120 | + | |
| 121 | +AVOutputFormat *av_output_video_device_next(AVOutputFormat *d) | |
| 122 | +{ | |
| 123 | + return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT, | |
| 124 | + AV_CLASS_CATEGORY_DEVICE_OUTPUT); | |
| 125 | +} | |
| 126 | + | |
| 81 | 127 | int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type, |
| 82 | 128 | void *data, size_t data_size) |
| 83 | 129 | { |
| @@ -65,29 +65,6 @@ const char *avdevice_configuration(void); · 64 unmodified lines | ||
| 65 | 65 | */ |
| 66 | 66 | const char *avdevice_license(void); |
| 67 | 67 | |
| 68 | −/** | |
| 69 | − * Iterate over all registered output devices. | |
| 70 | − * | |
| 71 | − * @param opaque a pointer where libavdevice will store the iteration state. Must | |
| 72 | − * point to NULL to start the iteration. | |
| 73 | − * | |
| 74 | − * @return the next registered output device or NULL when the iteration is | |
| 75 | − * finished | |
| 76 | − */ | |
| 77 | −const AVOutputFormat *av_outdev_iterate(void **opaque); | |
| 78 | − | |
| 79 | −/** | |
| 80 | − * Iterate over all registered input devices. | |
| 81 | − * | |
| 82 | − * @param opaque a pointer where libavdevice will store the iteration state. Must | |
| 83 | − * point to NULL to start the iteration. | |
| 84 | − * | |
| 85 | − * @return the next registered input device or NULL when the iteration is | |
| 86 | − * finished | |
| 87 | − */ | |
| 88 | −const AVInputFormat *av_indev_iterate(void **opaque); | |
| 89 | − | |
| 90 | −#if FF_API_NEXT | |
| 91 | 68 | /** |
| 92 | 69 | * Initialize libavdevice and register all the input and output devices. |
| 93 | 70 | */ |
| @@ -100,7 +77,6 @@ void avdevice_register_all(void); · 6 unmodified lines | ||
| 100 | 77 | * if d is non-NULL, returns the next registered input audio/video device after d |
| 101 | 78 | * or NULL if d is the last one. |
| 102 | 79 | */ |
| 103 | −attribute_deprecated | |
| 104 | 80 | AVInputFormat *av_input_audio_device_next(AVInputFormat *d); |
| 105 | 81 | |
| 106 | 82 | /** |
| @@ -110,7 +86,6 @@ AVInputFormat *av_input_audio_device_next(AVInputFormat *d); · 3 unmodified lines | ||
| 110 | 86 | * if d is non-NULL, returns the next registered input audio/video device after d |
| 111 | 87 | * or NULL if d is the last one. |
| 112 | 88 | */ |
| 113 | −attribute_deprecated | |
| 114 | 89 | AVInputFormat *av_input_video_device_next(AVInputFormat *d); |
| 115 | 90 | |
| 116 | 91 | /** |
| @@ -120,7 +95,6 @@ AVInputFormat *av_input_video_device_next(AVInputFormat *d); · 3 unmodified lines | ||
| 120 | 95 | * if d is non-NULL, returns the next registered output audio/video device after d |
| 121 | 96 | * or NULL if d is the last one. |
| 122 | 97 | */ |
| 123 | −attribute_deprecated | |
| 124 | 98 | AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); |
| 125 | 99 | |
| 126 | 100 | /** |
| @@ -130,9 +104,7 @@ AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d); · 3 unmodified lines | ||
| 130 | 104 | * if d is non-NULL, returns the next registered output audio/video device after d |
| 131 | 105 | * or NULL if d is the last one. |
| 132 | 106 | */ |
| 133 | −attribute_deprecated | |
| 134 | 107 | AVOutputFormat *av_output_video_device_next(AVOutputFormat *d); |
| 135 | −#endif | |
| 136 | 108 | |
| 137 | 109 | typedef struct AVDeviceRect { |
| 138 | 110 | int x; /**< x coordinate of top left corner */ |
| @@ -47,8 +47,4 @@ · 46 unmodified lines | ||
| 47 | 47 | * the public API and may change, break or disappear at any time. |
| 48 | 48 | */ |
| 49 | 49 | |
| 50 | −#ifndef FF_API_NEXT | |
| 51 | −#define FF_API_NEXT (LIBAVDEVICE_VERSION_MAJOR < 59) | |
| 52 | −#endif | |
| 53 | − | |
| 54 | 50 | #endif /* AVDEVICE_VERSION_H */ |
| @@ -25,9 +25,6 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "rdt.h" |
| 26 | 26 | #include "url.h" |
| 27 | 27 | #include "version.h" |
| 28 | −#if FF_API_NEXT | |
| 29 | −#include "internal.h" | |
| 30 | −#endif | |
| 31 | 28 | |
| 32 | 29 | /* (de)muxers */ |
| 33 | 30 | extern AVOutputFormat ff_a64_muxer; |
| @@ -491,7 +488,6 @@ const AVOutputFormat *av_muxer_iterate(void **opaque) · 457 unmodified lines | ||
| 491 | 488 | { |
| 492 | 489 | uintptr_t i = (uintptr_t)*opaque; |
| 493 | 490 | const AVOutputFormat *f = muxer_list[i]; |
| 494 | − | |
| 495 | 491 | if (f) |
| 496 | 492 | *opaque = (void*)(i + 1); |
| 497 | 493 | return f; |
| @@ -510,9 +506,6 @@ const AVInputFormat *av_demuxer_iterate(void **opaque){ · 12 unmodified lines | ||
| 510 | 506 | FF_DISABLE_DEPRECATION_WARNINGS |
| 511 | 507 | static AVOnce av_format_next_init = AV_ONCE_INIT; |
| 512 | 508 | |
| 513 | −static const AVInputFormat * const *indev_list = NULL; | |
| 514 | −static const AVOutputFormat * const *outdev_list = NULL; | |
| 515 | − | |
| 516 | 509 | static void av_format_init_next(void) |
| 517 | 510 | { |
| 518 | 511 | AVOutputFormat *prevout = NULL, *out; |
| @@ -525,61 +518,30 @@ static void av_format_init_next(void) · 6 unmodified lines | ||
| 525 | 518 | prevout = out; |
| 526 | 519 | } |
| 527 | 520 | |
| 528 | − if (outdev_list) { | |
| 529 | − for (int j = 0; (out = (AVOutputFormat*)outdev_list[j]); j++) { | |
| 530 | − if (prevout) | |
| 531 | − prevout->next = out; | |
| 532 | − prevout = out; | |
| 533 | − } | |
| 534 | − } | |
| 535 | − | |
| 536 | 521 | i = 0; |
| 537 | 522 | while ((in = (AVInputFormat*)av_demuxer_iterate(&i))) { |
| 538 | 523 | if (previn) |
| 539 | 524 | previn->next = in; |
| 540 | 525 | previn = in; |
| 541 | 526 | } |
| 542 | − | |
| 543 | − if (indev_list) { | |
| 544 | − for (int j = 0; (in = (AVInputFormat*)indev_list[j]); j++) { | |
| 545 | − if (previn) | |
| 546 | − previn->next = in; | |
| 547 | − previn = in; | |
| 548 | − } | |
| 549 | − } | |
| 550 | − | |
| 551 | −} | |
| 552 | − | |
| 553 | −void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputFormat * const i[]) | |
| 554 | −{ | |
| 555 | − static AVMutex avpriv_register_devices_mutex = AV_MUTEX_INITIALIZER; | |
| 556 | − ff_mutex_lock(&avpriv_register_devices_mutex); | |
| 557 | − outdev_list = o; | |
| 558 | − indev_list = i; | |
| 559 | − av_format_init_next(); | |
| 560 | − ff_mutex_unlock(&avpriv_register_devices_mutex); | |
| 561 | 527 | } |
| 562 | 528 | |
| 563 | 529 | AVInputFormat *av_iformat_next(const AVInputFormat *f) |
| 564 | 530 | { |
| 565 | 531 | ff_thread_once(&av_format_next_init, av_format_init_next); |
| 566 | − | |
| 567 | 532 | if (f) |
| 568 | 533 | return f->next; |
| 569 | 534 | else |
| 570 | − /* If there are no demuxers but input devices, then return the first input device. | |
| 571 | − * This will still return null if both there are both no demuxers or input devices. */ | |
| 572 | − return demuxer_list[0] ? (AVInputFormat*)demuxer_list[0] : (indev_list ? (AVInputFormat*)indev_list[0] : NULL); | |
| 535 | + return demuxer_list[0]; | |
| 573 | 536 | } |
| 574 | 537 | |
| 575 | 538 | AVOutputFormat *av_oformat_next(const AVOutputFormat *f) |
| 576 | 539 | { |
| 577 | 540 | ff_thread_once(&av_format_next_init, av_format_init_next); |
| 578 | − | |
| 579 | 541 | if (f) |
| 580 | 542 | return f->next; |
| 581 | 543 | else |
| 582 | − return muxer_list[0] ? (AVOutputFormat*)muxer_list[0] : (outdev_list ? (AVOutputFormat*)outdev_list[0] : NULL); | |
| 544 | + return muxer_list[0]; | |
| 583 | 545 | } |
| 584 | 546 | |
| 585 | 547 | void av_register_all(void) |
| @@ -129,18 +129,10 @@ enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, · 128 unmodified lines | ||
| 129 | 129 | AVInputFormat *av_find_input_format(const char *short_name) |
| 130 | 130 | { |
| 131 | 131 | AVInputFormat *fmt = NULL; |
| 132 | −#if FF_API_NEXT | |
| 133 | −FF_DISABLE_DEPRECATION_WARNINGS | |
| 134 | − while ((fmt = av_iformat_next(fmt))) | |
| 135 | − if (av_match_name(short_name, fmt->name)) | |
| 136 | − return fmt; | |
| 137 | −FF_ENABLE_DEPRECATION_WARNINGS | |
| 138 | −#else | |
| 139 | 132 | void *i = 0; |
| 140 | 133 | while ((fmt = av_demuxer_iterate(&i))) |
| 141 | 134 | if (av_match_name(short_name, fmt->name)) |
| 142 | 135 | return fmt; |
| 143 | −#endif | |
| 144 | 136 | return NULL; |
| 145 | 137 | } |
| 146 | 138 | |
| @@ -731,11 +731,4 @@ int ff_unlock_avformat(void); · 730 unmodified lines | ||
| 731 | 731 | */ |
| 732 | 732 | void ff_format_set_url(AVFormatContext *s, char *url); |
| 733 | 733 | |
| 734 | −#if FF_API_NEXT | |
| 735 | −/** | |
| 736 | − * Register devices in deprecated format linked list. | |
| 737 | − */ | |
| 738 | −void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputFormat * const i[]); | |
| 739 | −#endif | |
| 740 | − | |
| 741 | 734 | #endif /* AVFORMAT_INTERNAL_H */ |