[XviD-devel] Decoding stream

Marco Filippini marco.filippini at cisitaly.com
Fri Jun 20 09:46:05 CEST 2008


 

I'm trying to decode a stream, but I'm stuck with a problem.

I've tried to follow the xvid_decraw sample converting it into C#, using
pointers where needed.

Basically I have a loop where I read bytes from the stream into a fixed size
buffer of 1024 * 1024 bytes until the end of the stream is reached, then
another nested loop iterates through the encoded frames inside the buffer to
decode them until the bytes of the buffer are done incrementing the pointer
to the buffer of the bytes used.

I check the stats for each call to the decode function to analyze the frame
type (VOL, NOTHING, IVOP, PVOP etc.) and take the necessary action.

Everything is fine until I'm close to the end of the buffer, the last call
to the decode function returns a value of used bytes greater of the length
property of the xvid_dec_frame_t structure.

Since then the decoded frames are wrong.

I've tried not to increment the bytes used in this last case, so they can be
reused with the following buffer fill, but it doesn't work.

The only workaround I've found is to avoid the last calls and exit the inner
loop with an amount of bytes still to be used, but this amount is not easily
predictable.

Somewhere in the forums I've read that the decode function wants to eat a
full frame each time it is called, is it true?

Does anybody have a workable solution?

I don't mind to break my code if is wrong, I havent't find any updated docs
on xvid but the sample in the sources.

 

Thank you in advance

 

Marco

 

P.S. I've compiled the sources and the sample, and I've tried to use the
xvid_decraw executable with an avi xvid file containing a tv movie, but it
fails with a crash. L

 



More information about the XviD-devel mailing list