summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-10 13:40:33 (UTC)
committer harlekin <harlekin>2002-11-10 13:40:33 (UTC)
commitddfc3c3073216d6a9ef15b26e3836b9c3eb2085c (patch) (unidiff)
tree5bef89c4dc116d09c1864778127ca9106e1f29ae
parentea3334042e9625c0f67c9a7293a482849f60e4e2 (diff)
downloadopie-ddfc3c3073216d6a9ef15b26e3836b9c3eb2085c.zip
opie-ddfc3c3073216d6a9ef15b26e3836b9c3eb2085c.tar.gz
opie-ddfc3c3073216d6a9ef15b26e3836b9c3eb2085c.tar.bz2
fixed seeking and further adaption to the new api
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/lib.h3
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c8
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp11
4 files changed, 21 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 1ebbbd8..19b64e8 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,278 +1,279 @@
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 41
42#include <qgfx_qws.h> 42#include <qgfx_qws.h>
43#include <qdirectpainter_qws.h> 43#include <qdirectpainter_qws.h>
44 44
45#include "xinevideowidget.h" 45#include "xinevideowidget.h"
46#include "frame.h" 46#include "frame.h"
47#include "lib.h" 47#include "lib.h"
48 48
49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
50 int width, int height,int bytes ); 50 int width, int height,int bytes );
51 51
52extern "C" { 52extern "C" {
53 xine_vo_driver_t* init_video_out_plugin( xine_cfg_entry_t* conf, void* video); 53 xine_vo_driver_t* init_video_out_plugin( xine_cfg_entry_t* conf, void* video);
54 int null_is_showing_video( const xine_vo_driver_t* self ); 54 int null_is_showing_video( const xine_vo_driver_t* self );
55 void null_set_show_video( const xine_vo_driver_t* self, int show ); 55 void null_set_show_video( const xine_vo_driver_t* self, int show );
56 int null_is_fullscreen( const xine_vo_driver_t* self ); 56 int null_is_fullscreen( const xine_vo_driver_t* self );
57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
58 int null_is_scaling( const xine_vo_driver_t* self ); 58 int null_is_scaling( const xine_vo_driver_t* self );
59 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 59 void null_set_scaling( const xine_vo_driver_t* self, int scale );
60 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 60 void null_set_gui_width( const xine_vo_driver_t* self, int width );
61 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 61 void null_set_gui_height( const xine_vo_driver_t* self, int height );
62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
63 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 63 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
65} 65}
66 66
67using namespace XINE; 67using namespace XINE;
68 68
69Lib::Lib( XineVideoWidget* widget ) { 69Lib::Lib( XineVideoWidget* widget ) {
70 m_video = false; 70 m_video = false;
71 m_wid = widget; 71 m_wid = widget;
72 printf("Lib"); 72 printf("Lib");
73 QCString str( getenv("HOME") ); 73 QCString str( getenv("HOME") );
74 str += "/Settings/opiexine.cf"; 74 str += "/Settings/opiexine.cf";
75 // get the configuration 75 // get the configuration
76 76
77 // not really OO, should be an extra class, later 77 // not really OO, should be an extra class, later
78 if ( !QFile(str).exists() ) { 78 if ( !QFile(str).exists() ) {
79 QFile f(str); 79 QFile f(str);
80 f.open(IO_WriteOnly); 80 f.open(IO_WriteOnly);
81 QTextStream ts( &f ); 81 QTextStream ts( &f );
82 ts << "misc.memcpy_method:glibc\n"; 82 ts << "misc.memcpy_method:glibc\n";
83 f.close(); 83 f.close();
84 } 84 }
85 85
86 m_xine = xine_new( ); 86 m_xine = xine_new( );
87 87
88 xine_config_load( m_xine, str.data() ); 88 xine_config_load( m_xine, str.data() );
89 89
90 xine_init( m_xine ); 90 xine_init( m_xine );
91 91
92 // allocate oss for sound 92 // allocate oss for sound
93 // and fb for framebuffer 93 // and fb for framebuffer
94 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 94 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
95 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 95 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
96 96
97 97
98//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 98//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
99 99
100 100
101 null_display_handler( m_videoOutput, xine_display_frame, this ); 101 null_display_handler( m_videoOutput, xine_display_frame, this );
102 102
103 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 103 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
104 104
105 if (m_wid != 0 ) { 105 if (m_wid != 0 ) {
106 printf( "!0\n" ); 106 printf( "!0\n" );
107 resize ( m_wid-> size ( ) ); 107 resize ( m_wid-> size ( ) );
108 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 108 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
109 109
110 m_wid->repaint(); 110 m_wid->repaint();
111 } 111 }
112 112
113 m_queue = xine_event_new_queue (m_stream); 113 m_queue = xine_event_new_queue (m_stream);
114 114
115 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 115 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
116} 116}
117 117
118Lib::~Lib() { 118Lib::~Lib() {
119// free( m_config ); 119// free( m_config );
120 xine_exit( m_xine ); 120 xine_exit( m_xine );
121 /* FIXME either free or delete but valgrind bitches against both */ 121 /* FIXME either free or delete but valgrind bitches against both */
122 //free( m_videoOutput ); 122 //free( m_videoOutput );
123 //delete m_audioOutput; 123 //delete m_audioOutput;
124} 124}
125 125
126void Lib::resize ( const QSize &s ) { 126void Lib::resize ( const QSize &s ) {
127 if ( s. width ( ) && s. height ( ) ) { 127 if ( s. width ( ) && s. height ( ) ) {
128 ::null_set_gui_width( m_videoOutput, s. width() ); 128 ::null_set_gui_width( m_videoOutput, s. width() );
129 ::null_set_gui_height( m_videoOutput, s. height() ); 129 ::null_set_gui_height( m_videoOutput, s. height() );
130 } 130 }
131} 131}
132 132
133QCString Lib::version() { 133QCString Lib::version() {
134 // QCString str( xine_get_str_version() ); 134 // QCString str( xine_get_str_version() );
135 // return str; 135 // return str;
136 return "test"; 136 return "test";
137} 137}
138 138
139int Lib::majorVersion() { 139int Lib::majorVersion() {
140 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); 140 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
141 return m_major_version; 141 return m_major_version;
142} 142}
143 143
144int Lib::minorVersion() { 144int Lib::minorVersion() {
145 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); 145 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
146 return m_minor_version; 146 return m_minor_version;
147} 147}
148 148
149int Lib::subVersion() { 149int Lib::subVersion() {
150 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); 150 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
151 return m_sub_version; 151 return m_sub_version;
152} 152}
153 153
154int Lib::play( const QString& fileName, int startPos, int start_time ) { 154int Lib::play( const QString& fileName, int startPos, int start_time ) {
155 QString str = fileName.stripWhiteSpace(); 155 QString str = fileName.stripWhiteSpace();
156 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 156 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
157 return 0; 157 return 0;
158 } 158 }
159 return xine_play( m_stream, startPos, start_time); 159 return xine_play( m_stream, startPos, start_time);
160} 160}
161 161
162void Lib::stop() { 162void Lib::stop() {
163 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 163 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
164 xine_stop( m_stream ); 164 xine_stop( m_stream );
165} 165}
166 166
167void Lib::pause() { 167void Lib::pause() {
168 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); 168 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
169} 169}
170 170
171int Lib::speed() { 171int Lib::speed() {
172 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 172 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
173} 173}
174 174
175void Lib::setSpeed( int speed ) { 175void Lib::setSpeed( int speed ) {
176 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 176 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
177} 177}
178 178
179int Lib::status() { 179int Lib::status() {
180 return xine_get_status( m_stream ); 180 return xine_get_status( m_stream );
181} 181}
182 182
183int Lib::currentPosition() { 183int Lib::currentPosition() {
184 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); 184 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
185 return m_pos; 185 return m_pos;
186} 186}
187 187
188int Lib::currentTime() { 188int Lib::currentTime() {
189 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); 189 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
190 return m_time/1000; 190 return m_time/1000;
191} 191}
192 192
193int Lib::length() { 193int Lib::length() {
194 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length ); 194 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
195 return m_length/1000; 195 return m_length/1000;
196} 196}
197 197
198bool Lib::isSeekable() { 198bool Lib::isSeekable() {
199 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 199 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
200} 200}
201 201
202void Lib::seekTo( int time ) { 202void Lib::seekTo( int time ) {
203 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 203 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
204 xine_play( m_stream, 0, time ); 204 // since its now milliseconds we need *1000
205 xine_play( m_stream, 0, time*1000 );
205} 206}
206 207
207 208
208Frame Lib::currentFrame() { 209Frame Lib::currentFrame() {
209 Frame frame; 210 Frame frame;
210 return frame; 211 return frame;
211}; 212};
212 213
213QString Lib::metaInfo( int number) { 214QString Lib::metaInfo( int number) {
214 return xine_get_meta_info( m_stream, number ); 215 return xine_get_meta_info( m_stream, number );
215} 216}
216 217
217int Lib::error() { 218int Lib::error() {
218 return xine_get_error( m_stream ); 219 return xine_get_error( m_stream );
219}; 220};
220 221
221void Lib::handleXineEvent( const xine_event_t* t ) { 222void Lib::handleXineEvent( const xine_event_t* t ) {
222 if ( t->type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 223 if ( t->type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
223 emit stopped(); 224 emit stopped();
224 } 225 }
225} 226}
226 227
227 228
228void Lib::setShowVideo( bool video ) { 229void Lib::setShowVideo( bool video ) {
229 m_video = video; 230 m_video = video;
230 ::null_set_show_video( m_videoOutput, video ); 231 ::null_set_show_video( m_videoOutput, video );
231} 232}
232 233
233bool Lib::isShowingVideo() { 234bool Lib::isShowingVideo() {
234 return ::null_is_showing_video( m_videoOutput ); 235 return ::null_is_showing_video( m_videoOutput );
235} 236}
236 237
237bool Lib::hasVideo() { 238bool Lib::hasVideo() {
238 return xine_get_stream_info( m_stream, 18 ); 239 return xine_get_stream_info( m_stream, 18 );
239} 240}
240 241
241void Lib::showVideoFullScreen( bool fullScreen ) { 242void Lib::showVideoFullScreen( bool fullScreen ) {
242 ::null_set_fullscreen( m_videoOutput, fullScreen ); 243 ::null_set_fullscreen( m_videoOutput, fullScreen );
243} 244}
244 245
245bool Lib::isVideoFullScreen() { 246bool Lib::isVideoFullScreen() {
246 return ::null_is_fullscreen( m_videoOutput ); 247 return ::null_is_fullscreen( m_videoOutput );
247} 248}
248 249
249void Lib::setScaling( bool scale ) { 250void Lib::setScaling( bool scale ) {
250 ::null_set_scaling( m_videoOutput, scale ); 251 ::null_set_scaling( m_videoOutput, scale );
251} 252}
252 253
253void Lib::setGamma( int value ) { 254void Lib::setGamma( int value ) {
254 //qDebug( QString( "%1").arg(value) ); 255 //qDebug( QString( "%1").arg(value) );
255 /* int gammaValue = ( 100 + value ); */ 256 /* int gammaValue = ( 100 + value ); */
256 ::null_set_videoGamma( m_videoOutput, value ); 257 ::null_set_videoGamma( m_videoOutput, value );
257} 258}
258 259
259bool Lib::isScaling() { 260bool Lib::isScaling() {
260 return ::null_is_scaling( m_videoOutput ); 261 return ::null_is_scaling( m_videoOutput );
261} 262}
262 263
263void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { 264void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
264 ( (Lib*)user_data)->handleXineEvent( t ); 265 ( (Lib*)user_data)->handleXineEvent( t );
265} 266}
266 267
267void Lib::xine_display_frame( void* user_data, uint8_t *frame, 268void Lib::xine_display_frame( void* user_data, uint8_t *frame,
268 int width, int height, int bytes ) { 269 int width, int height, int bytes ) {
269 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 270 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
270} 271}
271 272
272void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 273void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
273 if ( !m_video ) { 274 if ( !m_video ) {
274 qWarning("not showing video now"); 275 qWarning("not showing video now");
275 return; 276 return;
276 } 277 }
277 m_wid-> setVideoFrame ( frame, width, height, bytes ); 278 m_wid-> setVideoFrame ( frame, width, height, bytes );
278} 279}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 191dbbd..38938a1 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -1,199 +1,202 @@
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#ifndef ZECKEXINELIB_H 34#ifndef ZECKEXINELIB_H
35#define ZECKEXINELIB_H 35#define ZECKEXINELIB_H
36 36
37#include <qcstring.h> 37#include <qcstring.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <qobject.h> 39#include <qobject.h>
40 40
41#include <xine.h> 41#include <xine.h>
42//#include "xine.h" 42//#include "xine.h"
43 43
44class XineVideoWidget; 44class XineVideoWidget;
45 45
46namespace XINE { 46namespace XINE {
47 47
48 /** 48 /**
49 * Lib wrapps the simple interface 49 * Lib wrapps the simple interface
50 * of libxine for easy every day use 50 * of libxine for easy every day use
51 * This will become a full C++ Wrapper 51 * This will become a full C++ Wrapper
52 * It supports playing, pausing, info, 52 * It supports playing, pausing, info,
53 * stooping, seeking. 53 * stooping, seeking.
54 */ 54 */
55 class Frame; 55 class Frame;
56 class Lib : public QObject { 56 class Lib : public QObject {
57 Q_OBJECT 57 Q_OBJECT
58 public: 58 public:
59 Lib(XineVideoWidget* = 0); 59 Lib(XineVideoWidget* = 0);
60 ~Lib(); 60 ~Lib();
61 QCString version(); 61 QCString version();
62 int majorVersion()/*const*/; 62 int majorVersion()/*const*/;
63 int minorVersion()/*const*/; 63 int minorVersion()/*const*/;
64 int subVersion()/*const*/; 64 int subVersion()/*const*/;
65 65
66 66
67 void resize ( const QSize &s ); 67 void resize ( const QSize &s );
68 68
69 int play( const QString& fileName, 69 int play( const QString& fileName,
70 int startPos = 0, 70 int startPos = 0,
71 int start_time = 0 ); 71 int start_time = 0 );
72 void stop() /*const*/; 72 void stop() /*const*/;
73 void pause()/*const*/; 73 void pause()/*const*/;
74 74
75 int speed() /*const*/; 75 int speed() /*const*/;
76 76
77 /** 77 /**
78 * Set the speed of the stream, if codec supports it 78 * Set the speed of the stream, if codec supports it
79 * XINE_SPEED_PAUSE 0 79 * XINE_SPEED_PAUSE 0
80 * XINE_SPEED_SLOW_4 1 80 * XINE_SPEED_SLOW_4 1
81 * XINE_SPEED_SLOW_2 2 81 * XINE_SPEED_SLOW_2 2
82 * XINE_SPEED_NORMAL 4 82 * XINE_SPEED_NORMAL 4
83 * XINE_SPEED_FAST_2 8 83 * XINE_SPEED_FAST_2 8
84 *XINE_SPEED_FAST_4 16 84 *XINE_SPEED_FAST_4 16
85 */ 85 */
86 void setSpeed( int speed = XINE_SPEED_PAUSE ); 86 void setSpeed( int speed = XINE_SPEED_PAUSE );
87 87
88 int status() /*const*/; 88 int status() /*const*/;
89 89
90 int currentPosition()/*const*/; 90 int currentPosition()/*const*/;
91 //in seconds 91 //in seconds
92 int currentTime()/*const*/; 92 int currentTime()/*const*/;
93
93 int length() /*const*/; 94 int length() /*const*/;
94 95
95 bool isSeekable()/*const*/; 96 bool isSeekable()/*const*/;
96 97
97 /** 98 /**
98 * Whether or not to show video output 99 * Whether or not to show video output
99 */ 100 */
100 void setShowVideo(bool video); 101 void setShowVideo(bool video);
101 102
102 /** 103 /**
103 * is we show video 104 * is we show video
104 */ 105 */
105 bool isShowingVideo() /*const*/; 106 bool isShowingVideo() /*const*/;
106 107
107 /** 108 /**
108 * 109 *
109 */ 110 */
110 void showVideoFullScreen( bool fullScreen ); 111 void showVideoFullScreen( bool fullScreen );
111 112
112 /** 113 /**
113 * 114 *
114 */ 115 */
115 bool isVideoFullScreen()/*const*/ ; 116 bool isVideoFullScreen()/*const*/ ;
116 117
117 118
118 /** 119 /**
119 * Get the meta info (like author etc) from the stream 120 * Get the meta info (like author etc) from the stream
120 * XINE_META_INFO_TITLE 0 121 * XINE_META_INFO_TITLE 0
121 * XINE_META_INFO_COMMENT 1 122 * XINE_META_INFO_COMMENT 1
122 * XINE_META_INFO_ARTIST 2 123 * XINE_META_INFO_ARTIST 2
123 * XINE_META_INFO_GENRE 3 124 * XINE_META_INFO_GENRE 3
124 * XINE_META_INFO_ALBUM 4 125 * XINE_META_INFO_ALBUM 4
125 * XINE_META_INFO_YEAR 5 126 * XINE_META_INFO_YEAR 5
126 * XINE_META_INFO_VIDEOCODEC 6 127 * XINE_META_INFO_VIDEOCODEC 6
127 * XINE_META_INFO_AUDIOCODEC 7 128 * XINE_META_INFO_AUDIOCODEC 7
128 * XINE_META_INFO_SYSTEMLAYER 8 129 * XINE_META_INFO_SYSTEMLAYER 8
129 * XINE_META_INFO_INPUT_PLUGIN 9 130 * XINE_META_INFO_INPUT_PLUGIN 9
130 */ 131 */
131 QString metaInfo( int number ); 132 QString metaInfo( int number );
132 133
133 /** 134 /**
134 * 135 *
135 */ 136 */
136 bool isScaling(); 137 bool isScaling();
137 138
138 /** 139 /**
139 * seek to a position 140 * seek to a position
140 */ 141 */
141 void seekTo( int time ); 142 void seekTo( int time );
142 143
143 /** 144 /**
144 * 145 *
145 * @return is media stream has video 146 * @return is media stream has video
146 */ 147 */
147 bool hasVideo(); 148 bool hasVideo();
148 149
149 /** 150 /**
150 * 151 *
151 */ 152 */
152 void setScaling( bool ); 153 void setScaling( bool );
153 154
154 /** 155 /**
155 * Set the Gamma value for video output 156 * Set the Gamma value for video output
156 * @param int the value between -100 and 100, 0 is original 157 * @param int the value between -100 and 100, 0 is original
157 */ 158 */
158 void setGamma( int ); 159 void setGamma( int );
159 160
160 /** 161 /**
161 * test 162 * test
162 */ 163 */
163 Frame currentFrame()/*const*/; 164 Frame currentFrame()/*const*/;
164 165
165 /** 166 /**
166 * Returns the error code 167 * Returns the error code
167 * XINE_ERROR_NONE 0 168 * XINE_ERROR_NONE 0
168 * XINE_ERROR_NO_INPUT_PLUGIN 1 169 * XINE_ERROR_NO_INPUT_PLUGIN 1
169 * XINE_ERROR_NO_DEMUXER_PLUGIN 2 170 * XINE_ERROR_NO_DEMUXER_PLUGIN 2
170 * XINE_ERROR_DEMUXER_FAILED 3 171 * XINE_ERROR_DEMUXER_FAILED 3
171 */ 172 */
172 int error() /*const*/; 173 int error() /*const*/;
173 174
174 signals: 175 signals:
176
175 void stopped(); 177 void stopped();
178
176 private: 179 private:
177 int m_bytes_per_pixel; 180 int m_bytes_per_pixel;
178 int m_length, m_pos, m_time; 181 int m_length, m_pos, m_time;
179 int m_major_version, m_minor_version, m_sub_version; 182 int m_major_version, m_minor_version, m_sub_version;
180 bool m_video:1; 183 bool m_video:1;
181 XineVideoWidget *m_wid; 184 XineVideoWidget *m_wid;
182 xine_t *m_xine; 185 xine_t *m_xine;
183 xine_stream_t *m_stream; 186 xine_stream_t *m_stream;
184 xine_cfg_entry_t *m_config; 187 xine_cfg_entry_t *m_config;
185 xine_vo_driver_t *m_videoOutput; 188 xine_vo_driver_t *m_videoOutput;
186 xine_ao_driver_t* m_audioOutput; 189 xine_ao_driver_t* m_audioOutput;
187 xine_event_queue_t *m_queue; 190 xine_event_queue_t *m_queue;
188 191
189 void handleXineEvent( const xine_event_t* t ); 192 void handleXineEvent( const xine_event_t* t );
190 void drawFrame( uint8_t* frame, int width, int height, int bytes ); 193 void drawFrame( uint8_t* frame, int width, int height, int bytes );
191 // C -> C++ bridge for the event system 194 // C -> C++ bridge for the event system
192 static void xine_event_handler( void* user_data, const xine_event_t* t); 195 static void xine_event_handler( void* user_data, const xine_event_t* t);
193 static void xine_display_frame( void* user_data, uint8_t* frame , 196 static void xine_display_frame( void* user_data, uint8_t* frame ,
194 int width, int height, int bytes ); 197 int width, int height, int bytes );
195 }; 198 };
196}; 199};
197 200
198 201
199#endif 202#endif
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index dcdfae6..b1f4811 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -186,423 +186,425 @@ static vo_frame_t* null_alloc_frame( xine_vo_driver_t* self ){
186 frame->frame.copy = null_frame_copy; 186 frame->frame.copy = null_frame_copy;
187 frame->frame.field = null_frame_field; 187 frame->frame.field = null_frame_field;
188 frame->frame.dispose = null_frame_dispose; 188 frame->frame.dispose = null_frame_dispose;
189 189
190 /* 190 /*
191 * colorspace converter for this frame 191 * colorspace converter for this frame
192 */ 192 */
193 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); 193 frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory);
194 194
195 return (vo_frame_t*) frame; 195 return (vo_frame_t*) frame;
196} 196}
197 197
198static void null_update_frame_format( xine_vo_driver_t* self, vo_frame_t* img, 198static void null_update_frame_format( xine_vo_driver_t* self, vo_frame_t* img,
199 uint32_t width, uint32_t height, 199 uint32_t width, uint32_t height,
200 int ratio_code, int format, int flags ){ 200 int ratio_code, int format, int flags ){
201 null_driver_t* this = (null_driver_t*) self; 201 null_driver_t* this = (null_driver_t*) self;
202 opie_frame_t* frame = (opie_frame_t*)img; 202 opie_frame_t* frame = (opie_frame_t*)img;
203 /* not needed now */ 203 /* not needed now */
204 204
205#ifdef LOG 205#ifdef LOG
206 fprintf (stderr, "nullvideo: update_frame_format\n"); 206 fprintf (stderr, "nullvideo: update_frame_format\n");
207#endif 207#endif
208 208
209 flags &= VO_BOTH_FIELDS; 209 flags &= VO_BOTH_FIELDS;
210 210
211 /* find out if we need to adapt this frame */ 211 /* find out if we need to adapt this frame */
212 212
213 if ((width != frame->sc.delivered_width) 213 if ((width != frame->sc.delivered_width)
214 || (height != frame->sc.delivered_height) 214 || (height != frame->sc.delivered_height)
215 || (ratio_code != frame->sc.delivered_ratio_code) 215 || (ratio_code != frame->sc.delivered_ratio_code)
216 || (flags != frame->flags) 216 || (flags != frame->flags)
217 || (format != frame->format) 217 || (format != frame->format)
218 || (this->sc.user_ratio != frame->sc.user_ratio) 218 || (this->sc.user_ratio != frame->sc.user_ratio)
219 || (this->gui_width != frame->sc.gui_width) 219 || (this->gui_width != frame->sc.gui_width)
220 || (this->gui_height != frame->sc.gui_height)) { 220 || (this->gui_height != frame->sc.gui_height)) {
221 221
222 frame->sc.delivered_width = width; 222 frame->sc.delivered_width = width;
223 frame->sc.delivered_height = height; 223 frame->sc.delivered_height = height;
224 frame->sc.delivered_ratio_code = ratio_code; 224 frame->sc.delivered_ratio_code = ratio_code;
225 frame->flags = flags; 225 frame->flags = flags;
226 frame->format = format; 226 frame->format = format;
227 frame->sc.user_ratio = this->sc.user_ratio; 227 frame->sc.user_ratio = this->sc.user_ratio;
228 frame->sc.gui_width = this->gui_width; 228 frame->sc.gui_width = this->gui_width;
229 frame->sc.gui_height = this->gui_height; 229 frame->sc.gui_height = this->gui_height;
230 frame->sc.gui_pixel_aspect = 1.0; 230 frame->sc.gui_pixel_aspect = 1.0;
231 231
232 vo_scale_compute_ideal_size ( &frame->sc ); 232 vo_scale_compute_ideal_size ( &frame->sc );
233 vo_scale_compute_output_size( &frame->sc ); 233 vo_scale_compute_output_size( &frame->sc );
234 234
235 #ifdef LOG 235 #ifdef LOG
236 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n", 236 fprintf (stderr, "nullvideo: gui %dx%d delivered %dx%d output %dx%d\n",
237 frame->sc.gui_width, frame->sc.gui_height, 237 frame->sc.gui_width, frame->sc.gui_height,
238 frame->sc.delivered_width, frame->sc.delivered_height, 238 frame->sc.delivered_width, frame->sc.delivered_height,
239 frame->sc.output_width, frame->sc.output_height); 239 frame->sc.output_width, frame->sc.output_height);
240#endif 240#endif
241 241
242 /* 242 /*
243 * (re-) allocate 243 * (re-) allocate
244 */ 244 */
245 if( frame->data ) { 245 if( frame->data ) {
246 if( frame->chunk[0] ){ 246 if( frame->chunk[0] ){
247 free( frame->chunk[0] ); 247 free( frame->chunk[0] );
248 frame->chunk[0] = NULL; 248 frame->chunk[0] = NULL;
249 } 249 }
250 if( frame->chunk[1] ){ 250 if( frame->chunk[1] ){
251 free ( frame->chunk[1] ); 251 free ( frame->chunk[1] );
252 frame->chunk[1] = NULL; 252 frame->chunk[1] = NULL;
253 } 253 }
254 if( frame->chunk[2] ){ 254 if( frame->chunk[2] ){
255 free ( frame->chunk[2] ); 255 free ( frame->chunk[2] );
256 frame->chunk[2] = NULL; 256 frame->chunk[2] = NULL;
257 } 257 }
258 free ( frame->data ); 258 free ( frame->data );
259 } 259 }
260 260
261 frame->data = xine_xmalloc (frame->sc.output_width 261 frame->data = xine_xmalloc (frame->sc.output_width
262 * frame->sc.output_height 262 * frame->sc.output_height
263 * this->bytes_per_pixel ); 263 * this->bytes_per_pixel );
264 264
265 if( format == XINE_IMGFMT_YV12 ) { 265 if( format == XINE_IMGFMT_YV12 ) {
266 frame->frame.pitches[0] = 8*((width + 7) / 8); 266 frame->frame.pitches[0] = 8*((width + 7) / 8);
267 frame->frame.pitches[1] = 8*((width + 15) / 16); 267 frame->frame.pitches[1] = 8*((width + 15) / 16);
268 frame->frame.pitches[2] = 8*((width + 15) / 16); 268 frame->frame.pitches[2] = 8*((width + 15) / 16);
269 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]); 269 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,(void **)&frame->chunk[0]);
270 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]); 270 frame->frame.base[1] = xine_xmalloc_aligned (16, frame->frame.pitches[1] * ((height+ 1)/2), (void **)&frame->chunk[1]);
271 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]); 271 frame->frame.base[2] = xine_xmalloc_aligned (16, frame->frame.pitches[2] * ((height+ 1)/2), (void **)&frame->chunk[2]);
272 272
273 }else{ 273 }else{
274 frame->frame.pitches[0] = 8*((width + 3) / 4); 274 frame->frame.pitches[0] = 8*((width + 3) / 4);
275 275
276 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height, 276 frame->frame.base[0] = xine_xmalloc_aligned (16, frame->frame.pitches[0] * height,
277 (void **)&frame->chunk[0]); 277 (void **)&frame->chunk[0]);
278 frame->chunk[1] = NULL; 278 frame->chunk[1] = NULL;
279 frame->chunk[2] = NULL; 279 frame->chunk[2] = NULL;
280 } 280 }
281 281
282 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height; 282 frame->stripe_height = 16 * frame->sc.output_height / frame->sc.delivered_height;
283 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; 283 frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel;
284 284
285 /* 285 /*
286 * set up colorspace converter 286 * set up colorspace converter
287 */ 287 */
288 288
289 switch (flags) { 289 switch (flags) {
290 case VO_TOP_FIELD: 290 case VO_TOP_FIELD:
291 case VO_BOTTOM_FIELD: 291 case VO_BOTTOM_FIELD:
292 frame->yuv2rgb->configure (frame->yuv2rgb, 292 frame->yuv2rgb->configure (frame->yuv2rgb,
293 frame->sc.delivered_width, 293 frame->sc.delivered_width,
294 16, 294 16,
295 2*frame->frame.pitches[0], 295 2*frame->frame.pitches[0],
296 2*frame->frame.pitches[1], 296 2*frame->frame.pitches[1],
297 frame->sc.output_width, 297 frame->sc.output_width,
298 frame->stripe_height, 298 frame->stripe_height,
299 frame->bytes_per_line*2); 299 frame->bytes_per_line*2);
300 frame->yuv_stride = frame->bytes_per_line*2; 300 frame->yuv_stride = frame->bytes_per_line*2;
301 break; 301 break;
302 case VO_BOTH_FIELDS: 302 case VO_BOTH_FIELDS:
303 frame->yuv2rgb->configure (frame->yuv2rgb, 303 frame->yuv2rgb->configure (frame->yuv2rgb,
304 frame->sc.delivered_width, 304 frame->sc.delivered_width,
305 16, 305 16,
306 frame->frame.pitches[0], 306 frame->frame.pitches[0],
307 frame->frame.pitches[1], 307 frame->frame.pitches[1],
308 frame->sc.output_width, 308 frame->sc.output_width,
309 frame->stripe_height, 309 frame->stripe_height,
310 frame->bytes_per_line); 310 frame->bytes_per_line);
311 frame->yuv_stride = frame->bytes_per_line; 311 frame->yuv_stride = frame->bytes_per_line;
312 break; 312 break;
313 } 313 }
314#ifdef LOG 314#ifdef LOG
315 fprintf (stderr, "nullvideo: colorspace converter configured.\n"); 315 fprintf (stderr, "nullvideo: colorspace converter configured.\n");
316#endif 316#endif
317 } 317 }
318 318
319 /* 319 /*
320 * reset dest pointers 320 * reset dest pointers
321 */ 321 */
322 322
323 if (frame->data) { 323 if (frame->data) {
324 switch (flags) { 324 switch (flags) {
325 case VO_TOP_FIELD: 325 case VO_TOP_FIELD:
326 frame->rgb_dst = (uint8_t *)frame->data; 326 frame->rgb_dst = (uint8_t *)frame->data;
327 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 327 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
328 break; 328 break;
329 case VO_BOTTOM_FIELD: 329 case VO_BOTTOM_FIELD:
330 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ; 330 frame->rgb_dst = (uint8_t *)frame->data + frame->bytes_per_line ;
331 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line; 331 frame->stripe_inc = 2 * frame->stripe_height * frame->bytes_per_line;
332 break; 332 break;
333 case VO_BOTH_FIELDS: 333 case VO_BOTH_FIELDS:
334 frame->rgb_dst = (uint8_t *)frame->data; 334 frame->rgb_dst = (uint8_t *)frame->data;
335 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line; 335 frame->stripe_inc = frame->stripe_height * frame->bytes_per_line;
336 break; 336 break;
337 } 337 }
338 } 338 }
339} 339}
340 340
341static void null_display_frame( xine_vo_driver_t* self, vo_frame_t *frame_gen ){ 341static void null_display_frame( xine_vo_driver_t* self, vo_frame_t *frame_gen ){
342 null_driver_t* this = (null_driver_t*) self; 342 null_driver_t* this = (null_driver_t*) self;
343 opie_frame_t* frame = (opie_frame_t*)frame_gen; 343 opie_frame_t* frame = (opie_frame_t*)frame_gen;
344 display_xine_frame_t display = this->frameDis; 344 display_xine_frame_t display = this->frameDis;
345 345
346 if (!this->m_show_video) 346 if (!this->m_show_video)
347 return; 347 return;
348 348
349 if( display != NULL ) { 349 if( display != NULL ) {
350 (*display)(this->caller, frame->data, 350 (*display)(this->caller, frame->data,
351 frame->sc.output_width, frame->sc.output_height, 351 frame->sc.output_width, frame->sc.output_height,
352 frame->bytes_per_line ); 352 frame->bytes_per_line );
353 } 353 }
354 354
355 frame->frame.displayed (&frame->frame); 355 frame->frame.displayed (&frame->frame);
356} 356}
357 357
358 358
359/* blending related */ 359/* blending related */
360static void null_overlay_clut_yuv2rgb (null_driver_t *this, 360static void null_overlay_clut_yuv2rgb (null_driver_t *this,
361 vo_overlay_t *overlay, 361 vo_overlay_t *overlay,
362 opie_frame_t *frame) { 362 opie_frame_t *frame) {
363 int i; 363 int i;
364 clut_t* clut = (clut_t*) overlay->color; 364 clut_t* clut = (clut_t*) overlay->color;
365 if (!overlay->rgb_clut) { 365 if (!overlay->rgb_clut) {
366 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 366 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
367 *((uint32_t *)&clut[i]) = 367 *((uint32_t *)&clut[i]) =
368 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb, 368 frame->yuv2rgb->yuv2rgb_single_pixel_fun (frame->yuv2rgb,
369 clut[i].y, clut[i].cb, clut[i].cr); 369 clut[i].y, clut[i].cb, clut[i].cr);
370 } 370 }
371 overlay->rgb_clut++; 371 overlay->rgb_clut++;
372 } 372 }
373 if (!overlay->clip_rgb_clut) { 373 if (!overlay->clip_rgb_clut) {
374 clut = (clut_t*) overlay->clip_color; 374 clut = (clut_t*) overlay->clip_color;
375 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) { 375 for (i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) {
376 *((uint32_t *)&clut[i]) = 376 *((uint32_t *)&clut[i]) =
377 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb, 377 frame->yuv2rgb->yuv2rgb_single_pixel_fun(frame->yuv2rgb,
378 clut[i].y, clut[i].cb, clut[i].cr); 378 clut[i].y, clut[i].cb, clut[i].cr);
379 } 379 }
380 overlay->clip_rgb_clut++; 380 overlay->clip_rgb_clut++;
381 } 381 }
382} 382}
383 383
384static void null_overlay_blend ( xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { 384static void null_overlay_blend ( xine_vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) {
385 null_driver_t *this = (null_driver_t *) this_gen; 385 null_driver_t *this = (null_driver_t *) this_gen;
386 opie_frame_t *frame = (opie_frame_t *) frame_gen; 386 opie_frame_t *frame = (opie_frame_t *) frame_gen;
387 387
388 if(!this->m_show_video || frame->sc.output_width == 0 388 if(!this->m_show_video || frame->sc.output_width == 0
389 || frame->sc.output_height== 0) 389 || frame->sc.output_height== 0)
390 return; 390 return;
391 391
392 /* Alpha Blend here */ 392 /* Alpha Blend here */
393 if (overlay->rle) { 393 if (overlay->rle) {
394 if( !overlay->rgb_clut || !overlay->clip_rgb_clut) 394 if( !overlay->rgb_clut || !overlay->clip_rgb_clut)
395 null_overlay_clut_yuv2rgb(this,overlay,frame); 395 null_overlay_clut_yuv2rgb(this,overlay,frame);
396 396
397 switch(this->bpp) { 397 switch(this->bpp) {
398 case 16: 398 case 16:
399 blend_rgb16( (uint8_t *)frame->data, overlay, 399 blend_rgb16( (uint8_t *)frame->data, overlay,
400 frame->sc.output_width, frame->sc.output_height, 400 frame->sc.output_width, frame->sc.output_height,
401 frame->sc.delivered_width, frame->sc.delivered_height); 401 frame->sc.delivered_width, frame->sc.delivered_height);
402 break; 402 break;
403 case 24: 403 case 24:
404 blend_rgb24( (uint8_t *)frame->data, overlay, 404 blend_rgb24( (uint8_t *)frame->data, overlay,
405 frame->sc.output_width, frame->sc.output_height, 405 frame->sc.output_width, frame->sc.output_height,
406 frame->sc.delivered_width, frame->sc.delivered_height); 406 frame->sc.delivered_width, frame->sc.delivered_height);
407 break; 407 break;
408 case 32: 408 case 32:
409 blend_rgb32( (uint8_t *)frame->data, overlay, 409 blend_rgb32( (uint8_t *)frame->data, overlay,
410 frame->sc.output_width, frame->sc.output_height, 410 frame->sc.output_width, frame->sc.output_height,
411 frame->sc.delivered_width, frame->sc.delivered_height); 411 frame->sc.delivered_width, frame->sc.delivered_height);
412 break; 412 break;
413 default: 413 default:
414 /* It should never get here */ 414 /* It should never get here */
415 break; 415 break;
416 } 416 }
417 } 417 }
418} 418}
419 419
420 420
421static int null_get_property( xine_vo_driver_t* self, 421static int null_get_property( xine_vo_driver_t* self,
422 int property ){ 422 int property ){
423 return 0; 423 return 0;
424} 424}
425static int null_set_property( xine_vo_driver_t* self, 425static int null_set_property( xine_vo_driver_t* self,
426 int property, 426 int property,
427 int value ){ 427 int value ){
428 return value; 428 return value;
429} 429}
430static void null_get_property_min_max( xine_vo_driver_t* self, 430static void null_get_property_min_max( xine_vo_driver_t* self,
431 int property, int *min, 431 int property, int *min,
432 int *max ){ 432 int *max ){
433 *max = 0; 433 *max = 0;
434 *min = 0; 434 *min = 0;
435} 435}
436static int null_gui_data_exchange( xine_vo_driver_t* self, 436static int null_gui_data_exchange( xine_vo_driver_t* self,
437 int data_type, 437 int data_type,
438 void *data ){ 438 void *data ){
439 return 0; 439 return 0;
440} 440}
441 441
442static void null_exit( xine_vo_driver_t* self ){ 442static void null_dispose ( xine_vo_driver_t* self ){
443 null_driver_t* this = (null_driver_t*)self; 443 null_driver_t* this = (null_driver_t*)self;
444 free ( this ); 444 free ( this );
445} 445}
446static int null_redraw_needed( xine_vo_driver_t* self ){ 446static int null_redraw_needed( xine_vo_driver_t* self ){
447 return 0; 447 return 0;
448} 448}
449 449
450 450
451xine_vo_driver_t* init_video_out_plugin( config_values_t* conf, 451xine_vo_driver_t* init_video_out_plugin( config_values_t* conf,
452 void* video ){ 452 void* video ){
453 null_driver_t *vo; 453 null_driver_t *vo;
454 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) ); 454 vo = (null_driver_t*)malloc( sizeof(null_driver_t ) );
455 455
456 /* memset? */ 456 /* memset? */
457 memset(vo,0, sizeof(null_driver_t ) ); 457 memset(vo,0, sizeof(null_driver_t ) );
458 458
459 vo_scale_init (&vo->sc, 0, 0); 459 vo_scale_init (&vo->sc, 0, 0);
460 460
461 vo->sc.gui_pixel_aspect = 1.0; 461 vo->sc.gui_pixel_aspect = 1.0;
462 462
463 vo->m_show_video = 0; // false 463 vo->m_show_video = 0; // false
464 vo->m_video_fullscreen = 0; 464 vo->m_video_fullscreen = 0;
465 vo->m_is_scaling = 0; 465 vo->m_is_scaling = 0;
466 vo->display_ratio = 1.0; 466 vo->display_ratio = 1.0;
467 vo->gui_width = 16; 467 vo->gui_width = 16;
468 vo->gui_height = 8; 468 vo->gui_height = 8;
469 vo->frameDis = NULL; 469 vo->frameDis = NULL;
470 470
471 /* install callback handlers*/ 471 /* install callback handlers*/
472 vo->vo_driver.get_capabilities = null_get_capabilities; 472 vo->vo_driver.get_capabilities = null_get_capabilities;
473 vo->vo_driver.alloc_frame = null_alloc_frame; 473 vo->vo_driver.alloc_frame = null_alloc_frame;
474 vo->vo_driver.update_frame_format = null_update_frame_format; 474 vo->vo_driver.update_frame_format = null_update_frame_format;
475 vo->vo_driver.display_frame = null_display_frame; 475 vo->vo_driver.display_frame = null_display_frame;
476 vo->vo_driver.overlay_blend = null_overlay_blend; 476 vo->vo_driver.overlay_blend = null_overlay_blend;
477 vo->vo_driver.get_property = null_get_property; 477 vo->vo_driver.get_property = null_get_property;
478 vo->vo_driver.set_property = null_set_property; 478 vo->vo_driver.set_property = null_set_property;
479 vo->vo_driver.get_property_min_max = null_get_property_min_max; 479 vo->vo_driver.get_property_min_max = null_get_property_min_max;
480 vo->vo_driver.gui_data_exchange = null_gui_data_exchange; 480 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
481 vo->vo_driver.exit = null_exit; 481 vo->vo_driver.dispose = null_dispose;
482 vo->vo_driver.redraw_needed = null_redraw_needed; 482 vo->vo_driver.redraw_needed = null_redraw_needed;
483 483
484 484
485 /* capabilities */ 485 /* capabilities */
486 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; 486 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12;
487 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, 487 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
488 vo->yuv2rgb_cmap); 488 vo->yuv2rgb_cmap);
489 489
490 return ( xine_vo_driver_t*) vo; 490 return ( xine_vo_driver_t*) vo;
491} 491}
492 492
493#if 0
493static vo_info_t vo_info_null = { 494static vo_info_t vo_info_null = {
494 5, 495 5,
495 "null plugin",
496 XINE_VISUAL_TYPE_FB 496 XINE_VISUAL_TYPE_FB
497}; 497};
498 498
499vo_info_t *get_video_out_plugin_info(){ 499vo_info_t *get_video_out_plugin_info(){
500 vo_info_null.description = _("xine video output plugin using null device"); 500 vo_info_null.description = _("xine video output plugin using null device");
501 return &vo_info_null; 501 return &vo_info_null;
502} 502}
503 503
504#endif
505
504/* this is special for this device */ 506/* this is special for this device */
505/** 507/**
506 * We know that we will be controled by the XINE LIB++ 508 * We know that we will be controled by the XINE LIB++
507 */ 509 */
508 510
509/** 511/**
510 * 512 *
511 */ 513 */
512int null_is_showing_video( xine_vo_driver_t* self ){ 514int null_is_showing_video( xine_vo_driver_t* self ){
513 null_driver_t* this = (null_driver_t*)self; 515 null_driver_t* this = (null_driver_t*)self;
514 return this->m_show_video; 516 return this->m_show_video;
515} 517}
516void null_set_show_video( xine_vo_driver_t* self, int show ) { 518void null_set_show_video( xine_vo_driver_t* self, int show ) {
517 ((null_driver_t*)self)->m_show_video = show; 519 ((null_driver_t*)self)->m_show_video = show;
518} 520}
519 521
520int null_is_fullscreen( xine_vo_driver_t* self ){ 522int null_is_fullscreen( xine_vo_driver_t* self ){
521 return ((null_driver_t*)self)->m_video_fullscreen; 523 return ((null_driver_t*)self)->m_video_fullscreen;
522} 524}
523void null_set_fullscreen( xine_vo_driver_t* self, int screen ){ 525void null_set_fullscreen( xine_vo_driver_t* self, int screen ){
524 ((null_driver_t*)self)->m_video_fullscreen = screen; 526 ((null_driver_t*)self)->m_video_fullscreen = screen;
525} 527}
526int null_is_scaling( xine_vo_driver_t* self ){ 528int null_is_scaling( xine_vo_driver_t* self ){
527 return ((null_driver_t*)self)->m_is_scaling; 529 return ((null_driver_t*)self)->m_is_scaling;
528} 530}
529 531
530void null_set_videoGamma( xine_vo_driver_t* self , int value ) { 532void null_set_videoGamma( xine_vo_driver_t* self , int value ) {
531 ((null_driver_t*) self) ->yuv2rgb_gamma = value; 533 ((null_driver_t*) self) ->yuv2rgb_gamma = value;
532 ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value ); 534 ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value );
533} 535}
534 536
535void null_set_scaling( xine_vo_driver_t* self, int scale ) { 537void null_set_scaling( xine_vo_driver_t* self, int scale ) {
536 ((null_driver_t*)self)->m_is_scaling = scale; 538 ((null_driver_t*)self)->m_is_scaling = scale;
537} 539}
538 540
539void null_set_gui_width( xine_vo_driver_t* self, int width ) { 541void null_set_gui_width( xine_vo_driver_t* self, int width ) {
540 ((null_driver_t*)self)->gui_width = width; 542 ((null_driver_t*)self)->gui_width = width;
541} 543}
542void null_set_gui_height( xine_vo_driver_t* self, int height ) { 544void null_set_gui_height( xine_vo_driver_t* self, int height ) {
543 ((null_driver_t*)self)->gui_height = height; 545 ((null_driver_t*)self)->gui_height = height;
544} 546}
545 547
546 548
547void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) { 549void null_set_mode( xine_vo_driver_t* self, int depth, int rgb ) {
548 null_driver_t* this = (null_driver_t*)self; 550 null_driver_t* this = (null_driver_t*)self;
549 551
550 this->bytes_per_pixel = (depth + 7 ) / 8; 552 this->bytes_per_pixel = (depth + 7 ) / 8;
551 this->bpp = this->bytes_per_pixel * 8; 553 this->bpp = this->bytes_per_pixel * 8;
552 this->depth = depth; 554 this->depth = depth;
553 printf("depth %d %d\n", depth, this->bpp); 555 printf("depth %d %d\n", depth, this->bpp);
554 printf("pixeltype %d\n", rgb ); 556 printf("pixeltype %d\n", rgb );
555 switch ( this->depth ) { 557 switch ( this->depth ) {
556 case 32: 558 case 32:
557 if( rgb == 0 ) 559 if( rgb == 0 )
558 this->yuv2rgb_mode = MODE_32_RGB; 560 this->yuv2rgb_mode = MODE_32_RGB;
559 else 561 else
560 this->yuv2rgb_mode = MODE_32_BGR; 562 this->yuv2rgb_mode = MODE_32_BGR;
561 case 24: 563 case 24:
562 if( this->bpp == 32 ) { 564 if( this->bpp == 32 ) {
563 if( rgb == 0 ) { 565 if( rgb == 0 ) {
564 this->yuv2rgb_mode = MODE_32_RGB; 566 this->yuv2rgb_mode = MODE_32_RGB;
565 } else { 567 } else {
566 this->yuv2rgb_mode = MODE_32_BGR; 568 this->yuv2rgb_mode = MODE_32_BGR;
567 } 569 }
568 }else{ 570 }else{
569 if( rgb == 0 ) 571 if( rgb == 0 )
570 this->yuv2rgb_mode = MODE_24_RGB; 572 this->yuv2rgb_mode = MODE_24_RGB;
571 else 573 else
572 this->yuv2rgb_mode = MODE_24_BGR; 574 this->yuv2rgb_mode = MODE_24_BGR;
573 }; 575 };
574 break; 576 break;
575 case 16: 577 case 16:
576 if( rgb == 0 ) { 578 if( rgb == 0 ) {
577 this->yuv2rgb_mode = MODE_16_RGB; 579 this->yuv2rgb_mode = MODE_16_RGB;
578 } else { 580 } else {
579 this->yuv2rgb_mode = MODE_16_BGR; 581 this->yuv2rgb_mode = MODE_16_BGR;
580 } 582 }
581 break; 583 break;
582 case 15: 584 case 15:
583 if( rgb == 0 ) { 585 if( rgb == 0 ) {
584 this->yuv2rgb_mode = MODE_15_RGB; 586 this->yuv2rgb_mode = MODE_15_RGB;
585 } else { 587 } else {
586 this->yuv2rgb_mode = MODE_15_BGR; 588 this->yuv2rgb_mode = MODE_15_BGR;
587 } 589 }
588 break; 590 break;
589 case 8: 591 case 8:
590 if( rgb == 0 ) { 592 if( rgb == 0 ) {
591 this->yuv2rgb_mode = MODE_8_RGB; 593 this->yuv2rgb_mode = MODE_8_RGB;
592 } else { 594 } else {
593 this->yuv2rgb_mode = MODE_8_BGR; 595 this->yuv2rgb_mode = MODE_8_BGR;
594 } 596 }
595 break; 597 break;
596 }; 598 };
597 //free(this->yuv2rgb_factory ); 599 //free(this->yuv2rgb_factory );
598 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap, 600 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap,
599 // this->yuv2rgb_cmap); 601 // this->yuv2rgb_cmap);
600}; 602};
601 603
602void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t, 604void null_display_handler( xine_vo_driver_t* self, display_xine_frame_t t,
603 void* user_data ) { 605 void* user_data ) {
604 null_driver_t* this = (null_driver_t*) self; 606 null_driver_t* this = (null_driver_t*) self;
605 this->caller = user_data; 607 this->caller = user_data;
606 this->frameDis = t; 608 this->frameDis = t;
607} 609}
608 610
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 31ac9dc..03176b3 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,247 +1,258 @@
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 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = 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 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include "xinecontrol.h" 39#include "xinecontrol.h"
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41#include "videowidget.h" 41#include "videowidget.h"
42 42
43extern MediaPlayerState *mediaPlayerState; 43extern MediaPlayerState *mediaPlayerState;
44extern VideoWidget *videoUI; 44extern VideoWidget *videoUI;
45XineControl::XineControl( QObject *parent, const char *name ) 45XineControl::XineControl( QObject *parent, const char *name )
46 : QObject( parent, name ) { 46 : QObject( parent, name ) {
47 47
48 libXine = new XINE::Lib( videoUI->vidWidget() ); 48 libXine = new XINE::Lib( videoUI->vidWidget() );
49 49
50 connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); 50 connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) );
51 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 51 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
52 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); 52 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
53 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 53 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
54 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 54 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
55 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 55 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
56 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 56 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
58 58
59 disabledSuspendScreenSaver = FALSE; 59 disabledSuspendScreenSaver = FALSE;
60} 60}
61 61
62XineControl::~XineControl() { 62XineControl::~XineControl() {
63#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 63#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
64 if ( disabledSuspendScreenSaver ) { 64 if ( disabledSuspendScreenSaver ) {
65 disabledSuspendScreenSaver = FALSE; 65 disabledSuspendScreenSaver = FALSE;
66 // Re-enable the suspend mode 66 // Re-enable the suspend mode
67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
68 } 68 }
69#endif 69#endif
70 delete libXine; 70 delete libXine;
71} 71}
72 72
73void XineControl::play( const QString& fileName ) { 73void XineControl::play( const QString& fileName ) {
74 hasVideoChannel = FALSE; 74 hasVideoChannel = FALSE;
75 hasAudioChannel = FALSE; 75 hasAudioChannel = FALSE;
76 m_fileName = fileName; 76 m_fileName = fileName;
77 77
78 //qDebug("<<FILENAME: " + fileName + ">>>>"); 78 //qDebug("<<FILENAME: " + fileName + ">>>>");
79 79
80 if ( !libXine->play( fileName ) ) { 80 if ( !libXine->play( fileName ) ) {
81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
82 // toggle stop so the the play button is reset
83 mediaPlayerState->setPlaying( false );
82 return; 84 return;
83 } 85 }
84 mediaPlayerState->setPlaying( true ); 86 mediaPlayerState->setPlaying( true );
85 87
86 char whichGui; 88 char whichGui;
87 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 89 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
88 if ( !libXine->hasVideo() ) { 90 if ( !libXine->hasVideo() ) {
89 whichGui = 'a'; 91 whichGui = 'a';
90 qDebug("HAS AUDIO"); 92 qDebug("HAS AUDIO");
91 libXine->setShowVideo( false ); 93 libXine->setShowVideo( false );
92 hasAudioChannel = TRUE; 94 hasAudioChannel = TRUE;
93 } else { 95 } else {
94 whichGui = 'v'; 96 whichGui = 'v';
95 qDebug("HAS VIDEO"); 97 qDebug("HAS VIDEO");
96 libXine->setShowVideo( true ); 98 libXine->setShowVideo( true );
97 hasVideoChannel = TRUE; 99 hasVideoChannel = TRUE;
98 } 100 }
99 // determine if slider is shown 101 // determine if slider is shown
100 mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); 102 mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
101 // which gui (video / audio) 103 // which gui (video / audio)
102 mediaPlayerState->setView( whichGui ); 104 mediaPlayerState->setView( whichGui );
103 105
104#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 106#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
105 if ( !disabledSuspendScreenSaver ) { 107 if ( !disabledSuspendScreenSaver ) {
106 disabledSuspendScreenSaver = TRUE; 108 disabledSuspendScreenSaver = TRUE;
107 // Stop the screen from blanking and power saving state 109 // Stop the screen from blanking and power saving state
108 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 110 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
109 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 111 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
110 } 112 }
111#endif 113#endif
112 114
113 length(); 115 length();
114 position(); 116 position();
115} 117}
116 118
117void XineControl::nextMedia() { 119void XineControl::nextMedia() {
118 mediaPlayerState->setNext(); 120 mediaPlayerState->setNext();
119} 121}
120 122
121void XineControl::setGamma( int value ) { 123void XineControl::setGamma( int value ) {
122 libXine->setGamma( value ); 124 libXine->setGamma( value );
123} 125}
124 126
125void XineControl::stop( bool isSet ) { 127void XineControl::stop( bool isSet ) {
126 if ( !isSet ) { 128 if ( !isSet ) {
127 libXine->stop(); 129 libXine->stop();
128 130
129#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 131#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
130 if ( disabledSuspendScreenSaver ) { 132 if ( disabledSuspendScreenSaver ) {
131 disabledSuspendScreenSaver = FALSE; 133 disabledSuspendScreenSaver = FALSE;
132 // Re-enable the suspend mode 134 // Re-enable the suspend mode
133 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 135 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
134 } 136 }
135#endif 137#endif
136 } 138 }
137} 139}
138 140
139/** 141/**
140 * Pause playback 142 * Pause playback
141 * @isSet 143 * @isSet
142 */ 144 */
143void XineControl::pause( bool isSet) { 145void XineControl::pause( bool isSet) {
144 if ( isSet ) { 146 if ( isSet ) {
145 libXine->pause(); 147 libXine->pause();
146 } else { 148 } else {
147 libXine->play( m_fileName, 0, m_currentTime ); 149 libXine->play( m_fileName, 0, m_currentTime );
148 } 150 }
149} 151}
150 152
151 153
152/** 154/**
153 * get current time in playback 155 * get current time in playback
154 */ 156 */
155long XineControl::currentTime() { 157long XineControl::currentTime() {
156 // todo: jede sekunde überprüfen 158 // todo: jede sekunde überprüfen
157 m_currentTime = libXine->currentTime(); 159 m_currentTime = libXine->currentTime();
158 return m_currentTime; 160 return m_currentTime;
159 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 161 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
160} 162}
161 163
162/** 164/**
163 * Set the length of the media file 165 * Set the length of the media file
164 */ 166 */
165void XineControl::length() { 167void XineControl::length() {
166 m_length = libXine->length(); 168 m_length = libXine->length();
167 mediaPlayerState->setLength( m_length ); 169 mediaPlayerState->setLength( m_length );
168} 170}
169 171
170 172
171/** 173/**
172 * Reports the position the xine backend is at right now 174 * Reports the position the xine backend is at right now
173 * @return long the postion in seconds 175 * @return long the postion in seconds
174 */ 176 */
175long XineControl::position() { 177long XineControl::position() {
176 m_position = ( currentTime() ); 178 m_position = ( currentTime() );
177 mediaPlayerState->updatePosition( m_position ); 179 mediaPlayerState->updatePosition( m_position );
178 long emitPos = (long)m_position; 180 long emitPos = (long)m_position;
179 emit positionChanged( emitPos ); 181 emit positionChanged( emitPos );
180 if( mediaPlayerState->isPlaying ) { 182 if( mediaPlayerState->isPlaying ) {
181 // needs to be stopped the media is stopped 183 // needs to be stopped the media is stopped
182 QTimer::singleShot( 1000, this, SLOT( position() ) ); 184 QTimer::singleShot( 1000, this, SLOT( position() ) );
183 } 185 }
184 // qDebug("POSITION : %d", m_position); 186 // qDebug("POSITION : %d", m_position);
185 return m_position; 187 return m_position;
186} 188}
187 189
188/** 190/**
189 * Set videoplayback to fullscreen 191 * Set videoplayback to fullscreen
190 * @param isSet 192 * @param isSet
191 */ 193 */
192void XineControl::setFullscreen( bool isSet ) { 194void XineControl::setFullscreen( bool isSet ) {
193 libXine->showVideoFullScreen( isSet ); 195 libXine->showVideoFullScreen( isSet );
194} 196}
195 197
196 198
197QString XineControl::getMetaInfo() { 199QString XineControl::getMetaInfo() {
198 200
199 QString returnString; 201 QString returnString;
200 202
201 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 203 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
202 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 204 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
203 } 205 }
204 206
205 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 207 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
206 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 208 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
207 } 209 }
208 210
209 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 211 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
210 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 212 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
211 } 213 }
212 214
213 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 215 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
214 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 216 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
215 } 217 }
216 218
217 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 219 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
218 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 220 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
219 } 221 }
220 222
221 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 223 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
222 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 224 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
223 } 225 }
224 return returnString; 226 return returnString;
225} 227}
226 228
227QString XineControl::getErrorCode() { 229QString XineControl::getErrorCode() {
230
228 int errorCode = libXine->error(); 231 int errorCode = libXine->error();
229 232
233 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
234
230 if ( errorCode == 1 ) { 235 if ( errorCode == 1 ) {
231 return tr( "No input plugin found for this media type" ); 236 return tr( "No input plugin found for this media type" );
237 } else if ( errorCode == 2 ) {
238 return tr( "No demux plugin found for this media type" );
239 } else if ( errorCode == 3 ) {
240 return tr( "Demuxing failed for this media type" );
241 } else if ( errorCode == 4 ) {
242 return tr( "Malformed MRL" );
232 } else { 243 } else {
233 return tr( "Some other error" ); 244 return tr( "Some other error" );
234 } 245 }
235} 246}
236 247
237/** 248/**
238 * Seek to a position in the track 249 * Seek to a position in the track
239 * @param second the second to jump to 250 * @param second the second to jump to
240 */ 251 */
241void XineControl::seekTo( long second ) { 252void XineControl::seekTo( long second ) {
242 libXine->seekTo( (int)second ); 253 libXine->seekTo( (int)second );
243} 254}
244 255
245void XineControl::videoResized ( const QSize &s ) { 256void XineControl::videoResized ( const QSize &s ) {
246 libXine->resize( s ); 257 libXine->resize( s );
247} 258}