[FFmpeg-devel] [PATCH 1/4] configure and al.: remove declarations from generated files.
Nicolas George
george at nsup.org
Thu May 19 09:47:09 CEST 2016
Files containing lists generated from enabled components were:
static Type *var[] = {
generated list,
NULL };
and included as is in the file using them.
This commit removes the "static Type *var[] = {" declaration
and the final "NULL };" from the generated list and moves them
to the including code.
This means the generated files are no longer self-contained C
statements, but it is not a property that was being used.
It also means less shellized-C code in configure.
Signed-off-by: Nicolas George <george at nsup.org>
---
configure | 11 ++++-------
libavcodec/bitstream_filters.c | 3 +++
libavformat/protocols.c | 3 +++
3 files changed, 10 insertions(+), 7 deletions(-)
This is necessary to add the null bsf unconditionally (I already explained
my reasons for wanting it that way), but I think this is also a good change
by itself because of the last sentence. For example, we may want to tweak
the implementation of one of the lists (remove the final NULL and use
FF_ARRAY_ELEMS for example) but not both.
diff --git a/configure b/configure
index cc2c9e7..2547bb1 100755
--- a/configure
+++ b/configure
@@ -6650,19 +6650,16 @@ fi
# generate the lists of enabled components
print_enabled_components(){
file=$1
- struct_name=$2
- name=$3
- shift 3
- echo "static const $struct_name *$name[] = {" > $TMPH
+ shift
+ printf "" > $TMPH
for c in $*; do
enabled $c && printf " &ff_%s,\n" $c >> $TMPH
done
- echo " NULL };" >> $TMPH
cp_if_changed $TMPH $file
}
-print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
-print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
+print_enabled_components libavcodec/bsf_list.c $BSF_LIST
+print_enabled_components libavformat/protocol_list.c $PROTOCOL_LIST
# build pkg-config files
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 840bb43..6d58233 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -41,7 +41,10 @@ extern const AVBitStreamFilter ff_remove_extradata_bsf;
extern const AVBitStreamFilter ff_text2movsub_bsf;
extern const AVBitStreamFilter ff_vp9_superframe_bsf;
+static const AVBitStreamFilter *bitstream_filters[] = {
#include "libavcodec/bsf_list.c"
+ NULL
+};
const AVBitStreamFilter *av_bsf_next(void **opaque)
{
diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index 124010c..477948c 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -69,7 +69,10 @@ extern const URLProtocol ff_librtmpte_protocol;
extern const URLProtocol ff_libssh_protocol;
extern const URLProtocol ff_libsmbclient_protocol;
+static const URLProtocol *url_protocols[] = {
#include "libavformat/protocol_list.c"
+ NULL
+};
const AVClass *ff_urlcontext_child_class_next(const AVClass *prev)
{
--
2.8.1
More information about the ffmpeg-devel
mailing list