From patchwork Tue Aug 31 18:07:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29923 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5154770iov; Tue, 31 Aug 2021 11:08:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxuBH6g+06s2nIQ7jsmU4WVEn/32zHsYLL+KbxO9m6HqPG9kNXjT0XZxQm2mNTh9QGEjSf X-Received: by 2002:aa7:c7c2:: with SMTP id o2mr30906842eds.166.1630433308436; Tue, 31 Aug 2021 11:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433308; cv=none; d=google.com; s=arc-20160816; b=eMM1HrOnUq6iwOyeeBIn+SAsqe4lGIGcl+cw97ANwcl9o8H36iVgKscf+CgkTPGk1p Oy6uBpccqPUNVKWMh5X2B9tYHGwlweyz6auSF4lHljvu5SY/bVUwfQMQvVg3dWp6G7OY qTPYHYNzziKm13eccC9sgWSQR5E+0Q1Hq+VIdGTicjQOJKAcc4/ZaGonxk5njM2g6eOb QtIVzNa3pMzO7XJKu2vE5E/u57al3jBf/w5+lao0m/cP7A10S7tpn8i83Bq81r8QVlqK tocPZpbFRNQZhtu4fWcZFW9lRme1h5hiQSJ6C3+aCUb6Y5v7qzajwheTs/P2GNQXaHrn X08w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=BTmr7r7URRcKOL1U9ornDiN6XYxHvAbu5ctwYWag6jM=; b=PTLl4NcdYJMF6/QDH+JqW4PLtKNHP9kWcccEzCcXR1QVCjhInqOX1Ylc4c7wiyzsdS k/xwNgCJtCRHUSKqDmYkSuuw+xWtE+uOLBtJtc22SRAAfu5RimDJVvUyWQaMWI4qlQ2s JBqVEfoQDgpQuIkic/x+bdoM7pQzassUBW7BrZ9E8jeyxWa3tFLnbpO0aXBXpo2WLNO/ SZHYBZnGHRzpjgVFdng8pU+wlWiPHEDfXJW2Mw4UKbRpmoOdq9nxTm6Svt8zhQeCtbUb pOQj0fDTiukkBjxrUsniH/mErGUlnljyJSyBVAIFgBY7teCw2X2IMOl0cg5WWMjZuZm5 fyzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f16si503424edf.596.2021.08.31.11.08.28; Tue, 31 Aug 2021 11:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8C57268A4DB; Tue, 31 Aug 2021 21:07:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7C7AA68A1F0 for ; Tue, 31 Aug 2021 21:07:44 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 17VI7hDF030754 for ; Tue, 31 Aug 2021 20:07:44 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id B0C37EB5BD; Tue, 31 Aug 2021 20:07:43 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:31 +0200 Message-Id: <20210831180739.873390-4-george@nsup.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210831180739.873390-1-george@nsup.org> References: <20210831180739.873390-1-george@nsup.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Tue, 31 Aug 2021 20:07:44 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 04/12] lavf/concatdec: support stream metadata X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Rn2a/hrK+0Dc Signed-off-by: Nicolas George --- doc/demuxers.texi | 4 ++++ libavformat/concatdec.c | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index fd06be3195..87e4d0319a 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -177,6 +177,10 @@ subfiles will be used. This is especially useful for MPEG-PS (VOB) files, where the order of the streams is not reliable. +@item @code{stream_meta @var{key} @var{value}} +Metadata for the stream. +Can be present multiple times. + @end table @subsection Options diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 0e581e9a14..6e91fd1826 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -430,6 +430,7 @@ typedef enum ParseDirective { DIR_OPTION, DIR_STREAM, DIR_EXSID, + DIR_STMETA, } ParseDirective; static const ParseSyntax syntax[] = { @@ -443,6 +444,7 @@ static const ParseSyntax syntax[] = { [DIR_OPTION ] = { "option", "ks", NEEDS_FILE | NEEDS_UNSAFE }, [DIR_STREAM ] = { "stream", "", 0 }, [DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM }, + [DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM }, }; static int concat_parse_script(AVFormatContext *avf) @@ -452,6 +454,7 @@ static int concat_parse_script(AVFormatContext *avf) AVBPrint bp; uint8_t *cursor, *keyword; ConcatFile *file = NULL; + AVStream *stream = NULL; unsigned line = 0, arg; const ParseSyntax *dir; char *arg_kw[MAX_ARGS]; @@ -578,12 +581,19 @@ static int concat_parse_script(AVFormatContext *avf) break; case DIR_STREAM: - if (!avformat_new_stream(avf, NULL)) + stream = avformat_new_stream(avf, NULL); + if (!stream) FAIL(AVERROR(ENOMEM)); break; case DIR_EXSID: - avf->streams[avf->nb_streams - 1]->id = arg_int[0]; + stream->id = arg_int[0]; + break; + case DIR_STMETA: + ret = av_dict_set(&stream->metadata, arg_kw[0], arg_str[1], AV_DICT_DONT_STRDUP_VAL); + arg_str[1] = NULL; + if (ret < 0) + FAIL(ret); break; default: