[mythtv] [Experimental PATCH] BIG DVB PATCH V3.2 Released
Marcus Metzler
mocm at mocm.de
Mon Dec 20 11:38:12 UTC 2004
>>>>> "Tj" == Tj <htpc at treblid.dyndns.org> writes:
Tj> Tj wrote:
>> But mythfrontend crashes... ---- mythfronend --- 2004-12-20
>> 16:51:21.932 AvFormatDecoder: Could not find decoder for codec
>> (86021) aborting. free(): invalid pointer 0xaf3ee0a8!
>>
Tj> Prob why it crashes on my machine is because in
Tj> libs/libavformat/mpeg.c, ac3 is still looking for 0x80 instead
Tj> of 0x1bd, and left codec_id uninitialised.My diff at the end
Tj> of this email fixes the crash but introduce another problem -
Tj> switching from a channel with AC3 to a channel with MPEG2 will
Tj> result in the following message "WriteAudio: buffer
Tj> underrun".. The video is fine, but there's no sound. But once
Tj> I restart livetv again, sound is back, until I change channel
Tj> that uses a different codec.
Tj> * in mpeg.c, should "#define AC3_ID 0x80" be "#define AC3_ID
Tj> 0xbd" instead? There seem to be inconsisties around AC3_ID..
Tj> * the part where I commented out in mpegps_read_pes_header
Tj> isn't correct, but app will crash if I leave it in.. What is
Tj> the correct way to fix this?
Just to write it down and clear up some misconceptions:
AC3 in an MPEG stream, either trnsport or program stream, is packaged
in private stream 1 PES packets. Those start with 0x00 0x00 0x01 0xbd
followed by the usual PES header information concerning PTS etc.
Usually PES packets contain elementary streams in their payload. For
private streams this can be different, that's why they are called
private.
There are private streams for AC3, LPCM and DTS are defined by the DVD
specifications. They call for an additional header inside the PES
payload (not the PES header). For AC3 it is a for byte header
containing the AC3 id (0x80 - 0x87), the number of AC3 frames in the
payload ( 1 byte) and a two byte pointer pointing to the first frame
in the payload.
DVB and ATSC don't need those extra headers, the id is done by the
PIDs of the transport stream header and those other pointers are not
really necessary.
So setting 0xbd as AC3 id is just as wrong as 0x80, neither is a sure
way to recognize AC3 streams.
So if your MPEG player is based on DVD standards it needs the 4 byte
header in the private stream 1 PES payload.
I add the header in transform.c, but only if I see a private stream 1
header (not if the AC3 PES is turned into 0xc0 mpeg audio PES). Even
then I check if I can find an AC3 frame and add the information
(number of frames and first frame start) to the AC3 header in the
repacked private stream 1 PES.
So the AC3 problem should be fixed in CorrectStreamNumber, which it is
by the latest patch and nowhere else.
Marcus
--
/--------------------------------------------------------------------\
| Dr. Marcus O.C. Metzler | |
| mocm at metzlerbros.de | http://www.metzlerbros.de/ |
\--------------------------------------------------------------------/
|>>> Quis custodiet ipsos custodies <<<|
More information about the mythtv-dev
mailing list