From patchwork Tue Aug 31 18:07:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29924 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5155164iov; Tue, 31 Aug 2021 11:08:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKxoUD5n2XcQfMvhj/4JADAJr+lkz75EW4h51r7BvTCE7u3kfUr6Tvo5NZMgCxv1hn/Ysr X-Received: by 2002:a17:906:1d59:: with SMTP id o25mr32518038ejh.431.1630433339771; Tue, 31 Aug 2021 11:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433339; cv=none; d=google.com; s=arc-20160816; b=MrEsp36z1NwcYSCoISamKjVNo7hpb7t6rjHs34k8E+QTQf/houAd8LXJQfWUYnRuHm 1hW80W/yWfjpPK9etvNGJViNwLOmzFj0+Fkz3wh1YAb3/MTbW3UTASfQ1oJRbnGnWoLj ZGtXlDsSD9sG16yKaHsfrvWuZdwpQx+m9D89uem+aVHrgUuB+qQrQLtGwJi65CajwQTG wl5usSmMoAggIK9f7Cq+CXn/HK8SbmQra4+SJM9IQfbluzxq/DQ8CwAs8LywjYe+CcPT IZbvpcfdakoKH9yuN0hSbg5SywFZ3UIVbcC90I+PoLO913QuixJsIGq+NLu3jO4D5fdi xv5w== 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=nNsjbUdkPQk2LRnckHFMEqXZ5lE4q4qSJ78ccrMJyEY=; b=Urfsd9P65vQzGZbf9lOz/CucWwefPgcir3bjACLt+oOxJw5YHw7xVrg0BqQwH01Y8V uYvoSuxpjPvf/YYV7c3D/Zh6XQhmM+HLH1X5UYo3r5TpfEC89n2h9uLCCw58itP3+nuq DMji011awJSnXQN+1lj9k8AAZvXXmBqWYBKFyK5eZ9psW/Etm3f68ltOlUXtydr1AQeL oszNpKbStknOEwS9kT2ScAO5k0ll09XMuaIEKnlzVyiLxXaY8hcWWUi7EFUAZ0FWyGsT 7p9XRDp/y2PIXcbCgFBHcwxmv1cgK96pw8gXM0eAmT7LSMUWT8YAQhjraJuVR1lqTty0 y3bg== 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 j18si18229273edp.44.2021.08.31.11.08.59; Tue, 31 Aug 2021 11:08:59 -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 7700F68A538; Tue, 31 Aug 2021 21:07:56 +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 5779168A3F4 for ; Tue, 31 Aug 2021 21:07:45 +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 17VI7i9d030768 for ; Tue, 31 Aug 2021 20:07:44 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 837ACEB5BC; Tue, 31 Aug 2021 20:07:44 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:34 +0200 Message-Id: <20210831180739.873390-7-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 07/12] lavf/concatdec: add stream_codec directive 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: 79nx0PWw1mP+ Signed-off-by: Nicolas George --- doc/demuxers.texi | 3 +++ libavformat/concatdec.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 87e4d0319a..6bb0574e94 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -181,6 +181,9 @@ streams is not reliable. Metadata for the stream. Can be present multiple times. +@item @code{stream_codec @var{value}} +Codec for the stream. + @end table @subsection Options 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); }