From patchwork Wed Feb 17 10:13:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25691 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 06947449181 for ; Wed, 17 Feb 2021 12:14:38 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DABF668A73D; Wed, 17 Feb 2021 12:14:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F2E268A626 for ; Wed, 17 Feb 2021 12:14:33 +0200 (EET) Received: by mail-wr1-f54.google.com with SMTP id v7so16722191wrr.12 for ; Wed, 17 Feb 2021 02:14:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=zPI3C6D6KkV00SK4CZ27ESWCDIw4TUES2JE3b/KP7Ws=; b=TJ0vB1Lpw+PVQXX4TZc0mF6VtTLeBLIXjL9SSs512kY/gudRWKTmZaA6BVTjdK0h3i U6ZhpdHt8EADQ495jiumDd/UA4MCP8m+8E1izzJUz9GyOMAO2NcyudcR5p3DMtAZ9xeh BqZmUI1au9TCteMW9Z1sVG7HOPNovTq3IN7EfxG5YBmQUeZvibAsJuYWXdqUJUVKhgOu u/ZobMfaSpICaeLv/lPlj89+o7P4AxCzdlh6RWFFHjoqFPAqE3oZ5J4bczLXw+c7lQMP KkVIlxTHIZYjrfsGpN/wHCJ94flKOZpJgHlzkGeAfJt8XcZZ3UxcO92py5pxYjhhxmbt xLzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=zPI3C6D6KkV00SK4CZ27ESWCDIw4TUES2JE3b/KP7Ws=; b=Rga+xYoQ5rIn0Blv5NpQDPxdcv8Ni4PvdARxKyXdcOXkMyvdp5L7qXxMC8N+xOt/SZ OfPsV6lHmc/1waKkiJ0rUbeqEs8GKwDI+MPBQNdNSOGKVJA82anV596Ktl+vGtkrPY+L FTaApPnV5P5N3v5dPXUqBdMCZiYDH96jmV5AdlAYoOy7xsKuqZznYZOWKvTTe4PIiq55 YX0qW473ZNdHgnhAIsZs4DgUQYVlXpB97XeS95OW+hS2qPFUVlenhLJ84TP1T5nUbKhm LCBCeTvaIq//8mgN5XImlYRxHGP8hqmhGXsWXSptnfiekaCwrD3Gsq7f0DFk5s5wVhwN lwDQ== X-Gm-Message-State: AOAM532o9EZhOy4JTjSl1+PSOaE1iv6en1qbWjjhKSel6ddhNZyVnEK3 +oLvCiTsPwuW9Y8Gh4DLhQi35o9ETVY= X-Google-Smtp-Source: ABdhPJzaE47CWeT/6hdPtf0kwrqETw0yJj8auv/bmhWRvbCYiYQlA6jwpwKL/l0n/8oWPggCu6ll/w== X-Received: by 2002:adf:ea87:: with SMTP id s7mr28011606wrm.217.1613556872764; Wed, 17 Feb 2021 02:14:32 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id v12sm3502828wrv.69.2021.02.17.02.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 02:14:32 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Feb 2021 11:13:52 +0100 Message-Id: <20210217101356.1723370-15-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210217101356.1723370-1-andreas.rheinhardt@gmail.com> References: <20210217101356.1723370-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 15/19] avformat/matroskadec: Add support for FlagTextDescriptions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This is the equivalent of the WebM "D_WEBVTT/DESCRIPTIONS" and is therefore only exported for subtitles. Signed-off-by: Andreas Rheinhardt --- libavformat/matroska.h | 1 + libavformat/matroskadec.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/matroska.h b/libavformat/matroska.h index bee08d4398..6bec45d71a 100644 --- a/libavformat/matroska.h +++ b/libavformat/matroska.h @@ -101,6 +101,7 @@ #define MATROSKA_ID_TRACKFLAGFORCED 0x55AA #define MATROSKA_ID_TRACKFLAGLACING 0x9C #define MATROSKA_ID_TRACKFLAGORIGINAL 0x55AE +#define MATROSKA_ID_TRACKFLAGTEXTDESCRIPTIONS 0x55AD #define MATROSKA_ID_TRACKFLAGHEARINGIMPAIRED 0x55AB #define MATROSKA_ID_TRACKFLAGVISUALIMPAIRED 0x55AC #define MATROSKA_ID_TRACKMINCACHE 0x6DE7 diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index fa0d86c3e4..5b1efc3d49 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -252,6 +252,7 @@ typedef struct MatroskaTrack { uint64_t flag_forced; uint64_t flag_comment; CountedElement flag_original; + uint64_t flag_textdescriptions; uint64_t flag_hearingimpaired; uint64_t flag_visualimpaired; uint64_t seek_preroll; @@ -413,7 +414,7 @@ typedef struct MatroskaDemuxContext { // incomplete type (6.7.2 in C90, 6.9.2 in C99). // Removing the sizes breaks MSVC. static EbmlSyntax ebml_syntax[3], matroska_segment[9], matroska_track_video_color[15], matroska_track_video[19], - matroska_track[31], matroska_track_encoding[6], matroska_track_encodings[2], + matroska_track[32], matroska_track_encoding[6], matroska_track_encodings[2], matroska_track_combine_planes[2], matroska_track_operation[2], matroska_tracks[2], matroska_attachments[2], matroska_chapter_entry[9], matroska_chapter[6], matroska_chapters[2], matroska_index_entry[3], matroska_index[2], matroska_tag[3], matroska_tags[2], matroska_seekhead[2], @@ -579,6 +580,7 @@ static EbmlSyntax matroska_track[] = { { MATROSKA_ID_TRACKFLAGDEFAULT, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_default), { .u = 1 } }, { MATROSKA_ID_TRACKFLAGFORCED, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_forced), { .u = 0 } }, { MATROSKA_ID_TRACKFLAGORIGINAL, EBML_UINT, 1, 0, offsetof(MatroskaTrack, flag_original), {.u = 0 } }, + { MATROSKA_ID_TRACKFLAGTEXTDESCRIPTIONS, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_textdescriptions), { .u = 0 } }, { MATROSKA_ID_TRACKFLAGHEARINGIMPAIRED, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_hearingimpaired), { .u = 0 } }, { MATROSKA_ID_TRACKFLAGVISUALIMPAIRED, EBML_UINT, 0, 0, offsetof(MatroskaTrack, flag_visualimpaired), { .u = 0 } }, { MATROSKA_ID_TRACKVIDEO, EBML_NEST, 0, 0, offsetof(MatroskaTrack, video), { .n = matroska_track_video } }, @@ -2885,6 +2887,9 @@ static int matroska_parse_tracks(AVFormatContext *s) } } else if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE) { st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; + + if (track->flag_textdescriptions) + st->disposition |= AV_DISPOSITION_DESCRIPTIONS; } }