Commit fb6354a1 authored by François Cartegnie's avatar François Cartegnie 🤞 Committed by Jean-Baptiste Kempf
Browse files

demux: hls: handle packed MP3 and AC-3

refs #25781
parent 7fd99fbf
......@@ -54,6 +54,10 @@ std::string StreamFormat::str() const
return "Timed Text";
case Type::PackedAAC:
return "Packed AAC";
case Type::PackedMP3:
return "Packed MP3";
case Type::PackedAC3:
return "Packed AC-3";
case Type::WebM:
return "WebM";
case Type::Unsupported:
......@@ -82,6 +86,10 @@ StreamFormat::StreamFormat( const std::string &mimetype )
type = StreamFormat::Type::MP4;
else if(tail == "aac")
type = StreamFormat::Type::PackedAAC;
else if(tail == "mpeg" || tail == "mp3")
type = StreamFormat::Type::PackedMP3;
else if(tail == "ac3")
type = StreamFormat::Type::PackedAC3;
else if (tail == "mp2t")
type = StreamFormat::Type::MPEG2TS;
else if (tail == "vtt")
......@@ -132,6 +140,14 @@ StreamFormat::StreamFormat(const void *data_, size_t sz)
{
type = StreamFormat::Type::PackedAAC;
}
else if(sz > 4 && data[0] == 0xFF && (data[1] & 0xE6) > 0xE0)
{
type = StreamFormat::Type::PackedMP3;
}
else if(sz > 4 && data[0] == 0x0b && data[1] == 0x77)
{
type = StreamFormat::Type::PackedAC3;
}
}
}
......
......@@ -37,6 +37,8 @@ namespace adaptive
WebVTT,
TTML,
PackedAAC,
PackedMP3,
PackedAC3,
Unknown,
};
static const unsigned PEEK_SIZE = 4096;
......
......@@ -131,6 +131,8 @@ AbstractDemuxer *HLSStream::newDemux(vlc_object_t *p_obj, const StreamFormat &fo
switch(format)
{
case StreamFormat::Type::PackedAAC:
case StreamFormat::Type::PackedMP3:
case StreamFormat::Type::PackedAC3:
ret = new Demuxer(p_obj, "es", out, source);
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment