summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-11-09 11:18:45 (UTC)
committer harlekin <harlekin>2002-11-09 11:18:45 (UTC)
commit29758bfcaabf75a3155e8af140c11ca9ed014c42 (patch) (unidiff)
treeea8a0ed7eaffe1517a61fb5ac8bc2491eaf59f77
parent84e685e0c2922899dcdd69cfc23ecbccbf855af4 (diff)
downloadopie-29758bfcaabf75a3155e8af140c11ca9ed014c42.zip
opie-29758bfcaabf75a3155e8af140c11ca9ed014c42.tar.gz
opie-29758bfcaabf75a3155e8af140c11ca9ed014c42.tar.bz2
adated to todays version of xine api
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp63
-rw-r--r--noncore/multimedia/opieplayer2/lib.h6
2 files changed, 32 insertions, 37 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index c0e5acd..1ebbbd8 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,285 +1,278 @@
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 91
91 // allocate oss for sound 92 // allocate oss for sound
92 // and fb for framebuffer 93 // and fb for framebuffer
93 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 94 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
94 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 95 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
95 96
96 97
97//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);
98 99
99 100
100 null_display_handler( m_videoOutput, xine_display_frame, this ); 101 null_display_handler( m_videoOutput, xine_display_frame, this );
101 xine_init( m_xine, m_audioOutput, m_videoOutput ); 102
103 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
102 104
103 if (m_wid != 0 ) { 105 if (m_wid != 0 ) {
104 printf( "!0\n" ); 106 printf( "!0\n" );
105 resize ( m_wid-> size ( ) ); 107 resize ( m_wid-> size ( ) );
106 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 108 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
107 109
108 m_wid->repaint(); 110 m_wid->repaint();
109 } 111 }
110 112
111 xine_register_event_listener( m_xine, xine_event_handler, this ); 113 m_queue = xine_event_new_queue (m_stream);
114
115 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
112} 116}
113 117
114Lib::~Lib() { 118Lib::~Lib() {
115// free( m_config ); 119// free( m_config );
116 xine_remove_event_listener( m_xine, xine_event_handler );
117 xine_exit( m_xine ); 120 xine_exit( m_xine );
118 /* FIXME either free or delete but valgrind bitches against both */ 121 /* FIXME either free or delete but valgrind bitches against both */
119 //free( m_videoOutput ); 122 //free( m_videoOutput );
120 //delete m_audioOutput; 123 //delete m_audioOutput;
121} 124}
122 125
123void Lib::resize ( const QSize &s ) { 126void Lib::resize ( const QSize &s ) {
124 if ( s. width ( ) && s. height ( ) ) { 127 if ( s. width ( ) && s. height ( ) ) {
125 ::null_set_gui_width( m_videoOutput, s. width() ); 128 ::null_set_gui_width( m_videoOutput, s. width() );
126 ::null_set_gui_height( m_videoOutput, s. height() ); 129 ::null_set_gui_height( m_videoOutput, s. height() );
127 } 130 }
128} 131}
129 132
130QCString Lib::version() { 133QCString Lib::version() {
131 // QCString str( xine_get_str_version() ); 134 // QCString str( xine_get_str_version() );
132 // return str; 135 // return str;
133 return "test"; 136 return "test";
134} 137}
135 138
136int Lib::majorVersion() { 139int Lib::majorVersion() {
137 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 );
138 return m_major_version; 141 return m_major_version;
139} 142}
140 143
141int Lib::minorVersion() { 144int Lib::minorVersion() {
142 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 );
143 return m_minor_version; 146 return m_minor_version;
144} 147}
145 148
146int Lib::subVersion() { 149int Lib::subVersion() {
147 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 );
148 return m_sub_version; 151 return m_sub_version;
149} 152}
150 153
151int Lib::play( const QString& fileName, int startPos, int start_time ) { 154int Lib::play( const QString& fileName, int startPos, int start_time ) {
152 QString str = fileName.stripWhiteSpace(); 155 QString str = fileName.stripWhiteSpace();
153 if ( !xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ) ) { 156 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
154 return 0; 157 return 0;
155 } 158 }
156 return xine_play( m_xine, startPos, start_time); 159 return xine_play( m_stream, startPos, start_time);
157} 160}
158 161
159void Lib::stop() { 162void Lib::stop() {
160 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 163 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
161 xine_stop( m_xine ); 164 xine_stop( m_stream );
162} 165}
163 166
164void Lib::pause() { 167void Lib::pause() {
165 xine_set_param( m_xine, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); 168 xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
166} 169}
167 170
168int Lib::speed() { 171int Lib::speed() {
169 return xine_get_param ( m_xine, XINE_PARAM_SPEED ); 172 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
170} 173}
171 174
172void Lib::setSpeed( int speed ) { 175void Lib::setSpeed( int speed ) {
173 xine_set_param ( m_xine, XINE_PARAM_SPEED, speed ); 176 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
174} 177}
175 178
176int Lib::status() { 179int Lib::status() {
177 return xine_get_status( m_xine ); 180 return xine_get_status( m_stream );
178} 181}
179 182
180int Lib::currentPosition() { 183int Lib::currentPosition() {
181 xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); 184 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
182 return m_pos; 185 return m_pos;
183} 186}
184 187
185int Lib::currentTime() { 188int Lib::currentTime() {
186 xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); 189 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
187 return m_time/1000; 190 return m_time/1000;
188} 191}
189 192
190int Lib::length() { 193int Lib::length() {
191 xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); 194 xine_get_pos_length( m_stream, &m_pos, &m_time, &m_length );
192 return m_length/1000; 195 return m_length/1000;
193} 196}
194 197
195bool Lib::isSeekable() { 198bool Lib::isSeekable() {
196 return xine_get_stream_info( m_xine, XINE_STREAM_INFO_SEEKABLE ); 199 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
197} 200}
198 201
199void Lib::seekTo( int time ) { 202void Lib::seekTo( int time ) {
200// xine_trick_mode ( m_xine, 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 :_(
201 xine_play( m_xine, 0, time ); 204 xine_play( m_stream, 0, time );
202} 205}
203 206
204 207
205Frame Lib::currentFrame() { 208Frame Lib::currentFrame() {
206 Frame frame; 209 Frame frame;
207 return frame; 210 return frame;
208}; 211};
209 212
210QString Lib::metaInfo( int number) { 213QString Lib::metaInfo( int number) {
211 return xine_get_meta_info( m_xine, number ); 214 return xine_get_meta_info( m_stream, number );
212} 215}
213 216
214int Lib::error() { 217int Lib::error() {
215 return xine_get_error( m_xine ); 218 return xine_get_error( m_stream );
216}; 219};
217 220
218void Lib::handleXineEvent( xine_event_t* t ) { 221void Lib::handleXineEvent( const xine_event_t* t ) {
219 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) { 222 if ( t->type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
220 emit stopped(); 223 emit stopped();
221 } 224 }
222} 225}
223 226
224 227
225void Lib::setShowVideo( bool video ) { 228void Lib::setShowVideo( bool video ) {
226 m_video = video; 229 m_video = video;
227 ::null_set_show_video( m_videoOutput, video ); 230 ::null_set_show_video( m_videoOutput, video );
228} 231}
229 232
230bool Lib::isShowingVideo() { 233bool Lib::isShowingVideo() {
231 return ::null_is_showing_video( m_videoOutput ); 234 return ::null_is_showing_video( m_videoOutput );
232} 235}
233 236
234bool Lib::hasVideo() { 237bool Lib::hasVideo() {
235 //looks like it is not implemented yet 238 return xine_get_stream_info( m_stream, 18 );
236 //return xine_get_stream_info( m_xine, XINE_STREAM_INFO_VIDEO_CHANNELS );
237 // ugly hack until xine is ready, look for the width of the video
238 int test = xine_get_stream_info( m_xine, 2 );
239 if( test > 0 ) {
240 // qDebug( QString(" has video: %1").arg( test ) );
241 return true;
242 } else {
243 //qDebug ( "does not have video ");
244 return false;
245 }
246} 239}
247 240
248void Lib::showVideoFullScreen( bool fullScreen ) { 241void Lib::showVideoFullScreen( bool fullScreen ) {
249 ::null_set_fullscreen( m_videoOutput, fullScreen ); 242 ::null_set_fullscreen( m_videoOutput, fullScreen );
250} 243}
251 244
252bool Lib::isVideoFullScreen() { 245bool Lib::isVideoFullScreen() {
253 return ::null_is_fullscreen( m_videoOutput ); 246 return ::null_is_fullscreen( m_videoOutput );
254} 247}
255 248
256void Lib::setScaling( bool scale ) { 249void Lib::setScaling( bool scale ) {
257 ::null_set_scaling( m_videoOutput, scale ); 250 ::null_set_scaling( m_videoOutput, scale );
258} 251}
259 252
260void Lib::setGamma( int value ) { 253void Lib::setGamma( int value ) {
261 //qDebug( QString( "%1").arg(value) ); 254 //qDebug( QString( "%1").arg(value) );
262 int gammaValue = ( 100 + value ); 255 /* int gammaValue = ( 100 + value ); */
263 ::null_set_videoGamma( m_videoOutput, value ); 256 ::null_set_videoGamma( m_videoOutput, value );
264} 257}
265 258
266bool Lib::isScaling() { 259bool Lib::isScaling() {
267 return ::null_is_scaling( m_videoOutput ); 260 return ::null_is_scaling( m_videoOutput );
268} 261}
269 262
270void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { 263void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
271 ( (Lib*)user_data)->handleXineEvent( t ); 264 ( (Lib*)user_data)->handleXineEvent( t );
272} 265}
273 266
274void Lib::xine_display_frame( void* user_data, uint8_t *frame, 267void Lib::xine_display_frame( void* user_data, uint8_t *frame,
275 int width, int height, int bytes ) { 268 int width, int height, int bytes ) {
276 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 269 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
277} 270}
278 271
279void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 272void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
280 if ( !m_video ) { 273 if ( !m_video ) {
281 qWarning("not showing video now"); 274 qWarning("not showing video now");
282 return; 275 return;
283 } 276 }
284 m_wid-> setVideoFrame ( frame, width, height, bytes ); 277 m_wid-> setVideoFrame ( frame, width, height, bytes );
285} 278}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 6cdd9c6..191dbbd 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -1,197 +1,199 @@
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 int length() /*const*/; 93 int length() /*const*/;
94 94
95 bool isSeekable()/*const*/; 95 bool isSeekable()/*const*/;
96 96
97 /** 97 /**
98 * Whether or not to show video output 98 * Whether or not to show video output
99 */ 99 */
100 void setShowVideo(bool video); 100 void setShowVideo(bool video);
101 101
102 /** 102 /**
103 * is we show video 103 * is we show video
104 */ 104 */
105 bool isShowingVideo() /*const*/; 105 bool isShowingVideo() /*const*/;
106 106
107 /** 107 /**
108 * 108 *
109 */ 109 */
110 void showVideoFullScreen( bool fullScreen ); 110 void showVideoFullScreen( bool fullScreen );
111 111
112 /** 112 /**
113 * 113 *
114 */ 114 */
115 bool isVideoFullScreen()/*const*/ ; 115 bool isVideoFullScreen()/*const*/ ;
116 116
117 117
118 /** 118 /**
119 * Get the meta info (like author etc) from the stream 119 * Get the meta info (like author etc) from the stream
120 * XINE_META_INFO_TITLE 0 120 * XINE_META_INFO_TITLE 0
121 * XINE_META_INFO_COMMENT 1 121 * XINE_META_INFO_COMMENT 1
122 * XINE_META_INFO_ARTIST 2 122 * XINE_META_INFO_ARTIST 2
123 * XINE_META_INFO_GENRE 3 123 * XINE_META_INFO_GENRE 3
124 * XINE_META_INFO_ALBUM 4 124 * XINE_META_INFO_ALBUM 4
125 * XINE_META_INFO_YEAR 5 125 * XINE_META_INFO_YEAR 5
126 * XINE_META_INFO_VIDEOCODEC 6 126 * XINE_META_INFO_VIDEOCODEC 6
127 * XINE_META_INFO_AUDIOCODEC 7 127 * XINE_META_INFO_AUDIOCODEC 7
128 * XINE_META_INFO_SYSTEMLAYER 8 128 * XINE_META_INFO_SYSTEMLAYER 8
129 * XINE_META_INFO_INPUT_PLUGIN 9 129 * XINE_META_INFO_INPUT_PLUGIN 9
130 */ 130 */
131 QString metaInfo( int number ); 131 QString metaInfo( int number );
132 132
133 /** 133 /**
134 * 134 *
135 */ 135 */
136 bool isScaling(); 136 bool isScaling();
137 137
138 /** 138 /**
139 * seek to a position 139 * seek to a position
140 */ 140 */
141 void seekTo( int time ); 141 void seekTo( int time );
142 142
143 /** 143 /**
144 * 144 *
145 * @return is media stream has video 145 * @return is media stream has video
146 */ 146 */
147 bool hasVideo(); 147 bool hasVideo();
148 148
149 /** 149 /**
150 * 150 *
151 */ 151 */
152 void setScaling( bool ); 152 void setScaling( bool );
153 153
154 /** 154 /**
155 * Set the Gamma value for video output 155 * Set the Gamma value for video output
156 * @param int the value between -100 and 100, 0 is original 156 * @param int the value between -100 and 100, 0 is original
157 */ 157 */
158 void setGamma( int ); 158 void setGamma( int );
159 159
160 /** 160 /**
161 * test 161 * test
162 */ 162 */
163 Frame currentFrame()/*const*/; 163 Frame currentFrame()/*const*/;
164 164
165 /** 165 /**
166 * Returns the error code 166 * Returns the error code
167 * XINE_ERROR_NONE 0 167 * XINE_ERROR_NONE 0
168 * XINE_ERROR_NO_INPUT_PLUGIN 1 168 * XINE_ERROR_NO_INPUT_PLUGIN 1
169 * XINE_ERROR_NO_DEMUXER_PLUGIN 2 169 * XINE_ERROR_NO_DEMUXER_PLUGIN 2
170 * XINE_ERROR_DEMUXER_FAILED 3 170 * XINE_ERROR_DEMUXER_FAILED 3
171 */ 171 */
172 int error() /*const*/; 172 int error() /*const*/;
173 173
174 signals: 174 signals:
175 void stopped(); 175 void stopped();
176 private: 176 private:
177 int m_bytes_per_pixel; 177 int m_bytes_per_pixel;
178 int m_length, m_pos, m_time; 178 int m_length, m_pos, m_time;
179 int m_major_version, m_minor_version, m_sub_version; 179 int m_major_version, m_minor_version, m_sub_version;
180 bool m_video:1; 180 bool m_video:1;
181 XineVideoWidget *m_wid; 181 XineVideoWidget *m_wid;
182 xine_t *m_xine; 182 xine_t *m_xine;
183 xine_stream_t *m_stream;
183 xine_cfg_entry_t *m_config; 184 xine_cfg_entry_t *m_config;
184 xine_vo_driver_t *m_videoOutput; 185 xine_vo_driver_t *m_videoOutput;
185 xine_ao_driver_t* m_audioOutput; 186 xine_ao_driver_t* m_audioOutput;
187 xine_event_queue_t *m_queue;
186 188
187 void handleXineEvent( xine_event_t* t ); 189 void handleXineEvent( const xine_event_t* t );
188 void drawFrame( uint8_t* frame, int width, int height, int bytes ); 190 void drawFrame( uint8_t* frame, int width, int height, int bytes );
189 // C -> C++ bridge for the event system 191 // C -> C++ bridge for the event system
190 static void xine_event_handler( void* user_data, xine_event_t* t); 192 static void xine_event_handler( void* user_data, const xine_event_t* t);
191 static void xine_display_frame( void* user_data, uint8_t* frame , 193 static void xine_display_frame( void* user_data, uint8_t* frame ,
192 int width, int height, int bytes ); 194 int width, int height, int bytes );
193 }; 195 };
194}; 196};
195 197
196 198
197#endif 199#endif