Mercurial > otakunoraifu
annotate music2/movie.cc @ 65:4416cfac86ae
Convert EUC-JP files to UTF8
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 26 Nov 2010 10:53:15 +0100 |
parents | ddbcbd000206 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno | |
3 * All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | |
27 | |
28 /* | |
65
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
53
diff
changeset
|
29 * movie.cc smpeg による動画再生 |
0 | 30 * |
31 */ | |
32 | |
52 | 33 #include <stdio.h> |
34 #include "music.h" | |
35 #include <SDL.h> | |
36 #include <SDL_mixer.h> | |
37 #include <string.h> | |
38 #include <ctype.h> | |
39 #include <stdlib.h> | |
40 #include "system/file.h" | |
41 #include "window/system.h" | |
0 | 42 |
43 #if USE_SMPEG | |
52 | 44 #include <smpeg/smpeg.h> |
0 | 45 |
46 static SMPEG* smpeg_handle = 0; | |
47 const char* FindMovieFile(const char* path); | |
48 void MuSys::PlayMovie(const char* path, int x1, int y1, int x2, int y2, int loop_count) { | |
49 if (!pcm_enable) return; | |
50 FinalizeMusic(); | |
51 SMPEG_Info info; | |
52 const char* find_path = FindMovieFile(path); | |
52 | 53 if (find_path == NULL) return; |
0 | 54 smpeg_handle = SMPEG_new(find_path, &info, true); |
55 //SMPEG_enableaudio(smpeg_handle, true); | |
56 //SMPEG_enablevideo(smpeg_handle, true); | |
57 SMPEG_enableaudio(smpeg_handle, true); | |
58 SMPEG_enablevideo(smpeg_handle, true); | |
59 SDL_Surface* surface = SDL_GetVideoSurface(); | |
60 System::Main::DisableVideo(); | |
52 | 61 SMPEG_setdisplay(smpeg_handle, surface, 0, 0); |
0 | 62 // if (loop_c > 1) SMPEG_loop(smpeg_handle, true); |
63 //if (x1 != 0 || x2 != 0) SMPEG_setdisplayregion(smpeg_handle,x1, y1, x2-x1, y1-y2); | |
64 SMPEG_play(smpeg_handle); | |
65 #if 0 | |
66 while(SMPEG_status(smpeg_handle) != SMPEG_PLAYING) { | |
67 SDL_Delay( 10 ); | |
68 } | |
69 #endif | |
70 return; | |
71 } | |
52 | 72 |
0 | 73 const char* FindMovieFile(const char* path) { |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
74 FileSearcher* file_searcher = FileSearcher::GetInstance(); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
75 ARCINFO* info = file_searcher->Find(FileSearcher::MOV, path, "avi"); |
52 | 76 if (info == NULL) |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
77 info = file_searcher->Find(FileSearcher::MOV,path,"mpg"); |
52 | 78 if (info == NULL) return NULL; |
0 | 79 const char* file = info->Path(); |
80 delete info; | |
81 return file; | |
82 } | |
83 | |
84 void MuSys::StopMovie(void) { | |
85 if (smpeg_handle) { | |
86 if (SMPEG_status(smpeg_handle) == SMPEG_PLAYING) | |
87 SMPEG_stop(smpeg_handle); | |
88 while(SMPEG_status(smpeg_handle) == SMPEG_PLAYING) { | |
89 SDL_Delay( 10 ); | |
90 } | |
91 SMPEG_delete(smpeg_handle); | |
92 } | |
93 smpeg_handle = 0; | |
94 System::Main::EnableVideo(); | |
95 InitMusic(); | |
96 } | |
97 bool MuSys::IsStopMovie(void) { | |
98 if (!smpeg_handle) return true; | |
99 if (SMPEG_status(smpeg_handle) == SMPEG_PLAYING) return false; | |
100 return true; | |
101 } | |
102 | |
103 #else /* USE_SMPEG */ | |
104 void MuSys::PlayMovie(const char* path, int x1, int y1, int x2, int y2, int loop_count) { | |
105 } | |
106 void MuSys::StopMovie(void) { | |
107 } | |
108 bool MuSys::IsStopMovie(void) { | |
109 return true; | |
110 } | |
111 #endif |