From patchwork Fri Feb 16 21:18:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 46300 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:2a03:b0:19e:cdac:8cce with SMTP id e3csp190750pzh; Fri, 16 Feb 2024 13:18:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXYYv1WR9lBT6PLWlFpwZOxUdr3Nns0colIMJlmeWHfBIGdeONMFLoAxZaGGtFrDitOxOucfys6zBwrOQS4vHfGXQM0OHcGtis3CA== X-Google-Smtp-Source: AGHT+IEbDgH0P8JzHpVzb5x8t51kZNWaTpSm/9zjTmY3d5NOu2RFRwN3GhWdfd19ezYALu5eND7+ X-Received: by 2002:a19:645b:0:b0:511:936d:59d6 with SMTP id b27-20020a19645b000000b00511936d59d6mr4333537lfj.26.1708118299609; Fri, 16 Feb 2024 13:18:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708118299; cv=none; d=google.com; s=arc-20160816; b=M9CnjfTYeHKsuWXQcaMBUsVTA7hHZ0dwHR1A910C0aHpOGjOQzsELKyDt8CDqhEcFK 9fnUI8Pm2wWA1f19u8UifqJvGYT/xc4a/icQfzMf66Ig2aeqyVG2T91D6lUxYomJv+P6 S+UAqLGas45yJDNRapxVOAMUHpK1tNUPHgNdGz0QyW2mtqsuQqHkl+tM9Q/TqRkj6ZN0 rUpc2Twyjxve0SrE6pEYPZE0Uc2b0/+gfWpUhX0OkUKWiHsvDc17Ge19K43lQ2yX9qxG UxEInHFzmMLZf/kmGj4xcvxkGr7kVI94RXpliatO8hZP8PCwx8e3YRXrGMa7Q2vvTJ1T /0eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=ccR1JNflPQoOTybsrfqi0tdD3Uk4Jbt74adxVj9Pehw=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=yNOIkNWzAs2wS0z/Lm/6zRM5z89VTSfVkuQoRMxsYGCW6ZNjWhMT3n3V5OhtFu06LF Z9suQhu9mAWQB61zZZjJhGs4vz/3W4exqiPFPbvI8AYzlMh2YzavhPcYRq31cGhiHHLs b+4Xa/fTswMc3dEXXPHmCCedLdvLJTgKVHgSCJGmcO/8BH3GF63VDLwtwi8QbI1VqAwZ 58VwMsoi1zR0b1O4zOeNlRt0G9zC1d/YtL4qyqsFcvEzjRmNYQP/1njzFdSPYKxfnr0Y 3ZC/f3zSJl+bfWosWM6kEuzCzvlSb3zYcD0pTlIxODvmU/0UUczY9TH0xi8MQxDAcmsm /Nuw==; dara=google.com 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 g23-20020a1709063b1700b00a3e13b33272si104894ejf.975.2024.02.16.13.18.19; Fri, 16 Feb 2024 13:18:19 -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 9073868D294; Fri, 16 Feb 2024 23:18:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 079B568C4F1 for ; Fri, 16 Feb 2024 23:18:09 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 8D81FE9EF2; Fri, 16 Feb 2024 22:18:08 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XLpgLyZ4qs1n; Fri, 16 Feb 2024 22:18:06 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id E1619E9EDA; Fri, 16 Feb 2024 22:18:05 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Feb 2024 22:18:03 +0100 Message-Id: <20240216211804.4546-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/mxfdec: move resolving Descriptors to the multi descriptor resolve function 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PlNa5Oh6cN4w Also remove unused descriptor member from MXFPackage. Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index e42975e7fd..4e4e3e7a84 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -266,7 +266,6 @@ typedef struct MXFPackage { UID package_ul; UID *tracks_refs; int tracks_count; - MXFDescriptor *descriptor; /* only one */ UID descriptor_ref; char *name; UID *comment_refs; @@ -2257,11 +2256,12 @@ static MXFPackage* mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U return NULL; } -static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, MXFDescriptor *descriptor, int track_id) +static MXFDescriptor* mxf_resolve_descriptor(MXFContext *mxf, UID *strong_ref, int track_id) { - MXFDescriptor *file_descriptor = NULL; + MXFDescriptor *descriptor, *file_descriptor = NULL; int i; + descriptor = mxf_resolve_strong_ref(mxf, strong_ref, AnyType); if (!descriptor) return NULL; @@ -2782,8 +2782,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) st->id = material_track->track_id; st->priv_data = source_track; - source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType); - descriptor = mxf_resolve_multidescriptor(mxf, source_package->descriptor, source_track->track_id); + descriptor = mxf_resolve_descriptor(mxf, &source_package->descriptor_ref, source_track->track_id); /* A SourceClip from a EssenceGroup may only be a single frame of essence data. The clips duration is then how many * frames its suppose to repeat for. Descriptor->duration, if present, contains the real duration of the essence data */ From patchwork Fri Feb 16 21:18:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 46301 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:2a03:b0:19e:cdac:8cce with SMTP id e3csp190906pzh; Fri, 16 Feb 2024 13:18:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX3jhxGme3AU8tApSZAFwwLjSxh2EZklQlfhLdSiiFQsJn9lq/FdcMRmoyl0Zvov8mVHArARJdYn8F7gZ51YtK0FqWU4LiSn3V7nQ== X-Google-Smtp-Source: AGHT+IETaoPeoBZV29sO6M4I8DH6v1irBdCtQCA1AOvUUM2pWVuOHvVqxk3DENUI8q8olXTT9NDk X-Received: by 2002:a17:906:b889:b0:a3d:9366:8455 with SMTP id hb9-20020a170906b88900b00a3d93668455mr3981144ejb.54.1708118321525; Fri, 16 Feb 2024 13:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708118321; cv=none; d=google.com; s=arc-20160816; b=0FYk2kbwM4Gj0dvRAi5XfGhZdxRo/OBmre5iDABPnvXcUjEVr8pf8VEbSDU9zbIr/V 5w4YQAwMj/b7GS0udR1zAwg8hFbA7mWWPY/ZH2vGOIKltbaigWsNOA+6rOZ1mfl5Jfl8 oBlvojj3CZ3ZE7RgD2o8RztXO8UuAZCuTd9mcSDi9/Ui+bEya+I7LLlZim4SIwr229yB 1142bg5ChCK7JRoDuM3yYQVcsST7JJclFiv7kevZVz0LtE79lNU4uij/3kO62vZ6d+WW vXCrRmWhvf0RV7m1Db3ZCQ5k+j2Q9dumIBItabyrwXZP3+Dbq5UR3vyVwiaFpQLhWeTP 4vbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=8OuSg3BNoUqI3oouG+fY/ezbJr0EbtEtt1lLMODscZY=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=L0IOgKbb5g8wE2KxdmBDu3MJ6RGtkEsZeujgXy68e5h+Ri6hXhUvPHoG8Mrtg3LGa/ Mhn3U/mhSBWnTNOhT6oSjUb22Guzt4d717CbYyXSwGxDBIOjGs6aInxgTI+ATN1xU2lQ tX/lnvpmRLg8HK9gUVL9cFwkUHneSfERqSz0YyWG7jCDEDBua5ZY37Pw00cs0TXKXcME zxgeZU+prSOOjv6lf/gQCb0HNvzoFgCm7Zor6P03TIe2o57TlXLS8ju2T4qk/2CeQz3I 4RZcr2fy9/xG1zcGVvrVfxdIbwle3AQ341iS3kbc4zxZUM2zIZ207hTyyQAgxt1S3mOk gwjg==; dara=google.com 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 q23-20020a170906361700b00a3d606ad36asi257239ejb.338.2024.02.16.13.18.40; Fri, 16 Feb 2024 13:18:41 -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 C0DF268D2D0; Fri, 16 Feb 2024 23:18:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D8B2F68CE23 for ; Fri, 16 Feb 2024 23:18:31 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 5A82FE9EF2; Fri, 16 Feb 2024 22:18:31 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 509emV2MOi2c; Fri, 16 Feb 2024 22:18:28 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 87205E9FA4; Fri, 16 Feb 2024 22:18:28 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Feb 2024 22:18:04 +0100 Message-Id: <20240216211804.4546-2-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240216211804.4546-1-cus@passwd.hu> References: <20240216211804.4546-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avformat/mxfdec: do not use AnyType when resolving Descriptors and MultipleDescriptors 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: CDT9+2vrFLiS Using AnyType should not be a problem for proper MXF files because UIDs are supposed to be unique themselves. Unfortunately that is not the case for some broken files, so let's check the type more strictly. Fixes ticket #10865. Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 4e4e3e7a84..446bcf3276 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -2258,16 +2258,14 @@ static MXFPackage* mxf_resolve_source_package(MXFContext *mxf, UID package_ul, U static MXFDescriptor* mxf_resolve_descriptor(MXFContext *mxf, UID *strong_ref, int track_id) { - MXFDescriptor *descriptor, *file_descriptor = NULL; - int i; - - descriptor = mxf_resolve_strong_ref(mxf, strong_ref, AnyType); - if (!descriptor) - return NULL; + MXFDescriptor *descriptor = mxf_resolve_strong_ref(mxf, strong_ref, Descriptor); + if (descriptor) + return descriptor; - if (descriptor->meta.type == MultipleDescriptor) { - for (i = 0; i < descriptor->file_descriptors_count; i++) { - file_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->file_descriptors_refs[i], Descriptor); + descriptor = mxf_resolve_strong_ref(mxf, strong_ref, MultipleDescriptor); + if (descriptor) { + for (int i = 0; i < descriptor->file_descriptors_count; i++) { + MXFDescriptor *file_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->file_descriptors_refs[i], Descriptor); if (!file_descriptor) { av_log(mxf->fc, AV_LOG_ERROR, "could not resolve file descriptor strong ref\n"); @@ -2277,8 +2275,7 @@ static MXFDescriptor* mxf_resolve_descriptor(MXFContext *mxf, UID *strong_ref, i return file_descriptor; } } - } else if (descriptor->meta.type == Descriptor) - return descriptor; + } return NULL; }