History

avformat/flvdec: add support for reading multi track audio

Timo Rothenpieler committed 2 years ago

Commit 25faaa31 parent bbf1f3c1 file · +18 −3Browse files

Unified · Split

libavformat/flvdec.c+18−3
@@ -1338,12 +1338,26 @@ retry: · 1337 unmodified lines
13381338 pkt_type = flags & ~FLV_AUDIO_CODECID_MASK;
13391339
13401340 if (pkt_type == AudioPacketTypeMultitrack) {
1341− av_log(s, AV_LOG_ERROR, "Multitrack audio is unsupported!\n");
1342− return AVERROR_PATCHWELCOME;
1341+ uint8_t types = avio_r8(s->pb);
1342+ int multitrack_type = types >> 4;
1343+ pkt_type = types & 0xF;
1344+
1345+ if (multitrack_type != MultitrackTypeOneTrack) {
1346+ av_log(s, AV_LOG_ERROR, "Audio multitrack types other than MultitrackTypeOneTrack are unsupported!\n");
1347+ return AVERROR_PATCHWELCOME;
1348+ }
1349+
1350+ multitrack = 1;
1351+ size--;
13431352 }
13441353
13451354 codec_id = avio_rb32(s->pb);
13461355 size -= 4;
1356+
1357+ if (multitrack) {
1358+ track_idx = avio_r8(s->pb);
1359+ size--;
1360+ }
13471361 }
13481362 } else if (type == FLV_TAG_TYPE_VIDEO) {
13491363 stream_type = FLV_STREAM_TYPE_VIDEO;
@@ -1440,7 +1454,8 @@ skip: · 90 unmodified lines
14401454 st = s->streams[i];
14411455 if (stream_type == FLV_STREAM_TYPE_AUDIO) {
14421456 if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
1443− (s->audio_codec_id || flv_same_audio_codec(st->codecpar, flags, codec_id)))
1457+ (s->audio_codec_id || flv_same_audio_codec(st->codecpar, flags, codec_id)) &&
1458+ st->id == track_idx)
14441459 break;
14451460 } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {
14461461 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t