From patchwork Tue Aug 31 12:22:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29902 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4873342iov; Tue, 31 Aug 2021 05:22:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw30mfrawiEDXPTpznTk8uxJQ5DBGAuEojsayxtHkMA2CIyvqeubxEVTOAKzc0zIP4Cu17i X-Received: by 2002:aa7:d3d6:: with SMTP id o22mr12396610edr.155.1630412548820; Tue, 31 Aug 2021 05:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630412548; cv=none; d=google.com; s=arc-20160816; b=tp9qQEBavhea3ZvAjSmftWEkBxEGJ4yE7cLZOMZ2GJD0I8bZhw/StFDEjbBR6B+FkO EgQXiCc1KnFo5x47GEpp8Tn+nqK6ck15k51Z0Z7VJP8O33KXbZiCMfADUEF8XB0jRhxK AJbWFIq6b4NFf1I+8oPxKCOj0ce43Zc+a7/No+5iEry4LV4u5fjHkzEzipEAXV+bxYXl uEP41xqoZhIJJOOqYvaCIEudBYufby4hSXc2Hy97QBnvcS4mMI6R3Gl+1SdtVeFRntns mBf0wnczWZr2aM94+bOy2+zbrM4vzZccMEj+mcjbHAKVr4ofjJhWJXp0zSQ3YEu5rAQU JDBw== 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:message-id:date:to:from :delivered-to; bh=FbwgD403bSPD24jBocjfQaQwyb0eKL+2iQYNtTwiI/k=; b=F5FIMJ8x38mFhU2/nVjZ1/wpT0XsrN8gtIz8lQr6O/v63tM1iXxfCIku6RqG2Jp9fN NzRqB4u9Pcn/C1diU5oHmUnHQZXmU2t0YnflxoqmLosdSBUpySBYHXvFSJKST0H+8F8t T/xOoWQQGroWEMyerd0SFnAtmDjh1q25cpHSGwu1xouANcNzgsABrpyC+TNpSp34xSx7 SdL0ezR/QMKqmBT3H2Z5GsRgsagYloD2Z0F/+XfQDBTX/9teioqJtsgzHjZu6gSEAnsk lALgLO68O9IOIi6brqu5Cxwpu88aF9FzzhcUBRKAqkdBqdi4S9haYZOK35i2XLyZjzAU BS9g== 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 t21si17642815ejy.151.2021.08.31.05.22.24; Tue, 31 Aug 2021 05:22: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 6049B68A134; Tue, 31 Aug 2021 15:22:19 +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 D147968016E 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 17VCMCT8019249 for ; Tue, 31 Aug 2021 14:22:12 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id F0996EB5BC; Tue, 31 Aug 2021 14:22:11 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 14:22:04 +0200 Message-Id: <20210831122209.586348-1-george@nsup.org> X-Mailer: git-send-email 2.33.0 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 1/6] lavf/concat: refactor parsing 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: fHXF5cqCx3qB Signed-off-by: Nicolas George --- libavformat/concatdec.c | 245 +++++++++++++++++++++++++--------------- 1 file changed, 157 insertions(+), 88 deletions(-) It does not make the code shorter, but it makes it clearer and reduces the risk of mistakes, like the ones I made myself recently. Also, it makes adding new directives much simpler. And I am about to add quite a few. diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 30db456b0e..223c7e36c4 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -19,6 +19,7 @@ */ #include "libavutil/avstring.h" +#include "libavutil/avassert.h" #include "libavutil/bprint.h" #include "libavutil/intreadwrite.h" #include "libavutil/opt.h" @@ -407,15 +408,54 @@ static int concat_read_close(AVFormatContext *avf) return 0; } -static int concat_read_header(AVFormatContext *avf) +#define MAX_ARGS 2 +#define NEEDS_UNSAFE (1 << 1) +#define NEEDS_FILE (1 << 1) +#define NEEDS_STREAM (1 << 2) + +typedef struct ParseSyntax { + const char *keyword; + char args[MAX_ARGS]; + uint8_t flags; +} ParseSyntax; + +typedef enum ParseDirective { + DIR_FFCONCAT, + DIR_FILE, + DIR_DURATION, + DIR_INPOINT, + DIR_OUTPOINT, + DIR_FPMETAS, + DIR_OPTION, + DIR_STREAM, + DIR_EXSID, +} ParseDirective; + +static const ParseSyntax syntax[] = { + [DIR_FFCONCAT ] = { "ffconcat", "kk", 0 }, + [DIR_FILE ] = { "file", "s", 0 }, + [DIR_DURATION ] = { "duration", "d", NEEDS_FILE }, + [DIR_INPOINT ] = { "inpoint", "d", NEEDS_FILE }, + [DIR_OUTPOINT ] = { "outpoint", "d", NEEDS_FILE }, + [DIR_FPMETAS ] = { "file_packet_metadata", "s", NEEDS_FILE }, + [DIR_OPTION ] = { "option", "ks", NEEDS_FILE | NEEDS_UNSAFE }, + [DIR_STREAM ] = { "stream", "", 0 }, + [DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM }, +}; + +static int concat_parse_script(AVFormatContext *avf) { ConcatContext *cat = avf->priv_data; + unsigned nb_files_alloc = 0; AVBPrint bp; uint8_t *cursor, *keyword; - int line = 0, i; - unsigned nb_files_alloc = 0; ConcatFile *file = NULL; - int64_t ret, time = 0; + unsigned line = 0, arg; + const ParseSyntax *dir; + char *arg_kw[MAX_ARGS]; + char *arg_str[MAX_ARGS] = { 0 }; + int64_t arg_int[MAX_ARGS]; + int ret; av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); @@ -425,100 +465,131 @@ static int concat_read_header(AVFormatContext *avf) keyword = get_keyword(&cursor); if (!*keyword || *keyword == '#') continue; + for (dir = syntax; dir < syntax + FF_ARRAY_ELEMS(syntax); dir++) + if (!strcmp(dir->keyword, keyword)) + break; + if (dir >= syntax + FF_ARRAY_ELEMS(syntax)) { + av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n", + line, keyword); + FAIL(AVERROR_INVALIDDATA); + } - if (!strcmp(keyword, "file")) { - char *filename = av_get_token((const char **)&cursor, SPACE_CHARS); - if (!filename) { - av_log(avf, AV_LOG_ERROR, "Line %d: filename required\n", line); - FAIL(AVERROR_INVALIDDATA); + /* Flags check */ + if ((dir->flags & NEEDS_UNSAFE) && cat->safe) { + av_log(avf, AV_LOG_ERROR, "Line %d: %s not allowed if safe\n", line, keyword); + FAIL(AVERROR_INVALIDDATA); + } + if ((dir->flags & NEEDS_FILE) && !cat->nb_files) { + av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", line, keyword); + FAIL(AVERROR_INVALIDDATA); + } + if ((dir->flags & NEEDS_STREAM) && !avf->nb_streams) { + av_log(avf, AV_LOG_ERROR, "Line %d: %s without stream\n", line, keyword); + FAIL(AVERROR_INVALIDDATA); + } + + /* Arguments parsing */ + for (arg = 0; arg < FF_ARRAY_ELEMS(dir->args) && dir->args[arg]; arg++) { + switch (dir->args[arg]) { + case 'd': /* duration */ + arg_kw[arg] = get_keyword(&cursor); + ret = av_parse_time(&arg_int[arg], arg_kw[arg], 1); + if (ret < 0) { + av_log(avf, AV_LOG_ERROR, "Line %d: invalid duration '%s'\n", + line, arg_kw[arg]); + goto fail; + } + break; + case 'i': /* integer */ + arg_int[arg] = strtol(get_keyword(&cursor), NULL, 0); + break; + case 'k': /* keyword */ + arg_kw[arg] = get_keyword(&cursor); + break; + case 's': /* string */ + av_assert0(!arg_str[arg]); + arg_str[arg] = av_get_token((const char **)&cursor, SPACE_CHARS); + if (!arg_str[arg]) + FAIL(AVERROR(ENOMEM)); + if (!*arg_str[arg]) { + av_log(avf, AV_LOG_ERROR, "Line %d: string required\n", line); + FAIL(AVERROR_INVALIDDATA); + } + break; + default: + FAIL(AVERROR_BUG); } - if ((ret = add_file(avf, filename, &file, &nb_files_alloc)) < 0) - goto fail; - } else if (!strcmp(keyword, "duration") || !strcmp(keyword, "inpoint") || !strcmp(keyword, "outpoint")) { - char *dur_str = get_keyword(&cursor); - int64_t dur; - if (!file) { - av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", - line, keyword); + } + + /* Directive action */ + switch ((ParseDirective)(dir - syntax)) { + case DIR_FFCONCAT: + if (strcmp(arg_kw[0], "version") || strcmp(arg_kw[1], "1.0")) { + av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line); FAIL(AVERROR_INVALIDDATA); } - if ((ret = av_parse_time(&dur, dur_str, 1)) < 0) { - av_log(avf, AV_LOG_ERROR, "Line %d: invalid %s '%s'\n", - line, keyword, dur_str); + break; + case DIR_FILE: + ret = add_file(avf, arg_str[0], &file, &nb_files_alloc); + arg_str[0] = NULL; + if (ret < 0) goto fail; - } - if (!strcmp(keyword, "duration")) - file->user_duration = dur; - else if (!strcmp(keyword, "inpoint")) - file->inpoint = dur; - else if (!strcmp(keyword, "outpoint")) - file->outpoint = dur; - } else if (!strcmp(keyword, "file_packet_metadata")) { - char *metadata; - if (!file) { - av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", - line, keyword); - FAIL(AVERROR_INVALIDDATA); - } - metadata = av_get_token((const char **)&cursor, SPACE_CHARS); - if (!metadata) { - av_log(avf, AV_LOG_ERROR, "Line %d: packet metadata required\n", line); - FAIL(AVERROR_INVALIDDATA); - } - if ((ret = av_dict_parse_string(&file->metadata, metadata, "=", "", 0)) < 0) { + break; + case DIR_DURATION: + file->user_duration = arg_int[0]; + break; + case DIR_INPOINT: + file->inpoint = arg_int[0]; + break; + case DIR_OUTPOINT: + file->outpoint = arg_int[0]; + 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); - av_freep(&metadata); FAIL(AVERROR_INVALIDDATA); } - av_freep(&metadata); - } else if (!strcmp(keyword, "option")) { - char *key, *val; - if (cat->safe) { - av_log(avf, AV_LOG_ERROR, "Options not permitted in safe mode.\n"); - FAIL(AVERROR(EPERM)); - } - if (!file) { - av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n", - line, keyword); - FAIL(AVERROR_INVALIDDATA); - } - if (!(key = av_get_token((const char **)&cursor, SPACE_CHARS)) || - !(val = av_get_token((const char **)&cursor, SPACE_CHARS))) { - av_freep(&key); - FAIL(AVERROR(ENOMEM)); - } - ret = av_dict_set(&file->options, key, val, - AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + av_freep(&arg_str[0]); + break; + case DIR_OPTION: + ret = av_dict_set(&file->options, arg_kw[0], arg_str[1], AV_DICT_DONT_STRDUP_VAL); if (ret < 0) FAIL(ret); - } else if (!strcmp(keyword, "stream")) { + arg_str[1] = NULL; + break; + case DIR_STREAM: if (!avformat_new_stream(avf, NULL)) FAIL(AVERROR(ENOMEM)); - } else if (!strcmp(keyword, "exact_stream_id")) { - if (!avf->nb_streams) { - av_log(avf, AV_LOG_ERROR, "Line %d: exact_stream_id without stream\n", - line); - FAIL(AVERROR_INVALIDDATA); - } - avf->streams[avf->nb_streams - 1]->id = - strtol(get_keyword(&cursor), NULL, 0); - } else if (!strcmp(keyword, "ffconcat")) { - char *ver_kw = get_keyword(&cursor); - char *ver_val = get_keyword(&cursor); - if (strcmp(ver_kw, "version") || strcmp(ver_val, "1.0")) { - av_log(avf, AV_LOG_ERROR, "Line %d: invalid version\n", line); - FAIL(AVERROR_INVALIDDATA); - } - } else { - av_log(avf, AV_LOG_ERROR, "Line %d: unknown keyword '%s'\n", - line, keyword); - FAIL(AVERROR_INVALIDDATA); + break; + case DIR_EXSID: + avf->streams[avf->nb_streams - 1]->id = arg_int[0]; + break; + default: + FAIL(AVERROR_BUG); } } - if (ret != AVERROR_EOF && ret < 0) - goto fail; - if (!cat->nb_files) - FAIL(AVERROR_INVALIDDATA); + +fail: + for (arg = 0; arg < MAX_ARGS; arg++) + av_freep(&arg_str[arg]); + av_bprint_finalize(&bp, NULL); + return ret == AVERROR_EOF ? 0 : ret; +} + +static int concat_read_header(AVFormatContext *avf) +{ + ConcatContext *cat = avf->priv_data; + int64_t time = 0; + unsigned i; + int ret; + + ret = concat_parse_script(avf); + if (ret < 0) + return ret; + if (!cat->nb_files) { + av_log(avf, AV_LOG_ERROR, "No files to concat\n"); + return AVERROR_INVALIDDATA; + } for (i = 0; i < cat->nb_files; i++) { if (cat->files[i].start_time == AV_NOPTS_VALUE) @@ -541,11 +612,9 @@ static int concat_read_header(AVFormatContext *avf) cat->stream_match_mode = avf->nb_streams ? MATCH_EXACT_ID : MATCH_ONE_TO_ONE; if ((ret = open_file(avf, 0)) < 0) - goto fail; + return ret; -fail: - av_bprint_finalize(&bp, NULL); - return ret; + return 0; } static int open_next_file(AVFormatContext *avf) 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); From patchwork Tue Aug 31 12:22:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29905 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4873657iov; Tue, 31 Aug 2021 05:22:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmZurXbDRYEFBMVZeSgUvzfQYw95x+YpLwVUdOpCz1T290OgZNDS4z9vYY4FQH84DInUOL X-Received: by 2002:a17:907:2a51:: with SMTP id fe17mr30824077ejc.179.1630412574057; Tue, 31 Aug 2021 05:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630412574; cv=none; d=google.com; s=arc-20160816; b=o2jCbmDaF1TzHkO8tE34ciCYweXvVjrtULg4bUw4jDe0ujVxAxlZdZuFlouPaYfZNF yk5zJ+j9gBa62t1NbJQTMYrrc402JCT9200Tw9kA25yyg0/oK/+WpLjrDOiNNp7HDTDC W3Ha5vafg3U3fSXrX5rX75C2ICXWXj0uNHJF3lBa79ajeQuibX0dCJ66H7/nFPQe7KWK r4AzQj61CmZEN4KdJA91OqEWdFp57AZW0Iq6G3tVCxyk404P3vlFbHPH5MwozN/gUyFN wa3taiSrTR1rHjZHE0rRuOtnXBxzsqXhwzVPuytw1j6VyG9HRD3ZtHWZvjXgZ0DSxbSU LxZQ== 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=WMZ7ht9uDMCumfv1nS4uV69E9+KShr2Gzy9yRKZU+DU=; b=jz/DA5YmlZdXIUfGRDoFu1xikjW2RcTxtVZSSbXaro3nYB1jgr4V7XjjfhgNiWioxM H/IKbRVh5j6uDNLp1BD+nrpFHGfHMSa1SrmZtylDeJiTnTZqCdzwUlWDdPJcySkGUzJ/ 2vgWJ8W+mCjoVW/Jn8scBj6N8Bkc9NAR8FrSyOZ7P7MMbj45KsAae1geOpuQTv6vV+to l8sStroD/NftqrK4n3E1F/imMA2d8+IhKZsk0Jd0WbRdQONgXK2V63OLuTYx7reYQBeD 2CKO9H4dVJEwLnd9O7/BMe9gX9MceQ+4PR0T2QkyL4egMLmgNbroeVhYUv8hhywM0p8o w4Og== 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 nd15si16342851ejc.463.2021.08.31.05.22.46; Tue, 31 Aug 2021 05:22:54 -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 95ED568A0EA; Tue, 31 Aug 2021 15:22:21 +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 49DB2680923 for ; Tue, 31 Aug 2021 15:22:13 +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 17VCMC2T019254 for ; Tue, 31 Aug 2021 14:22:12 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 8334BEB5BC; Tue, 31 Aug 2021 14:22:12 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 14:22:06 +0200 Message-Id: <20210831122209.586348-3-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 3/6] lavf/concat: deprecate file_packet_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: rrpwM7w3OzgZ Signed-off-by: Nicolas George --- doc/demuxers.texi | 1 + libavformat/concatdec.c | 3 +++ tests/extended.ffconcat | 2 +- tests/simple1.ffconcat | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index f338700396..fd06be3195 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -150,6 +150,7 @@ directive) will be reduced based on their specified Out point. 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. +This directive is deprecated, use @code{file_packet_meta} instead. @item @code{file_packet_meta @var{key} @var{value}} Metadata of the packets of the file. The specified metadata will be set for diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 76f3fafa50..2981c7c27f 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -557,6 +557,9 @@ static int concat_parse_script(AVFormatContext *avf) av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata string\n", line); FAIL(AVERROR_INVALIDDATA); } + av_log(avf, AV_LOG_WARNING, + "'file_packet_metadata key=value:key=value' is deprecated, " + "use multiple 'file_packet_meta key value' instead\n"); av_freep(&arg_str[0]); break; case DIR_OPTION: diff --git a/tests/extended.ffconcat b/tests/extended.ffconcat index 7359113c23..c8afbcedb5 100644 --- a/tests/extended.ffconcat +++ b/tests/extended.ffconcat @@ -4,7 +4,7 @@ file %SRCFILE% file %SRCFILE% duration 1 -file_packet_metadata dummy=1 +file_packet_meta dummy 1 file %SRCFILE% inpoint 00:00.00 diff --git a/tests/simple1.ffconcat b/tests/simple1.ffconcat index 0a754af421..c9299e0faa 100644 --- a/tests/simple1.ffconcat +++ b/tests/simple1.ffconcat @@ -8,5 +8,5 @@ inpoint 00:00.80 file %SRCFILE% inpoint 00:00.20 outpoint 00:00.40 -file_packet_metadata dummy=1 +file_packet_meta dummy 1 From patchwork Tue Aug 31 12:22:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29907 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4873722iov; Tue, 31 Aug 2021 05:23:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIN6jtUVc9kWl3igWu5XzMK3pQPY5OhZcFzrs0tnlBSP8x61N5EbFWfXj/AB8xKuuKAbb5 X-Received: by 2002:aa7:cb92:: with SMTP id r18mr29993434edt.282.1630412580461; Tue, 31 Aug 2021 05:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630412580; cv=none; d=google.com; s=arc-20160816; b=fst/Yrq67qnoQQb9t1LwFMM7/atwbUC0pz0ObZi6e7m0O6P3cjyBjJxCVcKON4FCsz xkpipMto3hiXopuR/xz8gFMr5FmoiV12i47oTLtKFi2kcnsl+QumD6ZXYZ/+aKfGSHEq wC35D2yaGbAmGBO6fXotYv8QCpaCnTHLuRKzO32khFG/RoR12QkgTWJ2zj6vM0JlmOaa Dz1xbg27uHSSd/n/76Q8dXqbxd3erfbn4gm/YcdWiNyX6Q3AxHr6XeaUYB2EFY/I2DOe RmBoL2BtAyo7EOcRUd23gui1w8BCMT01+9KjbTJQLijy+VkhtugMmYbi+ftlcJox56Jl JeYA== 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=uDgoipOMqa/+08BDACZp4U93CUy/0kyuErnytuVlG+E=; b=Ysb9lqdFNF/bP7jzrd0nkF8RU3zacGupzDinP82Rikc+iOU+WbSgYznpJJy67vHsRj bUVyuSGekSZ7FLGAbWpSDVkZYqm/lv6yD9uJ7zzSyrNktO/C4fq0n2L+PuacmJ83xB3I 2DG1b2Mcv7BQ0jqtt+cq272gPImVci4d/nymd34LMATfDZz1GmtEeyPVHdMmtF5b8Vl8 sVgBjzBZsJyKwO5it0YhcK/22b+14DiICszLCKvtvVc4inEyXNcLPsrI29FJNX0T3k4i 7UcdX111Lppj5jOmWQsYW+fwpAlfoSJKV3lLraY9DKbh8OB/yfo/Vlo0SJEFl3xd+sPi uo/Q== 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 g1si9048884edy.542.2021.08.31.05.22.57; Tue, 31 Aug 2021 05:23:00 -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 D325E68A3AE; Tue, 31 Aug 2021 15:22:24 +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 8AC24680087 for ; Tue, 31 Aug 2021 15:22:13 +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 17VCMCVu019261 for ; Tue, 31 Aug 2021 14:22:13 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id C47F6EB5BD; Tue, 31 Aug 2021 14:22:12 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 14:22:07 +0200 Message-Id: <20210831122209.586348-4-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:13 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 4/6] 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: j1657zgnYXa+ 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 2981c7c27f..5ebac49b97 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]; @@ -569,11 +572,18 @@ static int concat_parse_script(AVFormatContext *avf) arg_str[1] = NULL; 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); + if (ret < 0) + FAIL(ret); + arg_str[1] = NULL; break; default: FAIL(AVERROR_BUG); From patchwork Tue Aug 31 12:22:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29906 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4873933iov; Tue, 31 Aug 2021 05:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVTV5oIJYqLoiX4jI3CjZQD88cyKX+Y3Le5czk/384fvIS0PRkf1MN9e7rn1jgfiwk5g6Y X-Received: by 2002:a17:906:69d0:: with SMTP id g16mr29975794ejs.20.1630412593982; Tue, 31 Aug 2021 05:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630412593; cv=none; d=google.com; s=arc-20160816; b=F8NbWcestNrZBDkeYpczz6lJ0Fwkx8IedNbJz6RNqmk+7eMQwGQPrfMTpIxWfPQyNU om8FfZ6N+IV6e+cRNswksLPc0Bgb+DhJpHCndKeY7Q8H/5jYs+ilzEO6cE+F7ada30aC MKxvncY51HjaFfor6KgCkjV5Les3+DaLNxF4pRZ5iHVU7zp5HDbKus1WTqpJQq230LYp LnZ0Gd+LKYAmKmwveZLD46aysQe1PvNwoykG8vfQ1Dl6E6lsY7B/AC3zB9pAtJ7VhqsA lTckRAsDpYsylvctwxl0HaKyEG07agp4cEoHLWsTkEVqs2bAZ7qVVUObxsJGmU4RAzfm Uueg== 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=m8R6/CTj2/QA+16iPzZ9PwYYAwFdyj9oRSOUFgWMYeI=; b=EbXA/BywaSNZNAtDuhJXIGT6p7FAWvqpf7/A6aJOQxTHXD6oaJcCtUYot3adk7jd0e TrOdSQt4VsvaXf6uAwrSj9MunvYpP3jR1HlIBy3/+R5o7N1r4a5zkMjqH3FDVAcaKnqY B2TU3iCmBOJ1omwbNrcBIxQn2eBVtgLhQR6iaaXfvWliyuRgDt0enTx33wkHigNbUa/Z KO48VdGVjKjE/DsKCzYTqEL0l2vusHOR+g9Zr5+9r56+qXNhKFPn0gJIHOim0jOF2dIv WjdyY7nFW1DdvrSAzMS77XJ6a5KdD3f7CfavDMPX14/aeOlrFUFPTAbYnXpMV8o98vxT mWwQ== 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 do8si6183358ejc.520.2021.08.31.05.23.08; Tue, 31 Aug 2021 05:23:13 -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 E32FF68834D; Tue, 31 Aug 2021 15:22:25 +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 D5713680087 for ; Tue, 31 Aug 2021 15:22:13 +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 17VCMDRD019265 for ; Tue, 31 Aug 2021 14:22:13 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 13A51EB5BC; Tue, 31 Aug 2021 14:22:13 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 14:22:08 +0200 Message-Id: <20210831122209.586348-5-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:13 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 5/6] tools/dvd2concat: include language 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: Q/bGtiGOW+Bl Signed-off-by: Nicolas George --- tools/dvd2concat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/dvd2concat b/tools/dvd2concat index ef04a87d05..474b474191 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -88,9 +88,11 @@ my $concat = "ffconcat version 1.0\n"; $concat .= "\nstream\nexact_stream_id 0x1E0\n"; for my $audio (@{$track->{audio}}) { $concat .= "\nstream\nexact_stream_id " . $audio->{streamid} . "\n"; + $concat .= "stream_meta language " . $audio->{langcode} . "\n" if $audio->{langcode}; } for my $subp (@{$track->{subp}}) { $concat .= "\nstream\nexact_stream_id " . $subp->{streamid} . "\n"; + $concat .= "stream_meta language " . $subp->{langcode} . "\n" if $subp->{langcode}; } for my $cell (@{$track->{cell}}) { my $off = $cell->{first_sector}; From patchwork Tue Aug 31 12:22:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29903 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4874138iov; Tue, 31 Aug 2021 05:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySz4IQ3LgjcCmq81PlbTeDGEoDAbBGbMelRIR9Fx+xjZ6JvePicoD/wUOI2imwdc+KRBFI X-Received: by 2002:a17:906:4482:: with SMTP id y2mr11281871ejo.484.1630412610072; Tue, 31 Aug 2021 05:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630412610; cv=none; d=google.com; s=arc-20160816; b=LxRVl8j1feeqDnAct4RdouhbORpoCwiHiiZiT8qNbgAHj19SPWQww0wMOoconVEv4W g/pnqPHwZuuKRfYlZHfkNHTI9G1BgBbu/Qskk/ojedySXbQ7shjJ/Lrh8yZxs+mY56dp KQhbyiKSUjEXpByMJN3Kfl2rAZ+wwQJ0smQYjxfMINXR2cG7edUQXuhx1iiJv1SnDoSQ vQXy2pajIFhV9IpJvFkjDmU4ZPE1flvKY89xcq1IQYfmGRnmNM023YyNihGa3+A+FP0R rM/iPkUZEWDgDDZyvtGev43U0raRKEg6MbfvvADd7Uu75iNnQrwucUOH9kLsjCNs2HkR GVpQ== 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=OkOKisBVqoNdH5Tg6+Ugtc/0Rk0jDH8wFxxS98nbcLk=; b=jnXFJo3iodSJ+b853Ps+ks+zsL/LmSUdf4V/p4uPJ+YuGBVDsgG2CpZEL7yi0OUeBp 6wuBohbAT3hUIc2Kzcvj+yIsNqFD0YhO8kX0RrEYpQXnzWL5u4Db8Xo+yNGh1ijJiL/w J0I8uOpKK2rsXV6IyFE2pqaiR90IWOLtQNShLsl78n9Pnpht0JVnQkhdrHFOEPVDGDqZ rqFZuUTjcJhOCcEUSSbvhr0hj/ZIPNuyARVNYiT5Yl3HNJ3jJ3Th+qYMXxROaH3CtCBB 49WumUt5oOxgZT2gZFiNKdzS9AENkW5WMLybRwZoL4Vp+//rmLrsRKPbMNlVzoZRUIxu SYfQ== 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 y5si17582981edt.247.2021.08.31.05.23.19; Tue, 31 Aug 2021 05:23:30 -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 DEB2168A044; Tue, 31 Aug 2021 15:22:26 +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 2ADE268A134 for ; Tue, 31 Aug 2021 15:22:14 +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 17VCMDWK019268 for ; Tue, 31 Aug 2021 14:22:13 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 5B1F0EB5BD; Tue, 31 Aug 2021 14:22:13 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 14:22:09 +0200 Message-Id: <20210831122209.586348-6-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:13 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 6/6] tests/concat-demuxer: add stream_meta test 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: QP5D1i+Nqp3B Signed-off-by: Nicolas George --- tests/ref/fate/concat-demuxer-simple2-lavf-ts | 4 ++-- tests/simple2.ffconcat | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts b/tests/ref/fate/concat-demuxer-simple2-lavf-ts index 529b987cce..b9106f0ea9 100644 --- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts +++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts @@ -211,5 +211,5 @@ video|1|171982|1.910911|168382|1.870911|3600|0.040000|17440|206988|__MPEGTS Stre video|1|175582|1.950911|171982|1.910911|3600|0.040000|15019|224848|__MPEGTS Stream ID|224 -0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0 -1|mpeg2video|4|video|[2][0][0][0]|0x0002|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/90000|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|60|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0 +0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 0 +1|mpeg2video|4|video|[2][0][0][0]|0x0002|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/90000|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|60|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 1 diff --git a/tests/simple2.ffconcat b/tests/simple2.ffconcat index 2a0a1b5c9e..d1c1ee0c4d 100644 --- a/tests/simple2.ffconcat +++ b/tests/simple2.ffconcat @@ -2,8 +2,10 @@ ffconcat version 1.0 stream 0 exact_stream_id 257 +stream_meta dummy 'this is stream 0' stream 1 exact_stream_id 256 +stream_meta dummy 'this is stream 1' file %SRCFILE%