Le decadi 10 floréal, an CCXXIV, Hendrik Leppkes a écrit :
> It probably does generally no harm to include it since its tiny,

That was my reasoning.

> however it would still show up in configure and be disable-able in
> configure (since the list is generated from the extern const bitstream
> filter entries in bitstream_filters.c) - it would just not actually
> disable it.
> I think this is rather confusing.

Indeed. Still, some users may think they do not need bitstream filters and
configure with --disable-bsfs, and end up with non-working applications
because they require this one to handle the no-filtering case. That is
confusing too.

I changed the declaration to hide it from configure.

> Also, something I forgot, there is a plan to generate the
> bitstream_filters array from configure instead of hardcoding it, which
> would make special cases not governed by the usual rules a bit more
> annoying.

I am rather more optimistic: the array is generated by configure, but the
declaration of the array,
"static const AVBitStreamFilter *bitstream_filters[] = {",
needs to be hardcoded somewhere. Adding the hardcoded filters there should
be easy enough.

IMHO, the cleanest design would be to have configure generate just the list,
and have:

static const AVBitStreamFilter *bitstream_filters[] = {
#include "bistream_filters_list.h"
};

Inserting null before #include is no problem.

Regards,

-- 
  Nicolas George
From 9507a24a4774dc7542e6cd9739104bb7d9528185 Mon Sep 17 00:00:00 2001
From: Nicolas George <geo...@nsup.org>
Date: Thu, 28 Apr 2016 10:25:37 +0200
Subject: [PATCH 1/3] lavc/bsf: add a null bitstream filter.

It passes packets unchanged with a very low overhead.
Using it allows to have the same code path when bitstream filtering
is not used, making the code simpler and avoiding bitroting.
The filter can not be disabled so that applications can rely on it.
It is added out of alphabetical order to keep the regularity.

TODO: minor bump.
Signed-off-by: Nicolas George <geo...@nsup.org>
---
 libavcodec/bitstream_filters.c |  3 +++
 libavcodec/bsf.c               | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 51f3cd9..ebfd873 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -24,6 +24,8 @@
 #include "avcodec.h"
 #include "bsf.h"
 
+extern const AVBitStreamFilter /* hardcoded, hidden from configure */ ff_null_bsf;
+
 extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
 extern const AVBitStreamFilter ff_chomp_bsf;
 extern const AVBitStreamFilter ff_dump_extradata_bsf;
@@ -42,6 +44,7 @@ extern const AVBitStreamFilter ff_text2movsub_bsf;
 extern const AVBitStreamFilter ff_vp9_superframe_bsf;
 
 static const AVBitStreamFilter *bitstream_filters[] = {
+    &ff_null_bsf,
 #if CONFIG_AAC_ADTSTOASC_BSF
     &ff_aac_adtstoasc_bsf,
 #endif
diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index 88b7f29..cd82f5e 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -217,3 +217,19 @@ int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
 
     return 0;
 }
+
+static int null_filter(AVBSFContext *ctx, AVPacket *out)
+{
+    AVPacket *in;
+    int ret = ff_bsf_get_packet(ctx, &in);
+    if (ret < 0)
+        return ret;
+    av_packet_move_ref(out, in);
+    av_packet_free(&in);
+    return 0;
+}
+
+const AVBitStreamFilter ff_null_bsf = {
+    .name           = "null",
+    .filter         = null_filter,
+};
-- 
2.8.0.rc3

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to