On Sunday 04 December 2005 00:58, Kevin Atkinson wrote:
> When playing back an mpeg with encoded VBI data the closed caption
> are displaying 1-2 seconds too early.  This time seams to correspond
> with the encoding delay.  Also the pack headers before each VBI
> packet are bogus: the System Clock Reference is always 36036 and the
> mux rate is not the same as the other pack headers.
>
>  From reading the ivtv-devel this seams like a known problem which
> isn't fixed because the developer didn't have an NTSC system.  Thus,
> I am more than willing to work with anyone to fix this problem.  I am
> a competent programmer myself so if someone can point me in the right
> direction I am willing to take a stab at fixing it myself.

Great! It is indeed something that I cannot test myself as PAL doesn't 
have CC. The delay can be caused by the encoding, the decoding or both. 
I suspect the encoding. The root of the problem is that while the 
firmware does support VBI insertion in the MPEG file the resulting MPEG 
stream is corrupt. So instead the driver mixes in the VBI stream on the 
fly.

Unfortunately it isn't clear if the VBI stream and the MPEG stream are 
synchronized. And if they aren't, how they should be synchronized.

The private packet containing the VBI data is created in ivtv-vbi.c, 
function copy_vbi_data(). The pack header is created here so any bugs 
in that should be fixed here. Right now it is very simplistic and I'm 
not surprised that it isn't 100% according to specs. It processes the 
sliced VBI data from the current frame and puts the resulting mpeg 
packet in the vbi_sliced_mpeg_data array. (Be sure to read README.vbi 
for more info). Currently the format of the private packet is 
ivtv-specific. But see ticket #59 for plans to add DVB standards for 
better support.

The ivtv_read() function in ivtv-fileops.c mixes in the VBI mpeg 
packets. My guess is that this is where the sync fails. It's a horrible 
function and in dire need of a rewrite.

The copy_vbi_data() function receives a PTS value from the firmware. 
Unfortunately, when receiving the MPEG stream no such timestamp is 
passed to us from the firmware.

I don't know if there is anything in the MPEG stream that will help sync 
the two. You may also want to look at the IVTV_API_ENC_MISC and 
IVTV_API_PREV_DMA_INFO_MB_9 commands in doc/fw-encoder-api.txt. They 
both do something with timestamps.

Feel free to ask questions, I'm glad someone is willing to take this up.

        Hans

_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to