Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 133 |
1 files changed, 83 insertions, 50 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index d8a0694..4021d4a 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -52,14 +52,14 @@ typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | |||
52 | extern "C" { | 52 | extern "C" { |
53 | vo_driver_t* init_video_out_plugin( config_values_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( vo_driver_t* self ); | 54 | int null_is_showing_video( const xine_vo_driver_t* self ); |
55 | void null_set_show_video( 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( vo_driver_t* self ); | 56 | int null_is_fullscreen( const xine_vo_driver_t* self ); |
57 | void null_set_fullscreen( vo_driver_t* self, int screen ); | 57 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); |
58 | int null_is_scaling( vo_driver_t* self ); | 58 | int null_is_scaling( const xine_vo_driver_t* self ); |
59 | void null_set_scaling( 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( 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( 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( 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( vo_driver_t* self , int value ); | 63 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); |
64 | void null_display_handler(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 | } |
@@ -85,3 +85,6 @@ Lib::Lib(XineVideoWidget* widget) { | |||
85 | 85 | ||
86 | m_config = xine_config_file_init( str.data() ); | 86 | m_xine = xine_new( ); |
87 | |||
88 | xine_config_load( m_xine, str.data() ); | ||
89 | |||
87 | 90 | ||
@@ -89,4 +92,12 @@ Lib::Lib(XineVideoWidget* widget) { | |||
89 | // and fb for framebuffer | 92 | // and fb for framebuffer |
90 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; | 93 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
91 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 94 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
95 | |||
96 | |||
97 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); | ||
98 | |||
99 | |||
100 | null_display_handler( m_videoOutput, xine_display_frame, this ); | ||
101 | xine_init( m_xine, m_audioOutput, m_videoOutput ); | ||
102 | |||
92 | if (m_wid != 0 ) { | 103 | if (m_wid != 0 ) { |
@@ -95,12 +106,6 @@ Lib::Lib(XineVideoWidget* widget) { | |||
95 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 106 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
96 | m_wid-> setLogo ( new QImage ( Resource::loadImage(""))); | 107 | |
97 | m_wid->repaint(); | 108 | m_wid->repaint(); |
98 | } | 109 | } |
99 | null_display_handler( m_videoOutput, | ||
100 | xine_display_frame, | ||
101 | this ); | ||
102 | 110 | ||
103 | m_xine = xine_init( m_videoOutput, | ||
104 | m_audioOutput, m_config ); | ||
105 | // install the event handler | ||
106 | xine_register_event_listener( m_xine, xine_event_handler, this ); | 111 | xine_register_event_listener( m_xine, xine_event_handler, this ); |
@@ -109,3 +114,3 @@ Lib::Lib(XineVideoWidget* widget) { | |||
109 | Lib::~Lib() { | 114 | Lib::~Lib() { |
110 | free( m_config ); | 115 | // free( m_config ); |
111 | xine_remove_event_listener( m_xine, xine_event_handler ); | 116 | xine_remove_event_listener( m_xine, xine_event_handler ); |
@@ -115,7 +120,5 @@ Lib::~Lib() { | |||
115 | //delete m_audioOutput; | 120 | //delete m_audioOutput; |
116 | |||
117 | } | 121 | } |
118 | 122 | ||
119 | void Lib::resize ( const QSize &s ) | 123 | void Lib::resize ( const QSize &s ) { |
120 | { | ||
121 | if ( s. width ( ) && s. height ( )) { | 124 | if ( s. width ( ) && s. height ( )) { |
@@ -127,26 +130,28 @@ void Lib::resize ( const QSize &s ) | |||
127 | QCString Lib::version() { | 130 | QCString Lib::version() { |
128 | QCString str( xine_get_str_version() ); | 131 | // QCString str( xine_get_str_version() ); |
129 | return str; | 132 | // return str; |
130 | }; | 133 | return "test"; |
134 | } | ||
131 | 135 | ||
132 | int Lib::majorVersion() { | 136 | int Lib::majorVersion() { |
133 | return xine_get_major_version(); | 137 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); |
138 | return m_major_version; | ||
134 | } | 139 | } |
140 | |||
135 | int Lib::minorVersion() { | 141 | int Lib::minorVersion() { |
136 | return xine_get_minor_version(); | 142 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); |
137 | }; | 143 | return m_minor_version; |
144 | } | ||
138 | 145 | ||
139 | int Lib::subVersion() { | 146 | int Lib::subVersion() { |
140 | return xine_get_sub_version(); | 147 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); |
148 | return m_sub_version; | ||
141 | } | 149 | } |
142 | int Lib::play( const QString& fileName, | 150 | |
143 | int startPos, | 151 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
144 | int start_time ) { | ||
145 | QString str = fileName.stripWhiteSpace(); | 152 | QString str = fileName.stripWhiteSpace(); |
146 | //workaround OpiePlayer bug | 153 | xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ); |
147 | //f (str.right(1) == QString::fromLatin1("/") ) | 154 | return xine_play( m_xine, startPos, start_time); |
148 | // str = str.mid( str.length() -1 ); | ||
149 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), | ||
150 | startPos, start_time); | ||
151 | } | 155 | } |
156 | |||
152 | void Lib::stop() { | 157 | void Lib::stop() { |
@@ -155,11 +160,15 @@ void Lib::stop() { | |||
155 | } | 160 | } |
161 | |||
156 | void Lib::pause(){ | 162 | void Lib::pause(){ |
157 | xine_set_speed( m_xine, SPEED_PAUSE ); | 163 | xine_set_param( m_xine, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
158 | } | 164 | } |
165 | |||
159 | int Lib::speed() { | 166 | int Lib::speed() { |
160 | return xine_get_speed( m_xine ); | 167 | return xine_get_param ( m_xine, XINE_PARAM_SPEED ); |
161 | } | 168 | } |
169 | |||
162 | void Lib::setSpeed( int speed ) { | 170 | void Lib::setSpeed( int speed ) { |
163 | xine_set_speed( m_xine, speed ); | 171 | xine_set_param ( m_xine, XINE_PARAM_SPEED, speed ); |
164 | } | 172 | } |
173 | |||
165 | int Lib::status(){ | 174 | int Lib::status(){ |
@@ -167,14 +176,22 @@ int Lib::status(){ | |||
167 | } | 176 | } |
177 | |||
168 | int Lib::currentPosition(){ | 178 | int Lib::currentPosition(){ |
169 | return xine_get_current_position( m_xine ); | 179 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); |
180 | return m_pos; | ||
170 | } | 181 | } |
182 | |||
171 | int Lib::currentTime() { | 183 | int Lib::currentTime() { |
172 | return xine_get_current_time( m_xine ); | 184 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); |
173 | }; | 185 | return m_time/1000; |
186 | } | ||
187 | |||
174 | int Lib::length() { | 188 | int Lib::length() { |
175 | return xine_get_stream_length( m_xine ); | 189 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); |
190 | return m_length/1000; | ||
176 | } | 191 | } |
192 | |||
177 | bool Lib::isSeekable() { | 193 | bool Lib::isSeekable() { |
178 | return xine_is_stream_seekable(m_xine); | 194 | return xine_get_stream_info ( m_xine, XINE_STREAM_INFO_SEEKABLE ); |
179 | } | 195 | } |
196 | |||
180 | Frame Lib::currentFrame() { | 197 | Frame Lib::currentFrame() { |
@@ -183,2 +200,7 @@ Frame Lib::currentFrame() { | |||
183 | }; | 200 | }; |
201 | |||
202 | QString Lib::metaInfo() { | ||
203 | xine_get_meta_info( m_xine, 0 ); | ||
204 | } | ||
205 | |||
184 | int Lib::error() { | 206 | int Lib::error() { |
@@ -186,6 +208,10 @@ int Lib::error() { | |||
186 | }; | 208 | }; |
209 | |||
187 | void Lib::handleXineEvent( xine_event_t* t ) { | 210 | void Lib::handleXineEvent( xine_event_t* t ) { |
188 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) | 211 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) { |
189 | emit stopped(); | 212 | emit stopped(); |
190 | } | 213 | } |
214 | } | ||
215 | |||
216 | |||
191 | void Lib::setShowVideo( bool video ) { | 217 | void Lib::setShowVideo( bool video ) { |
@@ -194,2 +220,3 @@ void Lib::setShowVideo( bool video ) { | |||
194 | } | 220 | } |
221 | |||
195 | bool Lib::isShowingVideo() { | 222 | bool Lib::isShowingVideo() { |
@@ -197,2 +224,3 @@ bool Lib::isShowingVideo() { | |||
197 | } | 224 | } |
225 | |||
198 | void Lib::showVideoFullScreen( bool fullScreen ) { | 226 | void Lib::showVideoFullScreen( bool fullScreen ) { |
@@ -200,2 +228,3 @@ void Lib::showVideoFullScreen( bool fullScreen ) { | |||
200 | } | 228 | } |
229 | |||
201 | bool Lib::isVideoFullScreen() { | 230 | bool Lib::isVideoFullScreen() { |
@@ -203,2 +232,3 @@ bool Lib::isVideoFullScreen() { | |||
203 | } | 232 | } |
233 | |||
204 | void Lib::setScaling( bool scale ) { | 234 | void Lib::setScaling( bool scale ) { |
@@ -215,2 +245,3 @@ bool Lib::isScaling() { | |||
215 | } | 245 | } |
246 | |||
216 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | 247 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { |
@@ -218,7 +249,8 @@ void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | |||
218 | } | 249 | } |
250 | |||
219 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 251 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
220 | int width, int height, int bytes ) { | 252 | int width, int height, int bytes ) { |
221 | |||
222 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 253 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
223 | } | 254 | } |
255 | |||
224 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 256 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
@@ -228,2 +260,3 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | |||
228 | } | 260 | } |
261 | |||
229 | // qWarning( "called draw frame %d %d", width, height ); | 262 | // qWarning( "called draw frame %d %d", width, height ); |