some bugfixes
authorkramm <kramm>
Wed, 31 Mar 2004 13:41:12 +0000 (13:41 +0000)
committerkramm <kramm>
Wed, 31 Mar 2004 13:41:12 +0000 (13:41 +0000)
avi2swf/avi2swf.cc
avi2swf/videoreader_avifile.cc

index c530cbb..2042acd 100644 (file)
 
 #include "../config.h"
 
-#ifdef HAVE_SIGNAL_H
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#include <signal.h>
-#define DO_SIGNALS
-#endif
-#endif
-
-extern "C" {
 #include "../lib/args.h"
-}
 #include "v2swf.h"
 #include "videoreader_avifile.hh"
 
@@ -188,9 +178,6 @@ static char*itoa(int a)
     return toabuf;
 }
 
-static int shutdown_avi2swf = 0;
-static int frameno = 0;
-
 #ifdef DO_SIGNALS
 pthread_t main_thread;
 static void sigterm(int sig)
@@ -295,7 +282,7 @@ int main (int argc,char ** argv)
            video.getimage(&video, buf);
            video.getsamples(&video, buf, (int)((video.rate/video.fps)*video.channels*2));
            if(!verbose) {
-               printf("\rSkipping frame %d", frameno);fflush(stdout);
+               printf("\rSkipping frame %d", video.frame);fflush(stdout);
            }
        }
        free(buf);
@@ -308,7 +295,7 @@ int main (int argc,char ** argv)
        if(!l)
            break;
        if(!verbose) {
-           printf("\rConverting frame %d", frameno);fflush(stdout);
+           printf("\rConverting frame %d", video.frame);fflush(stdout);
        }
     }
     if(!verbose)
index 825d12a..781beee 100644 (file)
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <memory.h>
 #include "../config.h"
 
-extern "C" {
-#include "../lib/args.h"
-}
-#include "v2swf.h"
-#include "../lib/q.h"
-
 #undef HAVE_CONFIG_H
 
 #ifdef HAVE_VERSION_H
@@ -53,8 +50,21 @@ extern "C" {
    #define Bpp bpp
 #endif
 
+#ifdef HAVE_SIGNAL_H
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#include <signal.h>
+#define DO_SIGNALS
+#endif
+#endif
+
+#include "../lib/q.h"
 #include "videoreader.h"
 
+static int shutdown_avi2swf = 0;
+static int verbose = 0;
+static int flip = 0;
+
 typedef struct _videoreader_avifile_internal
 {
     IAviReadFile* player;
@@ -138,8 +148,7 @@ static int videoreader_avifile_getimage(videoreader_t* v, void*buffer)
        img = img2;
     }
 
-
-    frameno++;
+    v->frame++;
     i->frame++;
     unsigned char*data = img->Data();
     int bpp = img->Bpp();
@@ -199,13 +208,13 @@ int videoreader_avifile_open(videoreader_t* v, char* filename)
     memset(i, 0, sizeof(videoreader_avifile_internal));
     memset(v, 0, sizeof(videoreader_t));
     v->getsamples = videoreader_avifile_getsamples;
-    v->getinfo = videoreader_avifile_getinfo;
     v->close = videoreader_avifile_close;
     v->eof = videoreader_avifile_eof;
     v->getimage = videoreader_avifile_getimage;
     v->getsamples = videoreader_avifile_getsamples;
     v->setparameter = videoreader_avifile_setparameter;
     v->internal = i;
+    v->frame = 0;
     
     i->do_video = 1;
     i->do_audio = 1;