summaryrefslogtreecommitdiff
path: root/libavformat/concatdec.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2021-08-31 14:30:28 +0200
committerNicolas George <george@nsup.org>2021-09-16 10:17:59 +0200
commit0a267bc5e20a8e7b1b79a501eed99c284ee00b4c (patch)
tree0fddc0c39699b04ec352ffcfe213d6ba512e8f34 /libavformat/concatdec.c
parent449ba49a9fb05642b068c51c2c6fbbfa4b11f010 (diff)
lavf/concatdec: add stream_codec directive
Diffstat (limited to 'libavformat/concatdec.c')
-rw-r--r--libavformat/concatdec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 6e91fd1826..a0d68d51cc 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -431,6 +431,7 @@ typedef enum ParseDirective {
DIR_STREAM,
DIR_EXSID,
DIR_STMETA,
+ DIR_STCODEC,
} ParseDirective;
static const ParseSyntax syntax[] = {
@@ -445,6 +446,7 @@ static const ParseSyntax syntax[] = {
[DIR_STREAM ] = { "stream", "", 0 },
[DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM },
[DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM },
+ [DIR_STCODEC ] = { "stream_codec", "k", NEEDS_STREAM },
};
static int concat_parse_script(AVFormatContext *avf)
@@ -596,6 +598,17 @@ static int concat_parse_script(AVFormatContext *avf)
FAIL(ret);
break;
+ case DIR_STCODEC: {
+ const AVCodecDescriptor *codec = avcodec_descriptor_get_by_name(arg_kw[0]);
+ if (!codec) {
+ av_log(avf, AV_LOG_ERROR, "Line %d: codec '%s' not found\n", line, arg_kw[0]);
+ FAIL(AVERROR_DECODER_NOT_FOUND);
+ }
+ stream->codecpar->codec_type = codec->type;
+ stream->codecpar->codec_id = codec->id;
+ break;
+ }
+
default:
FAIL(AVERROR_BUG);
}