[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 1645, Thu Oct 6 18:28:31 2005 UTC revision 1676, Tue Jan 17 19:06:25 2006 UTC
# Line 21  Line 21 
21   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
22   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23   *   *
24   * $Id: xvid_encraw.c,v 1.21 2005-10-06 18:28:31 Isibaar Exp $   * $Id: xvid_encraw.c,v 1.23 2006-01-17 19:06:25 Isibaar Exp $
25   *   *
26   ****************************************************************************/   ****************************************************************************/
27    
# Line 128  Line 128 
128  static int NUM_ZONES = 0;  static int NUM_ZONES = 0;
129    
130  /* Maximum number of frames to encode */  /* Maximum number of frames to encode */
131  #define ABS_MAXFRAMENR 9999  #define ABS_MAXFRAMENR -1 /* no limit */
132    
133  static int ARG_STATS = 0;  static int ARG_STATS = 0;
134  static int ARG_DUMP = 0;  static int ARG_DUMP = 0;
# Line 431  Line 431 
431                  return (-1);                  return (-1);
432          }          }
433    
434          if (ARG_MAXFRAMENR <= 0) {          if (ARG_MAXFRAMENR == 0) {
435                  fprintf(stderr, "Wrong number of frames\n");                  fprintf(stderr, "Wrong number of frames\n");
436                  return (-1);                  return (-1);
437          }          }
# Line 445  Line 445 
445                    ARG_INPUTTYPE==2)                    ARG_INPUTTYPE==2)
446        {        {
447                    AVISTREAMINFO avi_info;                    AVISTREAMINFO avi_info;
448                      FILE *avi_fp = fopen(ARG_INPUTFILE, "rb");
449                      if (avi_fp == NULL) {
450                              fprintf(stderr, "Couldn't open file '%s'!\n", ARG_INPUTFILE);
451                              return (-1);
452                      }
453                      fclose(avi_fp);
454    
455                    AVIFileInit();                    AVIFileInit();
456                    if (AVIStreamOpenFromFile(&avi_stream, ARG_INPUTFILE, streamtypeVIDEO, 0, OF_READ, NULL) != AVIERR_OK) {                    if (AVIStreamOpenFromFile(&avi_stream, ARG_INPUTFILE, streamtypeVIDEO, 0, OF_READ, NULL) != AVIERR_OK) {
# Line 467  Line 473 
473                return (-1);                return (-1);
474                    }                    }
475    
476    
477              if (ARG_MAXFRAMENR<0)
478                            ARG_MAXFRAMENR = avi_info.dwLength;
479                      else
480                            ARG_MAXFRAMENR = min(ARG_MAXFRAMENR, avi_info.dwLength);
481    
482                    XDIM = avi_info.rcFrame.right - avi_info.rcFrame.left;                    XDIM = avi_info.rcFrame.right - avi_info.rcFrame.left;
483                    YDIM = avi_info.rcFrame.bottom - avi_info.rcFrame.top;                    YDIM = avi_info.rcFrame.bottom - avi_info.rcFrame.top;
484                    ARG_FRAMERATE = (float) avi_info.dwRate / (float) avi_info.dwScale;                    ARG_FRAMERATE = (float) avi_info.dwRate / (float) avi_info.dwScale;
# Line 548  Line 560 
560                  char *type;                  char *type;
561                  int sse[3];                  int sse[3];
562    
563                  if (input_num >= ARG_MAXFRAMENR) {                  if (input_num >= ARG_MAXFRAMENR && ARG_MAXFRAMENR > 0) {
564                          result = 1;                          result = 1;
565                  }                  }
566    
# Line 754  Line 766 
766          clock_t clk;          clock_t clk;
767    
768          clk = clock();          clk = clock();
769          return (clk * 1000 / CLOCKS_PER_SEC);          return (clk * 1000.0 / CLOCKS_PER_SEC);
770  #endif  #endif
771  }  }
772    

Legend:
Removed from v.1645  
changed lines
  Added in v.1676

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