[MPlayer-dev-eng] Ac3 streams detected as LPCM or SPU in TS
James Courtier-Dutton
James at superbug.demon.co.uk
Sat Jun 5 13:15:44 CEST 2004
lordvader at swiftdsl.com.au wrote:
> Hi. This is my first posting to this list, and my first real attempt at
> hacking mplayer :)
>
> I've been playing around with the transport stream demuxer in order to get
> ac3
> sound working properly for Australian HDTV streams. It has become apparent
> that the streams provided are being detected as LPCM streams, and DVD
> subtitles rather than a proper ac3 stream.
> The dvb card I'm using is the VisionPlus DVB-T, which uses the bt848 chipset.
> It also requires "TWINHAN DST based DVB-S frontend" and "Nebula/Pinnacle PCTV
> PCI cards". From what I understand, this card does not provide PMT, hence pid
> autodetection is required, which is where this falls apart.
>
> If I alter the condition
> if((type_from_pmt == AUDIO_A52) ||(p[0] == 0x0B && p[1] == 0x77)) from
> pes_parse2 to be true, i get ac3 playback. Of course, this is just a test, as
> any subtitles in the stream will then the detected as ac3.
>
This is a well known problem, and xine has the same problem.
1) The DVB card cannot output the PAT or PMT
One has to use the DVB API to gather that information.
As a result the file saved from that DVB card will not have a PAT or
PMT. Really the program saving the file should add PAT and PMT for every
10s of the stream before it saves it, but I don't think any linux
programs do this currently.
2) We are left with TS streams without any PAT or PMT.
3) The AC3 is placed in private_stream_1
4) The AC3 in private_stream_1 is not in sync with the PES pack.
i.e. The beginning of an AC3 pack does not necessarily apprear at the
start of a PES pack.
Solution:
When one starts playing the stream with a private_stream_1, that
particular PID should be marked as unidentified.
TS pack should be buffered up until 2*AC3 packet length.
Once buffered, content detection should be done on the buffered packet.
This content detection should probably search the buffer for the AC3
header (0x0b, 0x77) and then maybe do a AC3 CRC check on the next 1536
bytes. Once identified, all future TS packs can be sent to the AC3 decoder.
Problems with this method: -
What if the user changed channels while recording. The content of the
PID might change from AC3 to subtitles!
Cheers
James
More information about the MPlayer-dev-eng
mailing list