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
1338 pkt_type = flags & ~FLV_AUDIO_CODECID_MASK;1338 pkt_type = flags & ~FLV_AUDIO_CODECID_MASK;
1339 1339
1340 if (pkt_type == AudioPacketTypeMultitrack) {1340 if (pkt_type == AudioPacketTypeMultitrack) {
1341 av_log(s, AV_LOG_ERROR, "Multitrack audio is unsupported!\n");1341 uint8_t types = avio_r8(s->pb);
1342 return AVERROR_PATCHWELCOME;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--;
1343 }1352 }
1344 1353
1345 codec_id = avio_rb32(s->pb);1354 codec_id = avio_rb32(s->pb);
1346 size -= 4;1355 size -= 4;
1356
1357 if (multitrack) {
1358 track_idx = avio_r8(s->pb);
1359 size--;
1360 }
1347 }1361 }
1348 } else if (type == FLV_TAG_TYPE_VIDEO) {1362 } else if (type == FLV_TAG_TYPE_VIDEO) {
1349 stream_type = FLV_STREAM_TYPE_VIDEO;1363 stream_type = FLV_STREAM_TYPE_VIDEO;
@@ -1440,7 +1454,8 @@ skip: · 90 unmodified lines
1440 st = s->streams[i];1454 st = s->streams[i];
1441 if (stream_type == FLV_STREAM_TYPE_AUDIO) {1455 if (stream_type == FLV_STREAM_TYPE_AUDIO) {
1442 if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&1456 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)
1444 break;1459 break;
1445 } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {1460 } else if (stream_type == FLV_STREAM_TYPE_VIDEO) {
1446 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&1461 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