From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 6884543CBF for ; Mon, 5 Sep 2022 18:30:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3B46C68B747; Mon, 5 Sep 2022 21:30:09 +0300 (EEST) Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 104DB68B462 for ; Mon, 5 Sep 2022 21:30:03 +0300 (EEST) Received: by mail-pg1-f170.google.com with SMTP id q63so8652016pga.9 for ; Mon, 05 Sep 2022 11:30:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=Lrw5R/hNXKERm8GnKiYZEcShdcR708bJGSMLoP3u28s=; b=Qc+NyE1R94BwkAaM7sMxlqZ40M0WNIZpjInOiXmVmbV8bhTBfIfhUa0rIhDG0m5LWy En2sATQhyKWh4zpjgTdh8+xiop0fADQvqWihd7K3D/DJ9F3X3cOZ2zhvy936DCn5/lKF Aa3k/nTAFSKU0bjnkl2l23HuMrcMJ9Y8AB+i/pwqIAFAZxVxFcmHBDS9k7TZMoW2D+Wm Qbt3pZPEt0Ojvdv/CzAILlM4gZ39J/S3c5eZTQ/JdmKgxX/Y6dkiI0il3o31TGVCYZHp PM9pN1QHrnN6Fi+9hMPZGYHdUlTcz0OhXZALIuCf1A1raPWxIA0nheYXJmivWARsFDSj b54Q== X-Gm-Message-State: ACgBeo1KbyS7+280+1/qY+maqIL7nx26ZZ0CzHM25qBmtvUvxQoYRXoe Usvts6aFRQf/HtVeZTJefSX8OnxdRPI= X-Google-Smtp-Source: AA6agR71KGh3mApCjnJmfZM42Qzd73d6BZyTre6p7gRazuZ4kKUM2TiArA3VGkbuZinE7VNc7b6NSw== X-Received: by 2002:aa7:9019:0:b0:535:fb2e:4ae9 with SMTP id m25-20020aa79019000000b00535fb2e4ae9mr50750035pfo.72.1662402600660; Mon, 05 Sep 2022 11:30:00 -0700 (PDT) Received: from localhost (76-14-89-2.sf-cable.astound.net. [76.14.89.2]) by smtp.gmail.com with ESMTPSA id e23-20020a170902ed9700b00176c431e7e2sm919071plj.13.2022.09.05.11.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 11:30:00 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 05 Sep 2022 11:29:37 -0700 From: pal@sandflow.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Sep 2022 11:29:31 -0700 Message-Id: <20220905182932.7134-1-pal@sandflow.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/2] avformat/mxf: set stream frame rates for ST 422 essence containers 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: Pierre-Anthony Lemieux Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Pierre-Anthony Lemieux The MXF demuxer does not currently set AVStream::avg_frame_rate and ::r_frame_rate when J2K essence is wrapped according to SMPTE ST 422. --- libavformat/mxfdec.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index feebff67aa..043e2e06ec 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2140,6 +2140,13 @@ finish_decoding_index: return ret; } +static int mxf_is_st_422(const UID *essence_container_ul) { + static const uint8_t st_422_essence_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0c }; + + return essence_container_ul && mxf_match_uid(*essence_container_ul, st_422_essence_container_ul, + sizeof(st_422_essence_container_ul)); +} + static int mxf_is_intra_only(MXFDescriptor *descriptor) { return mxf_get_codec_ul(mxf_intra_only_essence_container_uls, @@ -2892,6 +2899,24 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) av_log(mxf->fc, AV_LOG_INFO, "Unknown frame layout type: %d\n", descriptor->frame_layout); } + if (mxf_is_st_422(essence_container_ul)) { + switch ((*essence_container_ul)[14]) { + case 2: /* Cn: Clip- wrapped Picture Element */ + case 3: /* I1: Interlaced Frame, 1 field/KLV */ + case 4: /* I2: Interlaced Frame, 2 fields/KLV */ + case 6: /* P1: Frame- wrapped Picture Element */ + st->avg_frame_rate = source_track->edit_rate; + st->r_frame_rate = st->avg_frame_rate; + break; + case 5: /* F1: Field-wrapped Picture Element */ + st->avg_frame_rate = av_mul_q(av_make_q(2, 1), source_track->edit_rate); + st->r_frame_rate = st->avg_frame_rate; + break; + default: + break; + } + } + if (st->codecpar->codec_id == AV_CODEC_ID_PRORES) { switch (descriptor->essence_codec_ul[14]) { case 1: st->codecpar->codec_tag = MKTAG('a','p','c','o'); break; -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".