[svn] / trunk / xvidcore / examples / xvid_encraw.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/xvid_encraw.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1884, Tue Mar 9 14:56:02 2010 UTC revision 1885, Tue Mar 9 16:25:17 2010 UTC
# Line 22  Line 22 
22   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
23   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
24   *   *
25   * $Id: xvid_encraw.c,v 1.40 2010-03-09 14:56:02 Isibaar Exp $   * $Id: xvid_encraw.c,v 1.41 2010-03-09 16:25:17 Isibaar Exp $
26   *   *
27   ****************************************************************************/   ****************************************************************************/
28    
# Line 345  Line 345 
345          int use_assembler = 1;          int use_assembler = 1;
346          int i;          int i;
347    
 #if defined(XVID_AVI_INPUT)  
         PAVIFILE avi_in = NULL;  
         PAVISTREAM avi_in_stream = NULL;  
         PGETFRAME get_frame = NULL;  
 #else  
 #define get_frame NULL  
 #endif  
 #if defined(XVID_AVI_OUTPUT)  
         PAVIFILE myAVIFile = NULL;  
         PAVISTREAM myAVIStream = NULL;  
         BITMAPINFOHEADER myBitmapInfoHeader;  
 #endif  
 #if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT)  
         AVIFileInit();  
 #endif  
 #ifdef XVID_MKV_OUTPUT  
         PMKVFILE myMKVFile=NULL;  
         PMKVSTREAM myMKVStream=NULL;  
         MKVSTREAMINFO myMKVStreamInfo;  
 #endif  
   
348          printf("xvid_encraw - raw mpeg4 bitstream encoder ");          printf("xvid_encraw - raw mpeg4 bitstream encoder ");
349          printf("written by Christoph Lampert\n\n");          printf("written by Christoph Lampert\n\n");
350    
# Line 834  Line 813 
813          }          }
814    
815          if (ARG_INPUTFILE != NULL) {          if (ARG_INPUTFILE != NULL) {
816  #ifdef XVID_AVI_INPUT  #if defined(XVID_AVI_INPUT)
817        if (strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avs")==0 ||        if (strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avs")==0 ||
818            strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avi")==0 ||            strcmp(ARG_INPUTFILE+(strlen(ARG_INPUTFILE)-3), "avi")==0 ||
819                    ARG_INPUTTYPE==2)                    ARG_INPUTTYPE==2)
820        {        {
821                      PAVIFILE avi_in = NULL;
822                      PAVISTREAM avi_in_stream = NULL;
823                      PGETFRAME get_frame = NULL;
824                      BITMAPINFOHEADER myBitmapInfoHeader;
825                    AVISTREAMINFO avi_info;                    AVISTREAMINFO avi_info;
   
826                    FILE *avi_fp = fopen(ARG_INPUTFILE, "rb");                    FILE *avi_fp = fopen(ARG_INPUTFILE, "rb");
827    
828                      AVIFileInit();
829    
830                    if (avi_fp == NULL) {                    if (avi_fp == NULL) {
831                            fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE);                            fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE);
832                            return (-1);                            return (-1);
# Line 934  Line 919 
919    
920                    if (get_frame) AVIStreamGetFrameClose(get_frame);                    if (get_frame) AVIStreamGetFrameClose(get_frame);
921                    if (avi_in_stream) AVIStreamRelease(avi_in_stream);                    if (avi_in_stream) AVIStreamRelease(avi_in_stream);
922                      AVIFileExit();
923        }        }
924        else        else
925  #endif  #endif
# Line 1162  Line 1148 
1148    
1149    release_all:    release_all:
1150    
 #if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT)  
         AVIFileExit();  
 #endif  
   
1151          return (0);          return (0);
   
1152  }  }
1153    
1154  /*****************************************************************************  /*****************************************************************************
# Line 1210  Line 1191 
1191    
1192          char filename[256];          char filename[256];
1193    
1194    #ifdef XVID_MKV_OUTPUT
1195            PMKVFILE myMKVFile = NULL;
1196            PMKVSTREAM myMKVStream = NULL;
1197            MKVSTREAMINFO myMKVStreamInfo;
1198    #endif
1199  #if defined(XVID_AVI_INPUT)  #if defined(XVID_AVI_INPUT)
1200          PAVIFILE avi_in = NULL;          PAVIFILE avi_in = NULL;
1201          PAVISTREAM avi_in_stream = NULL;          PAVISTREAM avi_in_stream = NULL;
1202          PGETFRAME get_frame = NULL;          PGETFRAME get_frame = NULL;
1203            BITMAPINFOHEADER myBitmapInfoHeader;
1204  #else  #else
1205  #define get_frame NULL  #define get_frame NULL
1206  #endif  #endif
# Line 1222  Line 1209 
1209          PAVIFILE myAVIFile=NULL;          PAVIFILE myAVIFile=NULL;
1210          PAVISTREAM myAVIStream=NULL;          PAVISTREAM myAVIStream=NULL;
1211          AVISTREAMINFO myAVIStreamInfo;          AVISTREAMINFO myAVIStreamInfo;
1212          BITMAPINFOHEADER myBitmapInfoHeader;  #endif
1213    #if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT)
1214            if (ARG_NUM_APP_THREADS > 1)
1215                    CoInitializeEx(0, COINIT_MULTITHREADED);
1216            AVIFileInit();
1217  #endif  #endif
1218    
1219          if (ARG_INPUTFILE == NULL || strcmp(ARG_INPUTFILE, "stdin") == 0) {          if (ARG_INPUTFILE == NULL || strcmp(ARG_INPUTFILE, "stdin") == 0) {
# Line 1236  Line 1227 
1227                    AVISTREAMINFO avi_info;                    AVISTREAMINFO avi_info;
1228                    FILE *avi_fp = fopen(ARG_INPUTFILE, "rb");                    FILE *avi_fp = fopen(ARG_INPUTFILE, "rb");
1229    
                   if (ARG_NUM_APP_THREADS > 1)  
                           CoInitializeEx(0, COINIT_MULTITHREADED);  
   
1230                    if (avi_fp == NULL) {                    if (avi_fp == NULL) {
1231                            fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE);                            fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE);
1232                            return;                            return;
# Line 1722  Line 1710 
1710          if (myMKVStream) MKVStreamRelease(myMKVStream);          if (myMKVStream) MKVStreamRelease(myMKVStream);
1711          if (myMKVFile) MKVFileRelease(myMKVFile);          if (myMKVFile) MKVFileRelease(myMKVFile);
1712  #endif  #endif
1713    #if defined(XVID_AVI_INPUT) || defined(XVID_AVI_OUTPUT)
1714            AVIFileExit();
1715    #endif
1716    
1717    free_all_memory:    free_all_memory:
1718          free(out_buffer);          free(out_buffer);

Legend:
Removed from v.1884  
changed lines
  Added in v.1885

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4