diff mbox series

[FFmpeg-devel,11/12] lavf/concatdec: add stream_extradata directive

Message ID 20210831180739.873390-11-george@nsup.org
State Accepted
Commit 94aa7e8a764b2136cafe43f296a6e41a6b0a14ed
Headers show
Series [FFmpeg-devel,01/12] lavf/concat: refactor parsing | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Nicolas George Aug. 31, 2021, 6:07 p.m. UTC
Signed-off-by: Nicolas George <george@nsup.org>
---
 doc/demuxers.texi       |  3 +++
 libavformat/concatdec.c | 11 +++++++++++
 2 files changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 0c347e3f47..06ab152cc7 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -184,6 +184,9 @@  Can be present multiple times.
 @item @code{stream_codec @var{value}}
 Codec for the stream.
 
+@item @code{stream_extradata @var{hex_string}}
+Extradata for the string, encoded in hexadecimal.
+
 @item @code{cahpter @var{id} @var{start} @var{end}}
 Add a chapter. @var{id} is an unique identifier, possibly small and
 consecutive.
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 0dd39a149e..ded0ba6031 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -432,6 +432,7 @@  typedef enum ParseDirective {
    DIR_EXSID,
    DIR_STMETA,
    DIR_STCODEC,
+   DIR_STEDATA,
    DIR_CHAPTER,
 } ParseDirective;
 
@@ -448,6 +449,7 @@  static const ParseSyntax syntax[] = {
     [DIR_EXSID    ] = { "exact_stream_id",      "i",    NEEDS_STREAM },
     [DIR_STMETA   ] = { "stream_meta",          "ks",   NEEDS_STREAM },
     [DIR_STCODEC  ] = { "stream_codec",         "k",    NEEDS_STREAM },
+    [DIR_STEDATA  ] = { "stream_extradata",     "k",    NEEDS_STREAM },
     [DIR_CHAPTER  ] = { "chapter",              "idd",  0 },
 };
 
@@ -612,6 +614,15 @@  static int concat_parse_script(AVFormatContext *avf)
             break;
         }
 
+        case DIR_STEDATA: {
+            int size = ff_hex_to_data(NULL, arg_kw[0]);
+            ret = ff_alloc_extradata(stream->codecpar, size);
+            if (ret < 0)
+                FAIL(ret);
+            ff_hex_to_data(stream->codecpar->extradata, arg_kw[0]);
+            break;
+        }
+
         case DIR_CHAPTER:
             chapter = avpriv_new_chapter(avf, arg_int[0], AV_TIME_BASE_Q,
                                          arg_int[1], arg_int[2], NULL);