/** @file test_vetLinuxMPEGPlayer.cpp * * @brief Testing code for class vetCodec_MPEG and vetWindowQT. * * Load first video stream from an MPEG1-2 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 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 * ****************************************************************************/ /* non crea la finestra, forse conflitto tra quicktime e gtk ? (glibc invalid pointer) */ //--------------------------------------------------------------------------- #pragma hdrstop //--------------------------------------------------------------------------- #include "../source/vetFrameRGB24.h" #include "../source/vetUtility.h" #include "../source/outputs/vetWindowGTK.h" #include "../source/outputs/vetDoctor.h" #include "../source/codecs/vetCodec_MOV.h" #include #pragma argsused int main(int argc, char* argv[]) { printf("Testing vetCodec_MPEG and vetWindowQT Development...\n"); printf("\nCreating Instances...\n"); vetDoctor doc; int i = 0; long time = 0; float fps = 0 ; vetCodec_MOV movSource; 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.getVideoStreamLenght() ); 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.getAudioStreamLenght() ); vetWindowGTK myWin(movSource.getWidth(), movSource.getHeight()); myWin.show(); printf("\nDecoding and Displaying (with vetFrameRGB24)...\n"); double offset = 0; long sleeptime = (long) (1000 / movSource.getVideoFrameRate()) - 10; //-10 to speed up a bit :P doc.reset(true); while (i++ < 100) { offset = vetUtility::getTime_usec(); movSource >> imgRGB24; myWin << 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 ); printf("Test Completed. Type something to continue...\n"); getchar(); return 0; } //---------------------------------------------------------------------------