mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavd: remove linked lists
Signed-off-by: Josh de Kock <josh@itanimul.li>
This commit is contained in:
parent
d8ae40611b
commit
65452bcd64
23
configure
vendored
23
configure
vendored
@ -3622,21 +3622,12 @@ for v in "$@"; do
|
|||||||
FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
|
FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
|
||||||
done
|
done
|
||||||
|
|
||||||
find_things(){
|
|
||||||
thing=$1
|
|
||||||
pattern=$2
|
|
||||||
file=$source_path/$3
|
|
||||||
sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
|
|
||||||
}
|
|
||||||
|
|
||||||
OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
|
|
||||||
INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
|
|
||||||
|
|
||||||
find_things_extern(){
|
find_things_extern(){
|
||||||
thing=$1
|
thing=$1
|
||||||
pattern=$2
|
pattern=$2
|
||||||
file=$source_path/$3
|
file=$source_path/$3
|
||||||
sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
|
out=${4:-$thing}
|
||||||
|
sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
find_filters_extern(){
|
find_filters_extern(){
|
||||||
@ -3646,6 +3637,8 @@ find_filters_extern(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
|
FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
|
||||||
|
OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev)
|
||||||
|
INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
|
||||||
MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
|
MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c)
|
||||||
DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
|
DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
|
||||||
ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
|
ENCODER_LIST=$(find_things_extern encoder AVCodec libavcodec/allcodecs.c)
|
||||||
@ -7179,6 +7172,12 @@ print_enabled_components(){
|
|||||||
filter_list)
|
filter_list)
|
||||||
c=$(full_filter_name $(remove_suffix _filter $c))
|
c=$(full_filter_name $(remove_suffix _filter $c))
|
||||||
;;
|
;;
|
||||||
|
indev_list)
|
||||||
|
c=$(add_suffix _demuxer $(remove_suffix _indev $c))
|
||||||
|
;;
|
||||||
|
outdev_list)
|
||||||
|
c=$(add_suffix _muxer $(remove_suffix _outdev $c))
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
printf " &ff_%s,\n" $c >> $TMPH
|
printf " &ff_%s,\n" $c >> $TMPH
|
||||||
fi
|
fi
|
||||||
@ -7198,6 +7197,8 @@ print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PAR
|
|||||||
print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
|
print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
|
||||||
print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
|
print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $DEMUXER_LIST
|
||||||
print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $MUXER_LIST
|
print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $MUXER_LIST
|
||||||
|
print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
|
||||||
|
print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list $OUTDEV_LIST
|
||||||
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
|
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
|
||||||
|
|
||||||
# Settings for pkg-config files
|
# Settings for pkg-config files
|
||||||
|
@ -22,57 +22,48 @@
|
|||||||
#include "libavutil/thread.h"
|
#include "libavutil/thread.h"
|
||||||
#include "avdevice.h"
|
#include "avdevice.h"
|
||||||
|
|
||||||
#define REGISTER_OUTDEV(X, x) \
|
/* devices */
|
||||||
{ \
|
extern AVInputFormat ff_alsa_demuxer;
|
||||||
extern AVOutputFormat ff_##x##_muxer; \
|
extern AVOutputFormat ff_alsa_muxer;
|
||||||
if (CONFIG_##X##_OUTDEV) \
|
extern AVInputFormat ff_android_camera_demuxer;
|
||||||
av_register_output_format(&ff_##x##_muxer); \
|
extern AVInputFormat ff_avfoundation_demuxer;
|
||||||
}
|
extern AVInputFormat ff_bktr_demuxer;
|
||||||
|
extern AVOutputFormat ff_caca_muxer;
|
||||||
|
extern AVInputFormat ff_decklink_demuxer;
|
||||||
|
extern AVOutputFormat ff_decklink_muxer;
|
||||||
|
extern AVInputFormat ff_libndi_newtek_demuxer;
|
||||||
|
extern AVOutputFormat ff_libndi_newtek_muxer;
|
||||||
|
extern AVInputFormat ff_dshow_demuxer;
|
||||||
|
extern AVInputFormat ff_fbdev_demuxer;
|
||||||
|
extern AVOutputFormat ff_fbdev_muxer;
|
||||||
|
extern AVInputFormat ff_gdigrab_demuxer;
|
||||||
|
extern AVInputFormat ff_iec61883_demuxer;
|
||||||
|
extern AVInputFormat ff_jack_demuxer;
|
||||||
|
extern AVInputFormat ff_kmsgrab_demuxer;
|
||||||
|
extern AVInputFormat ff_lavfi_demuxer;
|
||||||
|
extern AVInputFormat ff_openal_demuxer;
|
||||||
|
extern AVOutputFormat ff_opengl_muxer;
|
||||||
|
extern AVInputFormat ff_oss_demuxer;
|
||||||
|
extern AVOutputFormat ff_oss_muxer;
|
||||||
|
extern AVInputFormat ff_pulse_demuxer;
|
||||||
|
extern AVOutputFormat ff_pulse_muxer;
|
||||||
|
extern AVOutputFormat ff_sdl2_muxer;
|
||||||
|
extern AVInputFormat ff_sndio_demuxer;
|
||||||
|
extern AVOutputFormat ff_sndio_muxer;
|
||||||
|
extern AVInputFormat ff_v4l2_demuxer;
|
||||||
|
extern AVOutputFormat ff_v4l2_muxer;
|
||||||
|
extern AVInputFormat ff_vfwcap_demuxer;
|
||||||
|
extern AVInputFormat ff_xcbgrab_demuxer;
|
||||||
|
extern AVOutputFormat ff_xv_muxer;
|
||||||
|
|
||||||
#define REGISTER_INDEV(X, x) \
|
/* external libraries */
|
||||||
{ \
|
extern AVInputFormat ff_libcdio_demuxer;
|
||||||
extern AVInputFormat ff_##x##_demuxer; \
|
extern AVInputFormat ff_libdc1394_demuxer;
|
||||||
if (CONFIG_##X##_INDEV) \
|
|
||||||
av_register_input_format(&ff_##x##_demuxer); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define REGISTER_INOUTDEV(X, x) REGISTER_OUTDEV(X, x); REGISTER_INDEV(X, x)
|
#include "libavdevice/outdev_list.c"
|
||||||
|
#include "libavdevice/indev_list.c"
|
||||||
static void register_all(void)
|
|
||||||
{
|
|
||||||
/* devices */
|
|
||||||
REGISTER_INOUTDEV(ALSA, alsa);
|
|
||||||
REGISTER_INDEV (AVFOUNDATION, avfoundation);
|
|
||||||
REGISTER_INDEV (BKTR, bktr);
|
|
||||||
REGISTER_OUTDEV (CACA, caca);
|
|
||||||
REGISTER_INOUTDEV(DECKLINK, decklink);
|
|
||||||
REGISTER_INOUTDEV(LIBNDI_NEWTEK, libndi_newtek);
|
|
||||||
REGISTER_INDEV (DSHOW, dshow);
|
|
||||||
REGISTER_INOUTDEV(FBDEV, fbdev);
|
|
||||||
REGISTER_INDEV (GDIGRAB, gdigrab);
|
|
||||||
REGISTER_INDEV (IEC61883, iec61883);
|
|
||||||
REGISTER_INDEV (JACK, jack);
|
|
||||||
REGISTER_INDEV (KMSGRAB, kmsgrab);
|
|
||||||
REGISTER_INDEV (LAVFI, lavfi);
|
|
||||||
REGISTER_INDEV (OPENAL, openal);
|
|
||||||
REGISTER_OUTDEV (OPENGL, opengl);
|
|
||||||
REGISTER_INOUTDEV(OSS, oss);
|
|
||||||
REGISTER_INOUTDEV(PULSE, pulse);
|
|
||||||
REGISTER_OUTDEV (SDL2, sdl2);
|
|
||||||
REGISTER_INOUTDEV(SNDIO, sndio);
|
|
||||||
REGISTER_INOUTDEV(V4L2, v4l2);
|
|
||||||
REGISTER_INDEV (VFWCAP, vfwcap);
|
|
||||||
REGISTER_INDEV (XCBGRAB, xcbgrab);
|
|
||||||
REGISTER_OUTDEV (XV, xv);
|
|
||||||
|
|
||||||
/* external libraries */
|
|
||||||
REGISTER_INDEV (LIBCDIO, libcdio);
|
|
||||||
REGISTER_INDEV (LIBDC1394, libdc1394);
|
|
||||||
}
|
|
||||||
|
|
||||||
void avdevice_register_all(void)
|
void avdevice_register_all(void)
|
||||||
{
|
{
|
||||||
static AVOnce control = AV_ONCE_INIT;
|
avpriv_register_devices(outdev_list, indev_list);
|
||||||
|
|
||||||
ff_thread_once(&control, register_all);
|
|
||||||
}
|
}
|
||||||
|
@ -484,24 +484,45 @@ extern AVInputFormat ff_libopenmpt_demuxer;
|
|||||||
#include "libavformat/muxer_list.c"
|
#include "libavformat/muxer_list.c"
|
||||||
#include "libavformat/demuxer_list.c"
|
#include "libavformat/demuxer_list.c"
|
||||||
|
|
||||||
|
static const AVInputFormat * const *indev_list = NULL;
|
||||||
|
static const AVOutputFormat * const *outdev_list = NULL;
|
||||||
|
|
||||||
const AVOutputFormat *av_muxer_iterate(void **opaque)
|
const AVOutputFormat *av_muxer_iterate(void **opaque)
|
||||||
{
|
{
|
||||||
|
static const uintptr_t size = sizeof(muxer_list)/sizeof(muxer_list[0]) - 1;
|
||||||
uintptr_t i = (uintptr_t)*opaque;
|
uintptr_t i = (uintptr_t)*opaque;
|
||||||
const AVOutputFormat *f = muxer_list[i];
|
const AVOutputFormat *f = NULL;
|
||||||
if (f)
|
|
||||||
*opaque = (void*)(i + 1);
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
const AVInputFormat *av_demuxer_iterate(void **opaque){
|
if (i < size - 1) {
|
||||||
uintptr_t i = (uintptr_t)*opaque;
|
f = muxer_list[i];
|
||||||
const AVInputFormat *f = demuxer_list[i];
|
} else if (indev_list) {
|
||||||
|
f = outdev_list[i - size];
|
||||||
|
}
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
*opaque = (void*)(i + 1);
|
*opaque = (void*)(i + 1);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (i < size) {
|
||||||
|
f = demuxer_list[i];
|
||||||
|
} else if (outdev_list) {
|
||||||
|
f = indev_list[i - size];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f)
|
||||||
|
*opaque = (void*)(i + 1);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static AVMutex avpriv_register_devices_mutex = AV_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
#if FF_API_NEXT
|
#if FF_API_NEXT
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
static AVOnce av_format_next_init = AV_ONCE_INIT;
|
static AVOnce av_format_next_init = AV_ONCE_INIT;
|
||||||
@ -510,38 +531,62 @@ static void av_format_init_next(void)
|
|||||||
{
|
{
|
||||||
AVOutputFormat *prevout = NULL, *out;
|
AVOutputFormat *prevout = NULL, *out;
|
||||||
AVInputFormat *previn = NULL, *in;
|
AVInputFormat *previn = NULL, *in;
|
||||||
void *i = 0;
|
|
||||||
|
|
||||||
while ((out = (AVOutputFormat*)av_muxer_iterate(&i))) {
|
ff_mutex_lock(&avpriv_register_devices_mutex);
|
||||||
|
|
||||||
|
for (int i = 0; (out = (AVOutputFormat*)muxer_list[i]); i++) {
|
||||||
if (prevout)
|
if (prevout)
|
||||||
prevout->next = out;
|
prevout->next = out;
|
||||||
prevout = out;
|
prevout = out;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
if (outdev_list) {
|
||||||
while ((in = (AVInputFormat*)av_demuxer_iterate(&i))) {
|
for (int i = 0; (out = (AVOutputFormat*)outdev_list[i]); i++) {
|
||||||
|
if (prevout)
|
||||||
|
prevout->next = out;
|
||||||
|
prevout = out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; (in = (AVInputFormat*)demuxer_list[i]); i++) {
|
||||||
if (previn)
|
if (previn)
|
||||||
previn->next = in;
|
previn->next = in;
|
||||||
previn = in;
|
previn = in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (indev_list) {
|
||||||
|
for (int i = 0; (in = (AVInputFormat*)indev_list[i]); i++) {
|
||||||
|
if (previn)
|
||||||
|
previn->next = in;
|
||||||
|
previn = in;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ff_mutex_unlock(&avpriv_register_devices_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVInputFormat *av_iformat_next(const AVInputFormat *f)
|
AVInputFormat *av_iformat_next(const AVInputFormat *f)
|
||||||
{
|
{
|
||||||
ff_thread_once(&av_format_next_init, av_format_init_next);
|
ff_thread_once(&av_format_next_init, av_format_init_next);
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
return f->next;
|
return f->next;
|
||||||
else
|
else {
|
||||||
return demuxer_list[0];
|
void *opaque = NULL;
|
||||||
|
return (AVInputFormat *)av_demuxer_iterate(&opaque);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AVOutputFormat *av_oformat_next(const AVOutputFormat *f)
|
AVOutputFormat *av_oformat_next(const AVOutputFormat *f)
|
||||||
{
|
{
|
||||||
ff_thread_once(&av_format_next_init, av_format_init_next);
|
ff_thread_once(&av_format_next_init, av_format_init_next);
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
return f->next;
|
return f->next;
|
||||||
else
|
else {
|
||||||
return muxer_list[0];
|
void *opaque = NULL;
|
||||||
|
return (AVOutputFormat *)av_muxer_iterate(&opaque);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void av_register_all(void)
|
void av_register_all(void)
|
||||||
@ -560,3 +605,14 @@ void av_register_output_format(AVOutputFormat *format)
|
|||||||
}
|
}
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputFormat * const i[])
|
||||||
|
{
|
||||||
|
ff_mutex_lock(&avpriv_register_devices_mutex);
|
||||||
|
outdev_list = o;
|
||||||
|
indev_list = i;
|
||||||
|
ff_mutex_unlock(&avpriv_register_devices_mutex);
|
||||||
|
#if FF_API_NEXT
|
||||||
|
av_format_init_next();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -3060,6 +3060,8 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
|
|||||||
*/
|
*/
|
||||||
AVRational av_stream_get_codec_timebase(const AVStream *st);
|
AVRational av_stream_get_codec_timebase(const AVStream *st);
|
||||||
|
|
||||||
|
|
||||||
|
void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputFormat * const i[]);
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user