summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp9
-rw-r--r--noncore/multimedia/opieplayer2/lib.h7
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp60
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h10
-rw-r--r--noncore/multimedia/opieplayer2/nullvideo.c43
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h10
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h33
-rw-r--r--noncore/multimedia/opieplayer2/xinevideowidget.cpp88
-rw-r--r--noncore/multimedia/opieplayer2/yuv2rgb.c17
13 files changed, 244 insertions, 88 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index b2143a0..748ae1f 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,227 +1,234 @@
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 vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); 53 vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video);
54 int null_is_showing_video( vo_driver_t* self ); 54 int null_is_showing_video( vo_driver_t* self );
55 void null_set_show_video( vo_driver_t* self, int show ); 55 void null_set_show_video( vo_driver_t* self, int show );
56 int null_is_fullscreen( vo_driver_t* self ); 56 int null_is_fullscreen( vo_driver_t* self );
57 void null_set_fullscreen( vo_driver_t* self, int screen ); 57 void null_set_fullscreen( vo_driver_t* self, int screen );
58 int null_is_scaling( vo_driver_t* self ); 58 int null_is_scaling( vo_driver_t* self );
59 void null_set_scaling( vo_driver_t* self, int scale ); 59 void null_set_scaling( vo_driver_t* self, int scale );
60 void null_set_gui_width( vo_driver_t* self, int width ); 60 void null_set_gui_width( vo_driver_t* self, int width );
61 void null_set_gui_height( vo_driver_t* self, int height ); 61 void null_set_gui_height( vo_driver_t* self, int height );
62 void null_set_mode( vo_driver_t* self, int depth, int rgb ); 62 void null_set_mode( vo_driver_t* self, int depth, int rgb );
63 void null_set_videoGamma( vo_driver_t* self , int value );
63 void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data); 64 void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data);
64} 65}
65 66
66using namespace XINE; 67using namespace XINE;
67 68
68Lib::Lib(XineVideoWidget* widget) { 69Lib::Lib(XineVideoWidget* widget) {
69 m_video = false; 70 m_video = false;
70 m_wid = widget; 71 m_wid = widget;
71 printf("Lib"); 72 printf("Lib");
72 QCString str( getenv("HOME") ); 73 QCString str( getenv("HOME") );
73 str += "/Settings/opiexine.cf"; 74 str += "/Settings/opiexine.cf";
74 // get the configuration 75 // get the configuration
75 76
76 // not really OO, should be an extra class, later 77 // not really OO, should be an extra class, later
77 if ( !QFile(str).exists() ) { 78 if ( !QFile(str).exists() ) {
78 QFile f(str); 79 QFile f(str);
79 f.open(IO_WriteOnly); 80 f.open(IO_WriteOnly);
80 QTextStream ts( &f ); 81 QTextStream ts( &f );
81 ts << "misc.memcpy_method:glibc\n"; 82 ts << "misc.memcpy_method:glibc\n";
82 f.close(); 83 f.close();
83 } 84 }
84 85
85 m_config = xine_config_file_init( str.data() ); 86 m_config = xine_config_file_init( str.data() );
86 87
87 // allocate oss for sound 88 // allocate oss for sound
88 // and fb for framebuffer 89 // and fb for framebuffer
89 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; 90 m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
90 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 91 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
91 if (m_wid != 0 ) { 92 if (m_wid != 0 ) {
92 printf("!0\n" ); 93 printf("!0\n" );
93 resize ( m_wid-> size ( )); 94 resize ( m_wid-> size ( ));
94 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 95 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
95 m_wid-> setImage ( new QImage ( Resource::loadImage(""))); 96 m_wid-> setImage ( new QImage ( Resource::loadImage("") ) );
96 m_wid->repaint(); 97 m_wid->repaint();
97 } 98 }
98 null_display_handler( m_videoOutput, 99 null_display_handler( m_videoOutput,
99 xine_display_frame, 100 xine_display_frame,
100 this ); 101 this );
101 102
102 m_xine = xine_init( m_videoOutput, 103 m_xine = xine_init( m_videoOutput,
103 m_audioOutput, m_config ); 104 m_audioOutput, m_config );
104 // install the event handler 105 // install the event handler
105 xine_register_event_listener( m_xine, xine_event_handler, this ); 106 xine_register_event_listener( m_xine, xine_event_handler, this );
106} 107}
107 108
108Lib::~Lib() { 109Lib::~Lib() {
109 free( m_config ); 110 free( m_config );
110 xine_remove_event_listener( m_xine, xine_event_handler ); 111 xine_remove_event_listener( m_xine, xine_event_handler );
111 xine_exit( m_xine ); 112 xine_exit( m_xine );
112 /* FIXME either free or delete but valgrind bitches against both */ 113 /* FIXME either free or delete but valgrind bitches against both */
113 //free( m_videoOutput ); 114 //free( m_videoOutput );
114 //delete m_audioOutput; 115 //delete m_audioOutput;
115 116
116} 117}
117 118
118void Lib::resize ( const QSize &s ) 119void Lib::resize ( const QSize &s )
119{ 120{
120 if ( s. width ( ) && s. height ( )) { 121 if ( s. width ( ) && s. height ( )) {
121 ::null_set_gui_width( m_videoOutput, s. width() ); 122 ::null_set_gui_width( m_videoOutput, s. width() );
122 ::null_set_gui_height(m_videoOutput, s. height() ); 123 ::null_set_gui_height(m_videoOutput, s. height() );
123 } 124 }
124} 125}
125 126
126QCString Lib::version() { 127QCString Lib::version() {
127 QCString str( xine_get_str_version() ); 128 QCString str( xine_get_str_version() );
128 return str; 129 return str;
129}; 130};
130 131
131int Lib::majorVersion() { 132int Lib::majorVersion() {
132 return xine_get_major_version(); 133 return xine_get_major_version();
133} 134}
134int Lib::minorVersion() { 135int Lib::minorVersion() {
135 return xine_get_minor_version(); 136 return xine_get_minor_version();
136}; 137};
137 138
138int Lib::subVersion() { 139int Lib::subVersion() {
139 return xine_get_sub_version(); 140 return xine_get_sub_version();
140} 141}
141int Lib::play( const QString& fileName, 142int Lib::play( const QString& fileName,
142 int startPos, 143 int startPos,
143 int start_time ) { 144 int start_time ) {
144 QString str = fileName.stripWhiteSpace(); 145 QString str = fileName.stripWhiteSpace();
145 //workaround OpiePlayer bug 146 //workaround OpiePlayer bug
146 //f (str.right(1) == QString::fromLatin1("/") ) 147 //f (str.right(1) == QString::fromLatin1("/") )
147 // str = str.mid( str.length() -1 ); 148 // str = str.mid( str.length() -1 );
148 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), 149 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(),
149 startPos, start_time); 150 startPos, start_time);
150} 151}
151void Lib::stop() { 152void Lib::stop() {
152 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 153 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
153 xine_stop(m_xine ); 154 xine_stop(m_xine );
154} 155}
155void Lib::pause(){ 156void Lib::pause(){
156 xine_set_speed( m_xine, SPEED_PAUSE ); 157 xine_set_speed( m_xine, SPEED_PAUSE );
157} 158}
158int Lib::speed() { 159int Lib::speed() {
159 return xine_get_speed( m_xine ); 160 return xine_get_speed( m_xine );
160} 161}
161void Lib::setSpeed( int speed ) { 162void Lib::setSpeed( int speed ) {
162 xine_set_speed( m_xine, speed ); 163 xine_set_speed( m_xine, speed );
163} 164}
164int Lib::status(){ 165int Lib::status(){
165 return xine_get_status( m_xine ); 166 return xine_get_status( m_xine );
166} 167}
167int Lib::currentPosition(){ 168int Lib::currentPosition(){
168 return xine_get_current_position( m_xine ); 169 return xine_get_current_position( m_xine );
169} 170}
170int Lib::currentTime() { 171int Lib::currentTime() {
171 return xine_get_current_time( m_xine ); 172 return xine_get_current_time( m_xine );
172}; 173};
173int Lib::length() { 174int Lib::length() {
174 return xine_get_stream_length( m_xine ); 175 return xine_get_stream_length( m_xine );
175} 176}
176bool Lib::isSeekable() { 177bool Lib::isSeekable() {
177 return xine_is_stream_seekable(m_xine); 178 return xine_is_stream_seekable(m_xine);
178} 179}
179Frame Lib::currentFrame() { 180Frame Lib::currentFrame() {
180 Frame frame; 181 Frame frame;
181 return frame; 182 return frame;
182}; 183};
183int Lib::error() { 184int Lib::error() {
184 return xine_get_error( m_xine ); 185 return xine_get_error( m_xine );
185}; 186};
186void Lib::handleXineEvent( xine_event_t* t ) { 187void Lib::handleXineEvent( xine_event_t* t ) {
187 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) 188 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED )
188 emit stopped(); 189 emit stopped();
189} 190}
190void Lib::setShowVideo( bool video ) { 191void Lib::setShowVideo( bool video ) {
191 m_video = video; 192 m_video = video;
192 ::null_set_show_video( m_videoOutput, video ); 193 ::null_set_show_video( m_videoOutput, video );
193} 194}
194bool Lib::isShowingVideo() { 195bool Lib::isShowingVideo() {
195 return ::null_is_showing_video( m_videoOutput ); 196 return ::null_is_showing_video( m_videoOutput );
196} 197}
197void Lib::showVideoFullScreen( bool fullScreen ) { 198void Lib::showVideoFullScreen( bool fullScreen ) {
198 ::null_set_fullscreen( m_videoOutput, fullScreen ); 199 ::null_set_fullscreen( m_videoOutput, fullScreen );
199} 200}
200bool Lib::isVideoFullScreen() { 201bool Lib::isVideoFullScreen() {
201 return ::null_is_fullscreen( m_videoOutput ); 202 return ::null_is_fullscreen( m_videoOutput );
202} 203}
203void Lib::setScaling( bool scale ) { 204void Lib::setScaling( bool scale ) {
204 ::null_set_scaling( m_videoOutput, scale ); 205 ::null_set_scaling( m_videoOutput, scale );
205} 206}
207
208void Lib::setGamma( int value ) {
209 //qDebug( QString( "%1").arg(value) );
210 ::null_set_videoGamma( m_videoOutput, value );
211}
212
206bool Lib::isScaling() { 213bool Lib::isScaling() {
207 return ::null_is_scaling( m_videoOutput ); 214 return ::null_is_scaling( m_videoOutput );
208} 215}
209void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { 216void Lib::xine_event_handler( void* user_data, xine_event_t* t ) {
210 ((Lib*)user_data)->handleXineEvent( t ); 217 ((Lib*)user_data)->handleXineEvent( t );
211} 218}
212void Lib::xine_display_frame( void* user_data, uint8_t *frame, 219void Lib::xine_display_frame( void* user_data, uint8_t *frame,
213 int width, int height, int bytes ) { 220 int width, int height, int bytes ) {
214 221
215 ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); 222 ((Lib*)user_data)->drawFrame( frame, width, height, bytes );
216} 223}
217void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 224void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
218 if (!m_video ) { 225 if (!m_video ) {
219 qWarning("not showing video now"); 226 qWarning("not showing video now");
220 return; 227 return;
221 } 228 }
222// qWarning("called draw frame %d %d", width, height); 229// qWarning("called draw frame %d %d", width, height);
223 230
224 m_wid->setImage( frame, width, height, bytes ); 231 m_wid->setImage( frame, width, height, bytes );
225// m_wid->repaint(false); 232// m_wid->repaint(false);
226 233
227} 234}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index abd8c65..b9d0a8a 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -51,96 +51,103 @@ namespace XINE {
51 * It supports playing, pausing, info, 51 * It supports playing, pausing, info,
52 * stooping, seeking. 52 * stooping, seeking.
53 */ 53 */
54 class Frame; 54 class Frame;
55 class Lib : public QObject { 55 class Lib : public QObject {
56 Q_OBJECT 56 Q_OBJECT
57 public: 57 public:
58 Lib(XineVideoWidget* = 0); 58 Lib(XineVideoWidget* = 0);
59 ~Lib(); 59 ~Lib();
60 QCString version(); 60 QCString version();
61 int majorVersion()/*const*/; 61 int majorVersion()/*const*/;
62 int minorVersion()/*const*/; 62 int minorVersion()/*const*/;
63 int subVersion()/*const*/; 63 int subVersion()/*const*/;
64 64
65 65
66 void resize ( const QSize &s ); 66 void resize ( const QSize &s );
67 67
68 int play( const QString& fileName, 68 int play( const QString& fileName,
69 int startPos = 0, 69 int startPos = 0,
70 int start_time = 0 ); 70 int start_time = 0 );
71 void stop() /*const*/; 71 void stop() /*const*/;
72 void pause()/*const*/; 72 void pause()/*const*/;
73 73
74 int speed() /*const*/; 74 int speed() /*const*/;
75 void setSpeed( int speed = SPEED_PAUSE ); 75 void setSpeed( int speed = SPEED_PAUSE );
76 76
77 int status() /*const*/; 77 int status() /*const*/;
78 78
79 int currentPosition()/*const*/; 79 int currentPosition()/*const*/;
80 //in seconds 80 //in seconds
81 int currentTime()/*const*/; 81 int currentTime()/*const*/;
82 int length() /*const*/; 82 int length() /*const*/;
83 83
84 bool isSeekable()/*const*/; 84 bool isSeekable()/*const*/;
85 85
86 /** 86 /**
87 * Whether or not to show video output 87 * Whether or not to show video output
88 */ 88 */
89 void setShowVideo(bool video); 89 void setShowVideo(bool video);
90 90
91 /** 91 /**
92 * is we show video 92 * is we show video
93 */ 93 */
94 bool isShowingVideo() /*const*/; 94 bool isShowingVideo() /*const*/;
95 95
96 /** 96 /**
97 * 97 *
98 */ 98 */
99 void showVideoFullScreen( bool fullScreen ); 99 void showVideoFullScreen( bool fullScreen );
100 100
101 /** 101 /**
102 * 102 *
103 */ 103 */
104 bool isVideoFullScreen()/*const*/ ; 104 bool isVideoFullScreen()/*const*/ ;
105 105
106 /** 106 /**
107 * 107 *
108 */ 108 */
109 bool isScaling(); 109 bool isScaling();
110 110
111 /** 111 /**
112 * 112 *
113 */ 113 */
114 void setScaling( bool ); 114 void setScaling( bool );
115
116 /**
117 * Set the Gamma value for video output
118 * @param int the value between -100 and 100, 0 is original
119 */
120 void setGamma( int );
121
115 /** 122 /**
116 * test 123 * test
117 */ 124 */
118 Frame currentFrame()/*const*/; 125 Frame currentFrame()/*const*/;
119 126
120 /** 127 /**
121 * Returns the error code 128 * Returns the error code
122 */ 129 */
123 int error() /*const*/; 130 int error() /*const*/;
124 131
125 signals: 132 signals:
126 void stopped(); 133 void stopped();
127 private: 134 private:
128 int m_bytes_per_pixel; 135 int m_bytes_per_pixel;
129 bool m_video:1; 136 bool m_video:1;
130 XineVideoWidget *m_wid; 137 XineVideoWidget *m_wid;
131 xine_t *m_xine; 138 xine_t *m_xine;
132 config_values_t *m_config; 139 config_values_t *m_config;
133 vo_driver_t *m_videoOutput; 140 vo_driver_t *m_videoOutput;
134 ao_driver_t* m_audioOutput; 141 ao_driver_t* m_audioOutput;
135 142
136 void handleXineEvent( xine_event_t* t ); 143 void handleXineEvent( xine_event_t* t );
137 void drawFrame( uint8_t* frame, int width, int height, int bytes ); 144 void drawFrame( uint8_t* frame, int width, int height, int bytes );
138 // C -> C++ bridge for the event system 145 // C -> C++ bridge for the event system
139 static void xine_event_handler( void* user_data, xine_event_t* t); 146 static void xine_event_handler( void* user_data, xine_event_t* t);
140 static void xine_display_frame( void* user_data, uint8_t* frame , 147 static void xine_display_frame( void* user_data, uint8_t* frame ,
141 int width, int height, int bytes ); 148 int width, int height, int bytes );
142 }; 149 };
143}; 150};
144 151
145 152
146#endif 153#endif
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index d984022..4ec5989 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,117 +1,151 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34// this file is based on work by trolltech
35
1#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 37#include <qpe/qlibrary.h>
3#include <qpe/config.h> 38#include <qpe/config.h>
4#include <qvaluelist.h> 39#include <qvaluelist.h>
5#include <qobject.h> 40#include <qobject.h>
6#include <qdir.h> 41#include <qdir.h>
7#include "mediaplayerstate.h" 42#include "mediaplayerstate.h"
8 43
9 44
10 45
11//#define MediaPlayerDebug(x) qDebug x 46//#define MediaPlayerDebug(x) qDebug x
12#define MediaPlayerDebug(x) 47#define MediaPlayerDebug(x)
13 48
14 49
15MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 50MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
16 : QObject( parent, name ) { 51 : QObject( parent, name ) {
17 Config cfg( "OpiePlayer" ); 52 Config cfg( "OpiePlayer" );
18 readConfig( cfg ); 53 readConfig( cfg );
19 isStreaming = false; 54 isStreaming = false;
20} 55}
21 56
22 57
23MediaPlayerState::~MediaPlayerState() { 58MediaPlayerState::~MediaPlayerState() {
24// Config cfg( "OpiePlayer" );
25// writeConfig( cfg );
26
27} 59}
28 60
29 61
30void MediaPlayerState::readConfig( Config& cfg ) { 62void MediaPlayerState::readConfig( Config& cfg ) {
31 cfg.setGroup("Options"); 63 cfg.setGroup("Options");
32 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 64 isFullscreen = cfg.readBoolEntry( "FullScreen" );
33 isScaled = cfg.readBoolEntry( "Scaling" ); 65 isScaled = cfg.readBoolEntry( "Scaling" );
34 isLooping = cfg.readBoolEntry( "Looping" ); 66 isLooping = cfg.readBoolEntry( "Looping" );
35 isShuffled = cfg.readBoolEntry( "Shuffle" ); 67 isShuffled = cfg.readBoolEntry( "Shuffle" );
36 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 68 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
69 videoGamma = cfg.readNumEntry( "VideoGamma" );
37 usePlaylist = TRUE; 70 usePlaylist = TRUE;
38 isPlaying = FALSE; 71 isPlaying = FALSE;
39 isStreaming = FALSE; 72 isStreaming = FALSE;
40 isPaused = FALSE; 73 isPaused = FALSE;
41 curPosition = 0; 74 curPosition = 0;
42 curLength = 0; 75 curLength = 0;
43 curView = 'l'; 76 curView = 'l';
44} 77}
45 78
46 79
47void MediaPlayerState::writeConfig( Config& cfg ) const { 80void MediaPlayerState::writeConfig( Config& cfg ) const {
48 cfg.setGroup("Options"); 81 cfg.setGroup( "Options" );
49 cfg.writeEntry("FullScreen", isFullscreen ); 82 cfg.writeEntry( "FullScreen", isFullscreen );
50 cfg.writeEntry("Scaling", isScaled ); 83 cfg.writeEntry( "Scaling", isScaled );
51 cfg.writeEntry("Looping", isLooping ); 84 cfg.writeEntry( "Looping", isLooping );
52 cfg.writeEntry("Shuffle", isShuffled ); 85 cfg.writeEntry( "Shuffle", isShuffled );
53 cfg.writeEntry("UsePlayList", usePlaylist ); 86 cfg.writeEntry( "UsePlayList", usePlaylist );
87 cfg.writeEntry( "VideoGamma", videoGamma );
54} 88}
55 89
56 90
57// public stuff 91// public stuff
58 92
59 93
60bool MediaPlayerState::streaming() { 94bool MediaPlayerState::streaming() {
61 return isStreaming; 95 return isStreaming;
62} 96}
63 97
64bool MediaPlayerState::fullscreen() { 98bool MediaPlayerState::fullscreen() {
65 return isFullscreen; 99 return isFullscreen;
66} 100}
67 101
68bool MediaPlayerState::scaled() { 102bool MediaPlayerState::scaled() {
69 return isScaled; 103 return isScaled;
70} 104}
71 105
72bool MediaPlayerState::looping() { 106bool MediaPlayerState::looping() {
73 return isLooping; 107 return isLooping;
74} 108}
75 109
76bool MediaPlayerState::shuffled() { 110bool MediaPlayerState::shuffled() {
77 return isShuffled; 111 return isShuffled;
78} 112}
79 113
80 114
81bool MediaPlayerState:: playlist() { 115bool MediaPlayerState:: playlist() {
82 return usePlaylist; 116 return usePlaylist;
83} 117}
84 118
85bool MediaPlayerState::paused() { 119bool MediaPlayerState::paused() {
86 return isPaused; 120 return isPaused;
87} 121}
88 122
89bool MediaPlayerState::playing() { 123bool MediaPlayerState::playing() {
90 return isPlaying; 124 return isPlaying;
91} 125}
92 126
93bool MediaPlayerState::stop() { 127bool MediaPlayerState::stop() {
94 return isStoped; 128 return isStoped;
95} 129}
96 130
97long MediaPlayerState::position() { 131long MediaPlayerState::position() {
98 return curPosition; 132 return curPosition;
99} 133}
100 134
101long MediaPlayerState::length() { 135long MediaPlayerState::length() {
102 return curLength; 136 return curLength;
103} 137}
104 138
105char MediaPlayerState::view() { 139char MediaPlayerState::view() {
106 return curView; 140 return curView;
107} 141}
108 142
109// slots 143// slots
110void MediaPlayerState::setIsStreaming( bool b ) { 144void MediaPlayerState::setIsStreaming( bool b ) {
111 145
112 if ( isStreaming == b ) { 146 if ( isStreaming == b ) {
113 return; 147 return;
114 } 148 }
115 isStreaming = b; 149 isStreaming = b;
116} 150}
117 151
@@ -148,128 +182,136 @@ void MediaPlayerState::setLooping( bool b ) {
148 } 182 }
149 isLooping = b; 183 isLooping = b;
150 emit loopingToggled(b); 184 emit loopingToggled(b);
151} 185}
152 186
153void MediaPlayerState::setShuffled( bool b ) { 187void MediaPlayerState::setShuffled( bool b ) {
154 if ( isShuffled == b ) { 188 if ( isShuffled == b ) {
155 return; 189 return;
156 } 190 }
157 isShuffled = b; 191 isShuffled = b;
158 emit shuffledToggled(b); 192 emit shuffledToggled(b);
159} 193}
160 194
161void MediaPlayerState::setPlaylist( bool b ) { 195void MediaPlayerState::setPlaylist( bool b ) {
162 if ( usePlaylist == b ) { 196 if ( usePlaylist == b ) {
163 return; 197 return;
164 } 198 }
165 usePlaylist = b; 199 usePlaylist = b;
166 emit playlistToggled(b); 200 emit playlistToggled(b);
167} 201}
168 202
169void MediaPlayerState::setPaused( bool b ) { 203void MediaPlayerState::setPaused( bool b ) {
170 if ( isPaused == b ) { 204 if ( isPaused == b ) {
171 isPaused = FALSE; 205 isPaused = FALSE;
172 emit pausedToggled(FALSE); 206 emit pausedToggled(FALSE);
173 return; 207 return;
174 } 208 }
175 isPaused = b; 209 isPaused = b;
176 emit pausedToggled(b); 210 emit pausedToggled(b);
177} 211}
178 212
179void MediaPlayerState::setPlaying( bool b ) { 213void MediaPlayerState::setPlaying( bool b ) {
180 if ( isPlaying == b ) { 214 if ( isPlaying == b ) {
181 return; 215 return;
182 } 216 }
183 isPlaying = b; 217 isPlaying = b;
184 isStoped = !b; 218 isStoped = !b;
185 emit playingToggled(b); 219 emit playingToggled(b);
186} 220}
187 221
188void MediaPlayerState::setStop( bool b ) { 222void MediaPlayerState::setStop( bool b ) {
189 if ( isStoped == b ) { 223 if ( isStoped == b ) {
190 return; 224 return;
191 } 225 }
192 isStoped = b; 226 isStoped = b;
193 emit stopToggled(b); 227 emit stopToggled(b);
194} 228}
195 229
196void MediaPlayerState::setPosition( long p ) { 230void MediaPlayerState::setPosition( long p ) {
197 if ( curPosition == p ) { 231 if ( curPosition == p ) {
198 return; 232 return;
199 } 233 }
200 curPosition = p; 234 curPosition = p;
201 emit positionChanged(p); 235 emit positionChanged(p);
202} 236}
203 237
204void MediaPlayerState::updatePosition( long p ){ 238void MediaPlayerState::updatePosition( long p ){
205 if ( curPosition == p ) { 239 if ( curPosition == p ) {
206 return; 240 return;
207 } 241 }
208 curPosition = p; 242 curPosition = p;
209 emit positionUpdated(p); 243 emit positionUpdated(p);
210} 244}
211 245
246void MediaPlayerState::setVideoGamma( int v ){
247 if ( videoGamma == v ) {
248 return;
249 }
250 videoGamma = v;
251 emit videoGammaChanged( v );
252}
253
212void MediaPlayerState::setLength( long l ) { 254void MediaPlayerState::setLength( long l ) {
213 if ( curLength == l ) { 255 if ( curLength == l ) {
214 return; 256 return;
215 } 257 }
216 curLength = l; 258 curLength = l;
217 emit lengthChanged(l); 259 emit lengthChanged(l);
218} 260}
219 261
220void MediaPlayerState::setView( char v ) { 262void MediaPlayerState::setView( char v ) {
221 if ( curView == v ) { 263 if ( curView == v ) {
222 return; 264 return;
223 } 265 }
224 curView = v; 266 curView = v;
225 emit viewChanged(v); 267 emit viewChanged(v);
226} 268}
227 269
228void MediaPlayerState::setPrev(){ 270void MediaPlayerState::setPrev(){
229 emit prev(); 271 emit prev();
230} 272}
231 273
232void MediaPlayerState::setNext() { 274void MediaPlayerState::setNext() {
233 emit next(); 275 emit next();
234} 276}
235 277
236void MediaPlayerState::setList() { 278void MediaPlayerState::setList() {
237 setPlaying( FALSE ); 279 setPlaying( FALSE );
238 setView('l'); 280 setView('l');
239} 281}
240 282
241void MediaPlayerState::setVideo() { 283void MediaPlayerState::setVideo() {
242 setView('v'); 284 setView('v');
243} 285}
244 286
245void MediaPlayerState::setAudio() { 287void MediaPlayerState::setAudio() {
246 setView('a'); 288 setView('a');
247} 289}
248 290
249void MediaPlayerState::toggleFullscreen() { 291void MediaPlayerState::toggleFullscreen() {
250 setFullscreen( !isFullscreen ); 292 setFullscreen( !isFullscreen );
251} 293}
252 294
253void MediaPlayerState::toggleScaled() { 295void MediaPlayerState::toggleScaled() {
254 setScaled( !isScaled); 296 setScaled( !isScaled);
255} 297}
256 298
257void MediaPlayerState::toggleLooping() { 299void MediaPlayerState::toggleLooping() {
258 setLooping( !isLooping); 300 setLooping( !isLooping);
259} 301}
260 302
261void MediaPlayerState::toggleShuffled() { 303void MediaPlayerState::toggleShuffled() {
262 setShuffled( !isShuffled); 304 setShuffled( !isShuffled);
263} 305}
264 306
265void MediaPlayerState::togglePlaylist() { 307void MediaPlayerState::togglePlaylist() {
266 setPlaylist( !usePlaylist); 308 setPlaylist( !usePlaylist);
267} 309}
268 310
269void MediaPlayerState::togglePaused() { 311void MediaPlayerState::togglePaused() {
270 setPaused( !isPaused); 312 setPaused( !isPaused);
271} 313}
272 314
273void MediaPlayerState::togglePlaying() { 315void MediaPlayerState::togglePlaying() {
274 setPlaying( !isPlaying); 316 setPlaying( !isPlaying);
275} 317}
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 215a2a8..4fef8e0 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -1,135 +1,139 @@
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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// this file is based on work by trolltech
35
34#ifndef MEDIA_PLAYER_STATE_H 36#ifndef MEDIA_PLAYER_STATE_H
35#define MEDIA_PLAYER_STATE_H 37#define MEDIA_PLAYER_STATE_H
36 38
37 39
38#include <qobject.h> 40#include <qobject.h>
39 41
40 42
41class MediaPlayerDecoder; 43class MediaPlayerDecoder;
42class Config; 44class Config;
43 45
44 46
45class MediaPlayerState : public QObject { 47class MediaPlayerState : public QObject {
46Q_OBJECT 48Q_OBJECT
47public: 49public:
48 MediaPlayerState( QObject *parent, const char *name ); 50 MediaPlayerState( QObject *parent, const char *name );
49 ~MediaPlayerState(); 51 ~MediaPlayerState();
50 52
51 bool isPaused; 53 bool isPaused;
52 bool isPlaying; 54 bool isPlaying;
53 bool isStoped; 55 bool isStoped;
54 bool streaming(); 56 bool streaming();
55 bool fullscreen(); 57 bool fullscreen();
56 bool scaled(); 58 bool scaled();
57 bool looping(); 59 bool looping();
58 bool shuffled(); 60 bool shuffled();
59 bool playlist(); 61 bool playlist();
60 bool paused(); 62 bool paused();
61 bool playing(); 63 bool playing();
62 bool stop(); 64 bool stop();
63 long position(); 65 long position();
64 long length(); 66 long length();
65 char view(); 67 char view();
66 68
67public slots: 69public slots:
68 void setIsStreaming( bool b ); 70 void setIsStreaming( bool b );
69 void setFullscreen( bool b ); 71 void setFullscreen( bool b );
70 void setScaled( bool b ); 72 void setScaled( bool b );
71 void setLooping( bool b ); 73 void setLooping( bool b );
72 void setShuffled( bool b ); 74 void setShuffled( bool b );
73 void setPlaylist( bool b ); 75 void setPlaylist( bool b );
74 void setPaused( bool b ); 76 void setPaused( bool b );
75 void setPlaying( bool b ); 77 void setPlaying( bool b );
76 void setStop( bool b ); 78 void setStop( bool b );
77 void setPosition( long p ); 79 void setPosition( long p );
78 void updatePosition( long p ); 80 void updatePosition( long p );
79 void setLength( long l ); 81 void setLength( long l );
80 void setView( char v ); 82 void setView( char v );
81 void setBlanked( bool b ); 83 void setBlanked( bool b );
84 void setVideoGamma( int v );
82 85
83 void setPrev(); 86 void setPrev();
84 void setNext(); 87 void setNext();
85 void setList(); 88 void setList();
86 void setVideo(); 89 void setVideo();
87 void setAudio(); 90 void setAudio();
88 91
89 void toggleFullscreen(); 92 void toggleFullscreen();
90 void toggleScaled(); 93 void toggleScaled();
91 void toggleLooping(); 94 void toggleLooping();
92 void toggleShuffled(); 95 void toggleShuffled();
93 void togglePlaylist(); 96 void togglePlaylist();
94 void togglePaused(); 97 void togglePaused();
95 void togglePlaying(); 98 void togglePlaying();
96 void toggleBlank(); 99 void toggleBlank();
97 void writeConfig( Config& cfg ) const; 100 void writeConfig( Config& cfg ) const;
98 101
99 102
100signals: 103signals:
101 void fullscreenToggled( bool ); 104 void fullscreenToggled( bool );
102 void scaledToggled( bool ); 105 void scaledToggled( bool );
103 void loopingToggled( bool ); 106 void loopingToggled( bool );
104 void shuffledToggled( bool ); 107 void shuffledToggled( bool );
105 void playlistToggled( bool ); 108 void playlistToggled( bool );
106 void pausedToggled( bool ); 109 void pausedToggled( bool );
107 void playingToggled( bool ); 110 void playingToggled( bool );
108 void stopToggled( bool ); 111 void stopToggled( bool );
109 void positionChanged( long ); // When the slider is moved 112 void positionChanged( long ); // When the slider is moved
110 void positionUpdated( long ); // When the media file progresses 113 void positionUpdated( long ); // When the media file progresses
111 void lengthChanged( long ); 114 void lengthChanged( long );
112 void viewChanged( char ); 115 void viewChanged( char );
113 void blankToggled( bool ); 116 void blankToggled( bool );
117 void videoGammaChanged( int );
114 void prev(); 118 void prev();
115 void next(); 119 void next();
116 120
117private: 121private:
118 bool isStreaming; 122 bool isStreaming;
119 bool isFullscreen; 123 bool isFullscreen;
120 bool isScaled; 124 bool isScaled;
121 bool isBlanked; 125 bool isBlanked;
122 bool isLooping; 126 bool isLooping;
123 bool isShuffled; 127 bool isShuffled;
124 bool usePlaylist; 128 bool usePlaylist;
125 long curPosition; 129 long curPosition;
126 long curLength; 130 long curLength;
127 char curView; 131 char curView;
128 132 int videoGamma;
129 void readConfig( Config& cfg ); 133 void readConfig( Config& cfg );
130 134
131}; 135};
132 136
133 137
134#endif // MEDIA_PLAYER_STATE_H 138#endif // MEDIA_PLAYER_STATE_H
135 139
diff --git a/noncore/multimedia/opieplayer2/nullvideo.c b/noncore/multimedia/opieplayer2/nullvideo.c
index bd52869..ceda333 100644
--- a/noncore/multimedia/opieplayer2/nullvideo.c
+++ b/noncore/multimedia/opieplayer2/nullvideo.c
@@ -1,98 +1,130 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
1 33
2/*#include <xine.h>*/ 34/*#include <xine.h>*/
3#include <stdlib.h> 35#include <stdlib.h>
4#include <stdio.h> 36#include <stdio.h>
5 37
6#include <math.h> 38#include <math.h>
7 39
8#include <xine/video_out.h> 40#include <xine/video_out.h>
9#include <xine/xine_internal.h> 41#include <xine/xine_internal.h>
10#include <xine/xineutils.h> 42#include <xine/xineutils.h>
11#include <xine/configfile.h> 43#include <xine/configfile.h>
12 44
13#include <pthread.h> 45#include <pthread.h>
14#include "alphablend.h" 46#include "alphablend.h"
15#include "yuv2rgb.h" 47#include "yuv2rgb.h"
16 48
17#define printf(x,...) 49#define printf(x,...)
18 50
19/* the caller for our event draw handler */ 51/* the caller for our event draw handler */
20typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 52typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
21 int width, int height,int bytes ); 53 int width, int height,int bytes );
22 54
23typedef struct null_driver_s null_driver_t; 55typedef struct null_driver_s null_driver_t;
24 56
25struct null_driver_s { 57struct null_driver_s {
26 vo_driver_t vo_driver; 58 vo_driver_t vo_driver;
27 uint32_t m_capabilities; 59 uint32_t m_capabilities;
28 int m_show_video; 60 int m_show_video;
29 int m_video_fullscreen; 61 int m_video_fullscreen;
30 int m_is_scaling; 62 int m_is_scaling;
31 int depth, bpp, bytes_per_pixel; 63 int depth, bpp, bytes_per_pixel;
32 int yuv2rgb_mode; 64 int yuv2rgb_mode;
33 int yuv2rgb_swap; 65 int yuv2rgb_swap;
34 int zuv2rgb_gamma; 66 int yuv2rgb_gamma;
35 uint8_t *yuv2rgb_cmap; 67 uint8_t *yuv2rgb_cmap;
36 yuv2rgb_factory_t *yuv2rgb_factory; 68 yuv2rgb_factory_t *yuv2rgb_factory;
37 vo_overlay_t *overlay; 69 vo_overlay_t *overlay;
38 int user_ratio; 70 int user_ratio;
39 double output_scale_factor; 71 double output_scale_factor;
40 int last_frame_output_width; 72 int last_frame_output_width;
41 int last_frame_output_height; 73 int last_frame_output_height;
42 int gui_width; 74 int gui_width;
43 int gui_height; 75 int gui_height;
44 int gui_changed; 76 int gui_changed;
45 double display_ratio; 77 double display_ratio;
46 void* caller; 78 void* caller;
47 display_xine_frame_t frameDis; 79 display_xine_frame_t frameDis;
48 80
49 81
50}; 82};
51typedef struct opie_frame_s opie_frame_t; 83typedef struct opie_frame_s opie_frame_t;
52struct opie_frame_s { 84struct opie_frame_s {
53 vo_frame_t frame; 85 vo_frame_t frame;
54 char* name; 86 char* name;
55 int version; 87 int version;
56 int width; 88 int width;
57 int height; 89 int height;
58 int ratio_code; 90 int ratio_code;
59 int format; 91 int format;
60 int flags; 92 int flags;
61 int user_ratio; 93 int user_ratio;
62 94
63 double ratio_factor; 95 double ratio_factor;
64 int ideal_width; 96 int ideal_width;
65 int ideal_height; 97 int ideal_height;
66 int output_width, output_height; 98 int output_width, output_height;
67 int gui_width, gui_height; 99 int gui_width, gui_height;
68 uint8_t *chunk[3]; 100 uint8_t *chunk[3];
69 101
70 yuv2rgb_t *yuv2rgb; 102 yuv2rgb_t *yuv2rgb;
71 uint8_t *rgb_dst; 103 uint8_t *rgb_dst;
72 int yuv_stride; 104 int yuv_stride;
73 int stripe_height, stripe_inc; 105 int stripe_height, stripe_inc;
74 106
75 int bytes_per_line; 107 int bytes_per_line;
76 uint8_t *data; 108 uint8_t *data;
77 109
78// int show_video; 110// int show_video;
79 null_driver_t *output; 111 null_driver_t *output;
80}; 112};
81 113
82static uint32_t null_get_capabilities(vo_driver_t *self ){ 114static uint32_t null_get_capabilities(vo_driver_t *self ){
83 null_driver_t* this = (null_driver_t*)self; 115 null_driver_t* this = (null_driver_t*)self;
84 printf("capabilities\n"); 116 printf("capabilities\n");
85 return this->m_capabilities; 117 return this->m_capabilities;
86} 118}
87 119
88static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) { 120static void null_frame_copy (vo_frame_t *vo_img, uint8_t **src) {
89 opie_frame_t *frame = (opie_frame_t *) vo_img ; 121 opie_frame_t *frame = (opie_frame_t *) vo_img ;
90 printf("frame copy\n"); 122 printf("frame copy\n");
91 if(!frame->output->m_show_video ){ printf("no video\n"); return; } // no video 123 if(!frame->output->m_show_video ){ printf("no video\n"); return; } // no video
92 124
93 if (frame->format == IMGFMT_YV12) { 125 if (frame->format == IMGFMT_YV12) {
94 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, 126 frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst,
95 src[0], src[1], src[2]); 127 src[0], src[1], src[2]);
96 } else { 128 } else {
97 129
98 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, 130 frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst,
@@ -544,129 +576,138 @@ vo_driver_t* init_video_out_plugin( config_values_t* conf,
544 vo->gui_width = 16; 576 vo->gui_width = 16;
545 vo->gui_height = 8; 577 vo->gui_height = 8;
546 vo->frameDis = NULL; 578 vo->frameDis = NULL;
547 579
548 /* install callback handlers*/ 580 /* install callback handlers*/
549 vo->vo_driver.get_capabilities = null_get_capabilities; 581 vo->vo_driver.get_capabilities = null_get_capabilities;
550 vo->vo_driver.alloc_frame = null_alloc_frame; 582 vo->vo_driver.alloc_frame = null_alloc_frame;
551 vo->vo_driver.update_frame_format = null_update_frame_format; 583 vo->vo_driver.update_frame_format = null_update_frame_format;
552 vo->vo_driver.display_frame = null_display_frame; 584 vo->vo_driver.display_frame = null_display_frame;
553 vo->vo_driver.overlay_blend = null_overlay_blend; 585 vo->vo_driver.overlay_blend = null_overlay_blend;
554 vo->vo_driver.get_property = null_get_property; 586 vo->vo_driver.get_property = null_get_property;
555 vo->vo_driver.set_property = null_set_property; 587 vo->vo_driver.set_property = null_set_property;
556 vo->vo_driver.get_property_min_max = null_get_property_min_max; 588 vo->vo_driver.get_property_min_max = null_get_property_min_max;
557 vo->vo_driver.gui_data_exchange = null_gui_data_exchange; 589 vo->vo_driver.gui_data_exchange = null_gui_data_exchange;
558 vo->vo_driver.exit = null_exit; 590 vo->vo_driver.exit = null_exit;
559 vo->vo_driver.redraw_needed = null_redraw_needed; 591 vo->vo_driver.redraw_needed = null_redraw_needed;
560 592
561 593
562 /* capabilities */ 594 /* capabilities */
563 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12; 595 vo->m_capabilities = VO_CAP_COPIES_IMAGE | VO_CAP_YUY2 | VO_CAP_YV12;
564 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap, 596 vo->yuv2rgb_factory = yuv2rgb_factory_init (MODE_16_RGB, vo->yuv2rgb_swap,
565 vo->yuv2rgb_cmap); 597 vo->yuv2rgb_cmap);
566 printf("done initialisation\n"); 598 printf("done initialisation\n");
567 return (vo_driver_t*) vo; 599 return (vo_driver_t*) vo;
568} 600}
569 601
570static vo_info_t vo_info_null = { 602static vo_info_t vo_info_null = {
571 5, 603 5,
572 "null plugin", 604 "null plugin",
573 NULL, 605 NULL,
574 VISUAL_TYPE_FB, 606 VISUAL_TYPE_FB,
575 5 607 5
576}; 608};
577 609
578vo_info_t *get_video_out_plugin_info(){ 610vo_info_t *get_video_out_plugin_info(){
579 vo_info_null.description = _("xine video output plugin using null device"); 611 vo_info_null.description = _("xine video output plugin using null device");
580 return &vo_info_null; 612 return &vo_info_null;
581} 613}
582 614
583/* this is special for this device */ 615/* this is special for this device */
584/** 616/**
585 * We know that we will be controled by the XINE LIB++ 617 * We know that we will be controled by the XINE LIB++
586 */ 618 */
587 619
588/** 620/**
589 * 621 *
590 */ 622 */
591int null_is_showing_video( vo_driver_t* self ){ 623int null_is_showing_video( vo_driver_t* self ){
592 null_driver_t* this = (null_driver_t*)self; 624 null_driver_t* this = (null_driver_t*)self;
593 return this->m_show_video; 625 return this->m_show_video;
594} 626}
595void null_set_show_video( vo_driver_t* self, int show ) { 627void null_set_show_video( vo_driver_t* self, int show ) {
596 ((null_driver_t*)self)->m_show_video = show; 628 ((null_driver_t*)self)->m_show_video = show;
597} 629}
598 630
599int null_is_fullscreen( vo_driver_t* self ){ 631int null_is_fullscreen( vo_driver_t* self ){
600 return ((null_driver_t*)self)->m_video_fullscreen; 632 return ((null_driver_t*)self)->m_video_fullscreen;
601} 633}
602void null_set_fullscreen( vo_driver_t* self, int screen ){ 634void null_set_fullscreen( vo_driver_t* self, int screen ){
603 ((null_driver_t*)self)->m_video_fullscreen = screen; 635 ((null_driver_t*)self)->m_video_fullscreen = screen;
604} 636}
605int null_is_scaling( vo_driver_t* self ){ 637int null_is_scaling( vo_driver_t* self ){
606 return ((null_driver_t*)self)->m_is_scaling; 638 return ((null_driver_t*)self)->m_is_scaling;
607} 639}
640
641void null_set_videoGamma( vo_driver_t* self , int value ) {
642 ((null_driver_t*) self) ->yuv2rgb_gamma = value;
643 ((null_driver_t*) self) ->yuv2rgb_factory->set_gamma( ((null_driver_t*) self) ->yuv2rgb_factory, value );
644}
645
608void null_set_scaling( vo_driver_t* self, int scale ){ 646void null_set_scaling( vo_driver_t* self, int scale ){
609 ((null_driver_t*)self)->m_is_scaling = scale; 647 ((null_driver_t*)self)->m_is_scaling = scale;
610} 648}
611 649
612void null_set_gui_width( vo_driver_t* self, int width ){ 650void null_set_gui_width( vo_driver_t* self, int width ){
613 ((null_driver_t*)self)->gui_width = width; 651 ((null_driver_t*)self)->gui_width = width;
614} 652}
615void null_set_gui_height( vo_driver_t* self, int height ){ 653void null_set_gui_height( vo_driver_t* self, int height ){
616 ((null_driver_t*)self)->gui_height = height; 654 ((null_driver_t*)self)->gui_height = height;
617} 655}
656
657
618void null_set_mode( vo_driver_t* self, int depth, int rgb ){ 658void null_set_mode( vo_driver_t* self, int depth, int rgb ){
619 null_driver_t* this = (null_driver_t*)self; 659 null_driver_t* this = (null_driver_t*)self;
620 660
621 this->bytes_per_pixel = (depth + 7 ) / 8; 661 this->bytes_per_pixel = (depth + 7 ) / 8;
622 this->bpp = this->bytes_per_pixel * 8; 662 this->bpp = this->bytes_per_pixel * 8;
623 this->depth = depth; 663 this->depth = depth;
624 printf("depth %d %d\n", depth, this->bpp); 664 printf("depth %d %d\n", depth, this->bpp);
625 printf("pixeltype %d\n", rgb ); 665 printf("pixeltype %d\n", rgb );
626 switch ( this->depth ){ 666 switch ( this->depth ){
627 case 32: 667 case 32:
628 if( rgb == 0 ) 668 if( rgb == 0 )
629 this->yuv2rgb_mode = MODE_32_RGB; 669 this->yuv2rgb_mode = MODE_32_RGB;
630 else 670 else
631 this->yuv2rgb_mode = MODE_32_BGR; 671 this->yuv2rgb_mode = MODE_32_BGR;
632 case 24: 672 case 24:
633 if( this->bpp == 32 ) { 673 if( this->bpp == 32 ) {
634 if(rgb == 0 ) 674 if(rgb == 0 )
635 this->yuv2rgb_mode = MODE_32_RGB; 675 this->yuv2rgb_mode = MODE_32_RGB;
636 else 676 else
637 this->yuv2rgb_mode = MODE_32_BGR; 677 this->yuv2rgb_mode = MODE_32_BGR;
638 }else{ 678 }else{
639 if( rgb == 0 ) 679 if( rgb == 0 )
640 this->yuv2rgb_mode = MODE_24_RGB; 680 this->yuv2rgb_mode = MODE_24_RGB;
641 else 681 else
642 this->yuv2rgb_mode = MODE_24_BGR; 682 this->yuv2rgb_mode = MODE_24_BGR;
643 }; 683 };
644 break; 684 break;
645 case 16: 685 case 16:
646 if( rgb == 0 ) 686 if( rgb == 0 )
647 this->yuv2rgb_mode = MODE_16_RGB; 687 this->yuv2rgb_mode = MODE_16_RGB;
648 else 688 else
649 this->yuv2rgb_mode = MODE_16_BGR; 689 this->yuv2rgb_mode = MODE_16_BGR;
650 break; 690 break;
651 case 15: 691 case 15:
652 if( rgb == 0 ) 692 if( rgb == 0 )
653 this->yuv2rgb_mode = MODE_15_RGB; 693 this->yuv2rgb_mode = MODE_15_RGB;
654 else 694 else
655 this->yuv2rgb_mode = MODE_15_BGR; 695 this->yuv2rgb_mode = MODE_15_BGR;
656 break; 696 break;
657 case 8: 697 case 8:
658 if( rgb == 0 ) 698 if( rgb == 0 )
659 this->yuv2rgb_mode = MODE_8_RGB; 699 this->yuv2rgb_mode = MODE_8_RGB;
660 else 700 else
661 this->yuv2rgb_mode = MODE_8_BGR; 701 this->yuv2rgb_mode = MODE_8_BGR;
662 break; 702 break;
663 }; 703 };
664 //free(this->yuv2rgb_factory ); 704 //free(this->yuv2rgb_factory );
665 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap, 705 // this->yuv2rgb_factory = yuv2rgb_factory_init (this->yuv2rgb_mode, this->yuv2rgb_swap,
666 // this->yuv2rgb_cmap); 706 // this->yuv2rgb_cmap);
667}; 707};
668void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data) { 708void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data) {
669 null_driver_t* this = (null_driver_t*) self; 709 null_driver_t* this = (null_driver_t*) self;
670 this->caller = user_data; 710 this->caller = user_data;
671 this->frameDis = t; 711 this->frameDis = t;
672} 712}
713
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6c4d07f..3bd04bc 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,200 +1,201 @@
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#include <qpe/qpetoolbar.h> 34#include <qpe/qpetoolbar.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qdir.h> 41#include <qdir.h>
42#include <qmessagebox.h> 42#include <qmessagebox.h>
43#include <qregexp.h> 43#include <qregexp.h>
44#include <qtextstream.h> 44#include <qtextstream.h>
45 45
46#include "playlistselection.h" 46#include "playlistselection.h"
47#include "playlistwidget.h" 47#include "playlistwidget.h"
48#include "mediaplayerstate.h" 48#include "mediaplayerstate.h"
49#include "inputDialog.h" 49#include "inputDialog.h"
50 50
51//only needed for the random play 51//only needed for the random play
52#include <stdlib.h> 52#include <stdlib.h>
53 53
54#include "audiowidget.h" 54#include "audiowidget.h"
55#include "videowidget.h" 55#include "videowidget.h"
56 56
57extern MediaPlayerState *mediaPlayerState; 57extern MediaPlayerState *mediaPlayerState;
58 58
59 59
60PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 60PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
61 : PlayListWidgetGui( parent, name, fl ) { 61 : PlayListWidgetGui( parent, name, fl ) {
62 62
63 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", 63 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist",
64 this , SLOT(addSelected() ) ); 64 this , SLOT(addSelected() ) );
65 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", 65 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist",
66 this , SLOT(removeSelected() ) ); 66 this , SLOT(removeSelected() ) );
67 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 67 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
68 this , SLOT( btnPlay( bool) ), TRUE ); 68 this , SLOT( btnPlay( bool) ), TRUE );
69 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 69 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
70 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 70 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
71 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 71 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
72 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 72 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
73 73
74 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 74 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
75 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 75 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
76 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 76 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
77 (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 77 (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
78 pmPlayList->insertSeparator(-1); 78 pmPlayList->insertSeparator(-1);
79 (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 79 (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
80 (void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); 80 (void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) );
81 pmPlayList->insertSeparator(-1); 81 pmPlayList->insertSeparator(-1);
82 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 82 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
83 pmPlayList->insertSeparator(-1); 83 pmPlayList->insertSeparator(-1);
84 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 84 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
85 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 85 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
86 86
87 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); 87 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) );
88 88
89 Config cfg( "OpiePlayer" ); 89 Config cfg( "OpiePlayer" );
90 bool b= cfg.readBoolEntry("FullScreen", 0); 90 bool b= cfg.readBoolEntry("FullScreen", 0);
91 mediaPlayerState->setFullscreen( b ); 91 mediaPlayerState->setFullscreen( b );
92 pmView->setItemChecked( -16, b ); 92 pmView->setItemChecked( -16, b );
93 93
94 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) ); 94 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) );
95 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) ); 95 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) );
96 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) ); 96 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) );
97 QVBox *stretch2 = new QVBox( vbox1 ); 97 QVBox *stretch2 = new QVBox( vbox1 );
98 98
99 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) ); 99 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) );
100 connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) ); 100 connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) );
101 connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) ); 101 connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) );
102 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 102 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
103 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 103 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
104 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 104 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
105 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 105 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
106 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 106 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
107 this,SLOT( playIt( QListViewItem *) ) ); 107 this,SLOT( playIt( QListViewItem *) ) );
108 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 108 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
112 this,SLOT( playIt( QListViewItem *) ) ); 112 this,SLOT( playIt( QListViewItem *) ) );
113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) ); 115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) );
116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
121 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), mediaPlayerState, SLOT( setVideoGamma( int ) ) );
121 122
122 readConfig( cfg ); 123 readConfig( cfg );
123 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); 124 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" );
124 loadList(DocLnk( currentPlaylist ) ); 125 loadList(DocLnk( currentPlaylist ) );
125 setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); 126 setCaption( tr( "OpiePlayer: " ) + currentPlaylist );
126 127
127 // see which skins are installed 128 // see which skins are installed
128 videoScan=FALSE; 129 videoScan=FALSE;
129 audioScan=FALSE; 130 audioScan=FALSE;
130 populateSkinsMenu(); 131 populateSkinsMenu();
131 initializeStates(); 132 initializeStates();
132} 133}
133 134
134 135
135PlayListWidget::~PlayListWidget() { 136PlayListWidget::~PlayListWidget() {
136 // WTF?!@?! 137 // WTF?!@?!
137 138
138 if ( d->current ) { 139 if ( d->current ) {
139 delete d->current; 140 delete d->current;
140 } 141 }
141 delete d; 142 delete d;
142} 143}
143 144
144 145
145void PlayListWidget::initializeStates() { 146void PlayListWidget::initializeStates() {
146 d->tbPlay->setOn( mediaPlayerState->playing() ); 147 d->tbPlay->setOn( mediaPlayerState->playing() );
147 d->tbLoop->setOn( mediaPlayerState->looping() ); 148 d->tbLoop->setOn( mediaPlayerState->looping() );
148 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 149 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
149 setPlaylist( true ); 150 setPlaylist( true );
150} 151}
151 152
152 153
153void PlayListWidget::readConfig( Config& cfg ) { 154void PlayListWidget::readConfig( Config& cfg ) {
154 cfg.setGroup( "PlayList" ); 155 cfg.setGroup( "PlayList" );
155 QString currentString = cfg.readEntry( "current", "" ); 156 QString currentString = cfg.readEntry( "current", "" );
156 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 ); 157 int noOfFiles = cfg.readNumEntry( "NumberOfFiles", 0 );
157 for ( int i = 0; i < noOfFiles; i++ ) { 158 for ( int i = 0; i < noOfFiles; i++ ) {
158 QString entryName; 159 QString entryName;
159 entryName.sprintf( "File%i", i + 1 ); 160 entryName.sprintf( "File%i", i + 1 );
160 QString linkFile = cfg.readEntry( entryName ); 161 QString linkFile = cfg.readEntry( entryName );
161 if( QFileInfo( linkFile ).exists() ) { 162 if( QFileInfo( linkFile ).exists() ) {
162 DocLnk lnk( linkFile ); 163 DocLnk lnk( linkFile );
163 if ( QFileInfo( lnk.file() ).exists() || linkFile.find( "http" , 0, TRUE) != -1) { 164 if ( QFileInfo( lnk.file() ).exists() || linkFile.find( "http" , 0, TRUE) != -1) {
164 d->selectedFiles->addToSelection( lnk ); 165 d->selectedFiles->addToSelection( lnk );
165 } 166 }
166 } 167 }
167 } 168 }
168 d->selectedFiles->setSelectedItem( currentString ); 169 d->selectedFiles->setSelectedItem( currentString );
169} 170}
170 171
171 172
172void PlayListWidget::writeConfig( Config& cfg ) const { 173void PlayListWidget::writeConfig( Config& cfg ) const {
173 d->selectedFiles->writeCurrent( cfg ); 174 d->selectedFiles->writeCurrent( cfg );
174 cfg.setGroup( "PlayList" ); 175 cfg.setGroup( "PlayList" );
175 int noOfFiles = 0; 176 int noOfFiles = 0;
176 d->selectedFiles->first(); 177 d->selectedFiles->first();
177 do { 178 do {
178 const DocLnk *lnk = d->selectedFiles->current(); 179 const DocLnk *lnk = d->selectedFiles->current();
179 if ( lnk ) { 180 if ( lnk ) {
180 QString entryName; 181 QString entryName;
181 entryName.sprintf( "File%i", noOfFiles + 1 ); 182 entryName.sprintf( "File%i", noOfFiles + 1 );
182 cfg.writeEntry( entryName, lnk->linkFile() ); 183 cfg.writeEntry( entryName, lnk->linkFile() );
183 // if this link does exist, add it so we have the file 184 // if this link does exist, add it so we have the file
184 // next time... 185 // next time...
185 if ( !QFile::exists( lnk->linkFile() ) ) { 186 if ( !QFile::exists( lnk->linkFile() ) ) {
186 // the way writing lnks doesn't really check for out 187 // the way writing lnks doesn't really check for out
187 // of disk space, but check it anyway. 188 // of disk space, but check it anyway.
188 if ( !lnk->writeLink() ) { 189 if ( !lnk->writeLink() ) {
189 QMessageBox::critical( 0, tr("Out of space"), 190 QMessageBox::critical( 0, tr("Out of space"),
190 tr( "There was a problem saving " 191 tr( "There was a problem saving "
191 "the playlist.\n" 192 "the playlist.\n"
192 "Your playlist " 193 "Your playlist "
193 "may be missing some entries\n" 194 "may be missing some entries\n"
194 "the next time you start it." ) 195 "the next time you start it." )
195 ); 196 );
196 } 197 }
197 } 198 }
198 noOfFiles++; 199 noOfFiles++;
199 } 200 }
200 } 201 }
@@ -672,129 +673,129 @@ void PlayListWidget::deletePlaylist() {
672 case 0: // Yes clicked, 673 case 0: // Yes clicked,
673 QFile().remove(playLists->selected()->file()); 674 QFile().remove(playLists->selected()->file());
674 QFile().remove(playLists->selected()->linkFile()); 675 QFile().remove(playLists->selected()->linkFile());
675 playLists->reread(); 676 playLists->reread();
676 break; 677 break;
677 case 1: // Cancel 678 case 1: // Cancel
678 break; 679 break;
679 }; 680 };
680} 681}
681 682
682 683
683void PlayListWidget::playSelected() { 684void PlayListWidget::playSelected() {
684 btnPlay( TRUE); 685 btnPlay( TRUE);
685} 686}
686 687
687 688
688void PlayListWidget::scanForAudio() { 689void PlayListWidget::scanForAudio() {
689// qDebug("scan for audio"); 690// qDebug("scan for audio");
690 files.detachChildren(); 691 files.detachChildren();
691 QListIterator<DocLnk> sdit( files.children() ); 692 QListIterator<DocLnk> sdit( files.children() );
692 for ( ; sdit.current(); ++sdit ) { 693 for ( ; sdit.current(); ++sdit ) {
693 delete sdit.current(); 694 delete sdit.current();
694 } 695 }
695 Global::findDocuments(&files, "audio/*"); 696 Global::findDocuments(&files, "audio/*");
696 audioScan = TRUE; 697 audioScan = TRUE;
697} 698}
698 699
699void PlayListWidget::scanForVideo() { 700void PlayListWidget::scanForVideo() {
700// qDebug("scan for video"); 701// qDebug("scan for video");
701 vFiles.detachChildren(); 702 vFiles.detachChildren();
702 QListIterator<DocLnk> sdit( vFiles.children() ); 703 QListIterator<DocLnk> sdit( vFiles.children() );
703 for ( ; sdit.current(); ++sdit ) { 704 for ( ; sdit.current(); ++sdit ) {
704 delete sdit.current(); 705 delete sdit.current();
705 } 706 }
706 Global::findDocuments(&vFiles, "video/*"); 707 Global::findDocuments(&vFiles, "video/*");
707 videoScan = TRUE; 708 videoScan = TRUE;
708} 709}
709 710
710void PlayListWidget::populateAudioView() { 711void PlayListWidget::populateAudioView() {
711 audioView->clear(); 712 audioView->clear();
712 StorageInfo storageInfo; 713 StorageInfo storageInfo;
713 const QList<FileSystem> &fs = storageInfo.fileSystems(); 714 const QList<FileSystem> &fs = storageInfo.fileSystems();
714 if(!audioScan) { 715 if(!audioScan) {
715 scanForAudio(); 716 scanForAudio();
716 } 717 }
717 718
718 QListIterator<DocLnk> dit( files.children() ); 719 QListIterator<DocLnk> dit( files.children() );
719 QListIterator<FileSystem> it ( fs ); 720 QListIterator<FileSystem> it ( fs );
720 721
721 QString storage; 722 QString storage;
722 for ( ; dit.current(); ++dit ) { 723 for ( ; dit.current(); ++dit ) {
723 for( ; it.current(); ++it ){ 724 for( ; it.current(); ++it ){
724 const QString name = (*it)->name(); 725 const QString name = (*it)->name();
725 const QString path = (*it)->path(); 726 const QString path = (*it)->path();
726 if(dit.current()->file().find(path) != -1 ) { 727 if(dit.current()->file().find(path) != -1 ) {
727 storage = name; 728 storage = name;
728 } 729 }
729 } 730 }
730 731
731 QListViewItem * newItem; 732 QListViewItem * newItem;
732 if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { 733 if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) {
733 long size; 734 long size;
734 if( dit.current()->file().left(4) == "http" ) 735 if( dit.current()->file().left(4) == "http" )
735 size=0; 736 size=0;
736 else 737 else
737 size = QFile( dit.current()->file() ).size(); 738 size = QFile( dit.current()->file() ).size();
738 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage); 739 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage);
739 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 740 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
740 } 741 }
741 } 742 }
742} 743}
743 744
744 745
745void PlayListWidget::populateVideoView() { 746void PlayListWidget::populateVideoView() {
746 videoView->clear(); 747 videoView->clear();
747 StorageInfo storageInfo; 748 StorageInfo storageInfo;
748 const QList<FileSystem> &fs = storageInfo.fileSystems(); 749 const QList<FileSystem> &fs = storageInfo.fileSystems();
749 750
750 if(!videoScan ) { 751 if(!videoScan ) {
751 scanForVideo(); 752 scanForVideo();
752 } 753 }
753 754
754 QListIterator<DocLnk> Vdit( vFiles.children() ); 755 QListIterator<DocLnk> Vdit( vFiles.children() );
755 QListIterator<FileSystem> it ( fs ); 756 QListIterator<FileSystem> it ( fs );
756 videoView->clear(); 757 videoView->clear();
757 QString storage; 758 QString storage;
758 for ( ; Vdit.current(); ++Vdit ) { 759 for ( ; Vdit.current(); ++Vdit ) {
759 for( ; it.current(); ++it ) { 760 for( ; it.current(); ++it ) {
760 const QString name = (*it)->name(); 761 const QString name = (*it)->name();
761 const QString path = (*it)->path(); 762 const QString path = (*it)->path();
762 if( Vdit.current()->file().find(path) != -1 ) { 763 if( Vdit.current()->file().find(path) != -1 ) {
763 storage=name; 764 storage=name;
764 } 765 }
765 } 766 }
766 767
767 QListViewItem * newItem; 768 QListViewItem * newItem;
768 if ( QFile( Vdit.current()->file() ).exists() ) { 769 if ( QFile( Vdit.current()->file() ).exists() ) {
769 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 770 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
770 QString::number( QFile( Vdit.current()->file() ).size() ), storage ); 771 QString::number( QFile( Vdit.current()->file() ).size() ), storage );
771 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 772 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
772 } 773 }
773 } 774 }
774} 775}
775 776
776 777
777void PlayListWidget::openFile() { 778void PlayListWidget::openFile() {
778 QString filename, name; 779 QString filename, name;
779 InputDialog *fileDlg; 780 InputDialog *fileDlg;
780 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 781 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
781 fileDlg->exec(); 782 fileDlg->exec();
782 if( fileDlg->result() == 1 ) { 783 if( fileDlg->result() == 1 ) {
783 filename = fileDlg->text(); 784 filename = fileDlg->text();
784 785
785 qDebug( "Selected filename is " + filename ); 786 qDebug( "Selected filename is " + filename );
786 if( filename.right( 3 ) == "m3u" ) { 787 if( filename.right( 3 ) == "m3u" ) {
787 readm3u( filename ); 788 readm3u( filename );
788 } else if( filename.right(3) == "pls" ) { 789 } else if( filename.right(3) == "pls" ) {
789 readPls( filename ); 790 readPls( filename );
790 } else { 791 } else {
791 // this doesnt need fixing 792 // this doesnt need fixing
792 DocLnk lnk; 793 DocLnk lnk;
793 lnk.setName( filename ); //sets file name 794 lnk.setName( filename ); //sets file name
794 lnk.setFile( filename ); //sets File property 795 lnk.setFile( filename ); //sets File property
795 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); 796 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() );
796 lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); 797 lnk.setType( MimeType( QFile::encodeName(filename) ).id() );
797 lnk.setExec( "opieplayer" ); 798 lnk.setExec( "opieplayer" );
798 lnk.setIcon( "opieplayer2/MPEGPlayer" ); 799 lnk.setIcon( "opieplayer2/MPEGPlayer" );
799 800
800 if( !lnk.writeLink() ) { 801 if( !lnk.writeLink() ) {
@@ -873,129 +874,129 @@ void PlayListWidget::readm3u( const QString &filename ) {
873 if( f.open( IO_ReadOnly ) ) { 874 if( f.open( IO_ReadOnly ) ) {
874 QTextStream t(&f); 875 QTextStream t(&f);
875 QString s;//, first, second; 876 QString s;//, first, second;
876 int i=0; 877 int i=0;
877 while ( !t.atEnd() ) { 878 while ( !t.atEnd() ) {
878 s=t.readLine(); 879 s=t.readLine();
879 880
880 if( s.find( "#", 0, TRUE) == -1 ) { 881 if( s.find( "#", 0, TRUE) == -1 ) {
881 if( s.find( " ", 0, TRUE) == -1 ) { // not sure if this is neede since cf uses vfat 882 if( s.find( " ", 0, TRUE) == -1 ) { // not sure if this is neede since cf uses vfat
882 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 883 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
883 s = s.right( s.length() -2 ); 884 s = s.right( s.length() -2 );
884 DocLnk lnk( s ); 885 DocLnk lnk( s );
885 QFileInfo f( s ); 886 QFileInfo f( s );
886 QString name = f.baseName(); 887 QString name = f.baseName();
887 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 888 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
888 lnk.setName( name ); 889 lnk.setName( name );
889 s=s.replace( QRegExp( "\\" ), "/" ); 890 s=s.replace( QRegExp( "\\" ), "/" );
890 lnk.setFile( s ); 891 lnk.setFile( s );
891 lnk.writeLink(); 892 lnk.writeLink();
892 qDebug( "add " + name); 893 qDebug( "add " + name);
893 d->selectedFiles->addToSelection( lnk ); 894 d->selectedFiles->addToSelection( lnk );
894 } else { // is url 895 } else { // is url
895 s.replace( QRegExp( "%20" )," " ); 896 s.replace( QRegExp( "%20" )," " );
896 DocLnk lnk( s ); 897 DocLnk lnk( s );
897 QString name; 898 QString name;
898 if( name.left( 4 ) == "http" ) { 899 if( name.left( 4 ) == "http" ) {
899 name = s.right( s.length() - 7 ); 900 name = s.right( s.length() - 7 );
900 } else { 901 } else {
901 name = s; 902 name = s;
902 } 903 }
903 lnk.setName( name ); 904 lnk.setName( name );
904 if( s.at( s.length() - 4) == '.' ) { 905 if( s.at( s.length() - 4) == '.' ) {
905 lnk.setFile( s ); 906 lnk.setFile( s );
906 } else { 907 } else {
907 lnk.setFile( s + "/" ); 908 lnk.setFile( s + "/" );
908 } 909 }
909 lnk.setType( "audio/x-mpegurl" ); 910 lnk.setType( "audio/x-mpegurl" );
910 lnk.writeLink(); 911 lnk.writeLink();
911 d->selectedFiles->addToSelection( lnk ); 912 d->selectedFiles->addToSelection( lnk );
912 } 913 }
913 i++; 914 i++;
914 } 915 }
915 } 916 }
916 } 917 }
917 } 918 }
918 f.close(); 919 f.close();
919} 920}
920 921
921void PlayListWidget::writem3u() { 922void PlayListWidget::writem3u() {
922 InputDialog *fileDlg; 923 InputDialog *fileDlg;
923 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 924 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
924 fileDlg->exec(); 925 fileDlg->exec();
925 QString filename, list; 926 QString filename, list;
926 if( fileDlg->result() == 1 ) { 927 if( fileDlg->result() == 1 ) {
927 filename = fileDlg->text(); 928 filename = fileDlg->text();
928 qDebug( filename ); 929 qDebug( filename );
929 int noOfFiles = 0; 930 int noOfFiles = 0;
930 d->selectedFiles->first(); 931 d->selectedFiles->first();
931 do { 932 do {
932 // we dont check for existance because of url's 933 // we dont check for existance because of url's
933 // qDebug(d->selectedFiles->current()->file()); 934 // qDebug(d->selectedFiles->current()->file());
934 935
935 // so maybe we should do some net checking to ,-) 936 // so maybe we should do some net checking to ,-)
936 // no, cause it takes to long... 937 // no, cause it takes to long...
937 938
938 list += d->selectedFiles->current()->file() + "\n"; 939 list += d->selectedFiles->current()->file() + "\n";
939 noOfFiles++; 940 noOfFiles++;
940 } 941 }
941 while ( d->selectedFiles->next() ); 942 while ( d->selectedFiles->next() );
942 qDebug( list ); 943 qDebug( list );
943 if( filename.left( 1) != "/" ) { 944 if( filename.left( 1) != "/" ) {
944 filename=QPEApplication::documentDir() + "/" + filename; 945 filename=QPEApplication::documentDir() + "/" + filename;
945 } 946 }
946 if( filename.right( 3 ) != "m3u" ) { 947 if( filename.right( 3 ) != "m3u" ) {
947 filename=filename+".m3u"; 948 filename=filename+".m3u";
948 } 949 }
949 QFile f( filename ); 950 QFile f( filename );
950 f.open( IO_WriteOnly ); 951 f.open( IO_WriteOnly );
951 f.writeBlock( list, list.length() ); 952 f.writeBlock( list, list.length() );
952 f.close(); 953 f.close();
953 } 954 }
954 if( fileDlg ) { 955 if( fileDlg ) {
955 delete fileDlg; 956 delete fileDlg;
956 } 957 }
957} 958}
958 959
959void PlayListWidget::readPls( const QString &filename ) { 960void PlayListWidget::readPls( const QString &filename ) {
960 961
961 qDebug( "pls filename is " + filename ); 962 qDebug( "pls filename is " + filename );
962 QFile f( filename ); 963 QFile f( filename );
963 964
964 if( f.open( IO_ReadOnly ) ) { 965 if( f.open( IO_ReadOnly ) ) {
965 QTextStream t( &f ); 966 QTextStream t( &f );
966 QString s;//, first, second; 967 QString s;//, first, second;
967 int i = 0; 968 int i = 0;
968 while ( !t.atEnd() ) { 969 while ( !t.atEnd() ) {
969 s = t.readLine(); 970 s = t.readLine();
970 if( s.left(4) == "File" ) { 971 if( s.left(4) == "File" ) {
971 s = s.right( s.length() - 6 ); 972 s = s.right( s.length() - 6 );
972 s.replace( QRegExp( "%20" )," "); 973 s.replace( QRegExp( "%20" )," ");
973 qDebug( "adding " + s + " to playlist" ); 974 qDebug( "adding " + s + " to playlist" );
974 // numberofentries=2 975 // numberofentries=2
975 // File1=http 976 // File1=http
976 // Title 977 // Title
977 // Length 978 // Length
978 // Version 979 // Version
979 // File2=http 980 // File2=http
980 s = s.replace( QRegExp( "\\" ), "/" ); 981 s = s.replace( QRegExp( "\\" ), "/" );
981 DocLnk lnk( s ); 982 DocLnk lnk( s );
982 QFileInfo f( s ); 983 QFileInfo f( s );
983 QString name = f.baseName(); 984 QString name = f.baseName();
984 if( name.left( 4 ) == "http" ) { 985 if( name.left( 4 ) == "http" ) {
985 name = s.right( s.length() - 7); 986 name = s.right( s.length() - 7);
986 } else { 987 } else {
987 name = s; 988 name = s;
988 } 989 }
989 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 990 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
990 lnk.setName( name ); 991 lnk.setName( name );
991 if( s.at( s.length() - 4) == '.') // if this is probably a file 992 if( s.at( s.length() - 4) == '.') // if this is probably a file
992 lnk.setFile( s ); 993 lnk.setFile( s );
993 else { //if its a url 994 else { //if its a url
994 if( name.right( 1 ).find( '/' ) == -1) { 995 if( name.right( 1 ).find( '/' ) == -1) {
995 s += "/"; 996 s += "/";
996 } 997 }
997 lnk.setFile( s ); 998 lnk.setFile( s );
998 } 999 }
999 lnk.setType( "audio/x-mpegurl" ); 1000 lnk.setType( "audio/x-mpegurl" );
1000 1001
1001 //qDebug("DocLnk add "+name); 1002 //qDebug("DocLnk add "+name);
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 2742252..dcfdd48 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -1,90 +1,90 @@
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#ifndef PLAY_LIST_WIDGET_H 34#ifndef PLAY_LIST_WIDGET_H
35#define PLAY_LIST_WIDGET_H 35#define PLAY_LIST_WIDGET_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qpe/applnk.h> 38#include <qpe/applnk.h>
39#include <qtabwidget.h> 39#include <qtabwidget.h>
40#include <qpe/fileselector.h> 40#include <qpe/fileselector.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qpopupmenu.h> 42#include <qpopupmenu.h>
43 43
44#include "playlistwidgetgui.h" 44#include "playlistwidgetgui.h"
45 45
46 46
47//class PlayListWidgetPrivate; 47//class PlayListWidgetPrivate;
48class Config; 48class Config;
49class QListViewItem; 49class QListViewItem;
50class QListView; 50class QListView;
51class QPoint; 51class QPoint;
52class QAction; 52class QAction;
53class QLabel; 53class QLabel;
54 54
55class PlayListWidget : public PlayListWidgetGui { 55class PlayListWidget : public PlayListWidgetGui {
56 Q_OBJECT 56 Q_OBJECT
57public: 57public:
58 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 58 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
59 ~PlayListWidget(); 59 ~PlayListWidget();
60 DocLnkSet files; 60 DocLnkSet files;
61 DocLnkSet vFiles; 61 DocLnkSet vFiles;
62 bool fromSetDocument; 62 bool fromSetDocument;
63 bool insanityBool; 63 bool insanityBool;
64 QString setDocFileRef; 64 QString setDocFileRef;
65 // retrieve the current playlist entry (media file link) 65 // retrieve the current playlist entry (media file link)
66 const DocLnk *current(); 66 const DocLnk *current();
67 void useSelectedDocument(); 67 void useSelectedDocument();
68 int selected; 68 int selected;
69 69
70public slots: 70public slots:
71 bool first(); 71 bool first();
72 bool last(); 72 bool last();
73 bool next(); 73 bool next();
74 bool prev(); 74 bool prev();
75 void writeConfig( Config& cfg ) const; 75 void writeConfig( Config& cfg ) const;
76 76
77protected: 77protected:
78 void keyReleaseEvent( QKeyEvent *e); 78 void keyReleaseEvent( QKeyEvent *e);
79 79
80private: 80private:
81 int defaultSkinIndex; 81 int defaultSkinIndex;
82 bool audioScan, videoScan; 82 bool audioScan, videoScan;
83 void readm3u(const QString &); 83 void readm3u(const QString &);
84 void readPls(const QString &); 84 void readPls(const QString &);
85 void initializeStates(); 85 void initializeStates();
86 void readConfig( Config& cfg ); 86 void readConfig( Config& cfg );
87 void populateAudioView(); 87 void populateAudioView();
88 void populateVideoView(); 88 void populateVideoView();
89 89
90private slots: 90private slots:
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 6ecd016..250833c 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -1,174 +1,193 @@
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#include <qpe/qpemenubar.h> 34#include <qpe/qpemenubar.h>
35#include <qpe/qpetoolbar.h> 35#include <qpe/qpetoolbar.h>
36#include <qpe/fileselector.h> 36#include <qpe/fileselector.h>
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#include <qpe/storage.h> 38#include <qpe/storage.h>
39#include <qpe/mimetype.h> 39#include <qpe/mimetype.h>
40#include <qpe/config.h> 40#include <qpe/config.h>
41#include <qpe/global.h> 41#include <qpe/global.h>
42#include <qpe/resource.h> 42#include <qpe/resource.h>
43 43
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qaction.h> 45#include <qaction.h>
46#include <qcursor.h> 46#include <qcursor.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qlayout.h> 48#include <qlayout.h>
49 49
50#include "playlistselection.h" 50#include "playlistselection.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52#include "mediaplayerstate.h" 52#include "mediaplayerstate.h"
53#include "inputDialog.h" 53#include "inputDialog.h"
54 54
55//only needed for the random play 55//only needed for the random play
56#include <stdlib.h> 56#include <stdlib.h>
57 57
58#include "audiowidget.h" 58#include "audiowidget.h"
59#include "videowidget.h" 59#include "videowidget.h"
60#include "mediaplayerstate.h" 60#include "mediaplayerstate.h"
61 61
62extern MediaPlayerState *mediaPlayerState; 62extern MediaPlayerState *mediaPlayerState;
63 63
64PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl ) 64PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl )
65 : QMainWindow( parent, name, fl ) { 65 : QMainWindow( parent, name, fl ) {
66 66
67 d = new PlayListWidgetPrivate; 67 d = new PlayListWidgetPrivate;
68 d->setDocumentUsed = FALSE; 68 d->setDocumentUsed = FALSE;
69 d->current = NULL; 69 d->current = NULL;
70 70
71 setBackgroundMode( PaletteButton ); 71 setBackgroundMode( PaletteButton );
72 setToolBarsMovable( FALSE ); 72 setToolBarsMovable( FALSE );
73 73
74 // Create Toolbar 74 // Create Toolbar
75 QPEToolBar *toolbar = new QPEToolBar( this ); 75 QPEToolBar *toolbar = new QPEToolBar( this );
76 toolbar->setHorizontalStretchable( TRUE ); 76 toolbar->setHorizontalStretchable( TRUE );
77 77
78 // Create Menubar 78 // Create Menubar
79 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 79 QPEMenuBar *menu = new QPEMenuBar( toolbar );
80 menu->setMargin( 0 ); 80 menu->setMargin( 0 );
81 81
82 bar = new QPEToolBar( this ); 82 bar = new QPEToolBar( this );
83 bar->setLabel( tr( "Play Operations" ) ); 83 bar->setLabel( tr( "Play Operations" ) );
84 84
85 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 85 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
86 tbDeletePlaylist->setFlat( TRUE ); 86 tbDeletePlaylist->setFlat( TRUE );
87 tbDeletePlaylist->setFixedSize( 20, 20 ); 87 tbDeletePlaylist->setFixedSize( 20, 20 );
88 88
89 tbDeletePlaylist->hide(); 89 tbDeletePlaylist->hide();
90 90
91 pmPlayList = new QPopupMenu( this ); 91 pmPlayList = new QPopupMenu( this );
92 menu->insertItem( tr( "File" ), pmPlayList ); 92 menu->insertItem( tr( "File" ), pmPlayList );
93 93
94 pmView = new QPopupMenu( this ); 94 pmView = new QPopupMenu( this );
95 menu->insertItem( tr( "View" ), pmView ); 95 menu->insertItem( tr( "View" ), pmView );
96 pmView->isCheckable(); 96 pmView->isCheckable();
97 97
98 skinsMenu = new QPopupMenu( this ); 98 skinsMenu = new QPopupMenu( this );
99 pmView->insertItem( tr( "Skins" ), skinsMenu ); 99 pmView->insertItem( tr( "Skins" ), skinsMenu );
100 skinsMenu->isCheckable(); 100 skinsMenu->isCheckable();
101 101
102 gammaMenu = new QPopupMenu( this );
103 pmView->insertItem( tr( "Gamma" ), gammaMenu );
104 gammaMenu->setMinimumHeight( 50 );
105
106 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
107 gammaSlider->setRange( -100, 100 );
108 gammaSlider->setTickmarks( QSlider::Left );
109 gammaSlider->setTickInterval( 20 );
110 gammaSlider->setFocusPolicy( QWidget::NoFocus );
111 gammaSlider->setValue( 0 );
112 gammaSlider->setMinimumHeight( 50 );
113
114 gammaLCD = new QLCDNumber( 3, gammaMenu );
115
116 gammaMenu->insertItem( gammaSlider );
117 gammaMenu->insertItem( gammaLCD );
118
119 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
120
102 vbox5 = new QVBox( this ); 121 vbox5 = new QVBox( this );
103 QVBox *vbox4 = new QVBox( vbox5 ); 122 QVBox *vbox4 = new QVBox( vbox5 );
104 QHBox *hbox6 = new QHBox( vbox4 ); 123 QHBox *hbox6 = new QHBox( vbox4 );
105 124
106 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 125 tabWidget = new QTabWidget( hbox6, "tabWidget" );
107 126
108 QWidget *pTab; 127 QWidget *pTab;
109 pTab = new QWidget( tabWidget, "pTab" ); 128 pTab = new QWidget( tabWidget, "pTab" );
110 tabWidget->insertTab( pTab,"Playlist"); 129 tabWidget->insertTab( pTab, "Playlist");
111 130
112 QGridLayout *Playout = new QGridLayout( pTab ); 131 QGridLayout *Playout = new QGridLayout( pTab );
113 Playout->setSpacing( 2); 132 Playout->setSpacing( 2);
114 Playout->setMargin( 2); 133 Playout->setMargin( 2);
115 134
116 // Add the playlist area 135 // Add the playlist area
117 QVBox *vbox3 = new QVBox( pTab ); 136 QVBox *vbox3 = new QVBox( pTab );
118 d->playListFrame = vbox3; 137 d->playListFrame = vbox3;
119 138
120 QHBox *hbox2 = new QHBox( vbox3 ); 139 QHBox *hbox2 = new QHBox( vbox3 );
121 d->selectedFiles = new PlayListSelection( hbox2 ); 140 d->selectedFiles = new PlayListSelection( hbox2 );
122 141
123 vbox1 = new QVBox( hbox2 ); 142 vbox1 = new QVBox( hbox2 );
124 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 143 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
125 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 144 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
126 145
127 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 146 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
128 147
129 QWidget *aTab; 148 QWidget *aTab;
130 aTab = new QWidget( tabWidget, "aTab" ); 149 aTab = new QWidget( tabWidget, "aTab" );
131 150
132 QGridLayout *Alayout = new QGridLayout( aTab ); 151 QGridLayout *Alayout = new QGridLayout( aTab );
133 Alayout->setSpacing( 2 ); 152 Alayout->setSpacing( 2 );
134 Alayout->setMargin( 2 ); 153 Alayout->setMargin( 2 );
135 audioView = new QListView( aTab, "Audioview" ); 154 audioView = new QListView( aTab, "Audioview" );
136 audioView->addColumn( tr( "Title" ), 140 ); 155 audioView->addColumn( tr( "Title" ), 140 );
137 audioView->addColumn( tr( "Size" ), -1 ); 156 audioView->addColumn( tr( "Size" ), -1 );
138 audioView->addColumn( tr( "Media" ), -1 ); 157 audioView->addColumn( tr( "Media" ), -1 );
139 audioView->setColumnAlignment( 1, Qt::AlignRight ); 158 audioView->setColumnAlignment( 1, Qt::AlignRight );
140 audioView->setColumnAlignment( 2, Qt::AlignRight ); 159 audioView->setColumnAlignment( 2, Qt::AlignRight );
141 audioView->setAllColumnsShowFocus( TRUE ); 160 audioView->setAllColumnsShowFocus( TRUE );
142 audioView->setSorting( 0, TRUE ); 161 audioView->setSorting( 0, TRUE );
143 audioView->setMultiSelection( TRUE ); 162 audioView->setMultiSelection( TRUE );
144 audioView->setSelectionMode( QListView::Extended ); 163 audioView->setSelectionMode( QListView::Extended );
145 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 164 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
146 tabWidget->insertTab( aTab, tr( "Audio" ) ); 165 tabWidget->insertTab( aTab, tr( "Audio" ) );
147 166
148 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 167 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
149 168
150 QWidget *vTab; 169 QWidget *vTab;
151 vTab = new QWidget( tabWidget, "vTab" ); 170 vTab = new QWidget( tabWidget, "vTab" );
152 171
153 QGridLayout *Vlayout = new QGridLayout( vTab ); 172 QGridLayout *Vlayout = new QGridLayout( vTab );
154 Vlayout->setSpacing( 2 ); 173 Vlayout->setSpacing( 2 );
155 Vlayout->setMargin( 2 ); 174 Vlayout->setMargin( 2 );
156 videoView = new QListView( vTab, "Videoview" ); 175 videoView = new QListView( vTab, "Videoview" );
157 videoView->addColumn( tr( "Title" ), 140); 176 videoView->addColumn( tr( "Title" ), 140);
158 videoView->addColumn( tr( "Size" ), -1 ); 177 videoView->addColumn( tr( "Size" ), -1 );
159 videoView->addColumn(tr( "Media" ), -1 ); 178 videoView->addColumn(tr( "Media" ), -1 );
160 videoView->setColumnAlignment( 1, Qt::AlignRight ); 179 videoView->setColumnAlignment( 1, Qt::AlignRight );
161 videoView->setColumnAlignment( 2, Qt::AlignRight ); 180 videoView->setColumnAlignment( 2, Qt::AlignRight );
162 videoView->setAllColumnsShowFocus( TRUE ); 181 videoView->setAllColumnsShowFocus( TRUE );
163 videoView->setSorting( 0, TRUE ); 182 videoView->setSorting( 0, TRUE );
164 videoView->setMultiSelection( TRUE ); 183 videoView->setMultiSelection( TRUE );
165 videoView->setSelectionMode( QListView::Extended ); 184 videoView->setSelectionMode( QListView::Extended );
166 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 185 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
167 186
168 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 187 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
169 188
170 tabWidget->insertTab( vTab, tr( "Video" ) ); 189 tabWidget->insertTab( vTab, tr( "Video" ) );
171 190
172 //playlists list 191 //playlists list
173 QWidget *LTab; 192 QWidget *LTab;
174 LTab = new QWidget( tabWidget, "LTab" ); 193 LTab = new QWidget( tabWidget, "LTab" );
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index 4c8d737..61fd40d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -1,126 +1,130 @@
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#ifndef PLAY_LIST_WIDGET_GUI_H 34#ifndef PLAY_LIST_WIDGET_GUI_H
35#define PLAY_LIST_WIDGET_GUI_H 35#define PLAY_LIST_WIDGET_GUI_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qpe/applnk.h> 38#include <qpe/applnk.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40#include <qpe/qpemenubar.h> 40#include <qpe/qpemenubar.h>
41 41
42#include <qtabwidget.h> 42#include <qtabwidget.h>
43#include <qpe/fileselector.h> 43#include <qpe/fileselector.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qpopupmenu.h> 45#include <qpopupmenu.h>
46#include <qaction.h> 46#include <qaction.h>
47 47#include <qslider.h>
48#include <qlcdnumber.h>
48 49
49class PlayListWidgetPrivate; 50class PlayListWidgetPrivate;
50class PlayListSelection; 51class PlayListSelection;
51 52
52class Config; 53class Config;
53class QPEToolBar; 54class QPEToolBar;
54class QListViewItem; 55class QListViewItem;
55class QListView; 56class QListView;
56class QPoint; 57class QPoint;
57class QAction; 58class QAction;
58class QLabel; 59class QLabel;
59 60
60class PlayListWidgetPrivate { 61class PlayListWidgetPrivate {
61public: 62public:
62 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 63 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
63 QFrame *playListFrame; 64 QFrame *playListFrame;
64 FileSelector *files; 65 FileSelector *files;
65 PlayListSelection *selectedFiles; 66 PlayListSelection *selectedFiles;
66 bool setDocumentUsed; 67 bool setDocumentUsed;
67 DocLnk *current; 68 DocLnk *current;
68}; 69};
69 70
70 71
71class ToolButton : public QToolButton { 72class ToolButton : public QToolButton {
72public: 73public:
73 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 74 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
74 : QToolButton( parent, name ) { 75 : QToolButton( parent, name ) {
75 setTextLabel( name ); 76 setTextLabel( name );
76 setPixmap( Resource::loadPixmap( icon ) ); 77 setPixmap( Resource::loadPixmap( icon ) );
77 setAutoRaise( TRUE ); 78 setAutoRaise( TRUE );
78 setFocusPolicy( QWidget::NoFocus ); 79 setFocusPolicy( QWidget::NoFocus );
79 setToggleButton( t ); 80 setToggleButton( t );
80 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 81 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
81 QPEMenuToolFocusManager::manager()->addWidget( this ); 82 QPEMenuToolFocusManager::manager()->addWidget( this );
82 } 83 }
83}; 84};
84 85
85 86
86class MenuItem : public QAction { 87class MenuItem : public QAction {
87 88
88public: 89public:
89 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 90 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
90 : QAction( text, QString::null, 0, 0 ) { 91 : QAction( text, QString::null, 0, 0 ) {
91 connect( this, SIGNAL( activated() ), handler, slot ); 92 connect( this, SIGNAL( activated() ), handler, slot );
92 addTo( parent ); 93 addTo( parent );
93 } 94 }
94}; 95};
95 96
96class PlayListWidgetGui : public QMainWindow { 97class PlayListWidgetGui : public QMainWindow {
97 Q_OBJECT 98 Q_OBJECT
98public: 99public:
99 PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 100 PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 );
100 ~PlayListWidgetGui(); 101 ~PlayListWidgetGui();
101 102
102protected: 103protected:
103 QTabWidget * tabWidget; 104 QTabWidget * tabWidget;
104 QListView *audioView, *videoView, *playlistView; 105 QListView *audioView, *videoView, *playlistView;
105 QLabel *libString; 106 QLabel *libString;
106 QPopupMenu *pmView ; 107 QPopupMenu *pmView ;
108 QPopupMenu *gammaMenu;
109 QSlider *gammaSlider;
110 QLCDNumber *gammaLCD;
107 bool fromSetDocument; 111 bool fromSetDocument;
108 bool insanityBool; 112 bool insanityBool;
109 QString setDocFileRef; 113 QString setDocFileRef;
110 // retrieve the current playlist entry (media file link) 114 // retrieve the current playlist entry (media file link)
111 QPushButton *tbDeletePlaylist; 115 QPushButton *tbDeletePlaylist;
112 int selected; 116 int selected;
113 QPopupMenu *pmPlayList; 117 QPopupMenu *pmPlayList;
114 FileSelector* playLists; 118 FileSelector* playLists;
115 QPopupMenu *skinsMenu; 119 QPopupMenu *skinsMenu;
116 PlayListWidgetPrivate *d; // Private implementation data 120 PlayListWidgetPrivate *d; // Private implementation data
117 QVBox *vbox1; 121 QVBox *vbox1;
118 QVBox *vbox5; 122 QVBox *vbox5;
119 QPEToolBar *bar; 123 QPEToolBar *bar;
120 void setActiveWindow(); // need to handle this to show the right view 124 void setActiveWindow(); // need to handle this to show the right view
121 void setView( char ); 125 void setView( char );
122 126
123}; 127};
124 128
125#endif 129#endif
126 130
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 12d80ba..d18fde5 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,180 +1,185 @@
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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 <qpe/qcopenvelope_qws.h> 36#include <qpe/qcopenvelope_qws.h>
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#include "xinecontrol.h" 38#include "xinecontrol.h"
39#include "mediaplayerstate.h" 39#include "mediaplayerstate.h"
40#include "videowidget.h" 40#include "videowidget.h"
41 41
42extern MediaPlayerState *mediaPlayerState; 42extern MediaPlayerState *mediaPlayerState;
43extern VideoWidget *videoUI; 43extern VideoWidget *videoUI;
44XineControl::XineControl( QObject *parent, const char *name ) 44XineControl::XineControl( QObject *parent, const char *name )
45 : QObject( parent, name ) { 45 : QObject( parent, name ) {
46 libXine = new XINE::Lib(videoUI->vidWidget() ); 46 libXine = new XINE::Lib(videoUI->vidWidget() );
47 47
48 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); 48 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & )));
49 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); 49 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
50 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); 50 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
51 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 51 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
52 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 52 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
53 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 53 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
54 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
54 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 55 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
55 56
56 disabledSuspendScreenSaver = FALSE; 57 disabledSuspendScreenSaver = FALSE;
57} 58}
58 59
59XineControl::~XineControl() { 60XineControl::~XineControl() {
60#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 61#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
61 if ( disabledSuspendScreenSaver ) { 62 if ( disabledSuspendScreenSaver ) {
62 disabledSuspendScreenSaver = FALSE; 63 disabledSuspendScreenSaver = FALSE;
63 // Re-enable the suspend mode 64 // Re-enable the suspend mode
64 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 65 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
65 } 66 }
66#endif 67#endif
67 delete libXine; 68 delete libXine;
68} 69}
69 70
70void XineControl::play( const QString& fileName ) { 71void XineControl::play( const QString& fileName ) {
71 hasVideoChannel=FALSE; 72 hasVideoChannel=FALSE;
72 hasAudioChannel=FALSE; 73 hasAudioChannel=FALSE;
73 m_fileName = fileName; 74 m_fileName = fileName;
74 75
75 qDebug("<<FILENAME: " + fileName + ">>>>"); 76 //qDebug("<<FILENAME: " + fileName + ">>>>");
76 77
77 libXine->play( fileName ); 78 libXine->play( fileName );
78 mediaPlayerState->setPlaying( true ); 79 mediaPlayerState->setPlaying( true );
79 // default to audio view until we know how to handle video 80 // default to audio view until we know how to handle video
80 // MediaDetect mdetect; 81 // MediaDetect mdetect;
81 char whichGui = mdetect.videoOrAudio( fileName ); 82 char whichGui = mdetect.videoOrAudio( fileName );
82 if (whichGui == 'f') { 83 if (whichGui == 'f') {
83 qDebug("Nicht erkannter Dateityp"); 84 qDebug("Nicht erkannter Dateityp");
84 return; 85 return;
85 } 86 }
86 87
87 if (whichGui == 'a') { 88 if (whichGui == 'a') {
88 libXine->setShowVideo( false ); 89 libXine->setShowVideo( false );
89 hasAudioChannel=TRUE; 90 hasAudioChannel=TRUE;
90 } else { 91 } else {
91 libXine->setShowVideo( true ); 92 libXine->setShowVideo( true );
92 hasVideoChannel=TRUE; 93 hasVideoChannel=TRUE;
93 } 94 }
94 95
95 // determine if slider is shown 96 // determine if slider is shown
96 mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); 97 mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
97 // which gui (video / audio) 98 // which gui (video / audio)
98 mediaPlayerState->setView( whichGui ); 99 mediaPlayerState->setView( whichGui );
99 100
100#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 101#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
101 if ( !disabledSuspendScreenSaver ) { 102 if ( !disabledSuspendScreenSaver ) {
102 disabledSuspendScreenSaver = TRUE; 103 disabledSuspendScreenSaver = TRUE;
103 // Stop the screen from blanking and power saving state 104 // Stop the screen from blanking and power saving state
104 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 105 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
105 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 106 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
106 } 107 }
107#endif 108#endif
108 109
109 length(); 110 length();
110 position(); 111 position();
111} 112}
112 113
113void XineControl::nextMedia() { 114void XineControl::nextMedia() {
114 mediaPlayerState->setNext(); 115 mediaPlayerState->setNext();
115} 116}
116 117
118void XineControl::setGamma( int value ) {
119 libXine->setGamma( value );
120}
121
117void XineControl::stop( bool isSet ) { 122void XineControl::stop( bool isSet ) {
118 if ( !isSet) { 123 if ( !isSet) {
119 libXine->stop( ); 124 libXine->stop( );
120 mediaPlayerState->setList(); 125 mediaPlayerState->setList();
121 // mediaPlayerState->setPlaying( false ); 126 // mediaPlayerState->setPlaying( false );
122 127
123#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 128#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
124 if ( disabledSuspendScreenSaver ) { 129 if ( disabledSuspendScreenSaver ) {
125 disabledSuspendScreenSaver = FALSE; 130 disabledSuspendScreenSaver = FALSE;
126 // Re-enable the suspend mode 131 // Re-enable the suspend mode
127 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 132 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
128 } 133 }
129#endif 134#endif
130 135
131 } else { 136 } else {
132 // play again 137 // play again
133 } 138 }
134} 139}
135 140
136/** 141/**
137 * Pause playback 142 * Pause playback
138 * @isSet 143 * @isSet
139 */ 144 */
140void XineControl::pause( bool isSet) { 145void XineControl::pause( bool isSet) {
141 if (isSet) { 146 if (isSet) {
142 libXine->pause(); 147 libXine->pause();
143 } else { 148 } else {
144 libXine->play( m_fileName, 0, m_currentTime); 149 libXine->play( m_fileName, 0, m_currentTime);
145 } 150 }
146} 151}
147 152
148 153
149/** 154/**
150 * get current time in playback 155 * get current time in playback
151 */ 156 */
152long XineControl::currentTime() { 157long XineControl::currentTime() {
153 // todo: jede sekunde überprüfen 158 // todo: jede sekunde überprüfen
154 m_currentTime = libXine->currentTime(); 159 m_currentTime = libXine->currentTime();
155 return m_currentTime; 160 return m_currentTime;
156 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 161 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
157} 162}
158 163
159/** 164/**
160 * Set the length of the media file 165 * Set the length of the media file
161 */ 166 */
162void XineControl::length() { 167void XineControl::length() {
163 m_length = libXine->length(); 168 m_length = libXine->length();
164 mediaPlayerState->setLength( m_length ); 169 mediaPlayerState->setLength( m_length );
165} 170}
166 171
167 172
168/** 173/**
169 * Reports the position the xine backend is at right now 174 * Reports the position the xine backend is at right now
170 * @return long the postion in seconds 175 * @return long the postion in seconds
171 */ 176 */
172long XineControl::position() { 177long XineControl::position() {
173 m_position = ( currentTime() ); 178 m_position = ( currentTime() );
174 mediaPlayerState->updatePosition( m_position ); 179 mediaPlayerState->updatePosition( m_position );
175 long emitPos = (long)m_position; 180 long emitPos = (long)m_position;
176 emit positionChanged( emitPos ); 181 emit positionChanged( emitPos );
177 if(mediaPlayerState->isPlaying) 182 if(mediaPlayerState->isPlaying)
178 // needs to be stopped the media is stopped 183 // needs to be stopped the media is stopped
179 QTimer::singleShot( 1000, this, SLOT( position() ) ); 184 QTimer::singleShot( 1000, this, SLOT( position() ) );
180// qDebug("POSITION : %d", m_position); 185// qDebug("POSITION : %d", m_position);
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 4263b36..1de610b 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,79 +1,106 @@
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#ifndef XINECONTROL_H 34#ifndef XINECONTROL_H
35#define XINECONTROL_H 35#define XINECONTROL_H
36 36
37#include "lib.h" 37#include "lib.h"
38#include "mediadetect.h" 38#include "mediadetect.h"
39#include <qobject.h> 39#include <qobject.h>
40 40
41class XineControl : public QObject { 41class XineControl : public QObject {
42 Q_OBJECT 42 Q_OBJECT
43public: 43public:
44 XineControl( QObject *parent = 0, const char *name =0 ); 44 XineControl( QObject *parent = 0, const char *name =0 );
45 ~XineControl(); 45 ~XineControl();
46 46
47 bool hasVideo() const { return hasVideoChannel; } 47 bool hasVideo() const { return hasVideoChannel; }
48 bool hasAudio() const { return hasAudioChannel; } 48 bool hasAudio() const { return hasAudioChannel; }
49 49
50public slots: 50public slots:
51 void play( const QString& fileName ); 51 void play( const QString& fileName );
52 void stop( bool ); 52 void stop( bool );
53
54 /**
55 * Pause the media stream
56 * @param if pause or not
57 */
53 void pause( bool ); 58 void pause( bool );
59
60 /**
61 * Set videos fullscreen
62 * @param yes or no
63 */
54 void setFullscreen( bool ); 64 void setFullscreen( bool );
65
66 /**
67 *
68 */
55 long currentTime(); 69 long currentTime();
56 void seekTo( long ); 70 void seekTo( long );
57 // get length of media file and set it 71 // get length of media file and set it
58 void length(); 72 void length();
59 long position(); 73 long position();
74
75 /**
76 * Proceed to the next media file in playlist
77 */
60 void nextMedia(); 78 void nextMedia();
79
61 void videoResized ( const QSize &s ); 80 void videoResized ( const QSize &s );
62 81
82 /**
83 * Set the gamma value of the video output
84 * @param int value between -100 and 100, 0 is original
85 */
86 void setGamma( int );
87
88
63private: 89private:
64 XINE::Lib *libXine; 90 XINE::Lib *libXine;
65 MediaDetect mdetect; 91 MediaDetect mdetect;
66 long m_currentTime; 92 long m_currentTime;
67 long m_position; 93 long m_position;
68 int m_length; 94 int m_length;
69 QString m_fileName; 95 QString m_fileName;
70 bool disabledSuspendScreenSaver : 1; 96 bool disabledSuspendScreenSaver : 1;
71 bool hasVideoChannel : 1; 97 bool hasVideoChannel : 1;
72 bool hasAudioChannel : 1; 98 bool hasAudioChannel : 1;
99
73signals: 100signals:
74 void positionChanged( long ); 101 void positionChanged( long );
75 102
76}; 103};
77 104
78 105
79#endif 106#endif
diff --git a/noncore/multimedia/opieplayer2/xinevideowidget.cpp b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
index bc95d86..d06d62a 100644
--- a/noncore/multimedia/opieplayer2/xinevideowidget.cpp
+++ b/noncore/multimedia/opieplayer2/xinevideowidget.cpp
@@ -68,196 +68,196 @@ static inline void memcpy_step_rev ( void *dst, void *src, size_t len, size_t st
68{ 68{
69 len >>= 1; 69 len >>= 1;
70 70
71 ((char *) src ) += ( len * step ); 71 ((char *) src ) += ( len * step );
72 72
73 while ( len-- ) { 73 while ( len-- ) {
74 ((char *) src ) -= step; 74 ((char *) src ) -= step;
75 *((short int *) dst )++ = *((short int *) src ); 75 *((short int *) dst )++ = *((short int *) src );
76 } 76 }
77} 77}
78 78
79 79
80XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name ) 80XineVideoWidget::XineVideoWidget ( QWidget* parent, const char* name )
81 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase ) 81 : QWidget ( parent, name, WRepaintNoErase | WResizeNoErase )
82{ 82{
83 setBackgroundMode ( NoBackground ); 83 setBackgroundMode ( NoBackground );
84 84
85 m_image = 0; 85 m_image = 0;
86 m_buff = 0; 86 m_buff = 0;
87 m_bytes_per_line_fb = qt_screen-> linestep ( ); 87 m_bytes_per_line_fb = qt_screen-> linestep ( );
88 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8; 88 m_bytes_per_pixel = ( qt_screen->depth() + 7 ) / 8;
89 m_rotation = 0; 89 m_rotation = 0;
90} 90}
91 91
92 92
93XineVideoWidget::~XineVideoWidget ( ) 93XineVideoWidget::~XineVideoWidget ( )
94{ 94{
95 delete m_image; 95 delete m_image;
96} 96}
97 97
98void XineVideoWidget::clear ( ) 98void XineVideoWidget::clear ( )
99{ 99{
100 m_buff = 0; 100 m_buff = 0;
101 repaint ( false ); 101 repaint ( false );
102} 102}
103 103
104void XineVideoWidget::paintEvent ( QPaintEvent * ) 104void XineVideoWidget::paintEvent ( QPaintEvent * )
105{ 105{
106 //qWarning( "painting <<<" ); 106 //qWarning( "painting <<<" );
107 if ( m_buff == 0 ) { 107 if ( m_buff == 0 ) {
108 QPainter p ( this ); 108 QPainter p ( this );
109 p. fillRect ( rect ( ), black ); 109 p. fillRect ( rect ( ), black );
110 if ( m_image ) 110 if ( m_image )
111 p. drawImage ( 0, 0, *m_image ); 111 p. drawImage ( 0, 0, *m_image );
112 //qWarning ( "logo\n" ); 112 //qWarning ( "logo\n" );
113 } 113 }
114 else { 114 else {
115// qWarning ( "paintevent\n" ); 115// qWarning ( "paintevent\n" );
116 116
117 QArray <QRect> qt_bug_workaround_clip_rects; 117 QArray <QRect> qt_bug_workaround_clip_rects;
118 118
119 { 119 {
120 QDirectPainter dp ( this ); 120 QDirectPainter dp ( this );
121 121
122 int rot = dp. transformOrientation ( ) + m_rotation; 122 int rot = dp. transformOrientation ( ) + m_rotation;
123 123
124 uchar *fb = dp. frameBuffer ( ); 124 uchar *fb = dp. frameBuffer ( );
125 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame; 125 uchar *frame = m_buff; // rot == 0 ? m_buff : m_buff + ( m_thisframe. height ( ) - 1 ) * m_bytes_per_line_frame;
126 126
127 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 127 QRect framerect = qt_screen-> mapToDevice ( QRect ( mapToGlobal ( m_thisframe. topLeft ( )), m_thisframe. size ( )), QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
128 128
129 qt_bug_workaround_clip_rects. resize ( dp. numRects ( )); 129 qt_bug_workaround_clip_rects. resize ( dp. numRects ( ));
130 130
131 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) { 131 for ( int i = dp. numRects ( ) - 1; i >= 0; i-- ) {
132 const QRect &clip = dp. rect ( i ); 132 const QRect &clip = dp. rect ( i );
133 133
134 qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 134 qt_bug_workaround_clip_rects [i] = qt_screen-> mapFromDevice ( clip, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
135 135
136 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb ); 136 uchar *dst = fb + ( clip. x ( ) * m_bytes_per_pixel ) + ( clip. y ( ) * m_bytes_per_line_fb );
137 uchar *src = frame; 137 uchar *src = frame;
138 138
139 switch ( rot ) { 139 switch ( rot ) {
140 case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break; 140 case 0: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) ); break;
141 case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break; 141 case 1: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_pixel ) ); break;
142 case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break; 142 case 2: src += ( (( clip. x ( ) - framerect. x ( )) * m_bytes_per_pixel ) + (( clip. y ( ) - framerect. y ( )) * m_bytes_per_line_frame ) + (( framerect. height ( ) - 1 ) * m_bytes_per_line_frame ) ); break;
143 case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break; 143 case 3: src += ( (( clip. y ( ) - framerect. y ( )) * m_bytes_per_pixel ) + (( clip. x ( ) - framerect. x ( )) * m_bytes_per_line_frame ) ); break;
144 default: break; 144 default: break;
145 } 145 }
146 146
147 uint leftfill = 0; 147 uint leftfill = 0;
148 uint framefill = 0; 148 uint framefill = 0;
149 uint rightfill = 0; 149 uint rightfill = 0;
150 uint clipwidth = clip. width ( ) * m_bytes_per_pixel; 150 uint clipwidth = clip. width ( ) * m_bytes_per_pixel;
151 151
152 if ( clip. left ( ) < framerect. left ( )) 152 if ( clip. left ( ) < framerect. left ( ))
153 leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth; 153 leftfill = (( framerect. left ( ) - clip. left ( )) * m_bytes_per_pixel ) <? clipwidth;
154 if ( clip. right ( ) > framerect. right ( )) 154 if ( clip. right ( ) > framerect. right ( ))
155 rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth; 155 rightfill = (( clip. right ( ) - framerect. right ( )) * m_bytes_per_pixel ) <? clipwidth;
156 156
157 framefill = clipwidth - ( leftfill + rightfill ); 157 framefill = clipwidth - ( leftfill + rightfill );
158 158
159 for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) { 159 for ( int y = clip. top ( ); y <= clip. bottom ( ); y++ ) {
160 if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) { 160 if (( y < framerect. top ( )) || ( y > framerect. bottom ( ))) {
161 memset ( dst, 0, clipwidth ); 161 memset ( dst, 0, clipwidth );
162 } 162 }
163 else { 163 else {
164 if ( leftfill ) 164 if ( leftfill )
165 memset ( dst, 0, leftfill ); 165 memset ( dst, 0, leftfill );
166 166
167 if ( framefill ) { 167 if ( framefill ) {
168 switch ( rot ) { 168 switch ( rot ) {
169 case 0: memcpy ( dst + leftfill, src, framefill ); break; 169 case 0: memcpy ( dst + leftfill, src, framefill ); break;
170 case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; 170 case 1: memcpy_step ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
171 case 2: memcpy_rev ( dst + leftfill, src, framefill ); break; 171 case 2: memcpy_rev ( dst + leftfill, src, framefill ); break;
172 case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break; 172 case 3: memcpy_step_rev ( dst + leftfill, src, framefill, m_bytes_per_line_frame ); break;
173 default: break; 173 default: break;
174 }
174 } 175 }
175 }
176 if ( rightfill ) 176 if ( rightfill )
177 memset ( dst + leftfill + framefill, 0, rightfill ); 177 memset ( dst + leftfill + framefill, 0, rightfill );
178 } 178 }
179 179
180 dst += m_bytes_per_line_fb; 180 dst += m_bytes_per_line_fb;
181 181
182 switch ( rot ) { 182 switch ( rot ) {
183 case 0: src += m_bytes_per_line_frame; break; 183 case 0: src += m_bytes_per_line_frame; break;
184 case 1: src -= m_bytes_per_pixel; break; 184 case 1: src -= m_bytes_per_pixel; break;
185 case 2: src -= m_bytes_per_line_frame; break; 185 case 2: src -= m_bytes_per_line_frame; break;
186 case 3: src += m_bytes_per_pixel; break; 186 case 3: src += m_bytes_per_pixel; break;
187 default: break; 187 default: break;
188 }
188 } 189 }
189 }
190 } 190 }
191 } 191 }
192 //qWarning ( " ||| painting |||" ); 192 //qWarning ( " ||| painting |||" );
193 { 193 {
194 // QVFB hack by MArtin Jones 194 // QVFB hack by MArtin Jones
195 QPainter p ( this ); 195 QPainter p ( this );
196 196
197 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) { 197 for ( int i = qt_bug_workaround_clip_rects. size ( ) - 1; i >= 0; i-- ) {
198 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) ); 198 p. fillRect ( QRect ( mapFromGlobal ( qt_bug_workaround_clip_rects [i]. topLeft ( )), qt_bug_workaround_clip_rects [i]. size ( )), QBrush ( NoBrush ) );
199 } 199 }
200 } 200 }
201 } 201 }
202 //qWarning( "painting >>>" ); 202 //qWarning( "painting >>>" );
203} 203}
204 204
205 205
206void XineVideoWidget::setImage ( QImage* image ) 206void XineVideoWidget::setImage ( QImage* image )
207{ 207{
208 delete m_image; 208 delete m_image;
209 m_image = image; 209 m_image = image;
210} 210}
211 211
212void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl ) 212void XineVideoWidget::setImage ( uchar* img, int w, int h, int bpl )
213{ 213{
214 bool rot90 = (( -m_rotation ) & 1 ); 214 bool rot90 = (( -m_rotation ) & 1 );
215 215
216 if ( rot90 ) { 216 if ( rot90 ) {
217 int d = w; 217 int d = w;
218 w = h; 218 w = h;
219 h = d; 219 h = d;
220 } 220 }
221 221
222 m_lastframe = m_thisframe; 222 m_lastframe = m_thisframe;
223 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); 223 m_thisframe. setRect (( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
224 224
225// qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h ); 225// qDebug ( "Frame: %d,%d - %dx%d", ( width ( ) - w ) / 2, ( height ( ) - h ) / 2, w , h );
226 226
227 m_buff = img; 227 m_buff = img;
228 m_bytes_per_line_frame = bpl; 228 m_bytes_per_line_frame = bpl;
229 229
230 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false ); 230 repaint ((( m_thisframe & m_lastframe ) != m_lastframe ) ? m_lastframe : m_thisframe, false );
231} 231}
232 232
233void XineVideoWidget::resizeEvent ( QResizeEvent * ) 233void XineVideoWidget::resizeEvent ( QResizeEvent * )
234{ 234{
235 QSize s = size ( ); 235 QSize s = size ( );
236 bool fs = ( s == qApp-> desktop ( )-> size ( )); 236 bool fs = ( s == qApp-> desktop ( )-> size ( ));
237 237
238 m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0; 238 m_rotation = fs ? -qt_screen-> transformOrientation ( ) : 0;
239 239
240 if ( fs && qt_screen-> isTransformed ( )) { 240 if ( fs && qt_screen-> isTransformed ( )) {
241 s = qt_screen-> mapToDevice ( s ); 241 s = qt_screen-> mapToDevice ( s );
242 } 242 }
243 243
244// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation ); 244// qDebug ( "\n\nResize: %dx%d, Rot: %d", s.width(),s.height(),m_rotation );
245 245
246 emit videoResized ( s ); 246 emit videoResized ( s );
247} 247}
248 248
249 249
250void XineVideoWidget::mousePressEvent ( QMouseEvent * /*me*/ ) 250void XineVideoWidget::mousePressEvent ( QMouseEvent * /*me*/ )
251{ 251{
252 QWidget *p = parentWidget ( ); 252 QWidget *p = parentWidget ( );
253 253
254 if ( p ) { 254 if ( p ) {
255 // QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( )); 255 // QMouseEvent pme ( QEvent::MouseButtonPress, mapToParent ( me-> pos ( )), me-> globalPos ( ), me-> button ( ), me-> state ( ));
256 256
257 // QApplication::sendEvent ( p, &pme ); 257 // QApplication::sendEvent ( p, &pme );
258 // emit clicked(); 258 // emit clicked();
259 } 259 }
260} 260}
261 261
262void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ ) 262void XineVideoWidget::mouseReleaseEvent ( QMouseEvent * /*me*/ )
263{ 263{
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb.c b/noncore/multimedia/opieplayer2/yuv2rgb.c
index 22bb4cb..e8e86e6 100644
--- a/noncore/multimedia/opieplayer2/yuv2rgb.c
+++ b/noncore/multimedia/opieplayer2/yuv2rgb.c
@@ -3002,138 +3002,137 @@ static void yuy22rgb_c_init (yuv2rgb_factory_t *this)
3002 switch (this->mode) { 3002 switch (this->mode) {
3003 case MODE_32_RGB: 3003 case MODE_32_RGB:
3004 case MODE_32_BGR: 3004 case MODE_32_BGR:
3005 this->yuy22rgb_fun = yuy22rgb_c_32; 3005 this->yuy22rgb_fun = yuy22rgb_c_32;
3006 break; 3006 break;
3007 3007
3008 case MODE_24_RGB: 3008 case MODE_24_RGB:
3009 case MODE_24_BGR: 3009 case MODE_24_BGR:
3010 this->yuy22rgb_fun = 3010 this->yuy22rgb_fun =
3011 (this->mode==MODE_24_RGB && !this->swapped) || (this->mode==MODE_24_BGR && this->swapped) 3011 (this->mode==MODE_24_RGB && !this->swapped) || (this->mode==MODE_24_BGR && this->swapped)
3012 ? yuy22rgb_c_24_rgb 3012 ? yuy22rgb_c_24_rgb
3013 : yuy22rgb_c_24_bgr; 3013 : yuy22rgb_c_24_bgr;
3014 break; 3014 break;
3015 case MODE_15_BGR: 3015 case MODE_15_BGR:
3016 case MODE_16_BGR: 3016 case MODE_16_BGR:
3017 case MODE_15_RGB: 3017 case MODE_15_RGB:
3018 case MODE_16_RGB: 3018 case MODE_16_RGB:
3019 this->yuy22rgb_fun = yuy22rgb_c_16; 3019 this->yuy22rgb_fun = yuy22rgb_c_16;
3020 break; 3020 break;
3021 3021
3022 case MODE_8_RGB: 3022 case MODE_8_RGB:
3023 case MODE_8_BGR: 3023 case MODE_8_BGR:
3024 this->yuy22rgb_fun = yuy22rgb_c_8; 3024 this->yuy22rgb_fun = yuy22rgb_c_8;
3025 break; 3025 break;
3026 3026
3027 case MODE_8_GRAY: 3027 case MODE_8_GRAY:
3028 this->yuy22rgb_fun = yuy22rgb_c_gray; 3028 this->yuy22rgb_fun = yuy22rgb_c_gray;
3029 break; 3029 break;
3030 3030
3031 case MODE_PALETTE: 3031 case MODE_PALETTE:
3032 this->yuy22rgb_fun = yuy22rgb_c_palette; 3032 this->yuy22rgb_fun = yuy22rgb_c_palette;
3033 break; 3033 break;
3034 3034
3035 default: 3035 default:
3036 printf ("yuv2rgb: mode %d not supported for yuy2\n", this->mode); 3036 printf ("yuv2rgb: mode %d not supported for yuy2\n", this->mode);
3037 } 3037 }
3038} 3038}
3039 3039
3040yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) { 3040yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) {
3041 3041
3042 yuv2rgb_t *this = xine_xmalloc (sizeof (yuv2rgb_t)); 3042 yuv2rgb_t *this = xine_xmalloc (sizeof (yuv2rgb_t));
3043 3043
3044 this->cmap = factory->cmap; 3044 this->cmap = factory->cmap;
3045 3045
3046 this->y_chunk = this->y_buffer = NULL; 3046 this->y_chunk = this->y_buffer = NULL;
3047 this->u_chunk = this->u_buffer = NULL; 3047 this->u_chunk = this->u_buffer = NULL;
3048 this->v_chunk = this->v_buffer = NULL; 3048 this->v_chunk = this->v_buffer = NULL;
3049 3049
3050 this->table_rV = factory->table_rV; 3050 this->table_rV = factory->table_rV;
3051 this->table_gU = factory->table_gU; 3051 this->table_gU = factory->table_gU;
3052 this->table_gV = factory->table_gV; 3052 this->table_gV = factory->table_gV;
3053 this->table_bU = factory->table_bU; 3053 this->table_bU = factory->table_bU;
3054 3054
3055 this->yuv2rgb_fun = factory->yuv2rgb_fun; 3055 this->yuv2rgb_fun = factory->yuv2rgb_fun;
3056 this->yuy22rgb_fun = factory->yuy22rgb_fun; 3056 this->yuy22rgb_fun = factory->yuy22rgb_fun;
3057 this->yuv2rgb_single_pixel_fun = factory->yuv2rgb_single_pixel_fun; 3057 this->yuv2rgb_single_pixel_fun = factory->yuv2rgb_single_pixel_fun;
3058 3058
3059 this->configure = yuv2rgb_configure; 3059 this->configure = yuv2rgb_configure;
3060 return this; 3060 return this;
3061} 3061}
3062 3062
3063/* 3063/*
3064 * factory functions 3064 * factory functions
3065 */ 3065 */
3066
3067void yuv2rgb_set_gamma (yuv2rgb_factory_t *this, int gamma) { 3066void yuv2rgb_set_gamma (yuv2rgb_factory_t *this, int gamma) {
3068 3067
3069 int i; 3068 int i;
3070 3069
3071 for (i = 0; i < 256; i++) { 3070 for (i = 0; i < 256; i++) {
3072 (uint8_t *)this->table_rV[i] += this->entry_size*(gamma - this->gamma); 3071 (uint8_t *)this->table_rV[i] += this->entry_size*(gamma - this->gamma);
3073 (uint8_t *)this->table_gU[i] += this->entry_size*(gamma - this->gamma); 3072 (uint8_t *)this->table_gU[i] += this->entry_size*(gamma - this->gamma);
3074 (uint8_t *)this->table_bU[i] += this->entry_size*(gamma - this->gamma); 3073 (uint8_t *)this->table_bU[i] += this->entry_size*(gamma - this->gamma);
3075 } 3074 }
3076#ifdef ARCH_X86 3075#ifdef ARCH_X86
3077 mmx_yuv2rgb_set_gamma(gamma); 3076 mmx_yuv2rgb_set_gamma(gamma);
3078#endif 3077#endif
3079 this->gamma = gamma; 3078 this->gamma = gamma;
3080} 3079}
3081 3080
3082int yuv2rgb_get_gamma (yuv2rgb_factory_t *this) { 3081int yuv2rgb_get_gamma (yuv2rgb_factory_t *this) {
3083 3082
3084 return this->gamma; 3083 return this->gamma;
3085} 3084}
3086 3085
3087yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, 3086yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped,
3088 uint8_t *cmap) { 3087 uint8_t *cmap) {
3089 3088
3090 yuv2rgb_factory_t *this; 3089 yuv2rgb_factory_t *this;
3091 3090
3092#ifdef ARCH_X86 3091#ifdef ARCH_X86
3093 uint32_t mm = xine_mm_accel(); 3092 uint32_t mm = xine_mm_accel();
3094#endif 3093#endif
3095 3094
3096 this = malloc (sizeof (yuv2rgb_factory_t)); 3095 this = malloc (sizeof (yuv2rgb_factory_t));
3097 3096
3098 this->mode = mode; 3097 this->mode = mode;
3099 this->swapped = swapped; 3098 this->swapped = swapped;
3100 this->cmap = cmap; 3099 this->cmap = cmap;
3101 this->create_converter = yuv2rgb_create_converter; 3100 this->create_converter = yuv2rgb_create_converter;
3102 this->set_gamma = yuv2rgb_set_gamma; 3101 this->set_gamma = yuv2rgb_set_gamma;
3103 this->get_gamma = yuv2rgb_get_gamma; 3102 this->get_gamma = yuv2rgb_get_gamma;
3104 this->matrix_coefficients = 6; 3103 this->matrix_coefficients = 6;
3105 3104
3106 3105
3107 yuv2rgb_setup_tables (this, mode, swapped); 3106 yuv2rgb_setup_tables (this, mode, swapped);
3108 3107
3109 /* 3108 /*
3110 * auto-probe for the best yuv2rgb function 3109 * auto-probe for the best yuv2rgb function
3111 */ 3110 */
3112 3111
3113 this->yuv2rgb_fun = NULL; 3112 this->yuv2rgb_fun = NULL;
3114#ifdef ARCH_X86 3113#ifdef ARCH_X86
3115 if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMXEXT)) { 3114 if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMXEXT)) {
3116 3115
3117 yuv2rgb_init_mmxext (this); 3116 yuv2rgb_init_mmxext (this);
3118 3117
3119 if (this->yuv2rgb_fun != NULL) 3118 if (this->yuv2rgb_fun != NULL)
3120 printf ("yuv2rgb: using MMXEXT for colorspace transform\n"); 3119 printf ("yuv2rgb: using MMXEXT for colorspace transform\n");
3121 } 3120 }
3122 3121
3123 if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMX)) { 3122 if ((this->yuv2rgb_fun == NULL) && (mm & MM_ACCEL_X86_MMX)) {
3124 3123
3125 yuv2rgb_init_mmx (this); 3124 yuv2rgb_init_mmx (this);
3126 3125
3127 if (this->yuv2rgb_fun != NULL) 3126 if (this->yuv2rgb_fun != NULL)
3128 printf ("yuv2rgb: using MMX for colorspace transform\n"); 3127 printf ("yuv2rgb: using MMX for colorspace transform\n");
3129 } 3128 }
3130#endif 3129#endif
3131#if HAVE_MLIB 3130#if HAVE_MLIB
3132 if (this->yuv2rgb_fun == NULL) { 3131 if (this->yuv2rgb_fun == NULL) {
3133 3132
3134 yuv2rgb_init_mlib (this); 3133 yuv2rgb_init_mlib (this);
3135 3134
3136 if (this->yuv2rgb_fun != NULL) 3135 if (this->yuv2rgb_fun != NULL)
3137 printf ("yuv2rgb: using medialib for colorspace transform\n"); 3136 printf ("yuv2rgb: using medialib for colorspace transform\n");
3138 } 3137 }
3139#endif 3138#endif