Mercurial > hg > easaier-soundaccess
changeset 256:6eeb195adbb4
Video works fine now.
Ivan fixed bugs.
author | benoitrigolleau |
---|---|
date | Tue, 17 Jun 2008 11:59:02 +0000 |
parents | 1f26f21febd9 |
children | 057856cf81a2 |
files | data/fileio/VideoFileReader.cpp sv/videoio/SDL_ffmpeg.cpp |
diffstat | 2 files changed, 31 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/data/fileio/VideoFileReader.cpp Fri Jun 13 13:42:15 2008 +0000 +++ b/data/fileio/VideoFileReader.cpp Tue Jun 17 11:59:02 2008 +0000 @@ -38,7 +38,10 @@ long long countFreq; int Videow=320; int Videoh=240; -float zoomFivan=1; +int zoomWivan=320; +int zoomHivan=240; +int haveFilm=0; + VideoFileReader::VideoFileReader(QString path, bool showProgress, CacheMode mode) : CodedAudioFileReader(mode), m_path(path) @@ -65,7 +68,11 @@ } m_fileSize = stat.st_size; - + if (haveFilm) + { + haveFilm=1; + SDL_ffmpegFree(film); + } // open file from arg[1] film = SDL_ffmpegOpen(path.toLocal8Bit().data()); if (path.endsWith("mpg")) film->delay=1; @@ -210,7 +217,8 @@ // this will not work if video size is bigger than window size. m_width =w; m_height =h; - + zoomWivan =w; + zoomHivan =h; MWins->setSDLInitSize(w,h); // Open the Video device screen = SDL_SetVideoMode(w, h, 0, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); @@ -318,11 +326,13 @@ m_zoomfactor = 80.0/Videow; } // Open the Video device - zoomFivan = m_zoomfactor; + //zoomFivan = m_zoomfactor; screen = SDL_SetVideoMode(w, h, 0, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); MWins->setSDLInitSize(w,h); m_width =w; m_height =h; + zoomWivan =w; + zoomHivan =h; } // calls process events function, to take in account the user input
--- a/sv/videoio/SDL_ffmpeg.cpp Fri Jun 13 13:42:15 2008 +0000 +++ b/sv/videoio/SDL_ffmpeg.cpp Tue Jun 17 11:59:02 2008 +0000 @@ -46,9 +46,10 @@ //const int SDL_FFMPEG_MAX_BUFFERED_FRAMES = 25; //const int SDL_FFMPEG_MAX_BUFFERED_SAMPLES = 512 * 512; -extern float zoomFivan; +extern int zoomWivan; +extern int zoomHivan; int FFMPEG_init_was_called = 0; -FILE *pFile, *tFile; +//FILE *pFile, *tFile; int64_t Time,Time1; int64_t realt=0; @@ -63,8 +64,8 @@ Time=0; Time1=0; - fopen_s (&pFile,"myfile.txt","w"); - fopen_s (&tFile,"Timestampfile.txt","w"); + //fopen_s (&pFile,"myfile.txt","w"); + // fopen_s (&tFile,"Timestampfile.txt","w"); // allocate room for VStreams file->vs = (SDL_ffmpegStream**)malloc( sizeof(SDL_ffmpegStream*) * MAX_STREAMS ); if(!file->vs) { @@ -268,10 +269,10 @@ //for(i=0; i<SDL_FFMPEG_MAX_BUFFERED_FRAMES; i++) { pos=MWinsA->Get_CurAudioTime(); - if (pFile) +/* if (pFile) { fprintf (pFile, "p: \t %u\t", pos); - } + }*/ //if (MWinsA->Get_HardwareBufferTime()==0) // pos1=0; //else { @@ -284,10 +285,10 @@ // fprintf (pFile, "%u\t", pos1); //} //pos2=pos+pos1; - if (pFile) + /*if (pFile) { fprintf (pFile, "%u\n", pos); - } + }*/ // if this entry does not exist, continue while(((file->vs[file->videoStream]->writeImage - file->vs[file->videoStream]->readImage)>0)&&(file->vs[file->videoStream]->imageBuffer[file->vs[file->videoStream]->readImage%SDL_FFMPEG_MAX_BUFFERED_FRAMES]->timestamp <= pos + ((AVFormatContext*)file->_ffmpeg)->start_time/1000))//&& (file->vs[file->videoStream]->imageBuffer[file->vs[file->videoStream]->readImage%SDL_FFMPEG_MAX_BUFFERED_FRAMES]->timestamp >= pos - file->timebase+ ((AVFormatContext*)file->_ffmpeg)->start_time/1000)) @@ -333,10 +334,10 @@ pos=MWinsA->Get_CurAudioTime(); - if (pFile) + /* if (pFile) { fprintf (pFile, "e:\t%u\t", pos); - } + }*/ //if (MWinsA->Get_HardwareBufferTime()==0) // pos1=0; //else { @@ -376,12 +377,12 @@ QueryPerformanceCounter((LARGE_INTEGER *)(&file->timer)); file->timer=file->timer/(file->countFreq); realt+=tt; - fprintf (tFile, "%u\t", x); + /*fprintf (tFile, "%u\t", x); fprintf (tFile, "%u\t", realt); - fprintf (tFile, "%u\t", tt); + fprintf (tFile, "%u\t", tt);*/ timestamp=(pos-option->timestamp+((AVFormatContext*)file->_ffmpeg)->start_time/1000)/MWinsA->getPlaySpeedVal(); - fprintf (tFile, "%u\t", pos);//+ (file->vs[file->videoStream]->timeBase)/4+((AVFormatContext*)file->_ffmpeg)->start_time/1000); - fprintf (tFile, "%d\n", timestamp); + /*fprintf (tFile, "%u\t", option->timestamp);//+ (file->vs[file->videoStream]->timeBase)/4+((AVFormatContext*)file->_ffmpeg)->start_time/1000); + fprintf (tFile, "%d\n", timestamp);*/ // we did found an option, so we return the imagedata return option->img; } @@ -619,8 +620,8 @@ // if new timestamp is from future, we proceed // if(buf->timestamp >= SDL_ffmpegGetPosition(file)) // { - int w=(int)(zoomFivan*320+0.5); - int h=(int)(zoomFivan*240+0.5); + int w=zoomWivan;//(int)(zoomFivan*320+0.5); + int h=zoomHivan;//(int)(zoomFivan*240+0.5); //if ((w>file->vs[file->videoStream]->width)||(h>file->vs[file->videoStream]->height)){ // w=file->vs[file->videoStream]->width; // h=file->vs[file->videoStream]->height;