Mercurial > hg > easaier-soundaccess
comparison data/fileio/VideoFileReader.cpp @ 256:6eeb195adbb4
Video works fine now.
Ivan fixed bugs.
author | benoitrigolleau |
---|---|
date | Tue, 17 Jun 2008 11:59:02 +0000 |
parents | be6d31baecb9 |
children |
comparison
equal
deleted
inserted
replaced
255:1f26f21febd9 | 256:6eeb195adbb4 |
---|---|
36 #include <Windows.h> | 36 #include <Windows.h> |
37 #endif | 37 #endif |
38 long long countFreq; | 38 long long countFreq; |
39 int Videow=320; | 39 int Videow=320; |
40 int Videoh=240; | 40 int Videoh=240; |
41 float zoomFivan=1; | 41 int zoomWivan=320; |
42 int zoomHivan=240; | |
43 int haveFilm=0; | |
44 | |
42 VideoFileReader::VideoFileReader(QString path, bool showProgress, CacheMode mode) : | 45 VideoFileReader::VideoFileReader(QString path, bool showProgress, CacheMode mode) : |
43 CodedAudioFileReader(mode), | 46 CodedAudioFileReader(mode), |
44 m_path(path) | 47 m_path(path) |
45 { | 48 { |
46 m_frameCount = 0; | 49 m_frameCount = 0; |
63 m_error = QString("Failed to open file %1 for reading.").arg(SDL_GetError()); | 66 m_error = QString("Failed to open file %1 for reading.").arg(SDL_GetError()); |
64 return; | 67 return; |
65 } | 68 } |
66 m_fileSize = stat.st_size; | 69 m_fileSize = stat.st_size; |
67 | 70 |
68 | 71 if (haveFilm) |
72 { | |
73 haveFilm=1; | |
74 SDL_ffmpegFree(film); | |
75 } | |
69 // open file from arg[1] | 76 // open file from arg[1] |
70 film = SDL_ffmpegOpen(path.toLocal8Bit().data()); | 77 film = SDL_ffmpegOpen(path.toLocal8Bit().data()); |
71 if (path.endsWith("mpg")) film->delay=1; | 78 if (path.endsWith("mpg")) film->delay=1; |
72 if (path.endsWith("divx")) film->delay=1; | 79 if (path.endsWith("divx")) film->delay=1; |
73 if(!film) | 80 if(!film) |
208 | 215 |
209 //TODO update the size according to the component size | 216 //TODO update the size according to the component size |
210 // this will not work if video size is bigger than window size. | 217 // this will not work if video size is bigger than window size. |
211 m_width =w; | 218 m_width =w; |
212 m_height =h; | 219 m_height =h; |
213 | 220 zoomWivan =w; |
221 zoomHivan =h; | |
214 MWins->setSDLInitSize(w,h); | 222 MWins->setSDLInitSize(w,h); |
215 // Open the Video device | 223 // Open the Video device |
216 screen = SDL_SetVideoMode(w, h, 0, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); | 224 screen = SDL_SetVideoMode(w, h, 0, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); |
217 //SDL_WM_SetCaption("EASAIER Video Player", "EASAIER Video Player"); | 225 //SDL_WM_SetCaption("EASAIER Video Player", "EASAIER Video Player"); |
218 if(!screen) { | 226 if(!screen) { |
316 w=80; | 324 w=80; |
317 h=60; | 325 h=60; |
318 m_zoomfactor = 80.0/Videow; | 326 m_zoomfactor = 80.0/Videow; |
319 } | 327 } |
320 // Open the Video device | 328 // Open the Video device |
321 zoomFivan = m_zoomfactor; | 329 //zoomFivan = m_zoomfactor; |
322 screen = SDL_SetVideoMode(w, h, 0, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); | 330 screen = SDL_SetVideoMode(w, h, 0, SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); |
323 MWins->setSDLInitSize(w,h); | 331 MWins->setSDLInitSize(w,h); |
324 m_width =w; | 332 m_width =w; |
325 m_height =h; | 333 m_height =h; |
334 zoomWivan =w; | |
335 zoomHivan =h; | |
326 | 336 |
327 } | 337 } |
328 // calls process events function, to take in account the user input | 338 // calls process events function, to take in account the user input |
329 processEvents(); | 339 processEvents(); |
330 if (MWins->isAudioPlaying()) | 340 if (MWins->isAudioPlaying()) |