Skip to content

Commit

Permalink
lavfi: add new iteration API
Browse files Browse the repository at this point in the history
Signed-off-by: Josh de Kock <josh@itanimul.li>
  • Loading branch information
jdek committed Mar 31, 2018
1 parent cda4394 commit 8f1382f
Show file tree
Hide file tree
Showing 7 changed files with 490 additions and 456 deletions.
29 changes: 20 additions & 9 deletions configure
Expand Up @@ -3622,15 +3622,6 @@ for v in "$@"; do
FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
done

find_things(){
thing=$1
pattern=$2
file=$source_path/$3
sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
}

FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)

find_things_extern(){
thing=$1
pattern=$2
Expand All @@ -3639,6 +3630,13 @@ find_things_extern(){
sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
}

find_filters_extern(){
file=$source_path/$1
#sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file
sed -E -n "s/^extern AVFilter ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\2_filter/p" $file
}

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)
Expand Down Expand Up @@ -7157,6 +7155,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH

cp_if_changed $TMPH libavutil/avconfig.h

full_filter_name(){
sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c
}

# generate the lists of enabled components
print_enabled_components(){
file=$1
Expand All @@ -7167,6 +7169,9 @@ print_enabled_components(){
for c in $*; do
if enabled $c; then
case $name in
filter_list)
c=$(full_filter_name $(remove_suffix _filter $c))
;;
indev_list)
c=$(add_suffix _demuxer $(remove_suffix _indev $c))
;;
Expand All @@ -7177,10 +7182,16 @@ print_enabled_components(){
printf " &ff_%s,\n" $c >> $TMPH
fi
done
if [ "$name" == "filter_list" ]; then
for c in asrc_abuffer vsrc_buffer asink_abuffer vsink_buffer; do
printf " &ff_%s,\n" $c >> $TMPH
done
fi
echo " NULL };" >> $TMPH
cp_if_changed $TMPH $file
}

print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST
print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST
print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
Expand Down
4 changes: 4 additions & 0 deletions doc/APIchanges
Expand Up @@ -15,6 +15,10 @@ libavutil: 2017-10-21

API changes, most recent first:

2018-xx-xx - xxxxxxx - lavc 7.13.100 - avcodec.h
Deprecate use of avfilter_register(), avfilter_register_all(),
avfilter_next(). Add av_filter_iterate().

2018-03-xx - xxxxxxx - lavc 58.16.100 - avcodec.h
Add FF_SUB_CHARENC_MODE_IGNORE.

Expand Down
6 changes: 2 additions & 4 deletions doc/writing_filters.txt
Expand Up @@ -31,10 +31,8 @@ If everything went right, you should get a foobar.png with Lena edge-detected.
That's it, your new playground is ready.

Some little details about what's going on:
libavfilter/allfilters.c:avfilter_register_all() is called at runtime to create
a list of the available filters, but it's important to know that this file is
also parsed by the configure script, which in turn will define variables for
the build system and the C:
libavfilter/allfilters.c:this file is parsed by the configure script, which in turn
will define variables for the build system and the C:

--- after running configure ---

Expand Down

0 comments on commit 8f1382f

Please sign in to comment.