--- trunk/xvidcore/examples/ex1/ex1.c 2002/05/24 00:25:00 182 +++ trunk/xvidcore/examples/ex1/ex1.c 2002/06/19 01:00:14 222 @@ -1,13 +1,16 @@ /******************************************************************************* * This file is a example for how to use the xvid core to compress YUV file * -* +* 0.01b 28.05.2002 chenm001 +* fix a little bug for encode only codec I frame +* 0.01a 27.05.2002 chenm001 +* fix a little bug for BFRAMES define locate * 0.01 23.05.2002 chenm001 * the BFRAME option must be match to core compile option *******************************************************************************/ -#include "ex1.h" #define BFRAMES +#include "ex1.h" int Encode(char *, int, int, char *); int Decode(char *, int, int, char *); @@ -52,7 +55,9 @@ param->max_quantizer = 31; param->max_key_interval = 100; +#ifdef BFRAMES param->max_bframes = 0; // Disable B-frame +#endif } void set_enc_frame(XVID_ENC_FRAME *frame) @@ -116,6 +121,7 @@ // Encode Frame temp=fread(inBuf, 1, width*height*3/2, fpi); // Read YUV data while(temp == width*height*3/2){ + //printf("Frames=%d\n",num); set_enc_frame(&frame); if (!(num%param.max_key_interval)) frame.intra = 1; // Encode as I-frame @@ -124,6 +130,7 @@ xvid_encore(param.handle, XVID_ENC_ENCODE, &frame, &stats); fwrite(outBuf, 1, frame.length, fpo); temp=fread(inBuf, 1, width*height*3/2, fpi); // Read next YUV data + num++; } // Free Encode Core