cbs: Add a table of all supported codec IDs
authorMark Thompson <sw@jkqxz.net>
Sun, 11 Mar 2018 17:27:15 +0000 (17:27 +0000)
committerMark Thompson <sw@jkqxz.net>
Sun, 18 Mar 2018 17:55:00 +0000 (17:55 +0000)
Use it as the set of codec IDs supported by the trace_headers BSF.

configure
libavcodec/cbs.c
libavcodec/cbs.h
libavcodec/trace_headers_bsf.c

index f09f48c..87430f4 100755 (executable)
--- a/configure
+++ b/configure
@@ -2924,7 +2924,7 @@ h264_redundant_pps_bsf_select="cbs_h264"
 hevc_metadata_bsf_select="cbs_h265"
 mjpeg2jpeg_bsf_select="jpegtables"
 mpeg2_metadata_bsf_select="cbs_mpeg2"
-trace_headers_bsf_select="cbs_h264 cbs_h265 cbs_mpeg2"
+trace_headers_bsf_select="cbs"
 
 # external libraries
 aac_at_decoder_deps="audiotoolbox"
index 62f60be..897e0bb 100644 (file)
@@ -40,6 +40,19 @@ static const CodedBitstreamType *cbs_type_table[] = {
 #endif
 };
 
+const enum AVCodecID ff_cbs_all_codec_ids[] = {
+#if CONFIG_CBS_H264
+    AV_CODEC_ID_H264,
+#endif
+#if CONFIG_CBS_H265
+    AV_CODEC_ID_H265,
+#endif
+#if CONFIG_CBS_MPEG2
+    AV_CODEC_ID_MPEG2VIDEO,
+#endif
+    AV_CODEC_ID_NONE
+};
+
 int ff_cbs_init(CodedBitstreamContext **ctx_ptr,
                 enum AVCodecID codec_id, void *log_ctx)
 {
index 396ff0f..402eb39 100644 (file)
@@ -202,6 +202,14 @@ typedef struct CodedBitstreamContext {
 
 
 /**
+ * Table of all supported codec IDs.
+ *
+ * Terminated by AV_CODEC_ID_NONE.
+ */
+extern const enum AVCodecID ff_cbs_all_codec_ids[];
+
+
+/**
  * Create and initialise a new context for the given codec.
  */
 int ff_cbs_init(CodedBitstreamContext **ctx,
index 0697e98..94a3ef7 100644 (file)
@@ -107,18 +107,11 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
     return 0;
 }
 
-static const enum AVCodecID trace_headers_codec_ids[] = {
-    AV_CODEC_ID_H264,
-    AV_CODEC_ID_HEVC,
-    AV_CODEC_ID_MPEG2VIDEO,
-    AV_CODEC_ID_NONE,
-};
-
 const AVBitStreamFilter ff_trace_headers_bsf = {
     .name           = "trace_headers",
     .priv_data_size = sizeof(TraceHeadersContext),
     .init           = &trace_headers_init,
     .close          = &trace_headers_close,
     .filter         = &trace_headers,
-    .codec_ids      = trace_headers_codec_ids,
+    .codec_ids      = ff_cbs_all_codec_ids,
 };