[XviD-devel] Fw: libxvidcore decompression

reno reballos rreballos at yahoo.com
Thu Apr 17 04:35:22 CEST 2008


Hi Dark Sylinc,

thank you for the prompt reply...

i tried this method but didnt work out well as i wanted it to be...:
        
#define BUFFER_SIZE (1024*1024*3)
         FILE *fpi;
        long lFileSize = 0;
        unsigned char *gmp4_buffer = 0;
        gmp4_buffer = (unsigned char *)malloc(BUFFER_SIZE);

        /*seek from the beginning of the file*/
        fseek(fpi,0,SEEK_END);

         /*obtain the file size to determine the buffer size*/
        lFileSize = ftell(fpi);<-------- i got the file size here equivalent to the size of my to be read file

        /*rewind the file since we got now the file size*/
        rewind(fpi);
       
         /*allocate the buffer size where the read stream from fpi to be temporarily stored*/
        gmp4_buffer = (unsigned char *) malloc (lFileSize);

        /*read the content of the fpi */
      int useful_bytes = fread(gmp4_buffer, sizeof(char), lFileSize, fpi);<-----useful_bytes is equal to        the lFileSize, but the most important issue here is i got no data inside my gmp4_buffer supposedly there should have data the gmp4_buffer container of the read data from fpi

        /*checking values*/
        if(gmp4_buffer==0)
        {
            Msg(TEXT("gmp4_buffer is empty, cannot read from file"));
        }

        /*decode the frame, gmp4_buffer input stream for the decoder and dec_outBuf is the output             stream for the decoder*/
        int used_bytes = dec_decode(gmp4_buffer, dec_outBuf);<----- i got a return value from the used_bytes which is 28, since i got no data from the gmp4_buffer as input, dec_outBuf too has no output as a product of the decoding process
      
//-------------------------------- not so important ---------------------------
        /*saving the encoded data stream into single file*/
        sprintf(FileNames, "%sdec%05d.pgm", FilePath, totalframe);
        fpo = fopen(FileNames, "w+b");
        if(fpo==NULL)
        {
            Msg(TEXT("Error opening the file for writing"));
        }

        /*writing the data into file*/
        writedata = fwrite(dec_outBuf,1,used_bytes,fpo);
        totalframe++;


..... i think i have almost done it... only that i am suspecting something within the reading of my file since it does not give me reasonable data from the fpi... hope i can hear more technical thing about on this...

sorry for the long email.. just want to make it clear... thank you for the time...


regards,
reno






      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


More information about the XviD-devel mailing list