From patchwork Mon Feb 15 16:55:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25640 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 AB09A44B8A3 for ; Mon, 15 Feb 2021 18:56:04 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7F132688057; Mon, 15 Feb 2021 18:56:04 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DD8626800E0 for ; Mon, 15 Feb 2021 18:55:57 +0200 (EET) Received: by mail-wr1-f42.google.com with SMTP id 7so9797055wrz.0 for ; Mon, 15 Feb 2021 08:55:57 -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:reply-to:mime-version :content-transfer-encoding; bh=hSVOLUNkwKSMyeYkW+5kMINAlWpMzBYDbezmlOk0/MA=; b=rJvtcW41/VGWxcFrrx9WeqtcMCtwF5fWVBcGYjDcXIFBQRRruB3MuxMQFxQzYXq/ru GhnGyKp/vAVyzpfoBKqo9mHyPQIGnZtOQ2XKd3BttdGFBEzmpyaLnfTdXWpb6Hb/DdoO X+P8TRcliaq/MdVYscsnzAu2eFhGD3s+HM2uV8jMuhLd1BHT2F1QeVY2vSBrrghh6+S9 HNWAeyoLc69FL3BNGRu+hoDWS7/jiXLMDv7IRuNbxzi2HdbNZesBzOoMCBguCut9HEea J7KhkdijhHlW4RZUY9ZCEIplPpN8NIfMs2P2HJUfMWsOc1B9/z9jRxx0DS29MRagSn1a ZD2w== 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:reply-to :mime-version:content-transfer-encoding; bh=hSVOLUNkwKSMyeYkW+5kMINAlWpMzBYDbezmlOk0/MA=; b=SnvBlTmm+04cxUt6p0XPpUkWEoCPTroPIbtIl8ttU30RaOqcAu9bZYWMsbZCjlfucn mLHw7+VbDzroZuT0UU4rG93B7z2Lwf+GBIlfhZfdSGleESC3jd5dqp6l6Zq1dXRYRjVQ q3SmNqIt1Ut87eHkLcw86OEh1L3PhFDvmdmoVPikuwtLae1BcEtkRKkZ0QyH0R5OpVjP S+vefAzSPk0uMOvPRebM+Qe9u4mQITT8DqDnOAgScJM73HClyX8rvX+omQoSFB/ZZkd7 Bs4Su1H1mK/yOf159I8A1NCfmswBQm0qKvHB1+8gAvtr/E1POuzYOz8z2Zy41QyuHvgd vL1A== X-Gm-Message-State: AOAM5323fCWGxqPZl/9j2qFukAU4/BrdUKIavlJucnGIhq7FJEdv1NZ3 dLiA9kw/1CqDb22kmR6+jpDifUT4w1k= X-Google-Smtp-Source: ABdhPJz7vF9VFCOz4lIbRqn6u+++uvGVo46WaGBogQkjBvrcpnvX/mwDFj3pqeE+a00PXnJQ58pAbg== X-Received: by 2002:adf:9148:: with SMTP id j66mr20373590wrj.28.1613408157107; Mon, 15 Feb 2021 08:55:57 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id b2sm24531855wrv.73.2021.02.15.08.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 08:55:56 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Feb 2021 17:55:44 +0100 Message-Id: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/6] avformat/mxfenc: Never set codec_ul UID to NULL 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" mxf distinguishes codec profiles by different UIDs and therefore needs to check that the input is actually compatible with mxf (i.e. if there is a defined UID for it). If not, then sometimes the UID would be set to NULL and writing the (video) packet would fail. Yet the following audio packet would trigger writing the header (which has been postponed because the UID is not known at the start) and if the UID is NULL, this can lead to segfaults. This commit therefore stops setting the UID to NULL if the input is incompatible with mxf (it has initially been set to a generic value in mxf_write_header()). Fixes #7993. Signed-off-by: Andreas Rheinhardt --- This has already been sent earlier [1], yet it hasn't been applied because Baptiste wanted it to be fixed by making sure that it is always the video track that triggers writing the header. In a discussion on IRC Tomas indicated that he wants both fixes for this bug and I will therefore apply this here tomorrow unless there are objections. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-February/257755.html libavformat/mxfenc.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 0b399178b5..509cae8442 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2020,7 +2020,6 @@ static int mxf_parse_prores_frame(AVFormatContext *s, AVStream *st, AVPacket *pk if (mxf->header_written) return 1; - sc->codec_ul = NULL; profile = st->codecpar->profile; for (i = 0; i < FF_ARRAY_ELEMS(mxf_prores_codec_uls); i++) { if (profile == mxf_prores_codec_uls[i].profile) { @@ -2028,7 +2027,7 @@ static int mxf_parse_prores_frame(AVFormatContext *s, AVStream *st, AVPacket *pk break; } } - if (!sc->codec_ul) + if (i == FF_ARRAY_ELEMS(mxf_prores_codec_uls)) return 0; sc->frame_size = pkt->size; @@ -2074,7 +2073,6 @@ static int mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt if (pkt->size < 43) return 0; - sc->codec_ul = NULL; cid = AV_RB32(pkt->data + 0x28); for (i = 0; i < FF_ARRAY_ELEMS(mxf_dnxhd_codec_uls); i++) { if (cid == mxf_dnxhd_codec_uls[i].cid) { @@ -2082,7 +2080,7 @@ static int mxf_parse_dnxhd_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt break; } } - if (!sc->codec_ul) + if (i == FF_ARRAY_ELEMS(mxf_dnxhd_codec_uls)) return 0; sc->component_depth = 0; @@ -2245,6 +2243,7 @@ static int mxf_parse_h264_frame(AVFormatContext *s, AVStream *st, const uint8_t *buf = pkt->data; const uint8_t *buf_end = pkt->data + pkt->size; const uint8_t *nal_end; + const UID *codec_ul = NULL; uint32_t state = -1; int extra_size = 512; // support AVC Intra files without SPS/PPS header int i, frame_size, slice_type, has_sps = 0, intra_only = 0, ret; @@ -2315,12 +2314,11 @@ static int mxf_parse_h264_frame(AVFormatContext *s, AVStream *st, if (!has_sps) sc->interlaced = st->codecpar->field_order != AV_FIELD_PROGRESSIVE ? 1 : 0; - sc->codec_ul = NULL; frame_size = pkt->size + extra_size; for (i = 0; i < FF_ARRAY_ELEMS(mxf_h264_codec_uls); i++) { if (frame_size == mxf_h264_codec_uls[i].frame_size && sc->interlaced == mxf_h264_codec_uls[i].interlaced) { - sc->codec_ul = &mxf_h264_codec_uls[i].uid; + codec_ul = &mxf_h264_codec_uls[i].uid; sc->component_depth = 10; // AVC Intra is always 10 Bit sc->aspect_ratio = (AVRational){ 16, 9 }; // 16:9 is mandatory for broadcast HD st->codecpar->profile = mxf_h264_codec_uls[i].profile; @@ -2334,17 +2332,18 @@ static int mxf_parse_h264_frame(AVFormatContext *s, AVStream *st, mxf_h264_codec_uls[i].profile == sps->profile_idc && (mxf_h264_codec_uls[i].intra_only < 0 || mxf_h264_codec_uls[i].intra_only == intra_only)) { - sc->codec_ul = &mxf_h264_codec_uls[i].uid; + codec_ul = &mxf_h264_codec_uls[i].uid; st->codecpar->profile = sps->profile_idc; st->codecpar->level = sps->level_idc; // continue to check for avc intra } } - if (!sc->codec_ul) { + if (!codec_ul) { av_log(s, AV_LOG_ERROR, "h264 profile not supported\n"); return 0; } + sc->codec_ul = codec_ul; return 1; } @@ -2441,9 +2440,13 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, } } } - if (s->oformat != &ff_mxf_d10_muxer) - sc->codec_ul = mxf_get_mpeg2_codec_ul(st->codecpar); - return !!sc->codec_ul; + if (s->oformat != &ff_mxf_d10_muxer) { + const UID *codec_ul = mxf_get_mpeg2_codec_ul(st->codecpar); + if (!codec_ul) + return 0; + sc->codec_ul = codec_ul; + } + return 1; } static uint64_t mxf_parse_timestamp(int64_t timestamp64) From patchwork Mon Feb 15 16:55:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25641 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 B39B144B8A3 for ; Mon, 15 Feb 2021 18:56:19 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 98AE3688128; Mon, 15 Feb 2021 18:56:19 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 09736688092 for ; Mon, 15 Feb 2021 18:56:17 +0200 (EET) Received: by mail-wr1-f45.google.com with SMTP id t15so9678065wrx.13 for ; Mon, 15 Feb 2021 08:56:17 -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=KRivQKUPyrDYlgxfNQt4OI5j7UXHly6F0ehD8GyjXtI=; b=kxaED39FsUGSZ++g2QmcGhJ7NYQMzpWK6g5rqzYjRGTgCfANDLDbKVzMELJyM/Ts7j WtXMLdFf2OLdBbK4zlbbJ7zJychAxVHB/HKNYfeoSzCXFkKgp0i79QO7gIAa1juc82KY ZnA27iNy1oKXipWyGtzVKTQJltJ3/TjnZAoyIvb8A51bMx7acOjwdZ7fKm1TPBmtuB0O MOk/NAYwwOq5k/ldZnYU0J5kbEkdYFo/sLswgFCuNiCYcTxodx0o5SWz0rmfLXdrzW8X vqQYZgvbF6JnpWfY5nJmG8Iqutfd7LSS8SxtspQIanvTEh4GZifi9UXoOuuwVvlxQpol Jqaw== 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=KRivQKUPyrDYlgxfNQt4OI5j7UXHly6F0ehD8GyjXtI=; b=leJ+6NN1VLKIJewIrtHuFNm+fdTHS46vaf6N6/i7Z9aXRNqtoZU5qbITNpi8mCJJWd a0MfhJGMrpiR0gqtx2K7+zUBqn39wQxkXMz93MFLuaocOuWjc4ZVq5iDbjjqjS17tMzU 3adZ7WaApslfPpwAo2LPNKrLoZoBDN71r/hx7Pn9W6NePJRuFSejt/YJDdE8GwuEZVUN qgtQLCkIiTm09afBe6sPsa46d471ERX63W5rCCipwApN5srv3E9htRuaL1ywMMvPHlfE z995UUczbDyNsWHmKZ1CXjeKM4CczTw+qw6/VblEkykz3PHq43Mx3PUTouYbCHdkSBLX UelA== X-Gm-Message-State: AOAM531gmVpgzqPEe1Eg5v2yqOHLRIoEjp+J5QTKGdKq2Tpcg1kzyAXW 3COjLykkSS8epd4DV5X7UbJKVwzzvnQ= X-Google-Smtp-Source: ABdhPJxyFHix1M8KXVuBX3fQvfE5W9wDqjhjeJR8hM1r82LEU/zWQj4ejy29kNKWgMW1Xg3vJqCzgQ== X-Received: by 2002:adf:9504:: with SMTP id 4mr19409832wrs.306.1613408177185; Mon, 15 Feb 2021 08:56:17 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id b2sm24531855wrv.73.2021.02.15.08.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 08:56:16 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Feb 2021 17:55:45 +0100 Message-Id: <20210215165549.667105-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> References: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/6] avformat/mxfenc: Use user-specified version even when bitexact 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" Doing so is still bitexact. Signed-off-by: Andreas Rheinhardt --- libavformat/mxfenc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 509cae8442..3bfe2a5c1a 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -762,16 +762,15 @@ static void mxf_write_identification(AVFormatContext *s) AVDictionaryEntry *version_entry = av_dict_get(s->metadata, "product_version", NULL, 0); const char *company = com_entry ? com_entry->value : "FFmpeg"; const char *product = product_entry ? product_entry->value : s->oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer"; - const char *product_version = version_entry ? version_entry->value : AV_STRINGIFY(LIBAVFORMAT_VERSION); const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : PLATFROM_IDENT; - const char *version; + const char *version = version_entry ? version_entry->value : + s->flags & AVFMT_FLAG_BITEXACT ? "0.0.0" : + AV_STRINGIFY(LIBAVFORMAT_VERSION); int length; mxf_write_metadata_key(pb, 0x013000); PRINT_KEY(s, "identification key", pb->buf_ptr - 16); - version = s->flags & AVFMT_FLAG_BITEXACT ? - "0.0.0" : product_version; length = 100 +mxf_utf16_local_tag_length(company) + mxf_utf16_local_tag_length(product) + mxf_utf16_local_tag_length(platform) + From patchwork Mon Feb 15 16:55:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25642 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 ACA2844B8A3 for ; Mon, 15 Feb 2021 18:56:20 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 934EB68811F; Mon, 15 Feb 2021 18:56:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B511E687FFC for ; Mon, 15 Feb 2021 18:56:18 +0200 (EET) Received: by mail-wr1-f49.google.com with SMTP id v14so9724059wro.7 for ; Mon, 15 Feb 2021 08:56:18 -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=YoLCLcDIfASvij2+CQKoa4gVXtySERSTSMxjo+RHUrE=; b=fz+lMRR2jRNPcAaIZT0TrQawlVxuxJgXXB2JGuy7BMlk27LeYrT3friF0VGa6eVIgC izXYOxtlkcX+MxhcjDQT/Sgi7MkW4NseGtTrvtj9n4rFnXRLzQddOzTJQnGi8BUhkPry +5ph9WF1lwh6yhq9mJCJ4iKIpfEZ2j3ZYOCAiMhDQotXVcfFqg30pqnHFVtiywBFIjvL hLUI4bAKrmh4axqSQdef7nayeR1U31xGtOiGRl716QghxXos0cQGaoi9DPDkky3r80nY Wwg2tveHkeBwviY9hePStiS7hk2+Tp4teLR4qfCXTYeY40BEG3rstUq6M0cVbjcmjQdY c7aQ== 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=YoLCLcDIfASvij2+CQKoa4gVXtySERSTSMxjo+RHUrE=; b=iI8euKzRRaaF81qjWh7Y9eGaa1Ip2P/1MYIO0LRNhkhqeYBzeiYkz1GWCletlcSoU8 Bh2ny3dH97GhhXCtRADh6HSrZw1A7flQghSSk6760SKr1PwrEaha+M/GrxcEASK4Mo6V aHF/aGvDQqQyOBf3ekhnezcEb3aAysAhPlJeFEUk+ClEuFY2EBxUW49/DiGsYaBj4qL0 bVanbwD9uNrfk5pWy61nr9aiIQIIOojwYsNJUTW0Ck5ShjdwWNioxkgvWC+udV6aKhh7 1nf+Pfnlk+VMQ8QRdWSK/JIEUoLPHlSh5dxokDzLCDygVBricAAuOodGsdR72DIAX8J3 c5rw== X-Gm-Message-State: AOAM532zat2LTIZfwxGXIESiUiiunddbsVr+3WKIbdk1Jm6K92+ogBZi 0Vvr/gE+LGwu+WlQLIVDU2t1gwELT+U= X-Google-Smtp-Source: ABdhPJyZvUL5a8qz+YuJwAA9iDqgD/d4W1yaL2XN0zh+LjAPQ5/4QTvT2s6E41z5iFn+axuzWzGzXw== X-Received: by 2002:a5d:4850:: with SMTP id n16mr19781432wrs.296.1613408177962; Mon, 15 Feb 2021 08:56:17 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id b2sm24531855wrv.73.2021.02.15.08.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 08:56:17 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Feb 2021 17:55:46 +0100 Message-Id: <20210215165549.667105-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> References: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/6] avformat/mxfenc: Fix typo 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" Signed-off-by: Andreas Rheinhardt --- libavformat/mxfenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 3bfe2a5c1a..72edaa9e30 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -752,7 +752,7 @@ static void store_version(AVFormatContext *s){ avio_wb16(pb, 0); // release } -#define PLATFROM_IDENT "Lavf " AV_STRINGIFY((OS_NAME)) +#define PLATFORM_IDENT "Lavf " AV_STRINGIFY((OS_NAME)) static void mxf_write_identification(AVFormatContext *s) { MXFContext *mxf = s->priv_data; @@ -762,7 +762,7 @@ static void mxf_write_identification(AVFormatContext *s) AVDictionaryEntry *version_entry = av_dict_get(s->metadata, "product_version", NULL, 0); const char *company = com_entry ? com_entry->value : "FFmpeg"; const char *product = product_entry ? product_entry->value : s->oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer"; - const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : PLATFROM_IDENT; + const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : PLATFORM_IDENT; const char *version = version_entry ? version_entry->value : s->flags & AVFMT_FLAG_BITEXACT ? "0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION); From patchwork Mon Feb 15 16:55:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25643 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 C22E644B8A3 for ; Mon, 15 Feb 2021 18:56:21 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A9B09688188; Mon, 15 Feb 2021 18:56:21 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D82B6880EF for ; Mon, 15 Feb 2021 18:56:19 +0200 (EET) Received: by mail-wr1-f51.google.com with SMTP id 7so9798379wrz.0 for ; Mon, 15 Feb 2021 08:56:19 -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=UnVEsKmw0jqzGgMhpFz0OOl57ylF9ydqZzW8tZFJI4M=; b=o5qPpvT5Ji9wgVdFUc+uSlDhESmqR485uHQ2ZT1Ofs7tlQGc1xgrWDNpJqmrJ91TDG ZNv8ueAebNBNy4U+85wQFtLvnjept+nEtnorbfoxlE7/kDfsxET5AVYBarq2Sq9LpSoR tZzSu9doYiV3kj0MdJUZla9OykmZAWn4atDM3WQRrLN7fTt1hgS76kfRFjAyMLq8v9mq NAhxsUTAIg/gnuoTdxmGaPaugTkrDElGYemfkSHePHccpH0GDu4MYnMTRpBvkokiibfQ 6rY+oMFz2WMDgrjofbvoZ+QZMUnYZR8cbfBdMALaz69fZA8KVw3sRN6j2ugHmtIhTIi2 47iw== 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=UnVEsKmw0jqzGgMhpFz0OOl57ylF9ydqZzW8tZFJI4M=; b=ojEU21gJYA1Qgt5ktoDsU4giDvO3MNw+9D5puzp44/hBZNo+sTvepq4ShB70Rgbhdp 1oK4gfYcWZ/thTeXPpx6OIYt6KjSa+vtXyWPkzB6nMjtoO0D+auI+Ks0hVQPzmjeE8SY 81ScbhsyPsCppex7Hp6Aa60mygP3apXBVc1X7wmKSRVids2H7YXS2j3wfcEi3o9cdOph 9CwM1+tOa3GzcwTDzx+Lpm/EyFokFmHZpsNsLGZa531R/BjD0zfj1CzZx/6LW9FIL/eo 6ILLX2lQZ+RnvH8dNMnRNqLb+Qma/BnmWbt7BdaxWdZB0O/wbUMtlB2qKu4WZk3HwBO2 JmzA== X-Gm-Message-State: AOAM530wDdRdMHjECFeyhNbqLIAAso3FBWHBje69K0hY8W0b1mRCepVQ 0c/CfJnx6lfP7GQn8LiQt2hY8jlNC3I= X-Google-Smtp-Source: ABdhPJwh68nebnO6s7OqHi037710dJ3ARmTUkVdYBB5qqfnuBDkGehxktK/8A96R+ZKtxi/y58jmZQ== X-Received: by 2002:a05:6000:18f:: with SMTP id p15mr11357457wrx.27.1613408178721; Mon, 15 Feb 2021 08:56:18 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id b2sm24531855wrv.73.2021.02.15.08.56.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 08:56:18 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Feb 2021 17:55:47 +0100 Message-Id: <20210215165549.667105-4-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> References: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/6] fate/mxf: Fix d10-user-comments test 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" The mxf_d10 muxer is very picky regarding the input it accepts: The only video accepted is MPEG-2 with absolutely constant bitrate, i.e. all packets need to have exactly the same size; and only a few bitrates are accepted. The sample file used did not abide by this: Writing the first packet (a video packet) errors out and afterwards an audio packet from the muxing queue has been written. That's all besides metadata (which this test is about). The FFmpeg cli returned an error, but said error has been ignored by the md5 test. This commit changes the test to actually send a compliant stream to the muxer, so that it does not error out; furthermore, the test is changed to explicitly check the metadata instead of it only being implicitly included in the md5 checksum. The compliant stream is created by our encoder at runtime. Finally, the test now also covers writing user-specified product/company/version identification. Signed-off-by: Andreas Rheinhardt --- In comparison to the first version [1] I expanded the test to also cover the new product/company/version identification. [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/273405.html tests/fate/mxf.mak | 8 ++++---- tests/ref/fate/mxf-d10-user-comments | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak index ca119fa677..3a1096176f 100644 --- a/tests/fate/mxf.mak +++ b/tests/fate/mxf.mak @@ -45,9 +45,8 @@ FATE_MXF_USER_COMMENTS-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF) += fate-mxf-u fate-mxf-user-comments: $(SAMPLES)/mxf/Sony-00001.mxf fate-mxf-user-comments: CMD = md5 -y -i $(TARGET_SAMPLES)/mxf/Sony-00001.mxf -c copy -metadata "comment_test=value" -fflags +bitexact -f mxf -FATE_MXF_D10_USER_COMMENTS-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF) += fate-mxf-d10-user-comments -fate-mxf-d10-user-comments: $(SAMPLES)/mxf/Sony-00001.mxf -fate-mxf-d10-user-comments: CMD = md5 -y -i $(TARGET_SAMPLES)/mxf/Sony-00001.mxf -c copy -metadata "comment_test=value" -store_user_comments 1 -fflags +bitexact -f mxf_d10 +FATE_MXF_D10_USER_COMMENTS-$(call ALLYES, FILE_PROTOCOL MXF_DEMUXER DVVIDEO_DECODER SCALE_FILTER MPEG2VIDEO_ENCODER MXF_D10_MUXER EXTRACT_EXTRADATA_BSF MPEGVIDEO_PARSER PIPE_PROTOCOL FRAMECRC_MUXER) += fate-mxf-d10-user-comments +fate-mxf-d10-user-comments: CMD = transcode mxf $(TARGET_SAMPLES)/mxf/Avid-00005.mxf mxf_d10 "-c:v mpeg2video -b:v 30000k -minrate:v 30000k -maxrate:v 30000k -bufsize:v 30000k -rc_init_occupancy 30000k -vf scale=w=1280:h=720 -an -metadata comment_test=value -metadata company_name=FATE-company -metadata product_name=FATE-test -metadata product_version=3.14159 -store_user_comments 1" "-c copy -frames:v 5" "" "-show_entries format_tags" FATE_MXF_OPATOM_USER_COMMENTS-$(call ENCDEC2, MPEG2VIDEO, PCM_S16LE, MXF) += fate-mxf-opatom-user-comments fate-mxf-opatom-user-comments: $(SAMPLES)/mxf/Sony-00001.mxf @@ -56,7 +55,8 @@ fate-mxf-opatom-user-comments: CMD = md5 -y -i $(TARGET_SAMPLES)/mxf/Sony-00001. FATE_MXF-$(CONFIG_MXF_DEMUXER) += $(FATE_MXF) FATE_SAMPLES_AVCONV += $(FATE_MXF-yes) $(FATE_MXF_REEL_NAME-yes) -FATE_SAMPLES_AVCONV += $(FATE_MXF_USER_COMMENTS-yes) $(FATE_MXF_D10_USER_COMMENTS-yes) $(FATE_MXF_OPATOM_USER_COMMENTS-yes) +FATE_SAMPLES_AVCONV += $(FATE_MXF_USER_COMMENTS-yes) $(FATE_MXF_OPATOM_USER_COMMENTS-yes) +FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MXF_D10_USER_COMMENTS-yes) FATE_SAMPLES_FFPROBE += $(FATE_MXF_PROBE-yes) fate-mxf: $(FATE_MXF-yes) $(FATE_MXF_PROBE-yes) $(FATE_MXF_REEL_NAME-yes) $(FATE_MXF_USER_COMMENTS-yes) $(FATE_MXF_D10_USER_COMMENTS-yes) $(FATE_MXF_OPATOM_USER_COMMENTS-yes) diff --git a/tests/ref/fate/mxf-d10-user-comments b/tests/ref/fate/mxf-d10-user-comments index c35add0279..0dcb04de30 100644 --- a/tests/ref/fate/mxf-d10-user-comments +++ b/tests/ref/fate/mxf-d10-user-comments @@ -1 +1,27 @@ -7bb9f39e8e05724525154de17f0235d8 +6dc13ae283257e898e069e5041ac8435 *tests/data/fate/mxf-d10-user-comments.mxf_d10 +3782189 tests/data/fate/mxf-d10-user-comments.mxf_d10 +#extradata 0: 34, 0x716b05c4 +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: mpeg2video +#dimensions 0: 1280x720 +#sar 0: 3/4 +0, -1, 0, 1, 150000, 0x0547870d, S=1, 24, 0x5aa90ad0 +0, 0, 1, 1, 150000, 0xe80a1612, F=0x0 +0, 1, 2, 1, 150000, 0xc5c50e2f, F=0x0 +0, 2, 3, 1, 150000, 0x51e28a04, F=0x0 +0, 3, 4, 1, 150000, 0x9bbe6feb, F=0x0 +[FORMAT] +TAG:operational_pattern_ul=060e2b34.04010101.0d010201.01010900 +TAG:uid=adab4424-2f25-4dc7-92ff-29bd000c0000 +TAG:generation_uid=adab4424-2f25-4dc7-92ff-29bd000c0001 +TAG:company_name=FATE-company +TAG:product_name=FATE-test +TAG:product_version=3.14159 +TAG:application_platform=Lavf +TAG:product_uid=adab4424-2f25-4dc7-92ff-29bd000c0002 +TAG:toolkit_version=0.0.0.0.0 +TAG:material_package_umid=0x060A2B340101010501010D001300000000000000000000000000000000000000 +TAG:comment_test=value +TAG:timecode=01:00:00:00 +[/FORMAT] From patchwork Mon Feb 15 16:55:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25644 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 D9F2244B8A3 for ; Mon, 15 Feb 2021 18:56:22 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C193D68980E; Mon, 15 Feb 2021 18:56:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 199E06881B7 for ; Mon, 15 Feb 2021 18:56:20 +0200 (EET) Received: by mail-wr1-f49.google.com with SMTP id n4so6764179wrx.1 for ; Mon, 15 Feb 2021 08:56:20 -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=3Z1Vh5cEyMqF/bCbJ20qnMUM5g73FvA4KyUGc+NmH1w=; b=uCbyxlOznzNTkyVAOWl+26t/9ulEoOC1P3ABqnV2DRHujEq+XWjZW/faW4NIzyNH8s QNGVL0saczakcr+K7OJ/XR4o5K8E/KkHDZVAgjZl7/IGNjZLJkI79p00OD2KF4JCc/EL uorA9dDFJKYg1mv0PsH9dED9gL3GfjP6FRYytibbtljadSM8TDOT1Jh6Q69PnbzmkGyO t1sTb7s5bLilkbR4gPi1zEpXljUGV4yATiLsCBLjSGYWVIWT7aPTsQ7HUaoVOGe/oeOy R5RPT4ALp2PIQxYqRnHVabN/V5gpQVLYapzW/HHaBaqQZWogc6dmD8c1IsJ/vMHkKsuJ carQ== 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=3Z1Vh5cEyMqF/bCbJ20qnMUM5g73FvA4KyUGc+NmH1w=; b=GEirk77tlAixQgmhDZ4NGkZvvh5QTm/a/GkoOt8Y+ozi9Bl2SC2hEa5FJDg2a/E38e WqqsK5YBvCVKqmre4AG0EEo7lu944GD7mWsg337jyynZCMT1SOlIOoBNlMOzVte9AkNq /dAAbbFwLdHNrQin7o4WFHrdnvNI6qOkn9Y2hUHQrUumXtbiUbgN3yrq4HDJMuaUBRWY D/uABhqivt3N6Rhx9K/RDE6wPM0llnt81w/Y0Eu13LcSaEmSeKhpEOZb+k5LRmIntl8B 3zkVTxJr5TMDTt58V/O5dFrCgqNM1X0jzk3suE8TzNHIjk+NymDKchLpTNDTD04M3JjD zHtw== X-Gm-Message-State: AOAM532fV0y/goYvvtg8e4eYPar3x66hvwexg6dbyxkZJ6xukLvIYbE/ nVmTXYDeGV0DOMYvKa6U0gItoxWJR6c= X-Google-Smtp-Source: ABdhPJxdtoW9rj2AEf6TtFRkmMmhtm+x+T6eigTk9IHKPWfCEO/41+Hvy8vFVyf8iY6vgAn2EilwOQ== X-Received: by 2002:adf:fc09:: with SMTP id i9mr20016367wrr.235.1613408179433; Mon, 15 Feb 2021 08:56:19 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id b2sm24531855wrv.73.2021.02.15.08.56.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 08:56:19 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Feb 2021 17:55:48 +0100 Message-Id: <20210215165549.667105-5-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> References: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 5/6] tests/fate-run.sh: Don't overlook errors from md5 tests 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" The md5 test up until now ignored errors from ffmpeg (the cli) and just md5'ed whatever ffmpeg has output; while testing scenarios in which ffmpeg fails has its merits, errors should not be overlooked by default; doing so also reduces the effectiveness of sanitizers as errors from them are ignored. This has happened with a memleak in the AV1 decoder. Signed-off-by: Andreas Rheinhardt --- tests/fate-run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 58d5fdbb60..b69176f7c3 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -158,7 +158,7 @@ md5pipe(){ md5(){ encfile="${outdir}/${test}.out" cleanfiles="$cleanfiles $encfile" - ffmpeg -y "$@" $(target_path $encfile) + ffmpeg -y "$@" $(target_path $encfile) || return do_md5sum $encfile | awk '{print $1}' } From patchwork Mon Feb 15 16:55:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25645 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 C4E6644B8A3 for ; Mon, 15 Feb 2021 18:56:23 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2CE0688126; Mon, 15 Feb 2021 18:56:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 03FD86891F1 for ; Mon, 15 Feb 2021 18:56:20 +0200 (EET) Received: by mail-wr1-f47.google.com with SMTP id t15so9678263wrx.13 for ; Mon, 15 Feb 2021 08:56:20 -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=vUpgXSeNt+oWHbey0tjfQ7WJ0/00QiCg9As82QTiLBQ=; b=POnZOB668KMbCfPTmC9ulX7jbe6f0Sg8W9ga/s43qdFmtDnoS+l47Sw4RjcWU2Nls2 K0JDfDOEV4uVtdiNo4Ucq3Bns0Trwlua3+NsW4YAVKxy1zzbRkDDNlfwzyui91+E+FX1 vqqPr8pRLlzQ7snsmzquOpVRhkKNqIsEdFDSRIRRwwI52qvMaZqX7iydE0MeJrJm2Qyp qtn63fvTtz8UdcRQFyD03hGncIP3ykO/vWLE88cuMc4JDwskVecY+7iOPCxW3Tq890ww TIHaAsplw8mbKGpxk6C9Zs4frBsCLYfLhAW62thjP4mfA/0dka2ASI6/TQq4kczYbDXI Weaw== 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=vUpgXSeNt+oWHbey0tjfQ7WJ0/00QiCg9As82QTiLBQ=; b=cWAvmBRiW+Vou7zaxUNxIcOHWGXLxjyxYarjb+XqAYPDheY4HlQtiPiBNYNsfT6sZU m3xHlgdzSfVzviegNuAY2QMJoO0r0VoznqT93l3tsgroU/ScweLjIO4d1eTuSxEC9KyP uyp8MoS2qvmKTY4sm8ESEn3NzTmI4ryY9ZAUS9odqIUl7DZfGQthzriJH7lSMBX4DV88 xxCEcrXc084vim6ohRrCRnOVwQh86eu99NBb1vCEtBJ4NgRJT83f5NaJmMm9gXyzlVRm 02MWoX/Zb/fBYVvvCNUTIEiK/gXnY3WuG+HeElfZvN0IJhgY/Kj7X6VPrCnksJMFYGOs wahA== X-Gm-Message-State: AOAM532rT+eEXDZCYnJPxhcs+wNFMOwgcJ+nIxFX5JuDKF2aLXCZiWb9 yYPkWJAPslq1oD7vzCmDyh7T1dtST/4= X-Google-Smtp-Source: ABdhPJzTP8lTh8jDNFbM2ez+W/Z45R+q7tbCAqwcs2+T+X8sB6+jhvRJWfGgIS7GXOVtQPM8rHNx7g== X-Received: by 2002:a5d:518a:: with SMTP id k10mr19786163wrv.214.1613408180180; Mon, 15 Feb 2021 08:56:20 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id b2sm24531855wrv.73.2021.02.15.08.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 08:56:19 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Feb 2021 17:55:49 +0100 Message-Id: <20210215165549.667105-6-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> References: <20210215165549.667105-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 6/6] avformat/mxfenc: Discard audio until valid video has been received 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" Normally, video packets are muxed before audio packets for mxf (there is a dedicated interleave function for this); furthermore the first (video) packet triggers writing the actual header. Yet when the first video packet fails the checks performed on it, it will be an audio packet that leads to writing the header and codec_ul (a value set based upon properties of the bitstream which necessitates actually inspecting packets) may be wrong. Therefore this commit discards audio packets until a valid video packet has been received. Signed-off-by: Andreas Rheinhardt --- Updated the commit message in light of the fact that #7993 is now fixed by the earlier commit. libavformat/mxfenc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 72edaa9e30..1c668998e2 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2887,6 +2887,13 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) MXFIndexEntry ie = {0}; int err; + if (!mxf->header_written && pkt->stream_index != 0 && + s->oformat != &ff_mxf_opatom_muxer) { + av_log(s, AV_LOG_ERROR, "Received non-video packet before " + "header has been written\n"); + return AVERROR_INVALIDDATA; + } + if (!mxf->cbr_index && !mxf->edit_unit_byte_count && !(mxf->edit_units_count % EDIT_UNITS_PER_BODY)) { if ((err = av_reallocp_array(&mxf->index_entries, mxf->edit_units_count + EDIT_UNITS_PER_BODY, sizeof(*mxf->index_entries))) < 0) {