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 3ED174AD94 for ; Tue, 21 May 2024 09:06:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0DEE068D432; Tue, 21 May 2024 12:04:00 +0300 (EEST) Received: from btbn.de (btbn.de [144.76.60.213]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E94C68D3B3 for ; Tue, 21 May 2024 12:03:43 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 46BE227FFD2B6; Tue, 21 May 2024 11:03:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1716282219; 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=crAwDE76BC/pGFeZJpR6iKXLZNwtRn1/591jEwjsmmA=; b=hTCelBSoVX7GWWS6qXZlM/P+Dp5D+y21G+7vwqInxAXo2Y6Kx1ZjL7Qrq4NLPSJryputX3 YQZ3OHt99Sd5+iKyXGRYXnKFqPTSCI2LFKOgB47vjGHuKu2lTyx6QSV7zqvKc8/1VifGe/ oaSOOv9K8yFwSOvhmVTGOD7blBGcxw9U0Wuc9SfzxTqxQZvGPeLEcBQxcznBhqX0mE13Eu MU0FqqK1U7sGz0wu4HhStUGrOOhSxuccYeYa64aR9oi59lJ5EpB5tnqVYqn/6MMPcEwpqn vC/IBsPIAAUTK5/4TcHll8Gc61AbZRzauOHDWokQr1z9/M0WhdSZclwdoAYsgQ== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 May 2024 11:02:19 +0200 Message-ID: <20240521090316.782-11-timo@rothenpieler.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240521090316.782-1-timo@rothenpieler.org> References: <20240521090316.782-1-timo@rothenpieler.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/13] avformat/flvdec: add support for reading multi track audio 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: Timo Rothenpieler 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/flvdec.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 890958351a..5877828c52 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -1336,12 +1336,26 @@ retry: pkt_type = flags & ~FLV_AUDIO_CODECID_MASK; if (pkt_type == AudioPacketTypeMultitrack) { - av_log(s, AV_LOG_ERROR, "Multitrack audio is unsupported!\n"); - return AVERROR_PATCHWELCOME; + uint8_t types = avio_r8(s->pb); + int multitrack_type = types >> 4; + pkt_type = types & 0xF; + + if (multitrack_type != MultitrackTypeOneTrack) { + av_log(s, AV_LOG_ERROR, "Audio multitrack types other than MultitrackTypeOneTrack are unsupported!\n"); + return AVERROR_PATCHWELCOME; + } + + multitrack = 1; + size--; } codec_id = avio_rb32(s->pb); size -= 4; + + if (multitrack) { + track_idx = avio_r8(s->pb); + size--; + } } } else if (type == FLV_TAG_TYPE_VIDEO) { stream_type = FLV_STREAM_TYPE_VIDEO; @@ -1438,7 +1452,8 @@ skip: st = s->streams[i]; if (stream_type == FLV_STREAM_TYPE_AUDIO) { if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && - (s->audio_codec_id || flv_same_audio_codec(st->codecpar, flags, codec_id))) + (s->audio_codec_id || flv_same_audio_codec(st->codecpar, flags, codec_id)) && + st->id == track_idx) break; } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && -- 2.43.2 _______________________________________________ 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".