/** @file test_vetLinuxXVIDPlayer.cpp * * @brief Testing code for class vetCodec_XVID and vetWindowQT. * * * @warning requires VETLib with MPEG support and GUI support (make all) * * @see vetCodec_MPEG * @see vetWindowQT * @see app_Video4LinuxPlayer.cpp * @see app_LinuxMOVPlayer.cpp * * @version 1.0.2 * @date 11/09/2005 * @author Alessandro Polo * * **************************************************************************** * VETLib Framework 1.02 * Copyright (C) Alessandro Polo 2005 * http://www.ewgate.net/vetlib * ****************************************************************************/ //--------------------------------------------------------------------------- #pragma hdrstop //--------------------------------------------------------------------------- #include "../source/vetFrameRGB24.h" #include "../source/vetUtility.h" #include "../source/outputs/vetWindowQT.h" #include "../source/outputs/vetDoctor.h" #include "../source/codecs/vetCodec_XVID.h" #include #pragma argsused int main(int argc, char* argv[]) { printf("Testing vetCodec_XVID and vetWindowQT Development...\n"); printf("\nCreating Instances...\n"); vetDoctor doc; int i = 0; long time = 0; float fps = 0 ; vetCodec_XVID xvidSource; printf("\nLoading Movie...\n"); int ret = xvidSource.load("football.avi"); if ( ret == VETRET_OK) printf("XVID Stream loaded.\n"); else { printf("XVID Stream HAS NOT BEEN loaded. (file football.avi not found?)\n"); return 1; } // xvidSource >> img; vetFrameRGB24 img24 ( xvidSource.getWidth(), xvidSource.getHeight() ); printf("\nMPEG Stream INFO:\n"); printf(" VIDEO STREAM [0] WIDTH: %d\n", xvidSource.getWidth() ); printf(" VIDEO STREAM [0] HEIGHT: %d\n", xvidSource.getHeight() ); printf("\nCreating QApplication...\n"); QApplication app(argc, argv); printf("\nCreating QWindow...\n"); vetWindowQT *myapp = new vetWindowQT(xvidSource.getWidth(), xvidSource.getHeight() ); printf("\nShowing vetWindowQT...\n"); myapp->show(); app.setMainWidget(myapp); printf("\nDecoding and Displaying (with vetFrameRGB24)...\n"); // double offset = 0; // long sleeptime = (long) (1000 / xvidSource.getVideoFrameRate()) - 10; //-10 to speed up a bit :P doc.reset(true); while (i++ < 100) { // offset = vetUtility::getTime_usec(); xvidSource >> img24; *myapp << img24; // vetUtility::vetSleep( sleeptime - (long)(vetUtility::getTime_usec()-offset)/1000 ); } time = doc.getElapsedTime(); fps = (float)100000/(float)doc.getElapsedTime(); printf("Elapsed milliseconds : %ld\n", time ); printf("Average Frame Rate : %f fps\n", fps ); app.exec(); printf("Test Completed. Type something to continue...\n"); getchar(); return 0; } //---------------------------------------------------------------------------