Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] PCM audio in MPEG2 stream



Andreas Schultz writes:
 > Hi developers,
 > 
 > I'm sorry, but i have to steal some of your time.
 > 
 > For the last month i have tried to construct an MPEG2 stream with LPCM 
 > audio in it, that willplay back correctly through the DVB card.
 > 
 > I can only make it *almost* work.
 > 
 > The source for the audio and video is a DVD. The DVD AC3 track is 
 > converted to LPCM and the reinserted in the MPEG2 video stream.
 > As long as i don't use PTS for the audio stream, everything is fine.
 > 
 > Trouble starts when i copy the PTS from the orignial AC3 frame into the 
 > LPCM frame. A single AC3 frames will expand to more than one LPCM audio 
 > frame and i can obviously use the PTS only for the first LPCM frame.
 > 
 > 1. do i have to calculate and insert PTS for every LPCM audio frame i'm
 >     sending to the card?
 > 
 > What i'm currently seeing are variouse degress of picture and audio 
 > distortions depending on when i'm sending the frames. I order to narrow 
 > down the cause of the problem, could you please clarify the following 
 > points,
 > 
 > 2. does audio/video syncing handled in the kernel driver or in the
 >     firmware?

Neither, the hardware or maybe the firmware ROM + video/audio
microcodes do this for normal MPEG sound.
We have no sources for either.

Syncing of PCM was never supported. I hacked simple support into the
"firmware" (not the ROM but the volatile part which is loaded at
driver init time).
 
 > 3. How big are the video and audio buffers on the card (in bytes and/or
 >     in ms)

I'll have to look up the exact numbers, but video is around 240K and
audio around 8K.
 
 > 4. how (by what criteria) is audio and video synced at the moment?
 >     (could you provide some pseudo code on how it is done?)

I just set the current SCR to the PTS minus the amount of PCM data in
the audio buffer. SCR=PTS - (audiobufferdata)/(data per 1/90000 seconds)
This works very well with the DVD with PCM audio I have.

 
 > 5. what is the minimum required and maximum allowed latency for LPCM
 >     audio frames, so that the stream will stay in sync?

None. The audio has to give the right timing.


 > 6. do the video and audio PTS need to match, i.e. should i align audio
 >     packets, so that their presentation time macthes at a video frame
 >     PTS?
 > 
 > Also, i would be extremly helpfull, if you could provide a sample 
 > MPEG2/LPCM stream with audio PTS that plays correctly. I appear to be 
 > unable to generate one myself.

Sorry, I only have one on the DVD I mentioned above and that's
copyrighted. I bought it in a local electronics store a year or so ago to
get the PCM playback working. 


Ralph


-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.


Home | Main Index | Thread Index