added vfw videoreader.
authorkramm <kramm>
Mon, 20 Sep 2004 16:09:15 +0000 (16:09 +0000)
committerkramm <kramm>
Mon, 20 Sep 2004 16:09:15 +0000 (16:09 +0000)
avi2swf/avi2swf.cc

index dc9f5fe..82d70c6 100644 (file)
 
 #include "../lib/args.h"
 #include "v2swf.h"
 
 #include "../lib/args.h"
 #include "v2swf.h"
+#ifdef WIN32
+#include "videoreader_vfw.hh"
+#else
 #include "videoreader_avifile.hh"
 #include "videoreader_avifile.hh"
+#endif
 
 static char * filename = 0;
 static char * outputfilename = "output.swf";
 
 static char * filename = 0;
 static char * outputfilename = "output.swf";
@@ -226,7 +230,11 @@ int main (int argc,char ** argv)
        exit(1);
     }
 
        exit(1);
     }
 
+#ifdef WIN32
+    ret = videoreader_vfw_open(&video, filename);
+#else
     ret = videoreader_avifile_open(&video, filename);
     ret = videoreader_avifile_open(&video, filename);
+#endif
 
     if(!ret) {
        printf("Error opening %s\n", filename);
 
     if(!ret) {
        printf("Error opening %s\n", filename);
@@ -236,7 +244,7 @@ int main (int argc,char ** argv)
     if(verbose) {
        printf("| video framerate: %f\n", video.fps);
        printf("| video size: %dx%d\n", video.width, video.height);
     if(verbose) {
        printf("| video framerate: %f\n", video.fps);
        printf("| video size: %dx%d\n", video.width, video.height);
-       printf("| audio rate: %d\n", video.rate);
+       printf("| audio rate: %d\n", video.samplerate);
        printf("| audio channels: %d\n", video.channels);
     }
 
        printf("| audio channels: %d\n", video.channels);
     }
 
@@ -265,7 +273,7 @@ int main (int argc,char ** argv)
        printf("\n");
 
     if(audio_adjust>0) {
        printf("\n");
 
     if(audio_adjust>0) {
-       int num = ((int)(audio_adjust*video.rate))*video.channels*2;
+       int num = ((int)(audio_adjust*video.samplerate))*video.channels*2;
        void*buf = malloc(num);
        video.getsamples(&video, buf, num);
        free(buf);
        void*buf = malloc(num);
        video.getsamples(&video, buf, num);
        free(buf);
@@ -284,7 +292,7 @@ int main (int argc,char ** argv)
        void*buf = malloc(video.width*video.height*4);
        for(t=0;t<skip;t++) {
            video.getimage(&video, buf);
        void*buf = malloc(video.width*video.height*4);
        for(t=0;t<skip;t++) {
            video.getimage(&video, buf);
-           video.getsamples(&video, buf, (int)((video.rate/video.fps)*video.channels*2));
+           video.getsamples(&video, buf, (int)((video.samplerate/video.fps)*video.channels*2));
            if(!verbose) {
                printf("\rSkipping frame %d", video.frame);fflush(stdout);
            }
            if(!verbose) {
                printf("\rSkipping frame %d", video.frame);fflush(stdout);
            }