From patchwork Sun May 8 07:17:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 35698 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp2441774pzb; Sun, 8 May 2022 00:17:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqs9xvq+1U9eNNfx3tNRdNblUPverznj5av/dUMjvjo7luZqNJT6f7HFzbog14tEW8yqyv X-Received: by 2002:a17:907:7f91:b0:6f3:d6bc:cd5b with SMTP id qk17-20020a1709077f9100b006f3d6bccd5bmr10171707ejc.460.1651994241953; Sun, 08 May 2022 00:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651994241; cv=none; d=google.com; s=arc-20160816; b=o4jEVZ99tJxRb8R9LyflmLQqQUWxRvRgt+TONDmhZzyHjegDGLdw9YIeh47rEGcPL9 sj5jjO3/wrzul20YQp4nJZxd7bKfKGuhvosJ+FmYalbtud0+VsLhNWR4hmyO/0t7DZhY iczZZvbqtFQHnb5cbVSRV2ojaBUsOvl55jeGWEytr+D6nFAiA06PvWtrtrfOX2G0YpzF XxNxAsdqaOna6HVRrNm0qTLr4jNGMb8rYcbvHvvRSE3PWmv6AufNXA0+z4XxUlV8dliq Jee4rA8flYE+KTZA3cx18mDt5L82l+3VEciuMvnvj1+nvrNVKIPt/a+4WS6jlsdeU65l i+7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to; bh=Jq7h6JaUbGMkmsYi4mQDF51E4321iylXQ4vCwc9fU8A=; b=gVRYjecKFYldQT5xiqVSFMvuZWIte6CbhItirivXoJc5MYSn07b9aze6b6x0Gb3AlZ VAFQcLdhD4kmHAFA3fQvLHyqs4DzlzzZH2fOQOueoIsqypuV7bUIMZCQplv/a4K8wfLv CUmlR55Kmvij87Jz7QFslBzlrNMUEN6SRGIi7MGBmIMwaBOdJ4qFwehAJUYlBdtZcVAZ RRcGr51VYpFNy6m0dDHJqWhQRqm2zzrHPymYSiHy+BRQSSdx0zAJ4AROr4IZ7zOCuQCj sCKXAQpCKcsRnQfScI4oLIsHWWPKyVN7NCMyrduk7374Y1PlhgofN6MXiZeAoHvbSsKq LGYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ePrSok8Q; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w23-20020a056402129700b00425f7237b06si8062068edv.73.2022.05.08.00.17.21; Sun, 08 May 2022 00:17:21 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=ePrSok8Q; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2955568B1AC; Sun, 8 May 2022 10:17:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EEE1D6881B1 for ; Sun, 8 May 2022 10:17:10 +0300 (EEST) Received: by mail-pj1-f44.google.com with SMTP id e24so10595104pjt.2 for ; Sun, 08 May 2022 00:17:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=NfljcRiteH3OTQFzZ6mHvyMOAPGGHOL96cR1lVTwwRk=; b=ePrSok8QYPggVWqWhxlrs2hilW0w9cWaDjqPa4T8DcdikXqecMERXpMSLWJF4ylCY5 FtOtZRazyBMcCVNvw+YnoK0cklX9/Q9LYIeV8RZ1kdAtf5m3gjagc/ejtg9TWHuNaTjt BeIVSsRmt5+elh7Ad24HbLQZRXlC8l1b04vVRpB6r2NHTgjAYrpJ5ZyV1CgOgrSefoow Y/NvqNsHpfWQre592J+s2dpsWF6Hy1SagixmkgmWDLflXAUfUmo0POCCf4aH1exYcbF1 0Y72MGDLkPCHGwv+P/xTwhtmwPgWaWy89kMjtH6XjjEIBlIV1KAhaBOTj4ZkwrfjjhLc bdbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NfljcRiteH3OTQFzZ6mHvyMOAPGGHOL96cR1lVTwwRk=; b=kAD5r+S7Drj90GaBw0yUWA+YuJlUxpC6OrTviVejJDYtbzueNfqymTfTHZTBKME5CI zktW69tqOsVYd312CHYKW3Ni2wC+xqLu7eurK3vABMmOdLGzK7Fm8rxBr9loFNRPqaIm WAJBYo9UeXxWWIDHyy1I4aXrbq2sVFGDfctPLqgj8zpdE5dgJQ4LzmXUiKpLUTf1uXSZ j1rzqln9nU+Ggesj9uj9PeH/PCWBkR0iBFuxJlWOXDLvYwYq3uTQorNT4IrGZDP3g1NL dyQalkWzBq4tHOShgFQ2dXQuqLyN8XPg6Ggsqv0Y9w7B399qbbS6/9U/O14I4MGwhmgz ivtA== X-Gm-Message-State: AOAM530kRF6RqXRzj3nc1CGfI9Hja7VDmhhdkJnrd+RE04g96A3YBB2k bxsMoq98fp6pQHa2TqbEfLNBu+EQdlU= X-Received: by 2002:a17:902:7e06:b0:159:6c1:ea2b with SMTP id b6-20020a1709027e0600b0015906c1ea2bmr10744781plm.105.1651994228049; Sun, 08 May 2022 00:17:08 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id c3-20020a170902b68300b0015eee3ab203sm4239607pls.49.2022.05.08.00.17.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 May 2022 00:17:07 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Sun, 8 May 2022 15:17:00 +0800 Message-Id: <1651994221-11660-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/2] avfilter/src_movie: add dec_opts for the opened file 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 Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: g/mJGxJh56/A From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 9 +++++++++ libavfilter/src_movie.c | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 367614d2f8..6775cf43ba 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -29652,6 +29652,15 @@ shows how to add protocol_whitelist and protocol_blacklist options: ffplay -f lavfi "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'" @end example + +@item dec_opts +Specify decode options for the opened file. Format options can be specified +as a list of @var{key}=@var{value} pairs separated by ':'. The following example +shows how to add export_side_data options: +@example +./ffmpeg -y -f lavfi +-i "movie=./input.ts:dec_opts=export_side_data=scte20cc[out0+subcc]" out.srt +@end example @end table It allows overlaying a second video on top of the main input of diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 711854c23c..c7dbd90aa9 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -70,6 +70,7 @@ typedef struct MovieContext { int64_t discontinuity_threshold; int64_t ts_offset; int dec_threads; + AVDictionary *dec_opts; AVFormatContext *format_ctx; @@ -96,6 +97,7 @@ static const AVOption movie_options[]= { { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, { "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS }, { "format_opts", "set format options for the opened file", OFFSET(format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS}, + { "dec_opts", "set decode options for the opened file", OFFSET(dec_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS}, { NULL }, }; @@ -158,6 +160,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads) { + MovieContext *movie = ctx->priv; const AVCodec *codec; int ret; @@ -179,7 +182,7 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads) dec_threads = ff_filter_get_nb_threads(ctx); st->codec_ctx->thread_count = dec_threads; - if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { + if ((ret = avcodec_open2(st->codec_ctx, codec, &movie->dec_opts)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); return ret; }