From patchwork Sun Nov 6 15:08:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Lhomme X-Patchwork-Id: 39205 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1600141pzb; Sun, 6 Nov 2022 07:10:51 -0800 (PST) X-Google-Smtp-Source: AMsMyM7hPLCxM1w9h9NlUClBna3AEXbGSqQ7rx5pt6KD+E5AUkif/AG6PDQOI6kLCyeKhojQ1PTW X-Received: by 2002:a17:906:8470:b0:7ad:aeda:f47d with SMTP id hx16-20020a170906847000b007adaedaf47dmr41606451ejc.139.1667747451229; Sun, 06 Nov 2022 07:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667747451; cv=none; d=google.com; s=arc-20160816; b=tu3+eWic2P7qTfiGkR/pWkDV7tcBC3sHBB2DD32pCEyPwlTjxixAFYrfyz89BiPlmW 9tT1eCRn3JbpJwf2nN5p7USEljkzRARS1k7nrv0cBahafMGNqv5Ug/qh/KYrMIzXaAIy 9Fjd5neUvZolvlN5GMg92uTD3h6USGivC0oZ1loGErzof0Y9y6zHpVObP4gH/UnHeESE IcNXQrXju3m4QETojyH7uH7jGGOuHEzuyN/6HqywwlAm3sf5gOh2Mg+gfB1L3KjHvGFc 29x17T9UPSbXnvycn9UGp4rZl+RaWZsbE5PFf88wMDNuCjrHNg1WJh/jt9zxf3QK1s6M 0ghw== 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=zLF818/uNyw5HQrZUsuT41y5BAmXukMm6kZqmCr753I=; b=dwqaEL806h4yQsRyWxpQy4c+fYXfh5lQ6Au7yc2V+nhEz5E3Y8k/AzuiN3LPJGsA68 lhyp8s0yyDqVDrXB1w0KIfRk+fCCIh3tQTHqinlnJPj5V12fMSisl+AP959mgi3ktak2 om3mHEW+C/tDkAweyK24iwNT7DoWgEK4cAVSk9iJlDzjig2Sv3M6RNHdvlOQqP610PlM AYZbkSiOwoCC5aU7dflhZCLKtlLJR24rsAQ2yASc/P/ktRUuAJx13rZitps+GtO80sA4 p29u3GHbptRVUF18U38qZrt1ggaWSz6HOOO+BwvN0N4pnUxJSxHAwd7xfPI+HUU/4ggN iB9g== 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 s20-20020aa7d794000000b00461cdda451dsi5492798edq.435.2022.11.06.07.10.50; Sun, 06 Nov 2022 07:10:51 -0800 (PST) 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 79C5368B991; Sun, 6 Nov 2022 17:09:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B3E4D68B773 for ; Sun, 6 Nov 2022 17:09:02 +0200 (EET) Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4N4ySD4mB1z9skJ for ; Sun, 6 Nov 2022 16:09:00 +0100 (CET) From: Steve Lhomme To: ffmpeg-devel@ffmpeg.org Date: Sun, 6 Nov 2022 16:08:53 +0100 Message-Id: <20221106150854.9528-12-robux4@ycbcr.xyz> In-Reply-To: <20221106150854.9528-1-robux4@ycbcr.xyz> References: <20221106150854.9528-1-robux4@ycbcr.xyz> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4N4ySD4mB1z9skJ Subject: [FFmpeg-devel] [PATCH 11/12] avformat/matroska: only export a few elements. 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: mrjs6cC9qSXW --- libavformat/matroskasem.c | 69 +++++++++++++++++++++++++++------------ libavformat/matroskasem.h | 7 +--- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/libavformat/matroskasem.c b/libavformat/matroskasem.c index 0f4455058a..cdef0dbff4 100644 --- a/libavformat/matroskasem.c +++ b/libavformat/matroskasem.c @@ -37,6 +37,35 @@ #define CHILD_OF(parent) { .def = { .n = parent } } +// The following forward declarations need their size because +// a tentative definition with internal linkage must not be an +// incomplete type (6.7.2 in C90, 6.9.2 in C99). +// Removing the sizes breaks MSVC. +static EbmlSyntax matroska_seekhead[2]; +static EbmlSyntax matroska_info[8]; +static EbmlSyntax matroska_blockadditions[2]; +// static EbmlSyntax matroska_blockgroup[8]; +// static EbmlSyntax matroska_cluster_parsing[8]; +static EbmlSyntax matroska_track_video_color[15]; +static EbmlSyntax matroska_track_video[19]; +static EbmlSyntax matroska_track_combine_planes[2]; +static EbmlSyntax matroska_track_operation[2]; +static EbmlSyntax matroska_track_encoding_encryption[8]; +static EbmlSyntax matroska_track_encoding[6]; +static EbmlSyntax matroska_track_encodings[2]; +static EbmlSyntax matroska_track[33]; +static EbmlSyntax matroska_tracks[2]; +static EbmlSyntax matroska_index_pos[6]; +static EbmlSyntax matroska_index_entry[3]; +static EbmlSyntax matroska_index[2]; +static EbmlSyntax matroska_attachments[2]; +static EbmlSyntax matroska_chapter_entry[9]; +static EbmlSyntax matroska_chapter[6]; +static EbmlSyntax matroska_chapters[2]; +static EbmlSyntax matroska_tag[3]; +static EbmlSyntax matroska_tags[2]; + + static EbmlSyntax ebml_header[] = { { EBML_ID_EBMLREADVERSION, EBML_UINT, 0, 0, offsetof(Ebml, version), { .u = EBML_VERSION } }, { EBML_ID_EBMLMAXSIZELENGTH, EBML_UINT, 0, 0, offsetof(Ebml, max_size), { .u = 8 } }, @@ -77,7 +106,7 @@ static EbmlSyntax matroska_mastering_meta[] = { CHILD_OF(matroska_track_video_color) }; -EbmlSyntax matroska_track_video_color[] = { +static EbmlSyntax matroska_track_video_color[] = { { MATROSKA_ID_VIDEOCOLORMATRIXCOEFF, EBML_UINT, 0, 0, offsetof(MatroskaTrackVideoColor, matrix_coefficients), { .u = AVCOL_SPC_UNSPECIFIED } }, { MATROSKA_ID_VIDEOCOLORBITSPERCHANNEL, EBML_UINT, 0, 0, offsetof(MatroskaTrackVideoColor, bits_per_channel) }, { MATROSKA_ID_VIDEOCOLORCHROMASUBHORZ, EBML_UINT, 0, 0, offsetof(MatroskaTrackVideoColor, chroma_sub_horz) }, @@ -95,7 +124,7 @@ EbmlSyntax matroska_track_video_color[] = { CHILD_OF(matroska_track_video) }; -EbmlSyntax matroska_track_video[] = { +static EbmlSyntax matroska_track_video[] = { { MATROSKA_ID_VIDEOFRAMERATE, EBML_FLOAT, 0, 0, offsetof(MatroskaTrackVideo, frame_rate) }, { MATROSKA_ID_VIDEODISPLAYWIDTH, EBML_UINT, 0, 0, offsetof(MatroskaTrackVideo, display_width), { .u = -1 } }, { MATROSKA_ID_VIDEODISPLAYHEIGHT, EBML_UINT, 0, 0, offsetof(MatroskaTrackVideo, display_height), { .u = -1 } }, @@ -117,18 +146,18 @@ EbmlSyntax matroska_track_video[] = { CHILD_OF(matroska_track) }; -EbmlSyntax matroska_track_plane[] = { +static EbmlSyntax matroska_track_plane[] = { { MATROSKA_ID_TRACKPLANEUID, EBML_UINT, 0, 0, offsetof(MatroskaTrackPlane, uid) }, { MATROSKA_ID_TRACKPLANETYPE, EBML_UINT, 0, 0, offsetof(MatroskaTrackPlane, type) }, CHILD_OF(matroska_track_combine_planes) }; -EbmlSyntax matroska_track_combine_planes[] = { +static EbmlSyntax matroska_track_combine_planes[] = { { MATROSKA_ID_TRACKPLANE, EBML_NEST, 0, sizeof(MatroskaTrackPlane), offsetof(MatroskaTrackOperation, combine_planes), { .n = matroska_track_plane } }, CHILD_OF(matroska_track_operation) }; -EbmlSyntax matroska_track_operation[] = { +static EbmlSyntax matroska_track_operation[] = { { MATROSKA_ID_TRACKCOMBINEPLANES, EBML_NEST, 0, 0, 0, { .n = matroska_track_combine_planes } }, CHILD_OF(matroska_track) }; @@ -150,7 +179,7 @@ static EbmlSyntax matroska_track_encoding_compression[] = { CHILD_OF(matroska_track_encoding) }; -EbmlSyntax matroska_track_encoding[] = { +static EbmlSyntax matroska_track_encoding[] = { { MATROSKA_ID_ENCODINGSCOPE, EBML_UINT, 0, 0, offsetof(MatroskaTrackEncoding, scope), { .u = 1 } }, { MATROSKA_ID_ENCODINGTYPE, EBML_UINT, 0, 0, offsetof(MatroskaTrackEncoding, type) }, { MATROSKA_ID_ENCODINGCOMPRESSION, EBML_NEST, 0, 0, offsetof(MatroskaTrackEncoding, compression), { .n = matroska_track_encoding_compression } }, @@ -159,12 +188,12 @@ EbmlSyntax matroska_track_encoding[] = { CHILD_OF(matroska_track_encodings) }; -EbmlSyntax matroska_track_encodings[] = { +static EbmlSyntax matroska_track_encodings[] = { { MATROSKA_ID_TRACKCONTENTENCODING, EBML_NEST, 0, sizeof(MatroskaTrackEncoding), offsetof(MatroskaTrack, encodings), { .n = matroska_track_encoding } }, CHILD_OF(matroska_track) }; -EbmlSyntax matroska_block_addition_mapping[] = { +static EbmlSyntax matroska_block_addition_mapping[] = { { MATROSKA_ID_BLKADDIDNAME, EBML_STR, 0, 0, offsetof(MatroskaBlockAdditionMapping, name) }, { MATROSKA_ID_BLKADDIDTYPE, EBML_UINT, 0, 0, offsetof(MatroskaBlockAdditionMapping, type) }, { MATROSKA_ID_BLKADDIDEXTRADATA, EBML_BIN, 0, 0, offsetof(MatroskaBlockAdditionMapping, extradata) }, @@ -180,7 +209,7 @@ static EbmlSyntax matroska_track_audio[] = { CHILD_OF(matroska_track) }; -EbmlSyntax matroska_track[] = { +static EbmlSyntax matroska_track[] = { { MATROSKA_ID_TRACKNUMBER, EBML_UINT, 0, 0, offsetof(MatroskaTrack, num) }, { MATROSKA_ID_TRACKNAME, EBML_UTF8, 0, 0, offsetof(MatroskaTrack, name) }, { MATROSKA_ID_TRACKUID, EBML_UINT, 0, 0, offsetof(MatroskaTrack, uid) }, @@ -216,7 +245,7 @@ EbmlSyntax matroska_track[] = { CHILD_OF(matroska_tracks) }; -EbmlSyntax matroska_tracks[] = { +static EbmlSyntax matroska_tracks[] = { { MATROSKA_ID_TRACKENTRY, EBML_NEST, 0, sizeof(MatroskaTrack), offsetof(MatroskaDemuxContext, tracks), { .n = matroska_track } }, CHILD_OF(matroska_segment) }; @@ -240,13 +269,13 @@ static EbmlSyntax matroska_simpletag[] = { CHILD_OF(matroska_tag) }; -EbmlSyntax matroska_tag[] = { +static EbmlSyntax matroska_tag[] = { { MATROSKA_ID_SIMPLETAG, EBML_NEST, 0, sizeof(MatroskaTag), offsetof(MatroskaTags, tag), { .n = matroska_simpletag } }, { MATROSKA_ID_TAGTARGETS, EBML_NEST, 0, 0, offsetof(MatroskaTags, target), { .n = matroska_tagtargets } }, CHILD_OF(matroska_tags) }; -EbmlSyntax matroska_tags[] = { +static EbmlSyntax matroska_tags[] = { { MATROSKA_ID_TAG, EBML_NEST, 0, sizeof(MatroskaTags), offsetof(MatroskaDemuxContext, tags), { .n = matroska_tag } }, CHILD_OF(matroska_segment) }; @@ -257,7 +286,7 @@ static EbmlSyntax matroska_seekhead_entry[] = { CHILD_OF(matroska_seekhead) }; -EbmlSyntax matroska_seekhead[] = { +static EbmlSyntax matroska_seekhead[] = { { MATROSKA_ID_SEEKENTRY, EBML_NEST, 0, sizeof(MatroskaSeekhead), offsetof(MatroskaDemuxContext, seekhead), { .n = matroska_seekhead_entry } }, CHILD_OF(matroska_segment) }; @@ -282,13 +311,13 @@ static EbmlSyntax matroska_index_pos[] = { CHILD_OF(matroska_index_entry) }; -EbmlSyntax matroska_index_entry[] = { +static EbmlSyntax matroska_index_entry[] = { { MATROSKA_ID_CUETIME, EBML_UINT, 0, 0, offsetof(MatroskaIndex, time) }, { MATROSKA_ID_CUETRACKPOSITION, EBML_NEST, 0, sizeof(MatroskaIndexPos), offsetof(MatroskaIndex, pos), { .n = matroska_index_pos } }, CHILD_OF(matroska_index) }; -EbmlSyntax matroska_index[] = { +static EbmlSyntax matroska_index[] = { { MATROSKA_ID_POINTENTRY, EBML_NEST, 0, sizeof(MatroskaIndex), offsetof(MatroskaDemuxContext, index), { .n = matroska_index_entry } }, CHILD_OF(matroska_segment) }; @@ -299,7 +328,7 @@ static EbmlSyntax matroska_blockmore[] = { CHILD_OF(matroska_blockadditions) }; -EbmlSyntax matroska_blockadditions[] = { +static EbmlSyntax matroska_blockadditions[] = { { MATROSKA_ID_BLOCKMORE, EBML_NEST, 0, 0, 0, { .n = matroska_blockmore } }, CHILD_OF(matroska_blockgroup) }; @@ -335,7 +364,7 @@ static EbmlSyntax matroska_chapter_display[] = { CHILD_OF(matroska_chapter_entry) }; -EbmlSyntax matroska_chapter_entry[] = { +static EbmlSyntax matroska_chapter_entry[] = { { MATROSKA_ID_CHAPTERTIMESTART, EBML_UINT, 0, 0, offsetof(MatroskaChapter, start), { .u = AV_NOPTS_VALUE } }, { MATROSKA_ID_CHAPTERTIMEEND, EBML_UINT, 0, 0, offsetof(MatroskaChapter, end), { .u = AV_NOPTS_VALUE } }, { MATROSKA_ID_CHAPTERUID, EBML_UINT, 0, 0, offsetof(MatroskaChapter, uid) }, @@ -347,7 +376,7 @@ EbmlSyntax matroska_chapter_entry[] = { CHILD_OF(matroska_chapter) }; -EbmlSyntax matroska_chapter[] = { +static EbmlSyntax matroska_chapter[] = { { MATROSKA_ID_CHAPTERATOM, EBML_NEST, 0, sizeof(MatroskaChapter), offsetof(MatroskaDemuxContext, chapters), { .n = matroska_chapter_entry } }, { MATROSKA_ID_EDITIONUID, EBML_NONE }, { MATROSKA_ID_EDITIONFLAGDEFAULT, EBML_NONE }, @@ -356,7 +385,7 @@ EbmlSyntax matroska_chapter[] = { CHILD_OF(matroska_chapters) }; -EbmlSyntax matroska_chapters[] = { +static EbmlSyntax matroska_chapters[] = { { MATROSKA_ID_EDITIONENTRY, EBML_NEST, 0, 0, 0, { .n = matroska_chapter } }, CHILD_OF(matroska_segment) }; @@ -370,7 +399,7 @@ static EbmlSyntax matroska_attachment[] = { CHILD_OF(matroska_attachments) }; -EbmlSyntax matroska_attachments[] = { +static EbmlSyntax matroska_attachments[] = { { MATROSKA_ID_ATTACHEDFILE, EBML_NEST, 0, sizeof(MatroskaAttachment), offsetof(MatroskaDemuxContext, attachments), { .n = matroska_attachment } }, CHILD_OF(matroska_segment) }; diff --git a/libavformat/matroskasem.h b/libavformat/matroskasem.h index 01008b00bb..55ce97ef7a 100644 --- a/libavformat/matroskasem.h +++ b/libavformat/matroskasem.h @@ -381,12 +381,7 @@ typedef struct MatroskaDemuxContext { // a tentative definition with internal linkage must not be an // incomplete type (6.7.2 in C90, 6.9.2 in C99). // Removing the sizes breaks MSVC. -EbmlSyntax ebml_syntax[3], matroska_segment[9], matroska_track_video_color[15], matroska_track_video[19], - matroska_track[33], matroska_track_encoding[6], matroska_track_encodings[2], - matroska_track_combine_planes[2], matroska_track_operation[2], matroska_block_addition_mapping[5], 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], - matroska_blockadditions[2], matroska_blockgroup[8], matroska_cluster_parsing[8]; +EbmlSyntax ebml_syntax[3], matroska_segment[9], matroska_blockgroup[8], matroska_cluster_parsing[8]; EbmlSyntax matroska_segments[2]; EbmlSyntax matroska_cluster_enter[2];