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 BCD1D4036B for ; Fri, 18 Feb 2022 23:20:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8BD5568B0D3; Sat, 19 Feb 2022 01:20:15 +0200 (EET) Received: from ssq0.pkh.me (laubervilliers-656-1-228-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3F5DC68AF2A for ; Sat, 19 Feb 2022 01:20:09 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pkh.me; s=selector1; t=1645226403; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aHcJ9E6Czagwq12x8X7Rivq/nVJEMd0c0ePANwkLqwc=; b=dczMyyxhhESmQx9TuHfsFDzqUraGBqgIu082XInmvCXFUW04EoYeopvhk/g2D0MP3iViI6 GHHGtMwDUACGy1k8QMcGlHQm0nBBmMnV2SIU0tVLhDGkVrWQ7KNKIwvx5caAO4oAnD7sjk ZwPilsEVCpQqoLmiHJ2ZmOcvlSmTkNA= Received: from localhost (ssq0.pkh.me [local]) by ssq0.pkh.me (OpenSMTPD) with ESMTPA id 6b23e1df; Fri, 18 Feb 2022 23:20:03 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Sat, 19 Feb 2022 00:19:57 +0100 Message-Id: <20220218232001.345826-2-u@pkh.me> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220218232001.345826-1-u@pkh.me> References: <20220218232001.345826-1-u@pkh.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/5] avformat/mov: prepare sbgp parsing for other grouping types 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: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= 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: --- libavformat/mov.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 5e26267810..aade052b7a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3137,6 +3137,8 @@ static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom) unsigned int i, entries; uint8_t version; uint32_t grouping_type; + MOVSbgp *table, **tablep; + int *table_count; if (c->fc->nb_streams < 1) return 0; @@ -3146,28 +3148,34 @@ static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom) version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ grouping_type = avio_rl32(pb); - if (grouping_type != MKTAG( 'r','a','p',' ')) - return 0; /* only support 'rap ' grouping */ + + if (grouping_type == MKTAG('r','a','p',' ')) { + tablep = &sc->rap_group; + table_count = &sc->rap_group_count; + } else { + return 0; + } + if (version == 1) avio_rb32(pb); /* grouping_type_parameter */ entries = avio_rb32(pb); if (!entries) return 0; - if (sc->rap_group) - av_log(c->fc, AV_LOG_WARNING, "Duplicated SBGP atom\n"); - av_free(sc->rap_group); - sc->rap_group_count = 0; - sc->rap_group = av_malloc_array(entries, sizeof(*sc->rap_group)); - if (!sc->rap_group) + if (*tablep) + av_log(c->fc, AV_LOG_WARNING, "Duplicated SBGP %s atom\n", av_fourcc2str(grouping_type)); + av_freep(tablep); + table = av_malloc_array(entries, sizeof(*table)); + if (!table) return AVERROR(ENOMEM); + *tablep = table; for (i = 0; i < entries && !pb->eof_reached; i++) { - sc->rap_group[i].count = avio_rb32(pb); /* sample_count */ - sc->rap_group[i].index = avio_rb32(pb); /* group_description_index */ + table[i].count = avio_rb32(pb); /* sample_count */ + table[i].index = avio_rb32(pb); /* group_description_index */ } - sc->rap_group_count = i; + *table_count = i; if (pb->eof_reached) { av_log(c->fc, AV_LOG_WARNING, "reached eof, corrupted SBGP atom\n"); -- 2.35.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".