/** @file test_vetLinuxMOVPlayer.cpp * * @brief Testing code for class vetCodec_MOV and vetWindowQT. * * Load first video stream from a QuickTime format file and * show preview in a window , stream is passed through * vetFrameRGB24 objects. * Frame rate should be the higher possible, after 100 frames, * loop will exit printing average fps; this number depends * on source rate and window's redrawing both (sum). * Then last captured frame is saved. * * @warning requires VETLib with QuickTime support and GUI support (make all) * * @note vetWindowQT must be initialized after QApplication. * * @see vetCodec_MOV * @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_MOV.h" #include #pragma argsused int main(int argc, char* argv[]) { printf("Testing vetCodec_MOV and vetWindowQT Development...\n"); printf("\nCreating Instances...\n"); vetDoctor doc; vetCodec_MOV movSource; int i = 0; long time = 0; float fps = 0 ; printf("\nLoading Movie...\n"); int ret = movSource.load("hand.mov"); if ( ret == VETRET_OK) printf("MOV Stream loaded.\n"); else { printf("MOV Stream HAS NOT BEEN loaded. (file hand.mov not found?)\n"); return 1; } vetFrameRGB24 imgRGB24 ( movSource.getWidth(), movSource.getHeight() ); printf("\nMOV Stream INFO:\n"); printf(" Video StreamS Count: %d\n", movSource.getVideoStreamCount() ); printf(" Video Stream [0] Frame Rate: %f\n", movSource.getVideoFrameRate() ); printf(" Video Stream [0] Frame Count: %ld\n", movSource.getVideoStreamLength() ); printf(" Video Stream [0] Width: %d\n", movSource.getWidth() ); printf(" Video Stream [0] Height: %d\n", movSource.getHeight() ); printf(" Audio StreamS Count: %d\n", movSource.getAudioStreamCount() ); printf(" Audio Stream [0] Channels: %d\n", movSource.getAudioChannels() ); printf(" Audio Stream [0] Sample Rate: %f\n", movSource.getAudioSampleRate() ); printf(" Audio Stream [0] Sample Count: %ld\n", movSource.getAudioStreamLength() ); printf("\nCreating QApplication...\n"); QApplication app(argc, argv); printf("\nCreating QWindow...\n"); vetWindowQT *myapp = new vetWindowQT( movSource.getWidth(), movSource.getHeight() ); printf("\nShowing vetWindowQT...\n"); myapp->show(); app.setMainWidget(myapp); printf("\nDecoding and Displaying (with vetFrameRGB24)...\n"); long sleeptime = (long) (1000 / movSource.getVideoFrameRate()) - 10; //-10 to speed up a bit :P double offset = 0; i = 0; doc.reset(true); while (i++ < 100) { offset = vetUtility::getTime_usec(); movSource >> imgRGB24; *myapp << imgRGB24; 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; } //---------------------------------------------------------------------------