-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 040eab3..cef46a1 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,254 +1,257 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 LJP <> | 5 | Copyright (c) 2002 LJP <> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <stdio.h> | 34 | #include <stdio.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | #include <qimage.h> | 36 | #include <qimage.h> |
37 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
38 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | 39 | ||
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | 42 | ||
43 | #include <qgfx_qws.h> | 43 | #include <qgfx_qws.h> |
44 | #include <qdirectpainter_qws.h> | 44 | #include <qdirectpainter_qws.h> |
45 | 45 | ||
46 | #include <assert.h> | 46 | #include <assert.h> |
47 | 47 | ||
48 | #include "xinevideowidget.h" | 48 | #include "xinevideowidget.h" |
49 | #include "frame.h" | 49 | #include "frame.h" |
50 | #include "lib.h" | 50 | #include "lib.h" |
51 | 51 | ||
52 | 52 | ||
53 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 53 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
54 | int width, int height,int bytes ); | 54 | int width, int height,int bytes ); |
55 | 55 | ||
56 | extern "C" { | 56 | extern "C" { |
57 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); | 57 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); |
58 | int null_is_showing_video( const xine_vo_driver_t* self ); | 58 | int null_is_showing_video( const xine_vo_driver_t* self ); |
59 | void null_set_show_video( const xine_vo_driver_t* self, int show ); | 59 | void null_set_show_video( const xine_vo_driver_t* self, int show ); |
60 | int null_is_fullscreen( const xine_vo_driver_t* self ); | 60 | int null_is_fullscreen( const xine_vo_driver_t* self ); |
61 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); | 61 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); |
62 | int null_is_scaling( const xine_vo_driver_t* self ); | 62 | int null_is_scaling( const xine_vo_driver_t* self ); |
63 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); | 63 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); |
64 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); | 64 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); |
65 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); | 65 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); |
66 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 66 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
67 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); | 67 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); |
68 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 68 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
69 | } | 69 | } |
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
74 | { | 74 | { |
75 | m_initialized = false; | 75 | m_initialized = false; |
76 | m_duringInitialization = false; | ||
76 | m_video = false; | 77 | m_video = false; |
77 | m_wid = widget; | 78 | m_wid = widget; |
78 | printf("Lib"); | 79 | printf("Lib"); |
79 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 80 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
80 | // get the configuration | 81 | // get the configuration |
81 | 82 | ||
82 | // not really OO, should be an extra class, later | 83 | // not really OO, should be an extra class, later |
83 | if ( !QFile::exists(configPath) ) { | 84 | if ( !QFile::exists(configPath) ) { |
84 | QFile f(configPath); | 85 | QFile f(configPath); |
85 | f.open(IO_WriteOnly); | 86 | f.open(IO_WriteOnly); |
86 | QTextStream ts( &f ); | 87 | QTextStream ts( &f ); |
87 | ts << "misc.memcpy_method:glibc\n"; | 88 | ts << "misc.memcpy_method:glibc\n"; |
88 | f.close(); | 89 | f.close(); |
89 | } | 90 | } |
90 | 91 | ||
91 | if ( initMode == InitializeImmediately ) { | 92 | if ( initMode == InitializeImmediately ) { |
92 | initialize(); | 93 | initialize(); |
93 | m_initialized = true; | 94 | m_initialized = true; |
94 | } | 95 | } |
95 | else | 96 | else |
96 | assert( false ); | 97 | assert( false ); |
97 | } | 98 | } |
98 | 99 | ||
99 | void Lib::run() | 100 | void Lib::run() |
100 | { | 101 | { |
101 | assert( false ); | 102 | assert( false ); |
102 | } | 103 | } |
103 | 104 | ||
104 | void Lib::initialize() | 105 | void Lib::initialize() |
105 | { | 106 | { |
107 | m_duringInitialization = true; | ||
106 | m_xine = xine_new( ); | 108 | m_xine = xine_new( ); |
107 | 109 | ||
108 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 110 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
109 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 111 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
110 | 112 | ||
111 | xine_init( m_xine ); | 113 | xine_init( m_xine ); |
112 | 114 | ||
113 | // allocate oss for sound | 115 | // allocate oss for sound |
114 | // and fb for framebuffer | 116 | // and fb for framebuffer |
115 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 117 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
116 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 118 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
117 | 119 | ||
118 | 120 | ||
119 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); | 121 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); |
120 | 122 | ||
121 | 123 | ||
122 | // null_display_handler( m_videoOutput, xine_display_frame, this ); | 124 | // null_display_handler( m_videoOutput, xine_display_frame, this ); |
123 | 125 | ||
124 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 126 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
125 | 127 | ||
126 | if (m_wid != 0 ) { | 128 | if (m_wid != 0 ) { |
127 | printf( "!0\n" ); | 129 | printf( "!0\n" ); |
128 | resize ( m_wid-> size ( ) ); | 130 | resize ( m_wid-> size ( ) ); |
129 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 131 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
130 | 132 | ||
131 | // m_wid->repaint(); | 133 | // m_wid->repaint(); |
132 | } | 134 | } |
133 | 135 | ||
134 | m_queue = xine_event_new_queue (m_stream); | 136 | m_queue = xine_event_new_queue (m_stream); |
135 | 137 | ||
136 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 138 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
139 | m_duringInitialization = false; | ||
137 | } | 140 | } |
138 | 141 | ||
139 | Lib::~Lib() { | 142 | Lib::~Lib() { |
140 | assert( isRunning() == false ); | 143 | assert( isRunning() == false ); |
141 | assert( m_initialized ); | 144 | assert( m_initialized ); |
142 | 145 | ||
143 | // free( m_config ); | 146 | // free( m_config ); |
144 | 147 | ||
145 | xine_close( m_stream ); | 148 | xine_close( m_stream ); |
146 | 149 | ||
147 | xine_event_dispose_queue( m_queue ); | 150 | xine_event_dispose_queue( m_queue ); |
148 | 151 | ||
149 | xine_dispose( m_stream ); | 152 | xine_dispose( m_stream ); |
150 | 153 | ||
151 | xine_exit( m_xine ); | 154 | xine_exit( m_xine ); |
152 | /* FIXME either free or delete but valgrind bitches against both */ | 155 | /* FIXME either free or delete but valgrind bitches against both */ |
153 | //free( m_videoOutput ); | 156 | //free( m_videoOutput ); |
154 | //delete m_audioOutput; | 157 | //delete m_audioOutput; |
155 | } | 158 | } |
156 | 159 | ||
157 | void Lib::resize ( const QSize &s ) { | 160 | void Lib::resize ( const QSize &s ) { |
158 | assert( m_initialized ); | 161 | assert( m_initialized || m_duringInitialization ); |
159 | 162 | ||
160 | if ( s. width ( ) && s. height ( ) ) { | 163 | if ( s. width ( ) && s. height ( ) ) { |
161 | ::null_set_gui_width( m_videoOutput, s. width() ); | 164 | ::null_set_gui_width( m_videoOutput, s. width() ); |
162 | ::null_set_gui_height( m_videoOutput, s. height() ); | 165 | ::null_set_gui_height( m_videoOutput, s. height() ); |
163 | } | 166 | } |
164 | } | 167 | } |
165 | 168 | ||
166 | int Lib::majorVersion() { | 169 | int Lib::majorVersion() { |
167 | int major, minor, sub; | 170 | int major, minor, sub; |
168 | xine_get_version ( &major, &minor, &sub ); | 171 | xine_get_version ( &major, &minor, &sub ); |
169 | return major; | 172 | return major; |
170 | } | 173 | } |
171 | 174 | ||
172 | int Lib::minorVersion() { | 175 | int Lib::minorVersion() { |
173 | int major, minor, sub; | 176 | int major, minor, sub; |
174 | xine_get_version ( &major, &minor, &sub ); | 177 | xine_get_version ( &major, &minor, &sub ); |
175 | return minor; | 178 | return minor; |
176 | } | 179 | } |
177 | 180 | ||
178 | int Lib::subVersion() { | 181 | int Lib::subVersion() { |
179 | int major, minor, sub; | 182 | int major, minor, sub; |
180 | xine_get_version ( &major, &minor, &sub ); | 183 | xine_get_version ( &major, &minor, &sub ); |
181 | return sub; | 184 | return sub; |
182 | } | 185 | } |
183 | 186 | ||
184 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 187 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
185 | assert( m_initialized ); | 188 | assert( m_initialized ); |
186 | 189 | ||
187 | QString str = fileName.stripWhiteSpace(); | 190 | QString str = fileName.stripWhiteSpace(); |
188 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { | 191 | if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { |
189 | return 0; | 192 | return 0; |
190 | } | 193 | } |
191 | return xine_play( m_stream, startPos, start_time); | 194 | return xine_play( m_stream, startPos, start_time); |
192 | } | 195 | } |
193 | 196 | ||
194 | void Lib::stop() { | 197 | void Lib::stop() { |
195 | assert( m_initialized ); | 198 | assert( m_initialized ); |
196 | 199 | ||
197 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | 200 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); |
198 | xine_stop( m_stream ); | 201 | xine_stop( m_stream ); |
199 | } | 202 | } |
200 | 203 | ||
201 | void Lib::pause( bool toggle ) { | 204 | void Lib::pause( bool toggle ) { |
202 | assert( m_initialized ); | 205 | assert( m_initialized ); |
203 | 206 | ||
204 | xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); | 207 | xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); |
205 | } | 208 | } |
206 | 209 | ||
207 | int Lib::speed() const { | 210 | int Lib::speed() const { |
208 | assert( m_initialized ); | 211 | assert( m_initialized ); |
209 | 212 | ||
210 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); | 213 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
211 | } | 214 | } |
212 | 215 | ||
213 | void Lib::setSpeed( int speed ) { | 216 | void Lib::setSpeed( int speed ) { |
214 | assert( m_initialized ); | 217 | assert( m_initialized ); |
215 | 218 | ||
216 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); | 219 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
217 | } | 220 | } |
218 | 221 | ||
219 | int Lib::status() const { | 222 | int Lib::status() const { |
220 | assert( m_initialized ); | 223 | assert( m_initialized ); |
221 | 224 | ||
222 | return xine_get_status( m_stream ); | 225 | return xine_get_status( m_stream ); |
223 | } | 226 | } |
224 | 227 | ||
225 | int Lib::currentPosition() const { | 228 | int Lib::currentPosition() const { |
226 | assert( m_initialized ); | 229 | assert( m_initialized ); |
227 | 230 | ||
228 | int pos, time, length; | 231 | int pos, time, length; |
229 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 232 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
230 | return pos; | 233 | return pos; |
231 | } | 234 | } |
232 | 235 | ||
233 | int Lib::currentTime() const { | 236 | int Lib::currentTime() const { |
234 | assert( m_initialized ); | 237 | assert( m_initialized ); |
235 | 238 | ||
236 | int pos, time, length; | 239 | int pos, time, length; |
237 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 240 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
238 | return time/1000; | 241 | return time/1000; |
239 | } | 242 | } |
240 | 243 | ||
241 | int Lib::length() const { | 244 | int Lib::length() const { |
242 | assert( m_initialized ); | 245 | assert( m_initialized ); |
243 | 246 | ||
244 | int pos, time, length; | 247 | int pos, time, length; |
245 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 248 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
246 | return length/1000; | 249 | return length/1000; |
247 | } | 250 | } |
248 | 251 | ||
249 | bool Lib::isSeekable() const { | 252 | bool Lib::isSeekable() const { |
250 | assert( m_initialized ); | 253 | assert( m_initialized ); |
251 | 254 | ||
252 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); | 255 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
253 | } | 256 | } |
254 | 257 | ||
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 7e3a912..9dd7385 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h | |||
@@ -100,117 +100,118 @@ namespace XINE { | |||
100 | 100 | ||
101 | bool isSeekable()const; | 101 | bool isSeekable()const; |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Whether or not to show video output | 104 | * Whether or not to show video output |
105 | */ | 105 | */ |
106 | void setShowVideo(bool video); | 106 | void setShowVideo(bool video); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * is we show video | 109 | * is we show video |
110 | */ | 110 | */ |
111 | bool isShowingVideo() const; | 111 | bool isShowingVideo() const; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * | 114 | * |
115 | */ | 115 | */ |
116 | void showVideoFullScreen( bool fullScreen ); | 116 | void showVideoFullScreen( bool fullScreen ); |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * | 119 | * |
120 | */ | 120 | */ |
121 | bool isVideoFullScreen() const; | 121 | bool isVideoFullScreen() const; |
122 | 122 | ||
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Get the meta info (like author etc) from the stream | 125 | * Get the meta info (like author etc) from the stream |
126 | * XINE_META_INFO_TITLE 0 | 126 | * XINE_META_INFO_TITLE 0 |
127 | * XINE_META_INFO_COMMENT 1 | 127 | * XINE_META_INFO_COMMENT 1 |
128 | * XINE_META_INFO_ARTIST 2 | 128 | * XINE_META_INFO_ARTIST 2 |
129 | * XINE_META_INFO_GENRE 3 | 129 | * XINE_META_INFO_GENRE 3 |
130 | * XINE_META_INFO_ALBUM 4 | 130 | * XINE_META_INFO_ALBUM 4 |
131 | * XINE_META_INFO_YEAR 5 | 131 | * XINE_META_INFO_YEAR 5 |
132 | * XINE_META_INFO_VIDEOCODEC 6 | 132 | * XINE_META_INFO_VIDEOCODEC 6 |
133 | * XINE_META_INFO_AUDIOCODEC 7 | 133 | * XINE_META_INFO_AUDIOCODEC 7 |
134 | * XINE_META_INFO_SYSTEMLAYER 8 | 134 | * XINE_META_INFO_SYSTEMLAYER 8 |
135 | * XINE_META_INFO_INPUT_PLUGIN 9 | 135 | * XINE_META_INFO_INPUT_PLUGIN 9 |
136 | */ | 136 | */ |
137 | QString metaInfo( int number ) const; | 137 | QString metaInfo( int number ) const; |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * | 140 | * |
141 | */ | 141 | */ |
142 | bool isScaling() const; | 142 | bool isScaling() const; |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * seek to a position | 145 | * seek to a position |
146 | */ | 146 | */ |
147 | void seekTo( int time ); | 147 | void seekTo( int time ); |
148 | 148 | ||
149 | /** | 149 | /** |
150 | * | 150 | * |
151 | * @return is media stream has video | 151 | * @return is media stream has video |
152 | */ | 152 | */ |
153 | bool hasVideo() const; | 153 | bool hasVideo() const; |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * | 156 | * |
157 | */ | 157 | */ |
158 | void setScaling( bool ); | 158 | void setScaling( bool ); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Set the Gamma value for video output | 161 | * Set the Gamma value for video output |
162 | * @param int the value between -100 and 100, 0 is original | 162 | * @param int the value between -100 and 100, 0 is original |
163 | */ | 163 | */ |
164 | void setGamma( int ); | 164 | void setGamma( int ); |
165 | 165 | ||
166 | /** | 166 | /** |
167 | * test | 167 | * test |
168 | */ | 168 | */ |
169 | Frame currentFrame() const; | 169 | Frame currentFrame() const; |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Returns the error code | 172 | * Returns the error code |
173 | * XINE_ERROR_NONE 0 | 173 | * XINE_ERROR_NONE 0 |
174 | * XINE_ERROR_NO_INPUT_PLUGIN 1 | 174 | * XINE_ERROR_NO_INPUT_PLUGIN 1 |
175 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 | 175 | * XINE_ERROR_NO_DEMUXER_PLUGIN 2 |
176 | * XINE_ERROR_DEMUXER_FAILED 3 | 176 | * XINE_ERROR_DEMUXER_FAILED 3 |
177 | */ | 177 | */ |
178 | int error() const; | 178 | int error() const; |
179 | 179 | ||
180 | signals: | 180 | signals: |
181 | 181 | ||
182 | void stopped(); | 182 | void stopped(); |
183 | 183 | ||
184 | void initialized(); | 184 | void initialized(); |
185 | 185 | ||
186 | protected: | 186 | protected: |
187 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); | 187 | virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); |
188 | 188 | ||
189 | virtual void run(); | 189 | virtual void run(); |
190 | 190 | ||
191 | private: | 191 | private: |
192 | void initialize(); | 192 | void initialize(); |
193 | 193 | ||
194 | int m_bytes_per_pixel; | 194 | int m_bytes_per_pixel; |
195 | bool m_initialized:1; | 195 | bool m_initialized:1; |
196 | bool m_duringInitialization:1; | ||
196 | bool m_video:1; | 197 | bool m_video:1; |
197 | XineVideoWidget *m_wid; | 198 | XineVideoWidget *m_wid; |
198 | xine_t *m_xine; | 199 | xine_t *m_xine; |
199 | xine_stream_t *m_stream; | 200 | xine_stream_t *m_stream; |
200 | xine_cfg_entry_t *m_config; | 201 | xine_cfg_entry_t *m_config; |
201 | xine_vo_driver_t *m_videoOutput; | 202 | xine_vo_driver_t *m_videoOutput; |
202 | xine_ao_driver_t* m_audioOutput; | 203 | xine_ao_driver_t* m_audioOutput; |
203 | xine_event_queue_t *m_queue; | 204 | xine_event_queue_t *m_queue; |
204 | 205 | ||
205 | void handleXineEvent( const xine_event_t* t ); | 206 | void handleXineEvent( const xine_event_t* t ); |
206 | void handleXineEvent( int type ); | 207 | void handleXineEvent( int type ); |
207 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); | 208 | void drawFrame( uint8_t* frame, int width, int height, int bytes ); |
208 | // C -> C++ bridge for the event system | 209 | // C -> C++ bridge for the event system |
209 | static void xine_event_handler( void* user_data, const xine_event_t* t); | 210 | static void xine_event_handler( void* user_data, const xine_event_t* t); |
210 | static void xine_display_frame( void* user_data, uint8_t* frame , | 211 | static void xine_display_frame( void* user_data, uint8_t* frame , |
211 | int width, int height, int bytes ); | 212 | int width, int height, int bytes ); |
212 | }; | 213 | }; |
213 | }; | 214 | }; |
214 | 215 | ||
215 | 216 | ||
216 | #endif | 217 | #endif |