Mercurial > hg > aimc
comparison trunk/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc @ 400:dd13c9834ceb
- Well, most of the graphics stuff at least compiles now. Next step is getting it running.
M Modules/Output/Graphics/GraphicsView.h
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovieDirect.cc
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovieDirect.h
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.cc
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceCairo.h
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.cc
M Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.h
M Modules/Output/Graphics/Scale/ScaleLog.h
M Modules/Output/Graphics/Scale/ScaleERB.h
M Modules/Output/Graphics/Scale/ScaleLinear.h
M Modules/Output/Graphics/Scale/ScaleLogScaled.h
M Modules/Output/Graphics/Scale/Scale.cc
M Modules/Output/Graphics/Scale/Scale.h
M Support/Common.h
author | tom@acousticscale.org |
---|---|
date | Sat, 16 Oct 2010 23:05:26 +0000 |
parents | 3ee03a6b95a0 |
children | 69466da9745e |
comparison
equal
deleted
inserted
replaced
399:7bfed53caacf | 400:dd13c9834ceb |
---|---|
44 # include <dirent.h> // for opendir&friends | 44 # include <dirent.h> // for opendir&friends |
45 #endif | 45 #endif |
46 #include <stdio.h> | 46 #include <stdio.h> |
47 #include <string.h> | 47 #include <string.h> |
48 | 48 |
49 | 49 #include "Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.h" |
50 #include "Output/GraphicsOutputDeviceMovie.h" | 50 |
51 namespace aimc { | |
51 | 52 |
52 GraphicsOutputDeviceMovie::GraphicsOutputDeviceMovie(Parameters *pParam) | 53 GraphicsOutputDeviceMovie::GraphicsOutputDeviceMovie(Parameters *pParam) |
53 : GraphicsOutputDeviceCairo(pParam) { // or GraphicsOutputDevicePlotutils | 54 : GraphicsOutputDeviceCairo(pParam) { // or GraphicsOutputDevicePlotutils |
54 m_sMovieFile[0] = '\0'; | 55 m_sMovieFile[0] = '\0'; |
55 m_sSoundFile[0] = '\0'; | 56 m_sSoundFile[0] = '\0'; |
61 AIM_ASSERT(sSoundFile); | 62 AIM_ASSERT(sSoundFile); |
62 AIM_ASSERT(sMovieFile); | 63 AIM_ASSERT(sMovieFile); |
63 | 64 |
64 // Check sound file exists | 65 // Check sound file exists |
65 if ((f = fopen(sSoundFile, "r")) == NULL) { | 66 if ((f = fopen(sSoundFile, "r")) == NULL) { |
66 AIM_ERROR(_T("Couldn't open sound file '%s' for movie creation."), | 67 LOG_ERROR(_T("Couldn't open sound file '%s' for movie creation."), |
67 sSoundFile); | 68 sSoundFile); |
68 return false; | 69 return false; |
69 } | 70 } |
70 fclose(f); | 71 fclose(f); |
71 strcpy(m_sSoundFile, sSoundFile); | 72 strcpy(m_sSoundFile, sSoundFile); |
72 | 73 |
73 // Check movie output file can be made | 74 // Check movie output file can be made |
74 if ( (f=fopen(sMovieFile, "w"))==NULL ) { | 75 if ( (f=fopen(sMovieFile, "w"))==NULL ) { |
75 aimERROR(_T("Couldn't open movie file '%s' to write to."), | 76 LOG_ERROR(_T("Couldn't open movie file '%s' to write to."), |
76 sMovieFile); | 77 sMovieFile); |
77 return false; | 78 return false; |
78 } | 79 } |
79 fclose(f); | 80 fclose(f); |
80 strcpy(m_sMovieFile, sMovieFile); | 81 strcpy(m_sMovieFile, sMovieFile); |
94 if (mkdtemp(m_sDir)) { | 95 if (mkdtemp(m_sDir)) { |
95 strcat(m_sDir, "/"); // Make sure to end with trailing slash | 96 strcat(m_sDir, "/"); // Make sure to end with trailing slash |
96 } else | 97 } else |
97 #endif | 98 #endif |
98 { | 99 { |
99 AIM_ERROR(_T("Couldn't create a temporary directory for movie output.")); | 100 LOG_ERROR(_T("Couldn't create a temporary directory for movie output.")); |
100 if (sTmpDir) free(sTmpDir); | 101 if (sTmpDir) free(sTmpDir); |
101 return false; | 102 return false; |
102 } | 103 } |
103 if (sTmpDir) { | 104 if (sTmpDir) { |
104 free(sTmpDir); | 105 free(sTmpDir); |
163 m_pParam->GetString("output.movie.title"), | 164 m_pParam->GetString("output.movie.title"), |
164 fFps, sCodecOptions, m_sMovieFile); | 165 fFps, sCodecOptions, m_sMovieFile); |
165 printf(sCmdLine); | 166 printf(sCmdLine); |
166 printf("\n"); | 167 printf("\n"); |
167 if (system(sCmdLine)) { | 168 if (system(sCmdLine)) { |
168 AIM_ERROR(_T("Couldn't create movie output.")); | 169 LOG_ERROR(_T("Couldn't create movie output.")); |
169 } | 170 } |
170 | 171 |
171 #ifdef __WX__ | 172 #ifdef __WX__ |
172 // GUI only: close dialog again | 173 // GUI only: close dialog again |
173 #endif | 174 #endif |
176 #ifdef _WINDOWS | 177 #ifdef _WINDOWS |
177 HANDLE hList; | 178 HANDLE hList; |
178 WIN32_FIND_DATA FileData; | 179 WIN32_FIND_DATA FileData; |
179 snprintf(sCmdLine, sizeof(sCmdLine)/sizeof(sCmdLine[0]), "%s/*.*", m_sDir); | 180 snprintf(sCmdLine, sizeof(sCmdLine)/sizeof(sCmdLine[0]), "%s/*.*", m_sDir); |
180 if ((hList = FindFirstFile(sCmdLine, &FileData)) == INVALID_HANDLE_VALUE) { | 181 if ((hList = FindFirstFile(sCmdLine, &FileData)) == INVALID_HANDLE_VALUE) { |
181 AIM_ERROR(_T("Couldn't remove files from temporary directory.")); | 182 LOG_ERROR(_T("Couldn't remove files from temporary directory.")); |
182 return; | 183 return; |
183 } | 184 } |
184 bool bRMfinished = false; | 185 bool bRMfinished = false; |
185 while (!bRMfinished) { | 186 while (!bRMfinished) { |
186 snprintf(sCmdLine, | 187 snprintf(sCmdLine, |
197 _rmdir(m_sDir); | 198 _rmdir(m_sDir); |
198 #else | 199 #else |
199 DIR *dir; | 200 DIR *dir; |
200 struct dirent *dirent; | 201 struct dirent *dirent; |
201 if (!(dir = opendir(m_sDir))) { | 202 if (!(dir = opendir(m_sDir))) { |
202 AIM_ERROR(_T("Couldn't remove files in temporary directory.")); | 203 LOG_ERROR(_T("Couldn't remove files in temporary directory.")); |
203 return; | 204 return; |
204 } | 205 } |
205 while (dirent = readdir(dir)) { | 206 while (dirent = readdir(dir)) { |
206 snprintf(sCmdLine, | 207 snprintf(sCmdLine, |
207 sizeof(sCmdLine)/sizeof(sCmdLine[0]), | 208 sizeof(sCmdLine)/sizeof(sCmdLine[0]), |
252 gText2f(fMarL, | 253 gText2f(fMarL, |
253 1-(fMarT+fTextHeight*lineno++), | 254 1-(fMarT+fTextHeight*lineno++), |
254 sStr); | 255 sStr); |
255 } | 256 } |
256 } | 257 } |
258 } // namespace aimc |