Re: Fw: libxvidcore decompression

Stephan Assmus <[email protected]>
Newsgroups gmane.comp.video.xvid.devel
Message-ID <[email protected]>
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". :-)
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.