Decoding stream

"Marco Filippini" <[email protected]>
Newsgroups gmane.comp.video.xvid.devel
Message-ID <[email protected]>
 

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.