From patchwork Tue Aug 31 18:07:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29920 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5154269iov; Tue, 31 Aug 2021 11:07:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHrqpwJy4C4ejbmi+VItQOGDehClASewQUqLu3uhrk9BlG5Q+vDJN1Op6Wj98jrhc2HVFi X-Received: by 2002:a05:6402:3d8:: with SMTP id t24mr29879514edw.214.1630433275551; Tue, 31 Aug 2021 11:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433275; cv=none; d=google.com; s=arc-20160816; b=pj/iaszI+UuuELs7y20q0VK3iHRK0jiO8xDiXYlWRlqd3ASitrKGpD6pIDZOweoGGJ 2x/pouMDt76tHzXfhVPzbv4aTVp+tcAzDM++48U4CXzQ+YbAsjldyIVyo4+iHxkvvuTY RpETWt0THsda8KO3oRGK8MIhJmJFJSdrBpnJdCo5OB71TYwL5I6OGq1zQxixp+En9W6l jH+JZYlbITMBdhCWWpt3/w51xKyULAowGDYm7ip8mEdILbSWSxV6GcM/kLIrV7wEyY68 XcZMo6pVlb6Zy+Yry7U7XOnEgQee8jzvx0AucxTAZoIYUbMlgY+Hj/wV2cVOQMZIZH87 jvVQ== 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=pd74nHJJSj5fmS1j8uqKcQ3RUKrNppFjpyKhAXyCBV4=; b=vhf0NxfLW5C8TGwzEkbuy8lxp+zH1RBhwy9ZGR9P1N8vUJDaKt2wXTcjNDbyeIMn/f VKu35STiZI0VtI1PIkFVKkjpREDf/1MsEKXTFWGqvs7V4JfpyYPMvDQIIXk/pvrr/gwR smDUE5x4jW+3XKSuFVUPXcshE/TDXUZXl4ABcGkLKLrPvpr9n6W8oIQkEtN7/RktierA gvOtjYYJJjrrsC2ibmtBWKkl1bNxHR3J2xBCB0yQa7xEwhCQafoN5uPYjs4f5R+fkGrp MFrQy7aYI0s4yXITh4iwAcxGBFZS4n/94K+WUDM5iInno+TSBIcXo2CWpZlNCPU3ax7N b6yA== 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 e9si19458057edz.152.2021.08.31.11.07.54; Tue, 31 Aug 2021 11:07:55 -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 B880A68A3F4; Tue, 31 Aug 2021 21:07:50 +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 9E5EB68A1BB for ; Tue, 31 Aug 2021 21:07:43 +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 17VI7gkM030745 for ; Tue, 31 Aug 2021 20:07:43 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id C95AEEB5BC; Tue, 31 Aug 2021 20:07:42 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:28 +0200 Message-Id: <20210831180739.873390-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 20:07:43 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 01/12] 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: BkL/aSyif+O/ Signed-off-by: Nicolas George --- libavformat/concatdec.c | 255 ++++++++++++++++++++++++++-------------- 1 file changed, 167 insertions(+), 88 deletions(-) Fixed av_dict_set() on failure. Added some space. diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 30db456b0e..f63b5f0f22 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,141 @@ 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); + arg_str[1] = NULL; if (ret < 0) FAIL(ret); - } else if (!strcmp(keyword, "stream")) { + 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 +622,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 18:07:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29918 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5154493iov; Tue, 31 Aug 2021 11:08:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdB7yiVf9R6i4DtSM/fxMuMUagJSVdfIs+vtUBTUdYUCL/0AbUqG6Izf+6qqrFAt0SyOuW X-Received: by 2002:a17:906:f20a:: with SMTP id gt10mr31330873ejb.487.1630433287697; Tue, 31 Aug 2021 11:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433287; cv=none; d=google.com; s=arc-20160816; b=SOD8yFEbLK11lctQEIDDyFGYEIx4EZOBvsLleKcyFYRDIWsLsEwPQ77Tvq+YNzicm+ da8Bt2sDwrvbaPB1ZgbfnTjuvtc3BA0/iIsC4F5kCf+7aWdyPYAJzi9QbsbGQWDWZupJ UWTuq1BwtlzpIs9S6Z1X1REWqeQYt3VE4BKUqPMfdvzCE56S9lj2sGp3yM7MheNRmpjh 3R79Ha2oyjVQR9RewQbdan/4jJ+iTv5NhEnfrAWRRV25B//ZTu62Q8nt4iqOdHyoN58L aSNQG1IZDZnWXlaQP+CrTnHhw9N4iiQ988AWMWfZiZMetwJktS5EX87JMfObKvroGMs+ 6sOA== 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=03YzfZrs6l0b3PPIVq9dRToIqbfbD3IETJ23kL/6nQE=; b=wcW6Bu1cPnSttP3+xlO7YhhhiWFJiKgfWWd1ZpRG8prKNR/X3R5YtMQJlpDSQdEkFN /b+jOf/kXnsJUN0n71JUFVgpx01Nts2Cb8oBbf1eZoOlqEwOyze+LPkUFzoUZ2BoeJns iU8pS6bYzvtMy8zBwckSRwWpVJvUKIQBD81dUucCcwDR8z62xFS0nwwryRTOYUfxeh2P E2kO2K5GxuXRtc3tHRHlupDNo4sAj1klWLj59IgMRfKq21n+t5a/IfKxdmK02QAlSje0 c6NFBhw4WkdfezSBc6kWa+cEHLda1KmUkEVxRJCXxnY0rW7zJZbVJQQX5CbBdyCE8C5M ft2A== 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 lv23si19671044ejb.287.2021.08.31.11.08.07; Tue, 31 Aug 2021 11:08:07 -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 BB56A68A450; Tue, 31 Aug 2021 21:07:51 +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 DC83668A1BB for ; Tue, 31 Aug 2021 21:07:43 +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 17VI7h3F030746 for ; Tue, 31 Aug 2021 20:07:43 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 1BE6FEB5BD; Tue, 31 Aug 2021 20:07:43 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:29 +0200 Message-Id: <20210831180739.873390-2-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:43 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 02/12] 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: IskyUukNceMS Same as file_packet_metadata without the double parsing. Signed-off-by: Nicolas George --- doc/demuxers.texi | 5 +++++ libavformat/concatdec.c | 9 +++++++++ 2 files changed, 14 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 f63b5f0f22..cb6e1b58e7 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 }, @@ -550,6 +552,13 @@ static int concat_parse_script(AVFormatContext *avf) 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); + arg_str[1] = NULL; + if (ret < 0) + FAIL(ret); + 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 18:07:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29922 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5154630iov; Tue, 31 Aug 2021 11:08:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzQlbhpuw5BLj3oUgsJNVmkWHLlKgQ3pAzbgFs/J2V37Q9FPNCcYyF/D8OpxzxI+DxZW6n X-Received: by 2002:a17:906:2c07:: with SMTP id e7mr5510119ejh.87.1630433298331; Tue, 31 Aug 2021 11:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433298; cv=none; d=google.com; s=arc-20160816; b=xOGU4uC6Sd1VV/0EgUwRzNVKzXnqEgNAlfZUKAY+nf4t41XkZe6I9ccp8UvruVmCrt 0HbGBIFU4kXFmuC6/peME3EVhYt23tVc9WKPnCgq39TIDgAoWMJ9wPq0lLMVjG4EYwqb 54C/xmOGpcWXhiGpOnkg6zxePHiwnldml3B/9uplHQGdMdFswtEpjaqQnmHN6U1FaWb0 47KY/gZMm2vhF+1JeypAcfZ2OSEsbk9ekzg6dYkDYpISkwmVo3p0HybBYlgTZPXTlswc TOyoajtaxVhKN98ARw0XI33fZC/BpJ0yiIyc5UwtL4rgIsUO73/1Ye9JeeANEuGbwg9/ laBQ== 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=T5ZRTCViZCZmcdSFdvAUSco3701CBG4mPBoCP2qCjM4=; b=N2PahVqXXva2loZaYp1B29RU1dcDWk5pYoFFL2Gr5NU8uR+EvjnmxmYjHxbbZYjz38 nsFANVfanwM9mnmKFKsqHq4KLp3iyK6o/VhhKgsFL3JHgbTiSwZpbcxgQw+cU5SQC+Lp W3mlhGL4Q2lxBze8h6SKMCusNvG6ehn6oXkl5ijYgrM0aEEkMB1Lw04zYuXF/VXz7qJ1 01HVTlAZkBc5p83akHLl3qY3SMHuVuDdPxr1YI1wqNwVYHQlsh0N39IL/R5M+7lwQuna 5QjP2FS3s8VQ9g+RJU6E90nE9+vlcIAQufbZzogZX9iMV6ex5wn6yDnflXeRdSrJcQGa WB9A== 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 cq26si14746248edb.411.2021.08.31.11.08.17; Tue, 31 Aug 2021 11:08:18 -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 A574A68A473; Tue, 31 Aug 2021 21:07:52 +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 485B368A2CE for ; Tue, 31 Aug 2021 21:07:44 +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 17VI7hG8030751 for ; Tue, 31 Aug 2021 20:07:43 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 6E3F0EB5BC; Tue, 31 Aug 2021 20:07:43 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:30 +0200 Message-Id: <20210831180739.873390-3-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:43 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 03/12] 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: 20fAayo6l2r6 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 cb6e1b58e7..0e581e9a14 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -564,6 +564,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; 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 18:07:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29923 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5154770iov; Tue, 31 Aug 2021 11:08:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxuBH6g+06s2nIQ7jsmU4WVEn/32zHsYLL+KbxO9m6HqPG9kNXjT0XZxQm2mNTh9QGEjSf X-Received: by 2002:aa7:c7c2:: with SMTP id o2mr30906842eds.166.1630433308436; Tue, 31 Aug 2021 11:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433308; cv=none; d=google.com; s=arc-20160816; b=eMM1HrOnUq6iwOyeeBIn+SAsqe4lGIGcl+cw97ANwcl9o8H36iVgKscf+CgkTPGk1p Oy6uBpccqPUNVKWMh5X2B9tYHGwlweyz6auSF4lHljvu5SY/bVUwfQMQvVg3dWp6G7OY qTPYHYNzziKm13eccC9sgWSQR5E+0Q1Hq+VIdGTicjQOJKAcc4/ZaGonxk5njM2g6eOb QtIVzNa3pMzO7XJKu2vE5E/u57al3jBf/w5+lao0m/cP7A10S7tpn8i83Bq81r8QVlqK tocPZpbFRNQZhtu4fWcZFW9lRme1h5hiQSJ6C3+aCUb6Y5v7qzajwheTs/P2GNQXaHrn X08w== 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=BTmr7r7URRcKOL1U9ornDiN6XYxHvAbu5ctwYWag6jM=; b=PTLl4NcdYJMF6/QDH+JqW4PLtKNHP9kWcccEzCcXR1QVCjhInqOX1Ylc4c7wiyzsdS k/xwNgCJtCRHUSKqDmYkSuuw+xWtE+uOLBtJtc22SRAAfu5RimDJVvUyWQaMWI4qlQ2s JBqVEfoQDgpQuIkic/x+bdoM7pQzassUBW7BrZ9E8jeyxWa3tFLnbpO0aXBXpo2WLNO/ SZHYBZnGHRzpjgVFdng8pU+wlWiPHEDfXJW2Mw4UKbRpmoOdq9nxTm6Svt8zhQeCtbUb pOQj0fDTiukkBjxrUsniH/mErGUlnljyJSyBVAIFgBY7teCw2X2IMOl0cg5WWMjZuZm5 fyzQ== 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 f16si503424edf.596.2021.08.31.11.08.28; Tue, 31 Aug 2021 11:08: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 8C57268A4DB; Tue, 31 Aug 2021 21:07:53 +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 7C7AA68A1F0 for ; Tue, 31 Aug 2021 21:07:44 +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 17VI7hDF030754 for ; Tue, 31 Aug 2021 20:07:44 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id B0C37EB5BD; Tue, 31 Aug 2021 20:07:43 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:31 +0200 Message-Id: <20210831180739.873390-4-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 04/12] 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: Rn2a/hrK+0Dc 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 0e581e9a14..6e91fd1826 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]; @@ -578,12 +581,19 @@ static int concat_parse_script(AVFormatContext *avf) 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); + arg_str[1] = NULL; + if (ret < 0) + FAIL(ret); break; default: From patchwork Tue Aug 31 18:07:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29921 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5155047iov; Tue, 31 Aug 2021 11:08:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEzp8TEGvl1baETauKNqdzyJ74ggjugEgbh7ZLoXBxO2qWnXsYxaSmhsD7FgTPyIpNmvv0 X-Received: by 2002:a17:906:8468:: with SMTP id hx8mr31655302ejc.492.1630433329239; Tue, 31 Aug 2021 11:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433329; cv=none; d=google.com; s=arc-20160816; b=m6LK2XwmO3hFSf1jeiEyS1MD+v1EMMTH60za6OF5wVtqtPTWYtlOXA5Zd2+TNQd+yc 3d3i8e12+OFYHM6BLE+SeFAlwuNySNOO1pswnx07fdN9B9vYusTCHBfsdZQcxyCU+7Je ogPlIxH432KrpqPuH6sPTDH95fbnesbYcogfI4uy3Ca9Fy5cbdC/UCJc0UL8TRNYdIGu EukVHAfcaob+Y+efk4sZfJoLwmRo+Aan6rDGFGENDlVtcJK7ByqF5+YCrGfwyQgjKNgq aR/Vj/htjE29vrKfCx4+ljVTQpefAcK1fE42Zgi59DuMAyqE29L8vTKzNfQM0u6crFMe /ZdA== 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=JUeRkZa7Bxtl2Y3IeQzn20cHkZ5piE5GUyo9OCuXJLqs+AEAztl3BLGX15ug99rB1b F2MTBNjbVDdejFQJ6FH+YOUe85nvMr2vtoSoUtc5ZTQbaCEMwpE1mwu7XguKidwjsg8f kx4VCDDRlRn9d7/NSSDz/w+TczT80y2fQvP59ZNonNzfESMb/1xUPPq96noo8Jr5hIbq xWAqkHqQMC7s+tdkrKXaa45KDdJjnbCtmnQ+g/SCaA7bxmQUCjL9RVdG+XpZuDooLQZ2 /aAc3UnrNecqMHVHbrf2+gSaPfMCv/m6DzVrt6wAQW/q2yrKZwOHo6KDSyC1z5eb3Scb q1YA== 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 bl4si22092973ejb.283.2021.08.31.11.08.48; Tue, 31 Aug 2021 11:08:49 -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 9B17B68A50C; Tue, 31 Aug 2021 21:07:55 +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 BE47D68A1F0 for ; Tue, 31 Aug 2021 21:07:44 +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 17VI7iES030759 for ; Tue, 31 Aug 2021 20:07:44 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id F269CEB5BC; Tue, 31 Aug 2021 20:07:43 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:32 +0200 Message-Id: <20210831180739.873390-5-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 05/12] 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: XOHu/FUPNhcE 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 18:07:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29919 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5154906iov; Tue, 31 Aug 2021 11:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxF2yz0ZMcbITkBTwdEDP5qTJP9ps9dFAev4fd91BY4ASEslldSkbV4G6cnFHPotTcy0+z X-Received: by 2002:a17:907:990d:: with SMTP id ka13mr32255444ejc.392.1630433318469; Tue, 31 Aug 2021 11:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433318; cv=none; d=google.com; s=arc-20160816; b=nD+oWvMF/1+NeJbwDJ6jg9gQVo//AJy1rr/BG9a5WHGRWMcLx8vToR8UT0pomp4xvR 5FCZMaLCES7QyRmMD/uc2GLTQy7Ks4n+GTxPljkIk20cRI/Km5RD19Xdgtvk4TjpJuTa yqdv3JSzKRC9HaWC9t969A1S+mVGxX9Tudxc+BYOBAlMGnZHZ2rsswOZhVSXtZyzw3Sd vW9fPX0SWjHpCXyqGJ38hayh44wlEsWDyqIHakxCllWziISMQ8Ymyc5e6uGBuEs7t+PJ q97LV5lXB8CdOZNc0XWJkT7fFoHl6TrszfZXvBeZFZavKH8pdx0WhFGMdW8f5isPJ1I+ F4mA== 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=CXVz136AcW8GvnOOjIJ+rFhWvyeFsJn2Ma8wAl1kVXBsyowupfsnKKG2rlglhrUtkN 4Idq+HumIR6ZfMt4t9z6ysc1MyycmjZoVBXE5MrStiEEUM9ZQmW9YTGvwla+7Eq4qwq4 u2YH2BM3iYq+cYxWnNDbAIhDLb5Gaiu+jHLTg4PIi45nrupJ3NZZb4kwrRRjNktqTI/+ f12GSEZgxwwNgoifZfk6FG3zOYOffDucDshsk5aapNOGhXYjx2oWgDhWff2GtP8r+rDS qX8l0ZzB+R3S3l2N1UnsWhlAkGl8fzCONbxdZnDKe5IZoGT8lunOt4u/dDGuJ+TSTSbR DXmg== 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 ca20si18071714edb.178.2021.08.31.11.08.38; Tue, 31 Aug 2021 11:08:38 -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 900FB68A4EC; Tue, 31 Aug 2021 21:07:54 +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 0FA4568A3AE 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 17VI7inT030763 for ; Tue, 31 Aug 2021 20:07:44 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 4239FEB5BD; Tue, 31 Aug 2021 20:07:44 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:33 +0200 Message-Id: <20210831180739.873390-6-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 06/12] 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: OI3fqQef81NX 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% 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); } From patchwork Tue Aug 31 18:07:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29928 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5155309iov; Tue, 31 Aug 2021 11:09:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhI3J/6QFUdj2RYQSNbpaiOjurBu321e7MLXwCO4PUCg5/vch4fDRbJ0nmSwmvzrTik3un X-Received: by 2002:a17:906:3983:: with SMTP id h3mr31285574eje.249.1630433350205; Tue, 31 Aug 2021 11:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433350; cv=none; d=google.com; s=arc-20160816; b=S518Xr/rvBbhAihA+93wZe0pyJHdTViOXE0f6D1kQCelsSwbr5TLUZTM1RLyPXBdcL FuETPZ40SqmpQEYnpUxrhr/gCQPzUVNxEoNWWbMgfyM4zWvOwbpcpQpIARPRVGlu0ivD Cv7yZK8tVNQG+heSL19UQzlJYXIyaiRbfUKW0QNihmHgR4xsn18rmhE0EmNPsCPLpF9R edI/gTV0XqKIHpw50WDD+Pnfd9NJLS6JcRhZNx2MkOmpYJ8XZZpBMMfL6hrgfUcl0+vi T4ujyPdkoT5TpUuyJfN0dqwinlqdpUyjHSIiGv2gknjV/Dnp4AMnZEWygAlNUqhJEjON Kh2Q== 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=El5HLxsLLPJ7VOVIFn3PpebZWg+YAtXw3LyaOi4CpQc=; b=wTE/EmBZNeTspgmlVy03KiRWuyQX0+2DUHtwYD7Fq2Ljs7LiMqDkRDwsRPiQGgzEQ1 Mr1qHHnX+pEgI2AefrhRW+9hepOf+6xTqjvJ5VaHt9NYJri3alxJAxSbZX4UO8NLazxP UenTWpnGdjPl2FbePH1q+SrVQqwZbkq4GSrU94wAyjl32qpwvsxfTnMdBx0A576V/MZm /ofkmruIEGamfmEUSAyJbye7UhE6lfaREA290q9QPST9SFFNdy7u83sSb+y5hDWmM9+x d6W95dONPWqjGt++RXg2BQIBmJbxdO6m2wH5fPc9Yiydhy2B72q9UAMfupBJfLCrCRZF U80A== 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 s22si18962702edx.408.2021.08.31.11.09.09; Tue, 31 Aug 2021 11:09:10 -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 6DC0268A2D2; Tue, 31 Aug 2021 21:07:57 +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 95C2A68A3AE 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 17VI7ih1030772 for ; Tue, 31 Aug 2021 20:07:45 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id C7C6DEB5BD; Tue, 31 Aug 2021 20:07:44 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:35 +0200 Message-Id: <20210831180739.873390-8-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:45 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 08/12] tools/dvd2concat: specify stream_codec for subtitles 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: gw0MZWqxn1WV Avoid requiring a huge probe size and analyze duration. Signed-off-by: Nicolas George --- tools/dvd2concat | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/dvd2concat b/tools/dvd2concat index 474b474191..ea8b7ba8c9 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -92,6 +92,7 @@ for my $audio (@{$track->{audio}}) { } for my $subp (@{$track->{subp}}) { $concat .= "\nstream\nexact_stream_id " . $subp->{streamid} . "\n"; + $concat .= "stream_codec dvd_subtitle\n"; $concat .= "stream_meta language " . $subp->{langcode} . "\n" if $subp->{langcode}; } for my $cell (@{$track->{cell}}) { From patchwork Tue Aug 31 18:07:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29925 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5155470iov; Tue, 31 Aug 2021 11:09:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR2tYqXQ1SAbNuxoha9BcNkpCyZ2Jsx3cnuByCuWC4SBlA8ydQpNUTRaC+ypEa8ZQNSS8y X-Received: by 2002:a17:906:314e:: with SMTP id e14mr32699340eje.165.1630433363640; Tue, 31 Aug 2021 11:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433363; cv=none; d=google.com; s=arc-20160816; b=cIkhQlwJiUkPHpyL2muwpCHNglfQyMuTKqc49v8J8ECmp4UHbDAYfCtLTcxIUDNuAG y7aQWh4EQE6CQaIj234JV4k0aMvNMo7eu/AFxpSaphU2RIZfz1t/uNtXjc4SHz95H4Q8 2lP6Z8vUuuhqEg4VTCygWyDuYMP0CgO83MlCOyD3XSRAJbZJgw0diQRmQ6wORxQTZLnE pE6QK9gMHxnBC8MW0on7h7JIUhtYt0rI0K+3vrNo3GVzEm9tL1cLU0At4V2eP/WuZZ8x v4UoYKoy+08nLqt6KOULjXMZkqC6sij6xkLXc1YNz0NsISSAezMg5po8t+nzooWZ7OcC J7CA== 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=z5H4eaTk06elVJxFKv6hiEv6c6oMgMQXKj2p5AJclnA=; b=CeZT5reDJVxR99Y8434cvIsCtxvpCh54JnPcwPYV9Tl/dZME7ZJ9iUjeQbjNQcYqb+ VnspAHlNhpGtKbblwPQP77CgMX15ooY4CB6/6aoytR0vWyBMwY6c53oLUaahyYLe63le 3ZjludU7/m6ipr9II2OB3hI2SpINz2ICw875C29QhJLDbKNRYShO0SeqI9N0GWl8EVPA /EC4Hb1AzofkpxM3yQUbD+a7nyZ2lYxmj75fz2ATHad9tL4Sp1068bXmu2b4F9nw3DL6 Hoz0AN2eDnx+mRH/+izmy3jairo+61ldaZnQ7Y9eIQ9GM6Ve1XJLxtLOOzU+0JnfpHMw e3aA== 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 q2si592163eds.540.2021.08.31.11.09.23; Tue, 31 Aug 2021 11:09:23 -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 68C5868A543; Tue, 31 Aug 2021 21:07:58 +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 DC56868A3AE 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 17VI7jdi030775 for ; Tue, 31 Aug 2021 20:07:45 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 1A0E7EB5BC; Tue, 31 Aug 2021 20:07:45 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:36 +0200 Message-Id: <20210831180739.873390-9-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:45 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 09/12] lavf/concat: add support for chapters 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: Xj+CjTGrTVIa Signed-off-by: Nicolas George --- doc/demuxers.texi | 4 ++++ libavformat/concatdec.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 6bb0574e94..0c347e3f47 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -184,6 +184,10 @@ Can be present multiple times. @item @code{stream_codec @var{value}} Codec for the stream. +@item @code{cahpter @var{id} @var{start} @var{end}} +Add a chapter. @var{id} is an unique identifier, possibly small and +consecutive. + @end table @subsection Options diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index a0d68d51cc..0dd39a149e 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -408,7 +408,7 @@ static int concat_read_close(AVFormatContext *avf) return 0; } -#define MAX_ARGS 2 +#define MAX_ARGS 3 #define NEEDS_UNSAFE (1 << 1) #define NEEDS_FILE (1 << 1) #define NEEDS_STREAM (1 << 2) @@ -432,6 +432,7 @@ typedef enum ParseDirective { DIR_EXSID, DIR_STMETA, DIR_STCODEC, + DIR_CHAPTER, } ParseDirective; static const ParseSyntax syntax[] = { @@ -447,6 +448,7 @@ static const ParseSyntax syntax[] = { [DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM }, [DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM }, [DIR_STCODEC ] = { "stream_codec", "k", NEEDS_STREAM }, + [DIR_CHAPTER ] = { "chapter", "idd", 0 }, }; static int concat_parse_script(AVFormatContext *avf) @@ -457,6 +459,7 @@ static int concat_parse_script(AVFormatContext *avf) uint8_t *cursor, *keyword; ConcatFile *file = NULL; AVStream *stream = NULL; + AVChapter *chapter = NULL; unsigned line = 0, arg; const ParseSyntax *dir; char *arg_kw[MAX_ARGS]; @@ -609,6 +612,13 @@ static int concat_parse_script(AVFormatContext *avf) break; } + case DIR_CHAPTER: + chapter = avpriv_new_chapter(avf, arg_int[0], AV_TIME_BASE_Q, + arg_int[1], arg_int[2], NULL); + if (!chapter) + return AVERROR(ENOMEM); + break; + default: FAIL(AVERROR_BUG); } From patchwork Tue Aug 31 18:07:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29926 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5155676iov; Tue, 31 Aug 2021 11:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzb7wYi65QOu26loF9D9F2jxGhpM0EUEvP2sYvxbW95N6ubyid5Oi+5ci/boyNeNw6bTd0P X-Received: by 2002:a17:907:174b:: with SMTP id lf11mr32287709ejc.35.1630433377045; Tue, 31 Aug 2021 11:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433377; cv=none; d=google.com; s=arc-20160816; b=OSwCpZtbv58hZAxPHEO9E3aZOljHPV4EwOKdpbSx1Gou9tS/daXfJrmD3v5CuMj7u4 qYtmLjaNMTI+JEc3RlZSr8PaMTG5lFn+tk1OSglKyJhw/iAe6/9ktLMA+ghHvDPYHcSC /pRzLriMb9V+sYcyF4U1b/dV3h9NZ92/wJJKZmHvKEBk6nyMHQ44ZCgX3YBd+V9vnnvN hko1oPGCgY4BprHe8jvN7Hz3ViUiTik/B5oPvTr9w+jZa4GGE6y7dpxp+MhHyjvOXy9j X8I0Gd3TPQ+1mzQc7jukTtifLiLoibDvFuwRZelvfC6SIhKwkibIPIqxxUOtbF8+2BQ4 KYVg== 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=45+IjOK1HSK1+CNX0YE7c0lX8sdJAqRlQM1BwwgzNN4=; b=sqXprZlBRM/hoyFkABkOsTZCw/EuwsE2zG/kLmgB5Bm4UlogfERkyDbn74BrOdpHVk xHMAqV/vFnouGu1HKlogLug+g+0uZIVPmGlySOOEyUn7o/A8UxvNGlKqXdPpP4qtdkMg jcqRv6q7pKSrQzMiRnx2oJuGm3X+OB/LVYSWnt2MEeEKhZdNdIgXUrGbUjgYRo0/C1WM s0r6v1FQA9JcYvWu+niXLm7KEg10oyAe8B/XODTJOopB6BSPEa+Wop3HnIHS/SqcHWLE TAYIVBnYhE1zVWklEWMYlocs1/e0TNSH61v/onP6hqJXGsPJk5VUwzWZbH0rK6RMaesi u25w== 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 dg17si16925120edb.308.2021.08.31.11.09.36; Tue, 31 Aug 2021 11:09:37 -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 5BA5368A581; Tue, 31 Aug 2021 21:07:59 +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 306F968A1BB for ; Tue, 31 Aug 2021 21:07:46 +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 17VI7jNS030780 for ; Tue, 31 Aug 2021 20:07:45 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 5FAA8EB5BD; Tue, 31 Aug 2021 20:07:45 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:37 +0200 Message-Id: <20210831180739.873390-10-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:45 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 10/12] tools/dvd2concat: add support for chapters 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: c++YGv8hbkWM Signed-off-by: Nicolas George --- tools/dvd2concat | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/dvd2concat b/tools/dvd2concat index ea8b7ba8c9..ccc021c4cc 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -95,6 +95,12 @@ for my $subp (@{$track->{subp}}) { $concat .= "stream_codec dvd_subtitle\n"; $concat .= "stream_meta language " . $subp->{langcode} . "\n" if $subp->{langcode}; } +my $chap_time = 0; +for my $chap (@{$track->{chapter}}) { + $concat .= sprintf "\nchapter %d %.3f %.3f\n", + $chap->{ix}, $chap_time, $chap_time + $chap->{length}; + $chap_time += $chap->{length}; +} for my $cell (@{$track->{cell}}) { my $off = $cell->{first_sector}; die "Your lsdvd version does not print cell sectors.\n$lsdvd_message" From patchwork Tue Aug 31 18:07:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29927 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5155888iov; Tue, 31 Aug 2021 11:09:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywHPtLCOla6MQoLPyc2EHPGiSiKvAbNctZKInOH3wgM4N9QZ4JKKiCjpmZCY37sEGPMjNM X-Received: by 2002:a17:907:384:: with SMTP id ss4mr31851443ejb.478.1630433390586; Tue, 31 Aug 2021 11:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433390; cv=none; d=google.com; s=arc-20160816; b=zqw9qebhhyD2VuETTHWgudlwmJeu3CJS9Lzek12EdYIMnTrR3LceJCtkvhHJAE3uT2 wS/I1NMj1UlWYIQuH3PL5iAQu/vQnFxTdYcngbTmrNHBOCIaRUnTanaMytHMvJ5lP23O BB4SkzxZMovLCtgjUye6+uJryZAAC/8UpZge1FjurxOE/obAHeQI+EmlL9dJhv1nrAOi Q6WZV8cGtGpvdhhC1Smj1ldwQaHX7s27gwU9Qum6/ZcEkZzYHhkSEDBkPf1xLbhlF1Qu CPb9RdVEM7hxypTuBSiFF1gJltOOMGO2cwCwVlUBYdFllyr2X1ZK8ZJNiq8zOmgYNI2d QvNQ== 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=7OR3aqYu9kFI3KLfUvYCCwjjhjy6JmKgmLvDT4TAhnQ=; b=YnzJwrtVZqDczZYVgXN6HcCmc8ZmqAnGoLdVxra2YE+nOUKInb5kWGDm1ABjizLopH FKOn28GREg90zwfIWeUfz1IOGu18hFGUAm++8hBD1/PNPsjmTeiir6oIEKgzLtGkAoSo Hka6Mo3FbjK/wYDZlluCgBZxLgORwhRaauUA6F+d5KEsj5eQgcIBUFRRDegTpTQ4nKQw T/sixp4FUEhBwANayQ/5UbJRFhRg2ZQGmgMRILeiB3HV1896FyFsv4U0eB/coGkPSlFH T03eMf2LAPvfO1WVM1kV1hPj7bhQ65WAZvUvJP8LRDo0EPFxh0Q1Ekc5BUXIyMyEwZzX wYxg== 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 hd10si11395735ejc.687.2021.08.31.11.09.50; Tue, 31 Aug 2021 11:09:50 -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 59BF668A58D; Tue, 31 Aug 2021 21:08:00 +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 6CF0868A43A for ; Tue, 31 Aug 2021 21:07:46 +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 17VI7jij030786 for ; Tue, 31 Aug 2021 20:07:46 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id A2EAFEB5BF; Tue, 31 Aug 2021 20:07:45 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:38 +0200 Message-Id: <20210831180739.873390-11-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:46 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 11/12] lavf/concatdec: add stream_extradata 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: nWRr5ooVSmAz Signed-off-by: Nicolas George --- doc/demuxers.texi | 3 +++ libavformat/concatdec.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 0c347e3f47..06ab152cc7 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -184,6 +184,9 @@ Can be present multiple times. @item @code{stream_codec @var{value}} Codec for the stream. +@item @code{stream_extradata @var{hex_string}} +Extradata for the string, encoded in hexadecimal. + @item @code{cahpter @var{id} @var{start} @var{end}} Add a chapter. @var{id} is an unique identifier, possibly small and consecutive. diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 0dd39a149e..ded0ba6031 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -432,6 +432,7 @@ typedef enum ParseDirective { DIR_EXSID, DIR_STMETA, DIR_STCODEC, + DIR_STEDATA, DIR_CHAPTER, } ParseDirective; @@ -448,6 +449,7 @@ static const ParseSyntax syntax[] = { [DIR_EXSID ] = { "exact_stream_id", "i", NEEDS_STREAM }, [DIR_STMETA ] = { "stream_meta", "ks", NEEDS_STREAM }, [DIR_STCODEC ] = { "stream_codec", "k", NEEDS_STREAM }, + [DIR_STEDATA ] = { "stream_extradata", "k", NEEDS_STREAM }, [DIR_CHAPTER ] = { "chapter", "idd", 0 }, }; @@ -612,6 +614,15 @@ static int concat_parse_script(AVFormatContext *avf) break; } + case DIR_STEDATA: { + int size = ff_hex_to_data(NULL, arg_kw[0]); + ret = ff_alloc_extradata(stream->codecpar, size); + if (ret < 0) + FAIL(ret); + ff_hex_to_data(stream->codecpar->extradata, arg_kw[0]); + break; + } + case DIR_CHAPTER: chapter = avpriv_new_chapter(avf, arg_int[0], AV_TIME_BASE_Q, arg_int[1], arg_int[2], NULL); From patchwork Tue Aug 31 18:07:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29929 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp5156079iov; Tue, 31 Aug 2021 11:10:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2C9UGVZ6EmfLS93C3jvQwannn4H2Ss3XUVP/02l1e1vK7iaBsc90FFCNi8cSGMXBC8C3J X-Received: by 2002:a17:907:d86:: with SMTP id go6mr2064967ejc.475.1630433403604; Tue, 31 Aug 2021 11:10:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630433403; cv=none; d=google.com; s=arc-20160816; b=siHfdC904vPfDSTWYLZkGRzoLdSDkL7JXf6v0zqgglJcsIfufKNk/PG3dWWO7+utdg kZYBpLrRRdqydclcGbY/7PEzvZ52dS4MCunUdWwyogxkvsM/1O6Gjq2u+EX0xHS+/K3N rOZA9K59oGy/GEz+PWz3UD74Y/kc3YCmLM1NamKdtFLc9IifRwpZtplOq4c4N8lbi//+ lU+Tsl6CmIBk7Ms68AbF4DUIbn4AV7yM0pQLxxPSC+/JuduFKK24fZkmhLmx7EvM5u4u Nm7icnqux/cBIFkTUH/KWfmwHJXgQzTw4TSyiq2upgyeiGOLV/L+XccTIGcc0zbT4A2T NGBQ== 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=LM5eefqRiGKFUlRlmZ27aPbtxGB0yQE9Ci2ZQ+euRwc=; b=fZSh6MD+Tr7T+wkGZ9gli8LfEaaUQnhmEI1GWLoeEcIPhZn5rjZ4y27z+6xjmaKOeT OtKZGTJRkrwAV6yF/D0tASTHjoVXFGRQC28lG4hyxJJsdl+Qmx5651zCD+8lG8EmdvfH scYdskvfxWxVLqOZMRq9qb8saw0bMPxCrXmmWSWHPz+eTbI9AMvYsEpDPsum/hwoA4Y8 geU1gYuoy1w3QJ+4nb88ZrSYD13XaR8+88y+tmqA2X569iVVMuJ7CszztmBzXK2dY1rv qcE5gFSywc59IzfaZdbfF7G5Bc5oj4RM4f7lYAc8jx2APV4f36iyaroMZDeGDaMw1W5w iUYw== 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 n8si18195916edo.283.2021.08.31.11.10.03; Tue, 31 Aug 2021 11:10:03 -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 4E23368A412; Tue, 31 Aug 2021 21:08:01 +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 B8F8E68A43A for ; Tue, 31 Aug 2021 21:07:46 +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 17VI7j5K030789 for ; Tue, 31 Aug 2021 20:07:46 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id E644BEB5BC; Tue, 31 Aug 2021 20:07:45 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 31 Aug 2021 20:07:39 +0200 Message-Id: <20210831180739.873390-12-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:46 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 12/12] tools/dvd2concat: generate VOBSUB extradata 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: QeUQOS0PhEZC The extradata contains the frame size of the subtitles images and the palette. Signed-off-by: Nicolas George --- tools/dvd2concat | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) And with this, we can encode DVDs correctly, and even have the hardcoded subtitles the right color. For muxing the subtitles, some more work to be done, probably: mencoder is still needed. If somebody wants, taking the code from lsdvd and creating a special demuxer that will create a ConcatContext internally would allow us to read DVDs directly. diff --git a/tools/dvd2concat b/tools/dvd2concat index ccc021c4cc..24809fbdf5 100755 --- a/tools/dvd2concat +++ b/tools/dvd2concat @@ -94,6 +94,28 @@ for my $subp (@{$track->{subp}}) { $concat .= "\nstream\nexact_stream_id " . $subp->{streamid} . "\n"; $concat .= "stream_codec dvd_subtitle\n"; $concat .= "stream_meta language " . $subp->{langcode} . "\n" if $subp->{langcode}; + my $extradata = ""; + if ($track->{width} && $track->{height}) { + $extradata .= "size: " . $track->{width} . "x" . $track->{height} . "\n"; + } + if (my $pal = $track->{palette}) { + my @pal; + for my $c (@$pal) { + # Adapted from mplayer/sub/vobsub.c + my $y = ((hex($c) >> 16) & 0xFF); + my $u = ((hex($c) >> 8) & 0xFF) - 128; + my $v = ((hex($c) >> 0) & 0xFF) - 128; + my ($r, $g, $b) = map { int($_ < 0 ? 0 : $_ > 255 ? 255 : $_) } + $y + 1.4022 * $u, + $y - 0.3456 * $u - 0.7145 * $v, + $y + 1.7710 * $v; + push @pal, sprintf "%06x", ($r << 16) | ($g << 8) | $b; + } + $extradata .= "palette: " . join(", ", @pal) . "\n"; + } + if ($extradata ne "") { + $concat .= "stream_extradata " . unpack("H*", $extradata); + } } my $chap_time = 0; for my $chap (@{$track->{chapter}}) {