From patchwork Fri Aug 11 10:43:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 43208 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b1b:b0:130:ccc6:6c4b with SMTP id l27csp1256914pzh; Fri, 11 Aug 2023 03:42:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEX4rMlR1EaJ/pWMVWDZkbm8d9aN1FIkkXsMcVi8uz0XUuD35aB/MWUOPpBYH7Gfcc6DjiP X-Received: by 2002:a17:907:6d9d:b0:99c:ae91:e812 with SMTP id sb29-20020a1709076d9d00b0099cae91e812mr1592047ejc.73.1691750572235; Fri, 11 Aug 2023 03:42:52 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id s12-20020a170906060c00b00992169858f2si3142249ejb.3.2023.08.11.03.42.51; Fri, 11 Aug 2023 03:42:52 -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; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=BFUc7lUO; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 67FE968C7C5; Fri, 11 Aug 2023 13:42:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2039.outbound.protection.outlook.com [40.92.58.39]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E8F368C7BE for ; Fri, 11 Aug 2023 13:42:37 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RzHvejs6cDiQLrdVb4HFPb6eM7v5jkzQtkIfOINym+ZDKAq1VouMoWfJU1DBO/Q/upldMmY8zamEVXXo3h56Rk9pwzzjdqfakMjChnIM51Tunc1g4ZbItCAGg6b4ayEkx2P9qjol5ZmuGyJbovrMsLr1yv7VEgv4n+uSEP7Nvc+F4C2NEVIXLCuvpN7fJCL1Dg32A5bKtcoiuykC4FsqiRl6rIqGwMRMZg9j59O5ELk+k/koROpUQLpRqqYky4ptt5sB7pBlL+MM2h+mVkbGMV9U5TQWWHexpyJ6sVcLnia92hmX67XwIN51PXImLmDUFx4h5h3g9PKiEVDwx2EGCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4inoqbKgo4dwKxbOup5V6irxWNaShkdwc4aUw+FkTNg=; b=kp3eidwFMuBsldwlV+0fz+m/FSF76QuDOMRGhO/HxMY+WucNyZMmM/YzXHHFVhRl+Tkqj8ZUC8mLz2pxGdfR3Fozi1MG0i4QkqLWhxEU9tQQtCzSa6HKFlNvW3CsM7/BYa7pIJdlwdYroQ0x3wMl6stgcxHSvgSxZnWpuN80KDYN8y6AXviE29XwSYw2zlUG/ZcZVpUdfbRloyrwP85lbA71qc+ae3V6i25/p5dM6twrBaSk3d2g5IX4azf7ulz8NuHXBdvGiHdOH3pfeEShBFyND9SbNaJs9McrFXc/fCxy0T2bmcBeLm8JFoFHb9G8YQ74qQLHDGbdaXeD8YEPuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4inoqbKgo4dwKxbOup5V6irxWNaShkdwc4aUw+FkTNg=; b=BFUc7lUOzmPd7/vnOkDTpi7h+3E1lopZfMaS1ESg3t4309dUz6m0kraYtOEeqJ7HCB22+nT8R7RzkCD/gDjtPYxJvcnfIxnnpjXUH4snRyIfFZK3E34/XZM5OnUr0rn0TDX8t1PcVmHi36C6Zrk1BYcDr1wn6hOKR6jEaHwdJaH1VOgn+K065aSOEebd0g0TSa9QqCco8i7antQxzgmVRH0AhUwJ2WfaGdB2R4WMoZmMT7ClTV+OvN6cqymWH6f9EjbSNjrXenduZAKkwHCEAQA+VK3Cqe4t5wRzNaTWTxczj8mqoiu+U/T1AQFSNlooiD6yqe34vtuyRC65y8Domw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0273.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 10:42:36 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::5e01:aea5:d3a8:cafa%3]) with mapi id 15.20.6652.029; Fri, 11 Aug 2023 10:42:36 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Aug 2023 12:43:23 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [6+aApaGW3VlRrrfxtxfQjtURfyWbmLcD/RvQpfIRZII=] X-ClientProxiedBy: ZR2P278CA0021.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:46::17) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20230811104328.2278289-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0273:EE_ X-MS-Office365-Filtering-Correlation-Id: 76969a3e-7bb2-41a0-9db3-08db9a57a9b8 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKzB4ARh+58J9bfMIIBvRml6JIpyQQhKiP4U19KYqZJ13SPQASAPGaAE68CBPfDUd6FAeO5JzKC70ysXhZD4Lhke85kmreIM3cJ5RWGgAs6UW508blCti31UWoG5ghp5RR4GJgOjz6sPTcntjr0Y9IKSpPkmAWTEPsSzSc8rqXp1X2Fg2eDp7NZYiyPSl5F7wEZLjSkQBwlmGWJfHfnN0eR7IfWhQWL1gP020OXnsjDRk8vsTo/zG8K+ppDwTyWZw5dh0mP7y0Kfvdpaqe6B4mKad45EGwb0gPw/9mFLDmVZboevBeV7QWU/q2BNkfT/0CxzcVbiTNT4AEGAX/bdV2ctKeB9rFBGyLPYo/2K5Mm2Sn+x50JuyxQ4UuTR9+QZZB+DpoX7NqPygsyLwOWc1QTHIYcrE+ojz0c2MWdhs3hVYCp9zgw1qt3upHlW1maNoB6eE1ahGgTFVo6KxZiSkdPn+WE/xk9Gwr15DjzJKsGAprwLBxfWAClC6r/hrKw9dWjm2T5iJFMBUItd8kDI+04nKzjiG4m13e7JpEd23u2L3Ad9wNp6SZksDR1/kbpuWgo+zkZh9+YsdLF1niU4Z/Goi7QXiqvVK91Acsg58cmED6z8VMZm9xdAcj1l6hU23onO75qi0+FFhH9ZV8awqU109cptfW3zd/3lRTa0YwmItky3l7ZAvUDyT+RTbWsGoWEWrIxXoMrOUJT+T1Gu2XfZPpiGQUrBJ9k= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n/l6g9tKcM2hCcGkUgHqyst6u5v5cyqIbi+vO3RgDqt7CQMr6e/5iaEuzJW80GpCRbgGuWemlwk0/8yzjCd+Fc4M8I+6vkonqnvq+oQY5NFdgnp3G4E0wZZ7R+5GEs2czX/x3lJ7SzvhCpeU2E2+WeMJyK4P8xqoe1cu/Zlli5fMjX6mbwJC0uTvD1CvZ12DeRuhu1cp9f+7RrQORJRQ8KGpUjbH8MiP4P4kjDyPqCvkexiYw5Lq2ovn4IXSxQUO3Vycp4QmVIf7/taO5SIrUiaY9Q2cG0DOVPzrO5xFjhOvmA4he4YoapZ7cLP2bQFWXv11A0Vf9qdX8yQFx8TIgVKBNuDiEoQWGRIKN9jSC6FnxgC+W7a35VvYjouSZx0X9z3xO2YmkWUuZDbs3nMnGo9NSWidx/FaqvXovya64OsPVZfkXHFNUCouk4qB1jk7Vm3S87lO47hdCj5FgnWpWVq8FM9FgVnmC8GeyAimYnwpXkJ5SXy21IN6wb0NFePPsuaX8pl4xKG8RgJDc7LOCZ0jQ7xhdbdFkJkDoD9fzcQbkm+RTOhY38ryzU+Zgsj6NoCXBqMNz7sHsXv93JqLbKImZ+yezDxFhluTFg9N5kzyNYvs3TXhaxQXE2OnAiSa X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qV2Mk3wPvFLj4uaoQDSLb+tN62Fcof4B2l68hxkczj5qpFrz5zWmw/4SYRHOYoCl863KwnEA58wD9EglAdnVTESOx933KYyPmRCH09vUIHARiYHLTR+S4rdZxFkKJ1Twk08qiSJ2oar8EBW6L325bDzxm5hGorl1TezK7mdMedr3hBcPx8LJYw8vtCkp3i+DUg1GD1oEhbJ0Ek23Z9ti0hgiJkZAIh5IplWaCNDR5NP3yR/YQvl3RzJDNT9aRGmyatldU8258dMbhIeCOoY1WHGp0RLPLHEwOb8vZylBia4WLmn9J/dgEitBNZ6KXRC9gFmsO1NqdGRcpoOmBsoLIyh77grBGWdM7jvYaTKKnpkPfFKSIL82VfU9QVBlku+WE/SF1XFpXMKzKRGG9HHid23HVoZnc/AQYkRJLtzFS7yGjeZXqhIK8ORsarpElj1lQKX05u2uemnBZZIZ3JHzFk4yqcn3K13YaAHr73NFsKK7/lrvM9IxXSdtAqs481BxrrJTVDpe7NkVQpf2s/kixBVveW/jumL3mOe7OwziBmtrTeblIWESIoR3boTMF5J/K0Re8cro6ibuhtiPK8tU1zx9BgsB7RJE/3hzjViu0s/HYsdILFdoKG97BvVLCNtPdHKMt2Ufmwg37SfZERYHnuFVSR8w4pVrPG/Pd+zfFVLISrAXp/ltnobT/Yp/WajSypbhayviUxO13rkom/a9qnMn7UOckXlpKFlAY64GZs+OD6WGAxq/32iYNBGZcKEh7O5b9jKZt8YJE8xjb/R9Vem1LIpi4IuCUOXnwsHaVeuaKL75PlnI3JDxAak6M0Q8/HOhYRFvzZYrgDS8z8VslHs9wiwkVkFlydRrWlU1gAAx3REsZQ4gxgYhWe6ezlw+6mm2MLc2R58NC3B7caG0QC/WG9izG+g9eON/fWqyjPM2dDoWk6lzpLugoDTz6IA5Eq7+ReTZq8cjXvRVn5kgZ3blX3G+7xJQJ2XGV9QnTmBbkM74JpeKAM7yle4PN5Gi/qrgEahCY1XSXguh2qtGQ3GxExSLx/zP9tkjMF7EAL69nW352eCoxQlwyLBkVg9QFgH6ygqLYNnUaWx3BxwiL57V2Pn1D4w4wkNr88NExPl9TtrRpcASKhYlst4gBIX9nt1VJYubNQdZEl1Pp8Rn4HSE7CFBe1N+DnqF/++7w17zS4ARXK7dI1kIONKalJfFQr9PWU9ThSXnEpoh+r6Sr0dke9iC7l71vCb0gPqqdCEt9dIeAozI9IvhIjegX4N5 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76969a3e-7bb2-41a0-9db3-08db9a57a9b8 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 10:42:36.0806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3P250MB0273 Subject: [FFmpeg-devel] [PATCH 4/9] avformat/matroskaenc: Don't add side-data to input stream 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OMvdIcSW5SVJ When muxing, the AVStreams' side-data is typically set by the caller before avformat_write_header(); it is not documented to be else. Yet the Matroska muxer added an AVStereo3D side data if certain metadata was present: Since commit 4d686fb721b485ebbc4c7779d927d876c1e630f7 (adding support for AVStereo3D stream side-data), the Matroska muxer checked certain stream tags that contain Matroska's StereoMode and (if they are present) converted this value into an AVStereo3D struct that gets attached to the AVStream (reusing a function from the demuxer). Afterwards the AVStereo3D side data struct (whether it has just been added by the muxer or not) gets parsed and converted back into a Matroska StereoMode. Besides being an API violation this change broke StereoMode values without a corresponding AVStereo3D (namely the anaglyph ones). This commit fixes this: A StereoMode given via tags is now used-as-is; if no such tag exists and an AVStereo3D side data exists, it is converted into the corresponding StereoMode (if possible). The new STEREOMODE_STEREO3D_MAPPING has been put to good use for this. Signed-off-by: Andreas Rheinhardt --- mkv_write_tracks() now no longer modifies the public AVStream at all any more. libavformat/matroskaenc.c | 125 +++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 9bdf087c67..20d3af3b42 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1580,95 +1580,96 @@ static void mkv_write_field_order(EbmlWriter *writer, int is_webm, #define MAX_STEREO_MODE_ELEMS 1 static int mkv_write_stereo_mode(AVFormatContext *s, EbmlWriter *writer, - AVStream *st, int is_webm, + const AVStream *st, int is_webm, int *h_width, int *h_height) { const AVDictionaryEntry *tag; MatroskaVideoStereoModeType format = MATROSKA_VIDEO_STEREOMODE_TYPE_NB; - const AVStereo3D *stereo; + + /* The following macros create bitfields where the ith bit + * indicates whether the MatroskaVideoStereoModeType with that value + * uses double width/height or is WebM compatible. */ +#define FLAG(STEREOMODETYPE, BOOL) | (BOOL) << (STEREOMODETYPE) +#define WDIV1(STEREOMODETYPE, STEREO3DTYPE, FLAGS, WDIV, HDIV, WEBM) \ + FLAG(STEREOMODETYPE, WDIV) +#define WDIV2(STEREOMODETYPE, WDIV, HDIV, WEBM) \ + FLAG(STEREOMODETYPE, WDIV) + // The zero in the following line consumes the first '|'. + const unsigned width_bitfield = 0 STEREOMODE_STEREO3D_MAPPING(WDIV1, WDIV2); + +#define HDIV1(STEREOMODETYPE, STEREO3DTYPE, FLAGS, WDIV, HDIV, WEBM) \ + FLAG(STEREOMODETYPE, HDIV) +#define HDIV2(STEREOMODETYPE, WDIV, HDIV, WEBM) \ + FLAG(STEREOMODETYPE, HDIV) + const unsigned height_bitfield = 0 STEREOMODE_STEREO3D_MAPPING(HDIV1, HDIV2); + +#define WEBM1(STEREOMODETYPE, STEREO3DTYPE, FLAGS, WDIV, HDIV, WEBM) \ + FLAG(STEREOMODETYPE, WEBM) +#define WEBM2(STEREOMODETYPE, WDIV, HDIV, WEBM) \ + FLAG(STEREOMODETYPE, WEBM) + const unsigned webm_bitfield = 0 STEREOMODE_STEREO3D_MAPPING(WEBM1, WEBM2); *h_width = 1; *h_height = 1; - // convert metadata into proper side data and add it to the stream + if ((tag = av_dict_get(st->metadata, "stereo_mode", NULL, 0)) || (tag = av_dict_get( s->metadata, "stereo_mode", NULL, 0))) { - long stereo_mode = strtol(tag->value, NULL, 0); for (int i = 0; i < MATROSKA_VIDEO_STEREOMODE_TYPE_NB; i++) if (!strcmp(tag->value, ff_matroska_video_stereo_mode[i])){ - stereo_mode = i; + format = i; break; } - - if ((unsigned long)stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB && - stereo_mode != 10 && stereo_mode != 12) { - int ret = ff_mkv_stereo3d_conv(st, stereo_mode); - if (ret < 0) - return ret; + if (format == MATROSKA_VIDEO_STEREOMODE_TYPE_NB) { + long stereo_mode = strtol(tag->value, NULL, 0); + if ((unsigned long)stereo_mode >= MATROSKA_VIDEO_STEREOMODE_TYPE_NB) + goto fail; + format = stereo_mode; } - } + } else { + const AVStereo3D *stereo; + /* The following macro presumes all MATROSKA_VIDEO_STEREOMODE_TYPE_* + * values to be in the range 0..254. */ +#define STEREOMODE(STEREOMODETYPE, STEREO3DTYPE, FLAGS, WDIV, HDIV, WEBM) \ + [(STEREO3DTYPE)][!!((FLAGS) & AV_STEREO3D_FLAG_INVERT)] = (STEREOMODETYPE) + 1, +#define IGNORE(STEREOMODETYPE, WDIV, HDIV, WEBM) + static const unsigned char conversion_table[][2] = { + STEREOMODE_STEREO3D_MAPPING(STEREOMODE, IGNORE) + }; + int fmt; stereo = (const AVStereo3D*)av_stream_get_side_data(st, AV_PKT_DATA_STEREO3D, NULL); - if (stereo) { - switch (stereo->type) { - case AV_STEREO3D_2D: - format = MATROSKA_VIDEO_STEREOMODE_TYPE_MONO; - break; - case AV_STEREO3D_SIDEBYSIDE: - format = (stereo->flags & AV_STEREO3D_FLAG_INVERT) - ? MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT - : MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT; - *h_width = 2; - break; - case AV_STEREO3D_TOPBOTTOM: - format = MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM; - if (stereo->flags & AV_STEREO3D_FLAG_INVERT) - format--; - *h_height = 2; - break; - case AV_STEREO3D_CHECKERBOARD: - format = MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR; - if (stereo->flags & AV_STEREO3D_FLAG_INVERT) - format--; - break; - case AV_STEREO3D_LINES: - format = MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR; - if (stereo->flags & AV_STEREO3D_FLAG_INVERT) - format--; - *h_height = 2; - break; - case AV_STEREO3D_COLUMNS: - format = MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR; - if (stereo->flags & AV_STEREO3D_FLAG_INVERT) - format--; - *h_width = 2; - break; - case AV_STEREO3D_FRAMESEQUENCE: - format = MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR; - if (stereo->flags & AV_STEREO3D_FLAG_INVERT) - format++; - break; - } - } + if (!stereo) + return 0; - if (format == MATROSKA_VIDEO_STEREOMODE_TYPE_NB) - return 0; + /* A garbage AVStereo3D or something with no Matroska analogon. */ + if ((unsigned)stereo->type >= FF_ARRAY_ELEMS(conversion_table)) + return 0; + + fmt = conversion_table[stereo->type][!!(stereo->flags & AV_STEREO3D_FLAG_INVERT)]; + /* Format with no Matroska analogon; ignore it */ + if (!fmt) + return 0; + format = fmt - 1; + } // if webm, do not write unsupported modes - if ((is_webm && - format > MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM && - format != MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT) - || format >= MATROSKA_VIDEO_STEREOMODE_TYPE_NB) { - av_log(s, AV_LOG_ERROR, - "The specified stereo mode is not valid.\n"); - return AVERROR(EINVAL); + if (is_webm && !(webm_bitfield >> format)) { + goto fail; } + *h_width = 1 << ((width_bitfield >> format) & 1); + *h_height = 1 << ((height_bitfield >> format) & 1); + // write StereoMode if format is valid ebml_writer_add_uint(writer, MATROSKA_ID_VIDEOSTEREOMODE, format); return 0; +fail: + av_log(s, AV_LOG_ERROR, + "The specified stereo mode is not valid.\n"); + return AVERROR(EINVAL); } static void mkv_write_blockadditionmapping(AVFormatContext *s, const MatroskaMuxContext *mkv,