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 ...@@ -54,6 +54,10 @@ std::string StreamFormat::str() const
return "Timed Text"; return "Timed Text";
case Type::PackedAAC: case Type::PackedAAC:
return "Packed AAC"; return "Packed AAC";
case Type::PackedMP3:
return "Packed MP3";
case Type::PackedAC3:
return "Packed AC-3";
case Type::WebM: case Type::WebM:
return "WebM"; return "WebM";
case Type::Unsupported: case Type::Unsupported:
...@@ -82,6 +86,10 @@ StreamFormat::StreamFormat( const std::string &mimetype ) ...@@ -82,6 +86,10 @@ StreamFormat::StreamFormat( const std::string &mimetype )
type = StreamFormat::Type::MP4; type = StreamFormat::Type::MP4;
else if(tail == "aac") else if(tail == "aac")
type = StreamFormat::Type::PackedAAC; 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") else if (tail == "mp2t")
type = StreamFormat::Type::MPEG2TS; type = StreamFormat::Type::MPEG2TS;
else if (tail == "vtt") else if (tail == "vtt")
...@@ -132,6 +140,14 @@ StreamFormat::StreamFormat(const void *data_, size_t sz) ...@@ -132,6 +140,14 @@ StreamFormat::StreamFormat(const void *data_, size_t sz)
{ {
type = StreamFormat::Type::PackedAAC; 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 ...@@ -37,6 +37,8 @@ namespace adaptive
WebVTT, WebVTT,
TTML, TTML,
PackedAAC, PackedAAC,
PackedMP3,
PackedAC3,
Unknown, Unknown,
}; };
static const unsigned PEEK_SIZE = 4096; static const unsigned PEEK_SIZE = 4096;
......
...@@ -131,6 +131,8 @@ AbstractDemuxer *HLSStream::newDemux(vlc_object_t *p_obj, const StreamFormat &fo ...@@ -131,6 +131,8 @@ AbstractDemuxer *HLSStream::newDemux(vlc_object_t *p_obj, const StreamFormat &fo
switch(format) switch(format)
{ {
case StreamFormat::Type::PackedAAC: case StreamFormat::Type::PackedAAC:
case StreamFormat::Type::PackedMP3:
case StreamFormat::Type::PackedAC3:
ret = new Demuxer(p_obj, "es", out, source); ret = new Demuxer(p_obj, "es", out, source);
break; 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