[XviD-devel] Fw: libxvidcore decompression
Stephan Assmus
superstippi at gmx.de
Wed Apr 16 14:48:56 CEST 2008
reno reballos wrote:
> Hi DarkSylinc,
>
> i have done already the encoding part using the xvid_encraw as reference
> forthe encoding of the video, no problem with the playback of the encoded
> videoand right now i am stock with the decoding part of the compressed
> video that ihave. specifically in the reading of the compressed video
> file from directoryjust like what the xvid_decraw did in the
> decompression of the compressed videobut the only problem is when i read
> the file i get zero as a return value inreturn decompression does not
> decompress any data at all: this is exactlywhat i did in the reading of
> the .m4v file
>
> 1. open the file through
> FILE *fpi = NULL;
> fpi = fopen("c:\\sample_file.m4v","r+b");
> if(fpi==NULL)
> Msg(TEXT("Error openingthe file"));
>
> I GOT NO ERROR WHEN OPENING THE FILE...
>
> 2. determine the buffer size to allocate for the read stream buffer
> through
> fseek(fpi,0,SEEK_END);
You are seeking to the end of the file!
> long lFileSize = ftell(fpi);
> unsigned char *buffer = NULL;
> buffer = (unsigned char *) malloc (lFileSize);
> int useful_bytes = fread(buffer, 1, lFileSize, fpi);
And of course you get zero bytes when reading it, since it is already at
the end. :-)
> if(useful_bytes==NULL)
> Msg(TEXT("Errorreading to file"));
>
> I GOT ZERO BUFFER VALUE HERE!..
Best regards,
-Stephan
P.S. Don't use ALL-CAPS typing, it could be misunderstood as "yelling". :-)
More information about the XviD-devel
mailing list