From patchwork Wed May 12 19:03:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ignacio Losiggio X-Patchwork-Id: 27730 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:b214:0:0:0:0:0 with SMTP id b20csp5317092iof; Wed, 12 May 2021 12:34:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfnD84aQoXBdhiiKo3iOQGcuUOjWiMgLY7aUjkaVe/BSuYXf430Q8v/bEmINuWCYJzAE+S X-Received: by 2002:a17:906:dbfd:: with SMTP id yd29mr23066892ejb.534.1620848068115; Wed, 12 May 2021 12:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620848068; cv=none; d=google.com; s=arc-20160816; b=svd+43QQ+LJlFa1NKxt+2enI/Fx6rnXCH5NheTf9+cf/0FJ6sqD5TlNQ2KV0JM7O7A vPpE39qsQ/Cp3B8CbtdHyocum7/hx0AIy3J0oLFNSyEHr1V3OfruHSykrgf3sUSV0b0Q CRrT/XJN9pZOBDJrSDVyBnHVAQgGAAFTAh6x/JPJlc0SRXthQZ20zlPKLEl9aYo0gDfy Y05gpT5J9qb22UPz/fYrMCuzI7/dM1rWxF/0U8SeLQEQe0BUUATPbLFimwQ65uhS2jwM //PUCOLVIslCoq2+bJIBXttKZO5VMMzewgjAwbqEMqPtooH1nJKNt5t3zQe81iwNIrAc xchQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=BuZ5cwZJ9HUPZGXT+PUsfxnPZaDSOXivU7Qpph4xMR8=; b=yhuCqToZQHkJH06JFGnAFMaq+3KBaUYOJa9phRRGWPFRp1yGO8Jjv135IHGdtnsVmN Kp4++MaJjSPaHBKJ1IiYQvVhV4gzGWv3i1BkcPqzQo/0BhktgDhy3pGUMdVm6pQZJ5hr xiJF64RNu8k+RUd0oMVq6I0Ekk1wGyvoAnkAek0+4U/2O+FKgP0l4aU1I33IMZWO6+UB oFqLMD8rVrNw85z/EqAGXHtfAYpMfUKXWcwUoqHpTAckpf5eSTu8XaXaW66SuPFZ9H+c mXtJ0/MD6t3SFX2TNacFiQNexe9MQEEzoFrIXxcQ8gSaxgUH3okWOQ0X/sq7KLT65yQn C01g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=dc.uba.ar Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hr18si697698ejc.704.2021.05.12.12.34.27; Wed, 12 May 2021 12:34: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=dc.uba.ar Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 58AE36804F2; Wed, 12 May 2021 22:34:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 046916804F2 for ; Wed, 12 May 2021 22:34:18 +0300 (EEST) Received: by mail-qk1-f171.google.com with SMTP id v8so5435452qkv.1 for ; Wed, 12 May 2021 12:34:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WL49QC42/ofi56NHcFD0NvFmllPwahbRJogwvnA57Rg=; b=U2qLGv7/8XtA7x+t2GKcvP4A+gWstP6y2bwMiUUglchv1Dy1G7rb3gUgTxVLmxwcaS poUmR4aZNWkjDaAHMYGRy/TQpnaHRKM3ZfDVuCJrDkO/t6+i/IYRuE1QXNOZg4geEfTN clvy1Ku0PixUIcN4XP2BzWAaFD5LtXEn458vKA2/KQWxBEvNeX+v9WpPSflNYkdk3N4l 2gnAOJ+Nloc1dK30FNI+v2WyRirF69gduljmd/Szls15mdUqRw3vAikK7tpBOvVr4i8z KKITnDaYSHh9UW7QUq9Ihra/UR6Vz/7Y+HmTvYXoxyeM6lAiFVrJi/Iszusjhe13zEhJ cUNA== X-Gm-Message-State: AOAM530xm+2pQzJ/ZEt/WWhzGVm0ZXLFx+00aqkXhFX6cH+Ev2eKhHSi Rxu0TRmMw6SDFbDMlJHbvHAkER40i1Q= X-Received: by 2002:a05:620a:13a8:: with SMTP id m8mr24584105qki.213.1620846264601; Wed, 12 May 2021 12:04:24 -0700 (PDT) Received: from nobuc.localdomain (129-73-17-190.fibertel.com.ar. [190.17.73.129]) by smtp.gmail.com with ESMTPSA id f16sm612346qtv.82.2021.05.12.12.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 May 2021 12:04:24 -0700 (PDT) From: Ignacio Losiggio To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 May 2021 16:03:30 -0300 Message-Id: <20210512190329.360744-1-iglosiggio@dc.uba.ar> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210509223724.207365-1-iglosiggio@dc.uba.ar> References: <20210509223724.207365-1-iglosiggio@dc.uba.ar> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/src_movie: Expose open options 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: Ignacio Losiggio , Ignacio Losiggio Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cVBSEVjVy0Wp Add a dict-typed option to movie/amovie called options that gets forwarded to avformat_open_input. This now allows complex filtergraph setups that require options on their movie sources (for example, setting the pixel format of a webcam). Signed-off-by: Ignacio Losiggio --- doc/filters.texi | 5 +++++ libavfilter/src_movie.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index b405cc5dfb..51bc824795 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -27312,6 +27312,11 @@ changed, so it will generate non monotonically increasing timestamps. Specifies the time difference between frames above which the point is considered a timestamp discontinuity which is removed by adjusting the later timestamps. + +@item options +Specifies the options passed to the movie. Special care needs to be taken when +passing multiple options, because ":" is an special token it needs to be +escaped even inside "'" delimiters. @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 54f6738f9a..52cc6c6ca5 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -61,6 +61,7 @@ typedef struct MovieContext { int64_t seek_point; ///< seekpoint in microseconds double seek_point_d; char *format_name; + AVDictionary *options; char *file_name; char *stream_specs; /**< user-provided list of streams, separated by + */ int stream_index; /**< for compatibility */ @@ -90,6 +91,7 @@ static const AVOption movie_options[]= { { "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, 0, 0, FLAGS }, { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS }, { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, + { "options", "set format options", OFFSET(options), AV_OPT_TYPE_DICT, .flags = FLAGS }, { NULL }, }; @@ -239,7 +241,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; movie->format_ctx = NULL; - if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) { + if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, &movie->options)) < 0) { av_log(ctx, AV_LOG_ERROR, "Failed to avformat_open_input '%s'\n", movie->file_name); return ret;