From patchwork Tue Aug 31 12:22:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29904 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4873453iov; Tue, 31 Aug 2021 05:22:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSAZzxvVk+Qxg/VxRvJMqZXGULEU4qLkLWUDh+b3HuwEQOEuPq1qXRYosQ6aJiDG6ts0Ar X-Received: by 2002:a17:907:77c5:: with SMTP id kz5mr20838296ejc.175.1630412556545; Tue, 31 Aug 2021 05:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630412556; cv=none; d=google.com; s=arc-20160816; b=UCO3Q5AoSXLD6LNq1gvbdk0yiVRbBfBC92Zw5/Qk8rYeNfKzkp/vk3T+0XRGVSP0DW AXzIlwmikUvlVw1FZZcXgmJ6VEgm9AISc7Egv6Q1MRZAx7jccGhOLf5BeLOdLo2h3LPJ 3PPNbbTwtmFYGqHVCjEA52jkkMZWbbA5+eXj5p8Ah9+RpzNd/LqygtlWeacaqyhKdWQP 78231+iK1KAUWhd6fMZ/j8zql3zxTaiOK48MpJfuoQftGvmSucgrgZpyybmZ6UzM3JV7 /oCqmJ93r7WcutmKm+CQX5dZ1PFJPs6wXONVH5ZO49G9kwomXz4s7jEpcghidD7Ypbqd XsXw== 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=MS1F/gRbkaGhZb4o5XkSBsNUSBXjqsM1FfWQR/JeGKU=; b=BcFiTJly1/ryoH8wPJCvf9b5uhxnkQK4lLaEZFKJ5o3unkuItYzDX5NFK1/fwaICL6 +rt1bfFiB3jGYNZ4bA+uYCNC+0W5i8Vhxa47kzFaDoJulrUd/JtcFdi30KxVF9CLcNhT 0LVjha3LEpOOQK60RQaM1aURjXB+9aKqHQM6yk3pC4+L+PFAAiiXgBXOOiF27r121ARQ +sSGeN6hUWHBU736dQAcZtHcNqJCmamAlsPpDcEweTHuuTRl773P5lVisu2jdP3YePJq MmJlcBXqRKc60A+xezV/6+UKeCOumuzxEMaX/69XfKfxrKO3ebsqEtBmD6y2tyGhmfOP 2R2Q== 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 mp19si18192942ejc.630.2021.08.31.05.22.36; Tue, 31 Aug 2021 05:22:36 -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 A266F68A1F0; Tue, 31 Aug 2021 15:22:20 +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 07B00680923 for ; Tue, 31 Aug 2021 15:22:12 +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 17VCMCuH019250 for ; Tue, 31 Aug 2021 14:22:12 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 3FE0DEB5BD; Tue, 31 Aug 2021 14:22:12 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 14:22:05 +0200 Message-Id: <20210831122209.586348-2-george@nsup.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210831122209.586348-1-george@nsup.org> References: <20210831122209.586348-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 14:22:12 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 2/6] lavf/concat: add file_packet_meta 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: e6G8XvNlH1u/ Same as file_packet_metadata without the double parsing. Signed-off-by: Nicolas George --- doc/demuxers.texi | 5 +++++ libavformat/concatdec.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index eb3351833a..f338700396 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -151,6 +151,11 @@ Metadata of the packets of the file. The specified metadata will be set for each file packet. You can specify this directive multiple times to add multiple metadata entries. +@item @code{file_packet_meta @var{key} @var{value}} +Metadata of the packets of the file. The specified metadata will be set for +each file packet. You can specify this directive multiple times to add multiple +metadata entries. + @item @code{option @var{key} @var{value}} Option to access, open and probe the file. Can be present multiple times. diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 223c7e36c4..76f3fafa50 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -425,6 +425,7 @@ typedef enum ParseDirective { DIR_DURATION, DIR_INPOINT, DIR_OUTPOINT, + DIR_FPMETA, DIR_FPMETAS, DIR_OPTION, DIR_STREAM, @@ -437,6 +438,7 @@ static const ParseSyntax syntax[] = { [DIR_DURATION ] = { "duration", "d", NEEDS_FILE }, [DIR_INPOINT ] = { "inpoint", "d", NEEDS_FILE }, [DIR_OUTPOINT ] = { "outpoint", "d", NEEDS_FILE }, + [DIR_FPMETA ] = { "file_packet_meta", "ks", NEEDS_FILE }, [DIR_FPMETAS ] = { "file_packet_metadata", "s", NEEDS_FILE }, [DIR_OPTION ] = { "option", "ks", NEEDS_FILE | NEEDS_UNSAFE }, [DIR_STREAM ] = { "stream", "", 0 }, @@ -544,6 +546,12 @@ static int concat_parse_script(AVFormatContext *avf) case DIR_OUTPOINT: file->outpoint = arg_int[0]; break; + case DIR_FPMETA: + ret = av_dict_set(&file->metadata, arg_kw[0], arg_str[1], AV_DICT_DONT_STRDUP_VAL); + if (ret < 0) + FAIL(ret); + arg_str[1] = NULL; + break; case DIR_FPMETAS: if ((ret = av_dict_parse_string(&file->metadata, arg_str[0], "=", "", 0)) < 0) { av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata string\n", line);