summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
authorkergoth <kergoth>2003-08-09 16:24:58 (UTC)
committer kergoth <kergoth>2003-08-09 16:24:58 (UTC)
commite16d333ec2e8509fc665921ca106c25325bae9e0 (patch) (unidiff)
tree9e9068190a15bc9b2a52ab33b40881128f732c0e /noncore/multimedia/opieplayer2
parent1c58d1407f9584fedcdae390a04e2b37e5853361 (diff)
downloadopie-e16d333ec2e8509fc665921ca106c25325bae9e0.zip
opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.gz
opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.bz2
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h7
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp59
-rw-r--r--noncore/multimedia/opieplayer2/lib.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediadetect.cpp43
-rw-r--r--noncore/multimedia/opieplayer2/mediadetect.h31
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp11
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h3
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/om3u.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control10
-rwxr-xr-xnoncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.postinst5
-rw-r--r--noncore/multimedia/opieplayer2/opie-mediaplayer2.control4
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h7
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp28
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h10
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h1
-rw-r--r--noncore/multimedia/opieplayer2/yuv2rgb_arm2.c875
23 files changed, 976 insertions, 214 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 5d929cb..2c54ae6 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,95 +1,81 @@
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..}^=.=       =       ; 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 <qpe/qpeapplication.h>
35#include <qpe/resource.h>
36#include <qpe/config.h>
37#include <opie/oticker.h>
38
39#include <qwidget.h>
40#include <qpixmap.h>
41#include <qbutton.h>
42#include <qpainter.h>
43#include <qframe.h>
44#include <qlayout.h>
45#include <qdir.h>
46#include <stdlib.h>
47#include <stdio.h>
48 34
49#include "audiowidget.h" 35#include "audiowidget.h"
50#include "mediaplayerstate.h" 36#include "mediaplayerstate.h"
51#include "playlistwidget.h" 37#include "playlistwidget.h"
52 38
53namespace 39namespace
54{ 40{
55 41
56const int xo = -2; // movable x offset 42const int xo = -2; // movable x offset
57const int yo = 22; // movable y offset 43const int yo = 22; // movable y offset
58 44
59const MediaWidget::SkinButtonInfo skinInfo[] = 45const MediaWidget::SkinButtonInfo skinInfo[] =
60{ 46{
61 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 47 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
62 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 48 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
63 { MediaWidget::Next, "next", MediaWidget::NormalButton }, 49 { MediaWidget::Next, "next", MediaWidget::NormalButton },
64 { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, 50 { MediaWidget::Previous, "prev", MediaWidget::NormalButton },
65 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 51 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 52 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, 53 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, 54 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, 55 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
70 { MediaWidget::Back, "back", MediaWidget::NormalButton } 56 { MediaWidget::Back, "back", MediaWidget::NormalButton }
71}; 57};
72 58
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 59const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 60
75void changeTextColor( QWidget * w) { 61void changeTextColor( QWidget * w) {
76 QPalette p = w->palette(); 62 QPalette p = w->palette();
77 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 63 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
78 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 64 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
79 w->setPalette( p ); 65 w->setPalette( p );
80} 66}
81 67
82} 68}
83 69
84AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 70AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
85 71
86 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 72 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
87 audioSliderBeingMoved( false ) 73 audioSliderBeingMoved( false )
88{ 74{
89 setCaption( tr("OpiePlayer") ); 75 setCaption( tr("OpiePlayer") );
90 76
91 loadSkin(); 77 loadSkin();
92 78
93 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 79 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
94 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 80 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
95 81
@@ -145,97 +131,97 @@ void AudioWidget::sliderReleased() {
145 mediaPlayerState.setPosition( val ); 131 mediaPlayerState.setPosition( val );
146} 132}
147 133
148void AudioWidget::setPosition( long i ) { 134void AudioWidget::setPosition( long i ) {
149 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 135 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
150 updateSlider( i, mediaPlayerState.length() ); 136 updateSlider( i, mediaPlayerState.length() );
151} 137}
152 138
153 139
154void AudioWidget::setLength( long max ) { 140void AudioWidget::setLength( long max ) {
155 updateSlider( mediaPlayerState.position(), max ); 141 updateSlider( mediaPlayerState.position(), max );
156} 142}
157 143
158 144
159void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 145void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
160 if ( mediaType == MediaPlayerState::Audio ) { 146 if ( mediaType == MediaPlayerState::Audio ) {
161 // startTimer( 150 ); 147 // startTimer( 150 );
162 showMaximized(); 148 showMaximized();
163 return; 149 return;
164 } 150 }
165 151
166 killTimers(); 152 killTimers();
167 hide(); 153 hide();
168} 154}
169 155
170void AudioWidget::loadSkin() 156void AudioWidget::loadSkin()
171{ 157{
172 loadDefaultSkin( guiInfo() ); 158 loadDefaultSkin( guiInfo() );
173 159
174 songInfo.setFocusPolicy( QWidget::NoFocus ); 160 songInfo.setFocusPolicy( QWidget::NoFocus );
175// changeTextColor( &songInfo ); 161// changeTextColor( &songInfo );
176// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 162// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
177// songInfo.setFrameStyle( QFrame::NoFrame); 163// songInfo.setFrameStyle( QFrame::NoFrame);
178 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 164 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
179// songInfo.setForegroundColor(Qt::white); 165// songInfo.setForegroundColor(Qt::white);
180 166
181 slider.setFixedHeight( 20 ); 167 slider.setFixedHeight( 20 );
182 slider.setMinValue( 0 ); 168 slider.setMinValue( 0 );
183 slider.setMaxValue( 1 ); 169 slider.setMaxValue( 1 );
184 slider.setFocusPolicy( QWidget::NoFocus ); 170 slider.setFocusPolicy( QWidget::NoFocus );
185 slider.setBackgroundPixmap( backgroundPixmap ); 171 slider.setBackgroundPixmap( backgroundPixmap );
186 172
187// Config cofg("qpe"); 173// Config cofg("qpe");
188// cofg.setGroup("Appearance"); 174// cofg.setGroup("Appearance");
189// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 175// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
190 176
191 time.setFocusPolicy( QWidget::NoFocus ); 177 time.setFocusPolicy( QWidget::NoFocus );
192 time.setAlignment( Qt::AlignCenter ); 178 time.setAlignment( Qt::AlignCenter );
193 179
194// time.setFrame(FALSE); 180// time.setFrame(FALSE);
195// changeTextColor( &time ); 181// changeTextColor( &time );
196 182
197 resizeEvent( 0 ); 183 resizeEvent( 0 );
198} 184}
199 185
200void AudioWidget::setSeekable( bool isSeekable ) { 186void AudioWidget::setSeekable( bool isSeekable ) {
201 187
202 if ( !isSeekable ) { 188 if ( !isSeekable ) {
203 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); 189 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
204 if( !slider.isHidden()) { 190 if( !slider.isHidden()) {
205 slider.hide(); 191 slider.hide();
206 } 192 }
207 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 193 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
208 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 194 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
209 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 195 disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
210 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 196 disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
211 } else { 197 } else {
212 // this stops the slider from being moved, thus 198 // this stops the slider from being moved, thus
213 // does not stop stream when it reaches the end 199 // does not stop stream when it reaches the end
214 slider.show(); 200 slider.show();
215 qDebug( " CONNECT SET POSTION " ); 201 qDebug( " CONNECT SET POSTION " );
216 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 202 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
217 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 203 connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
218 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 204 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
219 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 205 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
220 } 206 }
221} 207}
222 208
223 209
224static QString timeAsString( long length ) { 210static QString timeAsString( long length ) {
225 int minutes = length / 60; 211 int minutes = length / 60;
226 int seconds = length % 60; 212 int seconds = length % 60;
227 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); 213 return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
228} 214}
229 215
230void AudioWidget::updateSlider( long i, long max ) { 216void AudioWidget::updateSlider( long i, long max ) {
231 217
232 time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); 218 time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
233// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; 219// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
234 220
235 if ( max == 0 ) { 221 if ( max == 0 ) {
236 return; 222 return;
237 } 223 }
238 // Will flicker too much if we don't do this 224 // Will flicker too much if we don't do this
239 // Scale to something reasonable 225 // Scale to something reasonable
240 int width = slider.width(); 226 int width = slider.width();
241 int val = int((double)i * width / max); 227 int val = int((double)i * width / max);
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 53dbb88..b436239 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,92 +1,85 @@
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..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qpainter.h>
38#include <qdrawutil.h>
39#include <qpixmap.h>
40#include <qstring.h>
41#include <qslider.h>
42#include <qframe.h>
43#include <qlineedit.h> 37#include <qlineedit.h>
44#include <qimage.h>
45 38
46#include <opie/oticker.h> 39#include <opie/oticker.h>
47 40
48#include "mediawidget.h" 41#include "mediawidget.h"
49 42
50class QPixmap; 43class QPixmap;
51 44
52class AudioWidget : public MediaWidget { 45class AudioWidget : public MediaWidget {
53 Q_OBJECT 46 Q_OBJECT
54public: 47public:
55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 48 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
56 ~AudioWidget(); 49 ~AudioWidget();
57 void setTickerText( const QString &text ) { songInfo.setText( text ); } 50 void setTickerText( const QString &text ) { songInfo.setText( text ); }
58 51
59 static MediaWidget::GUIInfo guiInfo(); 52 static MediaWidget::GUIInfo guiInfo();
60 53
61public slots: 54public slots:
62 void updateSlider( long, long ); 55 void updateSlider( long, long );
63 void sliderPressed( ); 56 void sliderPressed( );
64 void sliderReleased( ); 57 void sliderReleased( );
65 void setLooping( bool b) { setToggleButton( Loop, b ); } 58 void setLooping( bool b) { setToggleButton( Loop, b ); }
66 void setPosition( long ); 59 void setPosition( long );
67 void setSeekable( bool ); 60 void setSeekable( bool );
68 61
69public: 62public:
70 virtual void setLength( long ); 63 virtual void setLength( long );
71 virtual void setPlaying( bool b) { setToggleButton( Play, b ); } 64 virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
72 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 65 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
73 66
74 virtual void loadSkin(); 67 virtual void loadSkin();
75 68
76signals: 69signals:
77 void sliderMoved(long); 70 void sliderMoved(long);
78 71
79protected: 72protected:
80 void doBlank(); 73 void doBlank();
81 void doUnblank(); 74 void doUnblank();
82 void resizeEvent( QResizeEvent *re ); 75 void resizeEvent( QResizeEvent *re );
83 void timerEvent( QTimerEvent *event ); 76 void timerEvent( QTimerEvent *event );
84 void keyReleaseEvent( QKeyEvent *e); 77 void keyReleaseEvent( QKeyEvent *e);
85private slots: 78private slots:
86 void skipFor(); 79 void skipFor();
87 void skipBack(); 80 void skipBack();
88 void stopSkip(); 81 void stopSkip();
89private: 82private:
90 int skipDirection; 83 int skipDirection;
91 QString skin; 84 QString skin;
92 85
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index d04af08..11ad745 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,302 +1,337 @@
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
35#include <stdlib.h>
36#include <qimage.h>
37#include <qtextstream.h> 35#include <qtextstream.h>
38#include <qpe/resource.h>
39 36
40#include <qfile.h>
41#include <qdir.h> 37#include <qdir.h>
42 38
43#include <qgfx_qws.h> 39#include <qgfx_qws.h>
44#include <qdirectpainter_qws.h> 40#include <qdirectpainter_qws.h>
45 41
46#include <assert.h> 42#include <assert.h>
47 43
48#include "xinevideowidget.h" 44#include "xinevideowidget.h"
49#include "frame.h" 45#include "frame.h"
50#include "lib.h" 46#include "lib.h"
51 47
52 48
53typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
54 int width, int height,int bytes ); 50 int width, int height,int bytes );
55 51
56extern "C" { 52extern "C" {
57 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); 53 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * );
58 int null_is_showing_video( const xine_vo_driver_t* self ); 54 int null_is_showing_video( const xine_vo_driver_t* self );
59 void null_set_show_video( const xine_vo_driver_t* self, int show ); 55 void null_set_show_video( const xine_vo_driver_t* self, int show );
60 int null_is_fullscreen( const xine_vo_driver_t* self ); 56 int null_is_fullscreen( const xine_vo_driver_t* self );
61 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 57 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
62 int null_is_scaling( const xine_vo_driver_t* self ); 58 int null_is_scaling( const xine_vo_driver_t* self );
63 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 59 void null_set_scaling( const xine_vo_driver_t* self, int scale );
64 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 60 void null_set_gui_width( const xine_vo_driver_t* self, int width );
65 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 61 void null_set_gui_height( const xine_vo_driver_t* self, int height );
66 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 62 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
67 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 63 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
68 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 64 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
69 65
70 void null_preload_decoders( xine_stream_t *stream ); 66 void null_preload_decoders( xine_stream_t *stream );
71} 67}
72 68
73using namespace XINE; 69using namespace XINE;
74 70
75Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 71Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
76{ 72{
77 m_initialized = false; 73 m_initialized = false;
78 m_duringInitialization = false; 74 m_duringInitialization = false;
79 m_video = false; 75 m_video = false;
80 m_wid = widget; 76 m_wid = widget;
81 printf("Lib"); 77 printf("Lib");
82 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 78 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
83 // get the configuration 79 // get the configuration
84 80
85 // not really OO, should be an extra class, later 81 // not really OO, should be an extra class, later
86 if ( !QFile::exists(configPath) ) { 82 if ( !QFile::exists(configPath) ) {
87 QFile f(configPath); 83 QFile f(configPath);
88 f.open(IO_WriteOnly); 84 f.open(IO_WriteOnly);
89 QTextStream ts( &f ); 85 QTextStream ts( &f );
90 ts << "misc.memcpy_method:glibc\n"; 86 ts << "misc.memcpy_method:glibc\n";
87 ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n";
88 ts << "codec.ffmpeg_pp_quality:3\n";
89 ts << "audio.num_buffers:50\n";
90 ts << "audio.size_buffers:4160\n";
91 ts << "video.num_buffers:20\n";
92 ts << "video.size_buffers:4096\n";
93 ts << "audio.out_num_audio_buf:16\n";
94 ts << "audio.out_size_audio_buf:8096\n";
95 ts << "audio.out_size_zero_buf:1024\n";
96 ts << "audio.passthrough_offset:0\n";
91 f.close(); 97 f.close();
92 } 98 }
93 99
94 if ( initMode == InitializeImmediately ) { 100 if ( initMode == InitializeImmediately ) {
95 initialize(); 101 initialize();
96 m_initialized = true; 102 m_initialized = true;
97 } 103 }
98 else 104 else
99 start(); 105 start();
100} 106}
101 107
102void Lib::run() 108void Lib::run()
103{ 109{
104 qDebug( "Lib::run() started" ); 110 qDebug( "Lib::run() started" );
105 initialize(); 111 initialize();
106 m_initialized = true; 112 m_initialized = true;
107 qDebug( "Lib::run() finished" ); 113 qDebug( "Lib::run() finished" );
108} 114}
109 115
110void Lib::initialize() 116void Lib::initialize()
111{ 117{
112 m_duringInitialization = true; 118 m_duringInitialization = true;
113 m_xine = xine_new( ); 119 m_xine = xine_new( );
114 120
115 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 121 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
116 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 122 xine_config_load( m_xine, QFile::encodeName( configPath ) );
117 123
118 xine_init( m_xine ); 124 xine_init( m_xine );
119 125
120 // allocate oss for sound 126 // allocate oss for sound
121 // and fb for framebuffer 127 // and fb for framebuffer
122 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 128 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
123 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 129 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
124 130
125 131
126//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 132//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
127 133
128 134
129// null_display_handler( m_videoOutput, xine_display_frame, this ); 135// null_display_handler( m_videoOutput, xine_display_frame, this );
130 136
131 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 137 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
132 138
133 if (m_wid != 0 ) { 139 if (m_wid != 0 ) {
134 printf( "!0\n" ); 140 printf( "!0\n" );
135 setWidget( m_wid ); 141 setWidget( m_wid );
136 } 142 }
137 143
138 m_queue = xine_event_new_queue (m_stream); 144 m_queue = xine_event_new_queue (m_stream);
139 145
140 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 146 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
141 147
142 ::null_preload_decoders( m_stream ); 148 ::null_preload_decoders( m_stream );
143 149
144 m_duringInitialization = false; 150 m_duringInitialization = false;
145} 151}
146 152
147Lib::~Lib() { 153Lib::~Lib() {
148 assert( isRunning() == false ); 154 assert( isRunning() == false );
149 assert( m_initialized ); 155 assert( m_initialized );
150 156
151// free( m_config ); 157// free( m_config );
152 158
153 xine_close( m_stream ); 159 xine_close( m_stream );
154 160
155 xine_event_dispose_queue( m_queue ); 161 xine_event_dispose_queue( m_queue );
156 162
157 xine_dispose( m_stream ); 163 xine_dispose( m_stream );
158 164
159 xine_exit( m_xine ); 165 xine_exit( m_xine );
160 /* FIXME either free or delete but valgrind bitches against both */ 166 /* FIXME either free or delete but valgrind bitches against both */
161 //free( m_videoOutput ); 167 //free( m_videoOutput );
162 //delete m_audioOutput; 168 //delete m_audioOutput;
163} 169}
164 170
165void Lib::resize ( const QSize &s ) { 171void Lib::resize ( const QSize &s ) {
166 assert( m_initialized || m_duringInitialization ); 172 assert( m_initialized || m_duringInitialization );
167 173
168 if ( s. width ( ) && s. height ( ) ) { 174 if ( s. width ( ) && s. height ( ) ) {
169 ::null_set_gui_width( m_videoOutput, s. width() ); 175 ::null_set_gui_width( m_videoOutput, s. width() );
170 ::null_set_gui_height( m_videoOutput, s. height() ); 176 ::null_set_gui_height( m_videoOutput, s. height() );
171 } 177 }
172} 178}
173 179
174int Lib::majorVersion() { 180int Lib::majorVersion() {
175 int major, minor, sub; 181 int major, minor, sub;
176 xine_get_version ( &major, &minor, &sub ); 182 xine_get_version ( &major, &minor, &sub );
177 return major; 183 return major;
178} 184}
179 185
180int Lib::minorVersion() { 186int Lib::minorVersion() {
181 int major, minor, sub; 187 int major, minor, sub;
182 xine_get_version ( &major, &minor, &sub ); 188 xine_get_version ( &major, &minor, &sub );
183 return minor; 189 return minor;
184} 190}
185 191
186int Lib::subVersion() { 192int Lib::subVersion() {
187 int major, minor, sub; 193 int major, minor, sub;
188 xine_get_version ( &major, &minor, &sub ); 194 xine_get_version ( &major, &minor, &sub );
189 return sub; 195 return sub;
190} 196}
191 197
192int Lib::play( const QString& fileName, int startPos, int start_time ) { 198int Lib::play( const QString& fileName, int startPos, int start_time ) {
193 assert( m_initialized ); 199 assert( m_initialized );
200 // FIXME actually a hack imho. Should not be needed to dispose the whole stream
201 // but without we get wrong media length reads from libxine for the second media
202 //xine_dispose ( m_stream );
194 203
195 QString str = fileName.stripWhiteSpace(); 204 QString str = fileName.stripWhiteSpace();
205
206 //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
207 //m_queue = xine_event_new_queue (m_stream);
208 //xine_event_create_listener_thread (m_queue, xine_event_handler, this);
209
196 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 210 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
197 return 0; 211 return 0;
198 } 212 }
199 return xine_play( m_stream, startPos, start_time); 213 return xine_play( m_stream, startPos, start_time);
200} 214}
201 215
202void Lib::stop() { 216void Lib::stop() {
203 assert( m_initialized ); 217 assert( m_initialized );
204 218
205 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 219 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
206 xine_stop( m_stream ); 220 xine_stop( m_stream );
207} 221}
208 222
209void Lib::pause( bool toggle ) { 223void Lib::pause( bool toggle ) {
210 assert( m_initialized ); 224 assert( m_initialized );
211 225
212 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 226 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
213} 227}
214 228
215int Lib::speed() const { 229int Lib::speed() const {
216 assert( m_initialized ); 230 assert( m_initialized );
217 231
218 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 232 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
219} 233}
220 234
221void Lib::setSpeed( int speed ) { 235void Lib::setSpeed( int speed ) {
222 assert( m_initialized ); 236 assert( m_initialized );
223 237
224 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 238 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
225} 239}
226 240
227int Lib::status() const { 241int Lib::status() const {
228 assert( m_initialized ); 242 assert( m_initialized );
229 243
230 return xine_get_status( m_stream ); 244 return xine_get_status( m_stream );
231} 245}
232 246
233int Lib::currentPosition() const { 247int Lib::currentPosition() const {
234 assert( m_initialized ); 248 assert( m_initialized );
235 249
236 int pos, time, length; 250 int pos, time, length;
237 xine_get_pos_length( m_stream, &pos, &time, &length ); 251 xine_get_pos_length( m_stream, &pos, &time, &length );
238 return pos; 252 return pos;
239} 253}
240 254
241int Lib::currentTime() const { 255int Lib::currentTime() const {
242 assert( m_initialized ); 256 assert( m_initialized );
243 257
244 int pos, time, length; 258 int pos, time, length;
245 xine_get_pos_length( m_stream, &pos, &time, &length ); 259 xine_get_pos_length( m_stream, &pos, &time, &length );
246 return time/1000; 260 if ( time > 0 ) {
261 return time/1000;
262 } else {
263 return 0;
264 }
247} 265}
248 266
249int Lib::length() const { 267int Lib::length() const {
250 assert( m_initialized ); 268 assert( m_initialized );
251 269
252 int pos, time, length; 270 int pos, time, length;
253 xine_get_pos_length( m_stream, &pos, &time, &length ); 271/* dilb: patch to solve the wrong stream length reported to the GUI*/
254 return length/1000; 272 int iRetVal=0, iTestLoop=0;
273
274 do
275 {
276 iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length );
277 if (iRetVal)
278 {/* if the function didn't return 0, then pos, time and length are valid.*/
279 return length/1000;
280 }
281 /*don't poll too much*/
282 usleep(100000);
283 iTestLoop++;
284 }
285 while ( iTestLoop < 10 ); /* if after 1s, we still don't have any
286valid stream, then return -1 (this value could be used to make the stream
287unseekable, but it should never occur!! Mr. Murphy ? :) ) */
288
289 return -1;
255} 290}
256 291
257bool Lib::isSeekable() const { 292bool Lib::isSeekable() const {
258 assert( m_initialized ); 293 assert( m_initialized );
259 294
260 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 295 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
261} 296}
262 297
263void Lib::seekTo( int time ) { 298void Lib::seekTo( int time ) {
264 assert( m_initialized ); 299 assert( m_initialized );
265 300
266 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 301 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
267 // since its now milliseconds we need *1000 302 // since its now milliseconds we need *1000
268 xine_play( m_stream, 0, time*1000 ); 303 xine_play( m_stream, 0, time*1000 );
269} 304}
270 305
271 306
272Frame Lib::currentFrame() const { 307Frame Lib::currentFrame() const {
273 assert( m_initialized ); 308 assert( m_initialized );
274 309
275 Frame frame; 310 Frame frame;
276 return frame; 311 return frame;
277}; 312};
278 313
279QString Lib::metaInfo( int number) const { 314QString Lib::metaInfo( int number) const {
280 assert( m_initialized ); 315 assert( m_initialized );
281 316
282 return xine_get_meta_info( m_stream, number ); 317 return xine_get_meta_info( m_stream, number );
283} 318}
284 319
285int Lib::error() const { 320int Lib::error() const {
286 assert( m_initialized ); 321 assert( m_initialized );
287 322
288 return xine_get_error( m_stream ); 323 return xine_get_error( m_stream );
289}; 324};
290 325
291void Lib::ensureInitialized() 326void Lib::ensureInitialized()
292{ 327{
293 if ( m_initialized ) 328 if ( m_initialized )
294 return; 329 return;
295 330
296 qDebug( "waiting for initialization thread to finish" ); 331 qDebug( "waiting for initialization thread to finish" );
297 wait(); 332 wait();
298 qDebug( "initialization thread finished!" ); 333 qDebug( "initialization thread finished!" );
299} 334}
300 335
301void Lib::setWidget( XineVideoWidget *widget ) 336void Lib::setWidget( XineVideoWidget *widget )
302{ 337{
@@ -321,80 +356,78 @@ void Lib::handleXineEvent( int type ) {
321 assert( m_initialized ); 356 assert( m_initialized );
322 357
323 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 358 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
324 emit stopped(); 359 emit stopped();
325 } 360 }
326} 361}
327 362
328 363
329void Lib::setShowVideo( bool video ) { 364void Lib::setShowVideo( bool video ) {
330 assert( m_initialized ); 365 assert( m_initialized );
331 366
332 m_video = video; 367 m_video = video;
333 ::null_set_show_video( m_videoOutput, video ); 368 ::null_set_show_video( m_videoOutput, video );
334} 369}
335 370
336bool Lib::isShowingVideo() const { 371bool Lib::isShowingVideo() const {
337 assert( m_initialized ); 372 assert( m_initialized );
338 373
339 return ::null_is_showing_video( m_videoOutput ); 374 return ::null_is_showing_video( m_videoOutput );
340} 375}
341 376
342bool Lib::hasVideo() const { 377bool Lib::hasVideo() const {
343 assert( m_initialized ); 378 assert( m_initialized );
344 379
345 return xine_get_stream_info( m_stream, 18 ); 380 return xine_get_stream_info( m_stream, 18 );
346} 381}
347 382
348void Lib::showVideoFullScreen( bool fullScreen ) { 383void Lib::showVideoFullScreen( bool fullScreen ) {
349 assert( m_initialized ); 384 assert( m_initialized );
350 385
351 ::null_set_fullscreen( m_videoOutput, fullScreen ); 386 ::null_set_fullscreen( m_videoOutput, fullScreen );
352} 387}
353 388
354bool Lib::isVideoFullScreen() const { 389bool Lib::isVideoFullScreen() const {
355 assert( m_initialized ); 390 assert( m_initialized );
356 391
357 return ::null_is_fullscreen( m_videoOutput ); 392 return ::null_is_fullscreen( m_videoOutput );
358} 393}
359 394
360void Lib::setScaling( bool scale ) { 395void Lib::setScaling( bool scale ) {
361 assert( m_initialized ); 396 assert( m_initialized );
362 397
363 ::null_set_scaling( m_videoOutput, scale ); 398 ::null_set_scaling( m_videoOutput, scale );
364} 399}
365 400
366void Lib::setGamma( int value ) { 401void Lib::setGamma( int value ) {
367 assert( m_initialized ); 402 assert( m_initialized );
368 403
369 //qDebug( QString( "%1").arg(value) ); 404 ::null_set_videoGamma( m_videoOutput, value );
370 /* int gammaValue = ( 100 + value ); */
371 ::null_set_videoGamma( m_videoOutput, value );
372} 405}
373 406
374bool Lib::isScaling() const { 407bool Lib::isScaling() const {
375 assert( m_initialized ); 408 assert( m_initialized );
376 409
377 return ::null_is_scaling( m_videoOutput ); 410 return ::null_is_scaling( m_videoOutput );
378} 411}
379 412
380void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { 413void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
381 ( (Lib*)user_data)->handleXineEvent( t ); 414 ( (Lib*)user_data)->handleXineEvent( t );
382} 415}
383 416
384void Lib::xine_display_frame( void* user_data, uint8_t *frame, 417void Lib::xine_display_frame( void* user_data, uint8_t *frame,
385 int width, int height, int bytes ) { 418 int width, int height, int bytes ) {
386 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 419 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
387} 420}
388 421
389void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 422void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
390 assert( m_initialized ); 423 assert( m_initialized );
391 424
392 if ( !m_video ) { 425 if ( !m_video ) {
393 qWarning("not showing video now"); 426 qWarning("not showing video now");
394 return; 427 return;
395 } 428 }
396 429
397 assert( m_wid ); 430 assert( m_wid );
398 431
399 m_wid-> setVideoFrame ( frame, width, height, bytes ); 432 m_wid-> setVideoFrame ( frame, width, height, bytes );
400} 433}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 181735c..0ff14d0 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -1,90 +1,85 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef ZECKEXINELIB_H 34#ifndef ZECKEXINELIB_H
35#define ZECKEXINELIB_H 35#define ZECKEXINELIB_H
36 36
37#include <qcstring.h>
38#include <qstring.h>
39#include <qobject.h>
40
41#include <xine.h> 37#include <xine.h>
42//#include "xine.h"
43 38
44#include "threadutil.h" 39#include "threadutil.h"
45 40
46class XineVideoWidget; 41class XineVideoWidget;
47 42
48namespace XINE { 43namespace XINE {
49 44
50 /** 45 /**
51 * Lib wrapps the simple interface 46 * Lib wrapps the simple interface
52 * of libxine for easy every day use 47 * of libxine for easy every day use
53 * This will become a full C++ Wrapper 48 * This will become a full C++ Wrapper
54 * It supports playing, pausing, info, 49 * It supports playing, pausing, info,
55 * stooping, seeking. 50 * stooping, seeking.
56 */ 51 */
57 class Frame; 52 class Frame;
58 class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread 53 class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread
59 { 54 {
60 Q_OBJECT 55 Q_OBJECT
61 public: 56 public:
62 enum InitializationMode { InitializeImmediately, InitializeInThread }; 57 enum InitializationMode { InitializeImmediately, InitializeInThread };
63 58
64 Lib( InitializationMode initMode, XineVideoWidget* = 0); 59 Lib( InitializationMode initMode, XineVideoWidget* = 0);
65 60
66 ~Lib(); 61 ~Lib();
67 static int majorVersion(); 62 static int majorVersion();
68 static int minorVersion(); 63 static int minorVersion();
69 static int subVersion(); 64 static int subVersion();
70 65
71 66
72 void resize ( const QSize &s ); 67 void resize ( const QSize &s );
73 68
74 int play( const QString& fileName, 69 int play( const QString& fileName,
75 int startPos = 0, 70 int startPos = 0,
76 int start_time = 0 ); 71 int start_time = 0 );
77 void stop(); 72 void stop();
78 void pause( bool toggle ); 73 void pause( bool toggle );
79 74
80 int speed() const; 75 int speed() const;
81 76
82 /** 77 /**
83 * Set the speed of the stream, if codec supports it 78 * Set the speed of the stream, if codec supports it
84 * XINE_SPEED_PAUSE 0 79 * XINE_SPEED_PAUSE 0
85 * XINE_SPEED_SLOW_4 1 80 * XINE_SPEED_SLOW_4 1
86 * XINE_SPEED_SLOW_2 2 81 * XINE_SPEED_SLOW_2 2
87 * XINE_SPEED_NORMAL 4 82 * XINE_SPEED_NORMAL 4
88 * XINE_SPEED_FAST_2 8 83 * XINE_SPEED_FAST_2 8
89 *XINE_SPEED_FAST_4 16 84 *XINE_SPEED_FAST_4 16
90 */ 85 */
diff --git a/noncore/multimedia/opieplayer2/mediadetect.cpp b/noncore/multimedia/opieplayer2/mediadetect.cpp
deleted file mode 100644
index 91137db..0000000
--- a/noncore/multimedia/opieplayer2/mediadetect.cpp
+++ b/dev/null
@@ -1,43 +0,0 @@
1#include <qstring.h>
2#include "mediadetect.h"
3
4
5MediaDetect::MediaDetect() {
6}
7
8MediaDetect::~MediaDetect() {
9}
10
11char MediaDetect::videoOrAudio( const QString& fileName ) {
12 if( (fileName.lower()).right(4) == ".avi" ||
13 (fileName.lower()).right(4) == ".mpg" ||
14 (fileName.lower()).right(4) == ".asf" ||
15 (fileName.lower()).right(4) == ".mov" ||
16 (fileName.lower()).right(5) == ".mpeg" ) {
17 qDebug("Video out taken");
18 return 'v';
19 } else if ( (fileName.lower()).right(4) == "·mp1" ||
20 (fileName.lower()).right(4) == ".mp3" ||
21 (fileName.lower()).right(4) == ".ogg" ||
22 (fileName.lower()).right(4) == ".wav" ) {
23 qDebug("AUDIO out taken");
24 return 'a';
25 } else if ( (fileName.lower()).left(7) == "http://" &&
26 (fileName.lower()).right(1) == "/" ) {
27 return 'a';
28 } else {
29 return 'f';
30 }
31}
32
33bool MediaDetect::isStreaming( const QString& fileName ) {
34 // ugly
35 if( (fileName.lower()).left(4) == "http" ) {
36 return true;
37 } else if ( (fileName.lower()).left(3) == "ftp" ) {
38 return true;
39 } else {
40 return false;
41 }
42}
43
diff --git a/noncore/multimedia/opieplayer2/mediadetect.h b/noncore/multimedia/opieplayer2/mediadetect.h
deleted file mode 100644
index bd5ea1d..0000000
--- a/noncore/multimedia/opieplayer2/mediadetect.h
+++ b/dev/null
@@ -1,31 +0,0 @@
1
2#ifndef MEDIADETECT_H
3#define MEDIADETECT_H
4
5
6class QString;
7class MediaDetect {
8
9public:
10 MediaDetect();
11 ~MediaDetect();
12
13 /**
14 * Look at the filename and decide which gui is to be used
15 *
16 * @param filename the filename
17 * @return the char - a for audio gui, v for video, f for error
18 */
19 char videoOrAudio( const QString& fileName );
20
21 /**
22 * Find out if it is a streaming media file
23 *
24 * @param filename the filename
25 * @return if it is a streaming url or not
26 */
27 bool isStreaming( const QString& fileName );
28
29};
30
31#endif
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index d4396d2..9f51006 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,77 +1,68 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h>
3#include <qpe/resource.h>
4#include <qpe/config.h> 2#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 3#include <qpe/qcopenvelope_qws.h>
6#include <qfileinfo.h> 4#include <qfileinfo.h>
7 5
8#include <qmainwindow.h>
9#include <qmessagebox.h>
10#include <qwidgetstack.h>
11#include <qfile.h>
12
13#include "mediaplayer.h" 6#include "mediaplayer.h"
14#include "playlistwidget.h" 7#include "playlistwidget.h"
15#include "audiowidget.h" 8#include "audiowidget.h"
16#include "videowidget.h" 9#include "videowidget.h"
17#include "volumecontrol.h" 10#include "volumecontrol.h"
18#include "lib.h" 11#include "lib.h"
19 12
20#include "mediaplayerstate.h" 13#include "mediaplayerstate.h"
21 14
22// for setBacklight() 15 // for setBacklight()
23#include <linux/fb.h> 16#include <linux/fb.h>
24#include <sys/file.h> 17#include <sys/file.h>
25#include <sys/ioctl.h> 18#include <sys/ioctl.h>
26 19
27 20
28
29
30#define FBIOBLANK 0x4611 21#define FBIOBLANK 0x4611
31 22
32MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 23MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
33 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { 24 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
34 25
35 m_audioUI = 0; 26 m_audioUI = 0;
36 m_videoUI = 0; 27 m_videoUI = 0;
37 m_xineControl = 0; 28 m_xineControl = 0;
38 xine = new XINE::Lib( XINE::Lib::InitializeInThread ); 29 xine = new XINE::Lib( XINE::Lib::InitializeInThread );
39 30
40 fd=-1;fl=-1; 31 fd=-1;fl=-1;
41 playList.setCaption( tr( "OpiePlayer: Initializating" ) ); 32 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
42 33
43 qApp->processEvents(); 34 qApp->processEvents();
44 // QPEApplication::grabKeyboard(); // EVIL 35 // QPEApplication::grabKeyboard(); // EVIL
45 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 36 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
46 37
47 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 38 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
48 39
49// What is pauseCheck good for? (Simon) 40// What is pauseCheck good for? (Simon)
50// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 41// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
51 42
52 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 43 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
53 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 44 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
54 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 45 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
55 46
56 volControl = new VolumeControl; 47 volControl = new VolumeControl;
57 Config cfg( "OpiePlayer" ); 48 Config cfg( "OpiePlayer" );
58 cfg.setGroup("PlayList"); 49 cfg.setGroup("PlayList");
59 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 50 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
60 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 51 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
61 52
62 m_skinLoader = new SkinLoader; 53 m_skinLoader = new SkinLoader;
63 m_skinLoader->schedule( AudioWidget::guiInfo() ); 54 m_skinLoader->schedule( AudioWidget::guiInfo() );
64 m_skinLoader->schedule( VideoWidget::guiInfo() ); 55 m_skinLoader->schedule( VideoWidget::guiInfo() );
65 m_skinLoader->start(); 56 m_skinLoader->start();
66} 57}
67 58
68MediaPlayer::~MediaPlayer() { 59MediaPlayer::~MediaPlayer() {
69 // this shold never happen, but one never knows... 60 // this shold never happen, but one never knows...
70 if ( xine ) { 61 if ( xine ) {
71 xine->ensureInitialized(); 62 xine->ensureInitialized();
72 delete xine; 63 delete xine;
73 } 64 }
74 delete m_xineControl; 65 delete m_xineControl;
75 delete m_audioUI; 66 delete m_audioUI;
76 delete m_videoUI; 67 delete m_videoUI;
77 delete volControl; 68 delete volControl;
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index cbe4d86..34ff064 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,87 +1,84 @@
1 /* 1 /*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef MEDIA_PLAYER_H 34#ifndef MEDIA_PLAYER_H
35#define MEDIA_PLAYER_H 35#define MEDIA_PLAYER_H
36 36
37#include <qmainwindow.h>
38#include <qframe.h>
39
40#include "xinecontrol.h" 37#include "xinecontrol.h"
41 38
42#include "playlistwidget.h" 39#include "playlistwidget.h"
43#include "skin.h" 40#include "skin.h"
44 41
45class DocLnk; 42class DocLnk;
46class VolumeControl; 43class VolumeControl;
47class MediaPlayerState; 44class MediaPlayerState;
48class AudioWidget; 45class AudioWidget;
49class VideoWidget; 46class VideoWidget;
50 47
51namespace XINE 48namespace XINE
52{ 49{
53 class Lib; 50 class Lib;
54}; 51};
55 52
56class MediaPlayer : public QObject { 53class MediaPlayer : public QObject {
57 Q_OBJECT 54 Q_OBJECT
58public: 55public:
59 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); 56 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
60 ~MediaPlayer(); 57 ~MediaPlayer();
61 58
62public slots: 59public slots:
63 void reloadSkins(); 60 void reloadSkins();
64 61
65private slots: 62private slots:
66 void setPlaying( bool ); 63 void setPlaying( bool );
67 void pauseCheck( bool ); 64 void pauseCheck( bool );
68 void play(); 65 void play();
69 void next(); 66 void next();
70 void prev(); 67 void prev();
71 void startIncreasingVolume(); 68 void startIncreasingVolume();
72 void startDecreasingVolume(); 69 void startDecreasingVolume();
73 void stopChangingVolume(); 70 void stopChangingVolume();
74 void cleanUp(); 71 void cleanUp();
75 void blank( bool ); 72 void blank( bool );
76 73
77protected: 74protected:
78 void timerEvent( QTimerEvent *e ); 75 void timerEvent( QTimerEvent *e );
79 void keyReleaseEvent( QKeyEvent *e); 76 void keyReleaseEvent( QKeyEvent *e);
80 77
81private: 78private:
82 AudioWidget *audioUI() const; 79 AudioWidget *audioUI() const;
83 VideoWidget *videoUI() const; 80 VideoWidget *videoUI() const;
84 XineControl *xineControl() const; 81 XineControl *xineControl() const;
85 82
86 bool isBlanked, l, r; 83 bool isBlanked, l, r;
87 int fd, fl; 84 int fd, fl;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 3953d92..b1f88c9 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,70 +1,72 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <assert.h>
24
23#include "mediawidget.h" 25#include "mediawidget.h"
24#include "playlistwidget.h" 26#include "playlistwidget.h"
25#include "skin.h" 27#include "skin.h"
26 28
27#include <assert.h> 29#include <assert.h>
28 30
29MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 31MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
30 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 32 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
31{ 33{
32 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 34 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
33 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 35 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
34 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 36 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
35 this, SLOT( setLength( long ) ) ); 37 this, SLOT( setLength( long ) ) );
36 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 38 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
37 this, SLOT( setPlaying( bool ) ) ); 39 this, SLOT( setPlaying( bool ) ) );
38 40
39 setBackgroundMode( NoBackground ); 41 setBackgroundMode( NoBackground );
40} 42}
41 43
42MediaWidget::~MediaWidget() 44MediaWidget::~MediaWidget()
43{ 45{
44} 46}
45 47
46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 48void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
47 const Skin &skin ) 49 const Skin &skin )
48{ 50{
49 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 51 buttonMask = skin.buttonMask( skinInfo, buttonCount );
50 52
51 buttons.clear(); 53 buttons.clear();
52 buttons.reserve( buttonCount ); 54 buttons.reserve( buttonCount );
53 55
54 for ( uint i = 0; i < buttonCount; ++i ) { 56 for ( uint i = 0; i < buttonCount; ++i ) {
55 Button button = setupButton( skinInfo[ i ], skin ); 57 Button button = setupButton( skinInfo[ i ], skin );
56 buttons.push_back( button ); 58 buttons.push_back( button );
57 } 59 }
58} 60}
59 61
60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 62MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
61{ 63{
62 Button button; 64 Button button;
63 button.command = buttonInfo.command; 65 button.command = buttonInfo.command;
64 button.type = buttonInfo.type; 66 button.type = buttonInfo.type;
65 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 67 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
66 68
67 return button; 69 return button;
68} 70}
69 71
70void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) 72void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp
index 841d950..7183fb4 100644
--- a/noncore/multimedia/opieplayer2/om3u.cpp
+++ b/noncore/multimedia/opieplayer2/om3u.cpp
@@ -29,138 +29,132 @@
29 29
30*/ 30*/
31 31
32#include "playlistwidget.h" 32#include "playlistwidget.h"
33#include "om3u.h" 33#include "om3u.h"
34 34
35#include <qpe/applnk.h> 35#include <qpe/applnk.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37#include <qpe/storage.h> 37#include <qpe/storage.h>
38#include <qpe/mimetype.h> 38#include <qpe/mimetype.h>
39#include <qpe/global.h> 39#include <qpe/global.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41 41
42#include <qdir.h> 42#include <qdir.h>
43#include <qregexp.h> 43#include <qregexp.h>
44#include <qstring.h> 44#include <qstring.h>
45#include <qtextstream.h> 45#include <qtextstream.h>
46#include <qstringlist.h> 46#include <qstringlist.h>
47#include <qcstring.h> 47#include <qcstring.h>
48 48
49//extern PlayListWidget *playList; 49//extern PlayListWidget *playList;
50 50
51Om3u::Om3u( const QString &filePath, int mode) 51Om3u::Om3u( const QString &filePath, int mode)
52 : QStringList (){ 52 : QStringList (){
53qDebug("<<<<<<<new m3u "+filePath); 53qDebug("<<<<<<<new m3u "+filePath);
54 f.setName(filePath); 54 f.setName(filePath);
55 f.open(mode); 55 f.open(mode);
56} 56}
57 57
58Om3u::~Om3u(){} 58Om3u::~Om3u(){}
59 59
60void Om3u::readM3u() { 60void Om3u::readM3u() {
61// qDebug("<<<<<<reading m3u "+f.name()); 61// qDebug("<<<<<<reading m3u "+f.name());
62 QTextStream t(&f); 62 QTextStream t(&f);
63 QString s; 63 QString s;
64 while ( !t.atEnd() ) { 64 while ( !t.atEnd() ) {
65 s=t.readLine(); 65 s=t.readLine();
66// qDebug(s); 66// qDebug(s);
67 if( s.find( "#", 0, TRUE) == -1 ) { 67 if( s.find( "#", 0, TRUE) == -1 ) {
68 if( s.left(2) == "E:" || s.left(2) == "P:" ) { 68 if( s.left(2) == "E:" || s.left(2) == "P:" ) {
69 s = s.right( s.length() -2 ); 69 s = s.right( s.length() -2 );
70 QFileInfo f( s ); 70 QFileInfo f( s );
71 QString name = f.baseName(); 71 QString name = f.baseName();
72 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 72 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
73 s=s.replace( QRegExp( "\\" ), "/" ); 73 s=s.replace( QRegExp( "\\" ), "/" );
74 append(s); 74 append(s);
75// qDebug(s); 75// qDebug(s);
76 } else { // is url 76 } else { // is url
77 s.replace( QRegExp( "%20" )," " );
78 QString name; 77 QString name;
79// if( name.left( 4 ) == "http" ) { 78 name = s;
80// name = s.right( s.length() - 7 );
81// } else {
82 name = s;
83// }
84 append(name); 79 append(name);
85// qDebug(name);
86 } 80 }
87 } 81 }
88 } 82 }
89} 83}
90 84
91void Om3u::readPls() { //it's a pls file 85void Om3u::readPls() { //it's a pls file
92 QTextStream t( &f ); 86 QTextStream t( &f );
93 QString s; 87 QString s;
94 while ( !t.atEnd() ) { 88 while ( !t.atEnd() ) {
95 s = t.readLine(); 89 s = t.readLine();
96 if( s.left(4) == "File" ) { 90 if( s.left(4) == "File" ) {
97 s = s.right( s.length() - s.find("=",0,true)-1 ); 91 s = s.right( s.length() - s.find("=",0,true)-1 );
98 s = s.stripWhiteSpace(); 92 s = s.stripWhiteSpace();
99 s.replace( QRegExp( "%20" )," "); 93 s.replace( QRegExp( "%20" )," ");
100// qDebug( "adding " + s + " to playlist" ); 94// qDebug( "adding " + s + " to playlist" );
101 // numberofentries=2 95 // numberofentries=2
102 // File1=http 96 // File1=http
103 // Title 97 // Title
104 // Length 98 // Length
105 // Version 99 // Version
106 // File2=http 100 // File2=http
107 s = s.replace( QRegExp( "\\" ), "/" ); 101 s = s.replace( QRegExp( "\\" ), "/" );
108 QFileInfo f( s ); 102 QFileInfo f( s );
109 QString name = f.baseName(); 103 QString name = f.baseName();
110 if( name.left( 4 ) == "http" ) { 104 if( name.left( 4 ) == "http" ) {
111 name = s.right( s.length() - 7); 105 name = s.right( s.length() - 7);
112 } else { 106 } else {
113 name = s; 107 name = s;
114 } 108 }
115 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 109 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
116 if( s.at( s.length() - 4) == '.') // if this is probably a file 110 if( s.at( s.length() - 4) == '.') // if this is probably a file
117 append(s); 111 append(s);
118 else { //if its a url 112 else { //if its a url
119// if( name.right( 1 ).find( '/' ) == -1) { 113// if( name.right( 1 ).find( '/' ) == -1) {
120// s += "/"; 114// s += "/";
121// } 115// }
122 append(s); 116 append(s);
123 } 117 }
124 } 118 }
125 } 119 }
126} 120}
127 121
128void Om3u::write() { //writes list to m3u file 122void Om3u::write() { //writes list to m3u file
129 QString list; 123 QString list;
130 if(count()>0) { 124 if(count()>0) {
131 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 125 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
132// qDebug(*it); 126// qDebug(*it);
133 list += *it+"\n"; 127 list += *it+"\n";
134 } 128 }
135 f.writeBlock( list, list.length() ); 129 f.writeBlock( list, list.length() );
136 } 130 }
137// f.close(); 131// f.close();
138} 132}
139 133
140void Om3u::add(const QString &filePath) { //adds to m3u file 134void Om3u::add(const QString &filePath) { //adds to m3u file
141 append(filePath); 135 append(filePath);
142} 136}
143 137
144void Om3u::remove(const QString &filePath) { //removes from m3u list 138void Om3u::remove(const QString &filePath) { //removes from m3u list
145 QString list, currentFile; 139 QString list, currentFile;
146 if(count()>0) { 140 if(count()>0) {
147 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { 141 for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) {
148 currentFile=*it; 142 currentFile=*it;
149 // qDebug(*it); 143 // qDebug(*it);
150 144
151 if( filePath != currentFile) 145 if( filePath != currentFile)
152 list += currentFile+"\n"; 146 list += currentFile+"\n";
153 } 147 }
154 f.writeBlock( list, list.length() ); 148 f.writeBlock( list, list.length() );
155 } 149 }
156} 150}
157 151
158void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file 152void Om3u::deleteFile(const QString &/*filePath*/) {//deletes m3u file
159 f.close(); 153 f.close();
160 f.remove(); 154 f.remove();
161 155
162} 156}
163 157
164void Om3u::close() { //closes m3u file 158void Om3u::close() { //closes m3u file
165 f.close(); 159 f.close();
166} 160}
diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control
new file mode 100644
index 0000000..0e71fc5
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.control
@@ -0,0 +1,10 @@
1Package: opie-mediaplayer2-codecs
2 Files: root/usr/lib/libao.so* root/usr/lib/libogg* root/usr/lib/libvorbisidec.so* root/usr/lib/libxine.so* root/usr/lib/xine/*
3Section: opie/multimedia
4Essential: no
5Priority: optional
6Version: 0.7-$SUB_VERSION.3
7Architecture: arm
8Maintainer: Maximilian Reiss <harlekin@handhelds.org>
9Depends: libc6 (>= 2.1), opie-mediaplayer2
10Description: Codecs for opieplayer 2
diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.postinst b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.postinst
new file mode 100755
index 0000000..8e60212
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2-codecs.postinst
@@ -0,0 +1,5 @@
1#!/bin/sh
2
3[ "$1" = "configure" ] || exit 1
4
5ldconfig \ No newline at end of file
diff --git a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
index c072308..10c5d19 100644
--- a/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
+++ b/noncore/multimedia/opieplayer2/opie-mediaplayer2.control
@@ -1,11 +1,11 @@
1Package: opie-mediaplayer2 1Package: opie-mediaplayer2
2Files: bin/opieplayer2 apps/Applications/mediaplayer.desktop pics/opieplayer2/add_to_playlist.png pics/opieplayer2/cut.png pics/opieplayer2/delete.png pics/opieplayer2/down.png pics/opieplayer2/loop.png pics/opieplayer2/MPEGPlayer.png pics/opieplayer2/musicfile.png pics/opieplayer2/playlist2.png pics/opieplayer2/play.png pics/opieplayer2/remove_from_playlist.png pics/opieplayer2/shuffle.png pics/opieplayer2/up.png pics/opieplayer2/videofile.png 2Files: bin/opieplayer2 apps/Applications/mediaplayer.desktop pics/opieplayer2/add_to_playlist.png pics/opieplayer2/cut.png pics/opieplayer2/delete.png pics/opieplayer2/down.png pics/opieplayer2/loop.png pics/opieplayer2/MPEGPlayer.png pics/opieplayer2/musicfile.png pics/opieplayer2/playlist2.png pics/opieplayer2/play.png pics/opieplayer2/remove_from_playlist.png pics/opieplayer2/shuffle.png pics/opieplayer2/up.png pics/opieplayer2/videofile.png
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org> 5Maintainer: L.J.Potter <ljp@llornkcor.com>, Maximilian Reiss <harlekin@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION 7Depends: task-opie-minimal, libopie1, zlib1g, libstdc++2.10-glibc2.2, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer2-codecs
8Depends: task-opie-minimal, libopie1, zlib1g, opie-mediaplayer2-skin-default | opie-mediaplayer2-skin-default-landscape , libxine1 | opie-mediaplayer-codecs
9Description: The Opie media player 8Description: The Opie media player
10 The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and 9 The mediaplayer for Opie. It plays mp3, mpeg, wav, ogg, quicktime, divx and
11 more. Also it is streaming capable. 10 more. Also it is streaming capable.
11Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro
index 57cd18f..5dabbab 100644
--- a/noncore/multimedia/opieplayer2/opieplayer2.pro
+++ b/noncore/multimedia/opieplayer2/opieplayer2.pro
@@ -1,48 +1,48 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \ 4HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \
5 videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \ 5 videowidget.h audiowidget.h playlistwidget.h om3u.h mediaplayer.h inputDialog.h \
6 frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\ 6 frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\
7 alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \ 7 alphablend.h yuv2rgb.h threadutil.h mediawidget.h playlistview.h playlistfileview.h \
8 skin.h 8 skin.h
9SOURCES = main.cpp \ 9SOURCES = main.cpp \
10 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \ 10 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \
11 videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \ 11 videowidget.cpp audiowidget.cpp playlistwidget.cpp om3u.cpp mediaplayer.cpp inputDialog.cpp \
12 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \ 12 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \
13 playlistwidgetgui.cpp\ 13 playlistwidgetgui.cpp\
14 alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S \ 14 alphablend.c yuv2rgb.c yuv2rgb_arm2.c yuv2rgb_arm4l.S \
15 threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \ 15 threadutil.cpp mediawidget.cpp playlistview.cpp playlistfileview.cpp \
16 skin.cpp 16 skin.cpp
17TARGET = opieplayer2 17TARGET = opieplayer2
18INCLUDEPATH += $(OPIEDIR)/include 18INCLUDEPATH += $(OPIEDIR)/include
19DEPENDPATH += $(OPIEDIR)/include 19DEPENDPATH += $(OPIEDIR)/include
20LIBS += -lqpe -lpthread -lopie -lxine -lstdc++ 20LIBS += -lqpe -lpthread -lopie -lxine -lstdc++
21MOC_DIR = qpeobj 21MOC_DIR = qpeobj
22OBJECTS_DIR = qpeobj 22OBJECTS_DIR = qpeobj
23 23
24#INCLUDEPATH += $(OPIEDIR)/include 24#INCLUDEPATH += $(OPIEDIR)/include
25#DEPENDPATH += $(OPIEDIR)/include 25#DEPENDPATH += $(OPIEDIR)/include
26 26
27 27
28 28
29TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \ 29TRANSLATIONS = ../../../i18n/de/opieplayer2.ts \
30 ../../../i18n/nl/opieplayer2.ts \ 30 ../../../i18n/nl/opieplayer2.ts \
31 ../../../i18n/da/opieplayer2.ts \ 31 ../../../i18n/da/opieplayer2.ts \
32 ../../../i18n/xx/opieplayer2.ts \ 32 ../../../i18n/xx/opieplayer2.ts \
33 ../../../i18n/en/opieplayer2.ts \ 33 ../../../i18n/en/opieplayer2.ts \
34 ../../../i18n/es/opieplayer2.ts \ 34 ../../../i18n/es/opieplayer2.ts \
35 ../../../i18n/fr/opieplayer2.ts \ 35 ../../../i18n/fr/opieplayer2.ts \
36 ../../../i18n/hu/opieplayer2.ts \ 36 ../../../i18n/hu/opieplayer2.ts \
37 ../../../i18n/ja/opieplayer2.ts \ 37 ../../../i18n/ja/opieplayer2.ts \
38 ../../../i18n/ko/opieplayer2.ts \ 38 ../../../i18n/ko/opieplayer2.ts \
39 ../../../i18n/no/opieplayer2.ts \ 39 ../../../i18n/no/opieplayer2.ts \
40 ../../../i18n/pl/opieplayer2.ts \ 40 ../../../i18n/pl/opieplayer2.ts \
41 ../../../i18n/pt/opieplayer2.ts \ 41 ../../../i18n/pt/opieplayer2.ts \
42 ../../../i18n/pt_BR/opieplayer2.ts \ 42 ../../../i18n/pt_BR/opieplayer2.ts \
43 ../../../i18n/sl/opieplayer2.ts \ 43 ../../../i18n/sl/opieplayer2.ts \
44 ../../../i18n/zh_CN/opieplayer2.ts \ 44 ../../../i18n/zh_CN/opieplayer2.ts \
45 ../../../i18n/zh_TW/opieplayer2.ts 45 ../../../i18n/zh_TW/opieplayer2.ts
46 46
47 47
48include ( $(OPIEDIR)/include.pro ) 48include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 5f750ba..a1a1016 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,106 +1,95 @@
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,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpetoolbar.h> 34#include <qtoolbar.h>
35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h>
37#include <qpe/mimetype.h>
38#include <qpe/global.h>
39#include <qpe/resource.h>
40#include <qpe/config.h>
41 35
42#include <opie/ofiledialog.h> 36#include <opie/ofiledialog.h>
43 37
44#include <qdatetime.h>
45#include <qdir.h>
46#include <qmessagebox.h> 38#include <qmessagebox.h>
47#include <qregexp.h>
48#include <qtextstream.h>
49 39
50#include "playlistselection.h" 40#include "playlistselection.h"
51#include "playlistwidget.h" 41#include "playlistwidget.h"
52#include "mediaplayerstate.h" 42#include "mediaplayerstate.h"
53#include "inputDialog.h" 43#include "inputDialog.h"
54#include "om3u.h" 44#include "om3u.h"
55#include "playlistfileview.h" 45#include "playlistfileview.h"
56 46
57//only needed for the random play 47//only needed for the random play
58#include <stdlib.h>
59#include <assert.h> 48#include <assert.h>
60 49
61PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 50PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
62 : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) 51 : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 )
63{ 52{
64 53
65 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 54 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
66 "opieplayer2/add_to_playlist", 55 "opieplayer2/add_to_playlist",
67 this , SLOT(addSelected() ) ); 56 this , SLOT(addSelected() ) );
68 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 57 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
69 "opieplayer2/remove_from_playlist", 58 "opieplayer2/remove_from_playlist",
70 this , SLOT(removeSelected() ) ); 59 this , SLOT(removeSelected() ) );
71 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 60 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
72 this , SLOT( btnPlay( bool) ), TRUE ); 61 this , SLOT( btnPlay( bool) ), TRUE );
73 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 62 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
74 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 63 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
75 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 64 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
76 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 65 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
77 66
78 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 67 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
79 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 68 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
80 this, SLOT( addAllMusicToList() ) ); 69 this, SLOT( addAllMusicToList() ) );
81 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 70 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
82 this, SLOT( addAllVideoToList() ) ); 71 this, SLOT( addAllVideoToList() ) );
83 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 72 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
84 this, SLOT( addAllToList() ) ); 73 this, SLOT( addAllToList() ) );
85 pmPlayList->insertSeparator(-1); 74 pmPlayList->insertSeparator(-1);
86 (void)new MenuItem( pmPlayList, tr( "Add File" ), 75 (void)new MenuItem( pmPlayList, tr( "Add File" ),
87 this,SLOT( openFile() ) ); 76 this,SLOT( openFile() ) );
88 (void)new MenuItem( pmPlayList, tr("Add URL"), 77 (void)new MenuItem( pmPlayList, tr("Add URL"),
89 this,SLOT( openURL() ) ); 78 this,SLOT( openURL() ) );
90 pmPlayList->insertSeparator(-1); 79 pmPlayList->insertSeparator(-1);
91 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 80 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
92 this, SLOT(writem3u() ) ); 81 this, SLOT(writem3u() ) );
93 pmPlayList->insertSeparator(-1); 82 pmPlayList->insertSeparator(-1);
94 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 83 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
95 audioView, SLOT( scanFiles() ) ); 84 audioView, SLOT( scanFiles() ) );
96 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 85 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
97 videoView, SLOT( scanFiles() ) ); 86 videoView, SLOT( scanFiles() ) );
98 87
99 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 88 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
100 &mediaPlayerState, SLOT( toggleFullscreen() ) ); 89 &mediaPlayerState, SLOT( toggleFullscreen() ) );
101 90
102 Config cfg( "OpiePlayer" ); 91 Config cfg( "OpiePlayer" );
103 bool b= cfg.readBoolEntry("FullScreen", 0); 92 bool b= cfg.readBoolEntry("FullScreen", 0);
104 mediaPlayerState.setFullscreen( b ); 93 mediaPlayerState.setFullscreen( b );
105 pmView->setItemChecked( -16, b ); 94 pmView->setItemChecked( -16, b );
106 95
@@ -622,129 +611,131 @@ void PlayListWidget::openURL() {
622 611
623 if(filename.left(4) == "http") { 612 if(filename.left(4) == "http") {
624 QString m3uFile, m3uFilePath; 613 QString m3uFile, m3uFilePath;
625 if(filename.find(":",8,TRUE) != -1) { //found a port 614 if(filename.find(":",8,TRUE) != -1) { //found a port
626 m3uFile = filename.left( filename.find( ":",8,TRUE)); 615 m3uFile = filename.left( filename.find( ":",8,TRUE));
627 m3uFile = m3uFile.right( 7); 616 m3uFile = m3uFile.right( 7);
628 } else if(filename.left(4) == "http"){ 617 } else if(filename.left(4) == "http"){
629 m3uFile=filename; 618 m3uFile=filename;
630 m3uFile = m3uFile.right( m3uFile.length() - 7); 619 m3uFile = m3uFile.right( m3uFile.length() - 7);
631 } else{ 620 } else{
632 m3uFile=filename; 621 m3uFile=filename;
633 } 622 }
634 623
635 lnk.setName( filename ); //sets name 624 lnk.setName( filename ); //sets name
636 lnk.setFile( filename ); //sets file name 625 lnk.setFile( filename ); //sets file name
637 626
638// lnk.setIcon("opieplayer2/musicfile"); 627// lnk.setIcon("opieplayer2/musicfile");
639 628
640 d->selectedFiles->addToSelection( lnk ); 629 d->selectedFiles->addToSelection( lnk );
641 writeCurrentM3u(); 630 writeCurrentM3u();
642 d->selectedFiles->setSelectedItem( lnk.name()); 631 d->selectedFiles->setSelectedItem( lnk.name());
643 } 632 }
644 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 633 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
645 readListFromFile( filename ); 634 readListFromFile( filename );
646 } else { 635 } else {
647 lnk.setName( QFileInfo(filename).baseName() ); //sets name 636 lnk.setName( QFileInfo(filename).baseName() ); //sets name
648 lnk.setFile( filename ); //sets file name 637 lnk.setFile( filename ); //sets file name
649 d->selectedFiles->addToSelection( lnk); 638 d->selectedFiles->addToSelection( lnk);
650 writeCurrentM3u(); 639 writeCurrentM3u();
651 d->selectedFiles->setSelectedItem( lnk.name()); 640 d->selectedFiles->setSelectedItem( lnk.name());
652 } 641 }
653 } 642 }
654 643
655 644
656 delete fileDlg; 645 delete fileDlg;
657} 646}
658 647
659 648
660void PlayListWidget::openFile() { 649void PlayListWidget::openFile() {
661 650
662 QString filename, name; 651 QString filename, name;
663 652
664 Config cfg( "OpiePlayer" ); 653 Config cfg( "OpiePlayer" );
665 cfg.setGroup("Dialog"); 654 cfg.setGroup("Dialog");
666 MimeTypes types; 655 MimeTypes types;
667 QStringList audio, video, all; 656 QStringList audio, video, all;
668 audio << "audio/*"; 657 audio << "audio/*";
669 audio << "playlist/plain"; 658 audio << "playlist/plain";
659 audio << "application/ogg";
670 audio << "audio/x-mpegurl"; 660 audio << "audio/x-mpegurl";
671 661
672 video << "video/*"; 662 video << "video/*";
673 video << "playlist/plain"; 663 video << "playlist/plain";
674 664
675 all += audio; 665 all += audio;
676 all += video; 666 all += video;
677 types.insert("All Media Files", all ); 667 types.insert("All Media Files", all );
678 types.insert("Audio", audio ); 668 types.insert("Audio", audio );
679 types.insert("Video", video ); 669 types.insert("Video", video );
680 670
681 QString str = OFileDialog::getOpenFileName( 1, 671 QString str = OFileDialog::getOpenFileName( 1,
682 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", 672 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
683 types, 0 ); 673 types, 0 );
684 if(str.left(2) == "//") str=str.right(str.length()-1);
685 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath());
686 674
675 if(str.left(2) == "//") {
676 str=str.right(str.length()-1);
677 }
678 cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() );
687 679
688 if( !str.isEmpty() ) { 680 if( !str.isEmpty() ) {
681
689 qDebug( "Selected filename is " + str ); 682 qDebug( "Selected filename is " + str );
690 filename = str; 683 filename = str;
691 DocLnk lnk; 684 DocLnk lnk;
692 Config cfg( "OpiePlayer" );
693 cfg.setGroup("PlayList");
694 685
695 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 686 if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
696 readListFromFile( filename ); 687 readListFromFile( filename );
697 } else { 688 } else {
698 lnk.setName( QFileInfo(filename).baseName() ); //sets name 689 lnk.setName( QFileInfo(filename).baseName() ); //sets name
699 lnk.setFile( filename ); //sets file name 690 lnk.setFile( filename ); //sets file name
700 d->selectedFiles->addToSelection( lnk); 691 d->selectedFiles->addToSelection( lnk );
701 writeCurrentM3u(); 692 writeCurrentM3u();
702 d->selectedFiles->setSelectedItem( lnk.name()); 693 d->selectedFiles->setSelectedItem( lnk.name() );
703 } 694 }
704 } 695 }
705} 696}
706 697
707 698
708void PlayListWidget::readListFromFile( const QString &filename ) { 699void PlayListWidget::readListFromFile( const QString &filename ) {
709 qDebug( "read list filename " + filename ); 700 qDebug( "read list filename " + filename );
710 QFileInfo fi(filename); 701 QFileInfo fi(filename);
711 Om3u *m3uList; 702 Om3u *m3uList;
712 QString s, name; 703 QString s, name;
713 m3uList = new Om3u( filename, IO_ReadOnly ); 704 m3uList = new Om3u( filename, IO_ReadOnly );
714 if(fi.extension(false).find("m3u",0,false) != -1 ) 705 if(fi.extension(false).find("m3u",0,false) != -1 )
715 m3uList->readM3u(); 706 m3uList->readM3u();
716 else if(fi.extension(false).find("pls",0,false) != -1 ) 707 else if(fi.extension(false).find("pls",0,false) != -1 )
717 m3uList->readPls(); 708 m3uList->readPls();
718 709
719 DocLnk lnk; 710 DocLnk lnk;
720 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 711 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
721 s = *it; 712 s = *it;
722 // qDebug(s); 713 // qDebug(s);
723 if(s.left(4)=="http") { 714 if(s.left(4)=="http") {
724 lnk.setName( s ); //sets file name 715 lnk.setName( s ); //sets file name
725 lnk.setIcon("opieplayer2/musicfile"); 716 lnk.setIcon("opieplayer2/musicfile");
726 lnk.setFile( s ); //sets file name 717 lnk.setFile( s ); //sets file name
727 718
728 } else { //is file 719 } else { //is file
729 lnk.setName( QFileInfo(s).baseName()); 720 lnk.setName( QFileInfo(s).baseName());
730 if(s.left(1) != "/") { 721 if(s.left(1) != "/") {
731 722
732 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 723 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
733 } else { 724 } else {
734 lnk.setFile( s); 725 lnk.setFile( s);
735 } 726 }
736 } 727 }
737 d->selectedFiles->addToSelection( lnk ); 728 d->selectedFiles->addToSelection( lnk );
738 } 729 }
739 Config config( "OpiePlayer" ); 730 Config config( "OpiePlayer" );
740 config.setGroup( "PlayList" ); 731 config.setGroup( "PlayList" );
741 732
742 config.writeEntry("CurrentPlaylist",filename); 733 config.writeEntry("CurrentPlaylist",filename);
743 config.write(); 734 config.write();
744 currentPlayList=filename; 735 currentPlayList=filename;
745 736
746 m3uList->close(); 737 m3uList->close();
747 delete m3uList; 738 delete m3uList;
748 739
749 d->selectedFiles->setSelectedItem( s); 740 d->selectedFiles->setSelectedItem( s);
750 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 741 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 5230b03..fc305cd 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -1,96 +1,91 @@
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,2003 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#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
38#include <qpe/applnk.h>
39#include <qtabwidget.h>
40#include <qpe/fileselector.h>
41#include <qpushbutton.h> 38#include <qpushbutton.h>
42#include <qpopupmenu.h> 39#include <qpopupmenu.h>
43#include <qpe/qcopenvelope_qws.h> 40#include <qpe/qcopenvelope_qws.h>
44 41
45#include "playlistwidgetgui.h" 42#include "playlistwidgetgui.h"
46 43
47
48//class PlayListWidgetPrivate;
49class Config; 44class Config;
50class QListViewItem; 45class QListViewItem;
51class QListView; 46class QListView;
52class QPoint; 47class QPoint;
53class QAction; 48class QAction;
54class QLabel; 49class QLabel;
55 50
56class PlayListWidget : public PlayListWidgetGui { 51class PlayListWidget : public PlayListWidgetGui {
57 Q_OBJECT 52 Q_OBJECT
58public: 53public:
59 enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 54 enum TabType { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
60 enum { TabTypeCount = 4 }; 55 enum { TabTypeCount = 4 };
61 56
62 struct Entry 57 struct Entry
63 { 58 {
64 Entry( const QString &_name, const QString &_fileName ) 59 Entry( const QString &_name, const QString &_fileName )
65 : name( _name ), file( _fileName ) {} 60 : name( _name ), file( _fileName ) {}
66 Entry( const QString &_fileName ) 61 Entry( const QString &_fileName )
67 : name( _fileName ), file( _fileName ) {} 62 : name( _fileName ), file( _fileName ) {}
68 63
69 QString name; 64 QString name;
70 QString file; 65 QString file;
71 }; 66 };
72 67
73 PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 68 PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
74 ~PlayListWidget(); 69 ~PlayListWidget();
75 70
76 // retrieve the current playlist entry (media file link) 71 // retrieve the current playlist entry (media file link)
77 const DocLnk *current() const; 72 const DocLnk *current() const;
78 void useSelectedDocument(); 73 void useSelectedDocument();
79 TabType currentTab() const; 74 TabType currentTab() const;
80 75
81 Entry currentEntry() const; 76 Entry currentEntry() const;
82 77
83public slots: 78public slots:
84 bool first(); 79 bool first();
85 bool last(); 80 bool last();
86 bool next(); 81 bool next();
87 bool prev(); 82 bool prev();
88 void writeDefaultPlaylist( ); 83 void writeDefaultPlaylist( );
89 QString currentFileListPathName() const; 84 QString currentFileListPathName() const;
90protected: 85protected:
91 QCopChannel * channel; 86 QCopChannel * channel;
92 void keyReleaseEvent( QKeyEvent *e); 87 void keyReleaseEvent( QKeyEvent *e);
93 88
94signals: 89signals:
95 void skinSelected(); 90 void skinSelected();
96 91
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 5fc0c39..293bf45 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -1,199 +1,187 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpemenubar.h> 34
35#include <qpe/qpetoolbar.h> 35#include <qtoolbar.h>
36#include <qpe/fileselector.h>
37#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
38#include <qpe/storage.h> 37
39#include <qpe/mimetype.h>
40#include <qpe/config.h>
41#include <qpe/global.h>
42#include <qpe/resource.h>
43
44#include <qpopupmenu.h>
45#include <qaction.h>
46#include <qcursor.h>
47#include <qdir.h>
48#include <qlayout.h> 38#include <qlayout.h>
39#include <qmenubar.h>
49 40
50#include "playlistselection.h" 41#include "playlistselection.h"
51#include "playlistwidget.h" 42#include "playlistwidget.h"
52#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
53#include "inputDialog.h" 44#include "inputDialog.h"
54#include "playlistfileview.h" 45#include "playlistfileview.h"
55 46
56//only needed for the random play
57#include <stdlib.h>
58
59#include "mediaplayerstate.h" 47#include "mediaplayerstate.h"
60 48
61PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name ) 49PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name )
62 : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) { 50 : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) {
63 51
64 d = new PlayListWidgetPrivate; 52 d = new PlayListWidgetPrivate;
65 d->setDocumentUsed = FALSE; 53 d->setDocumentUsed = FALSE;
66 54
67 setBackgroundMode( PaletteButton ); 55 setBackgroundMode( PaletteButton );
68 setToolBarsMovable( FALSE ); 56 setToolBarsMovable( FALSE );
69 57
70 // Create Toolbar 58 // Create Toolbar
71 QPEToolBar *toolbar = new QPEToolBar( this ); 59 QToolBar *toolbar = new QToolBar( this );
72 toolbar->setHorizontalStretchable( TRUE ); 60 toolbar->setHorizontalStretchable( TRUE );
73 61
74 // Create Menubar 62 // Create Menubar
75 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 63 QMenuBar *menu = new QMenuBar( toolbar );
76 menu->setMargin( 0 ); 64 menu->setMargin( 0 );
77 65
78 bar = new QPEToolBar( this ); 66 bar = new QToolBar( this );
79 bar->setLabel( tr( "Play Operations" ) ); 67 bar->setLabel( tr( "Play Operations" ) );
80 68
81 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
82 tbDeletePlaylist->setFlat( TRUE ); 70 tbDeletePlaylist->setFlat( TRUE );
83 tbDeletePlaylist->setFixedSize( 20, 20 ); 71 tbDeletePlaylist->setFixedSize( 20, 20 );
84 72
85 tbDeletePlaylist->hide(); 73 tbDeletePlaylist->hide();
86 74
87 pmPlayList = new QPopupMenu( this ); 75 pmPlayList = new QPopupMenu( this );
88 menu->insertItem( tr( "File" ), pmPlayList ); 76 menu->insertItem( tr( "File" ), pmPlayList );
89 77
90 pmView = new QPopupMenu( this ); 78 pmView = new QPopupMenu( this );
91 menu->insertItem( tr( "View" ), pmView ); 79 menu->insertItem( tr( "View" ), pmView );
92 pmView->isCheckable(); 80 pmView->isCheckable();
93 81
94 skinsMenu = new QPopupMenu( this ); 82 skinsMenu = new QPopupMenu( this );
95 pmView->insertItem( tr( "Skins" ), skinsMenu ); 83 pmView->insertItem( tr( "Skins" ), skinsMenu );
96 skinsMenu->isCheckable(); 84 skinsMenu->isCheckable();
97 85
98 gammaMenu = new QPopupMenu( this ); 86 gammaMenu = new QPopupMenu( this );
99 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
100 88
101 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
102 gammaSlider->setRange( -40, 40 ); 90 gammaSlider->setRange( -40, 40 );
103 gammaSlider->setTickmarks( QSlider::Left ); 91 gammaSlider->setTickmarks( QSlider::Left );
104 gammaSlider->setTickInterval( 20 ); 92 gammaSlider->setTickInterval( 20 );
105 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 93 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
106 gammaSlider->setValue( 0 ); 94 gammaSlider->setValue( 0 );
107 gammaSlider->setMinimumHeight( 50 ); 95 gammaSlider->setMinimumHeight( 50 );
108 96
109 gammaLCD = new QLCDNumber( 3, gammaMenu ); 97 gammaLCD = new QLCDNumber( 3, gammaMenu );
110 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 98 gammaLCD-> setFrameShape ( QFrame::NoFrame );
111 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
112 100
113 gammaMenu->insertItem( gammaSlider ); 101 gammaMenu->insertItem( gammaSlider );
114 gammaMenu->insertItem( gammaLCD ); 102 gammaMenu->insertItem( gammaLCD );
115 103
116 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 104 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
117 105
118 vbox5 = new QVBox( this ); 106 vbox5 = new QVBox( this );
119 QVBox *vbox4 = new QVBox( vbox5 ); 107 QVBox *vbox4 = new QVBox( vbox5 );
120 QHBox *hbox6 = new QHBox( vbox4 ); 108 QHBox *hbox6 = new QHBox( vbox4 );
121 109
122 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 110 tabWidget = new QTabWidget( hbox6, "tabWidget" );
123 111
124 playListTab = new QWidget( tabWidget, "PlayListTab" ); 112 playListTab = new QWidget( tabWidget, "PlayListTab" );
125 tabWidget->insertTab( playListTab, "Playlist"); 113 tabWidget->insertTab( playListTab, "Playlist");
126 114
127 QGridLayout *Playout = new QGridLayout( playListTab ); 115 QGridLayout *Playout = new QGridLayout( playListTab );
128 Playout->setSpacing( 2); 116 Playout->setSpacing( 2);
129 Playout->setMargin( 2); 117 Playout->setMargin( 2);
130 118
131 // Add the playlist area 119 // Add the playlist area
132 QVBox *vbox3 = new QVBox( playListTab ); 120 QVBox *vbox3 = new QVBox( playListTab );
133 d->playListFrame = vbox3; 121 d->playListFrame = vbox3;
134 122
135 QHBox *hbox2 = new QHBox( vbox3 ); 123 QHBox *hbox2 = new QHBox( vbox3 );
136 d->selectedFiles = new PlayListSelection( hbox2 ); 124 d->selectedFiles = new PlayListSelection( hbox2 );
137 125
138 vbox1 = new QVBox( hbox2 ); 126 vbox1 = new QVBox( hbox2 );
139 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
140 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
141 129
142 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
143 131
144 QWidget *aTab; 132 QWidget *aTab;
145 aTab = new QWidget( tabWidget, "aTab" ); 133 aTab = new QWidget( tabWidget, "aTab" );
146 134
147 QGridLayout *Alayout = new QGridLayout( aTab ); 135 QGridLayout *Alayout = new QGridLayout( aTab );
148 Alayout->setSpacing( 2 ); 136 Alayout->setSpacing( 2 );
149 Alayout->setMargin( 2 ); 137 Alayout->setMargin( 2 );
150 // no m3u's here please 138 // no m3u's here please
151 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", "opieplayer2/musicfile", aTab, "Audioview" ); 139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" );
152 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
153 tabWidget->insertTab( aTab, tr( "Audio" ) ); 141 tabWidget->insertTab( aTab, tr( "Audio" ) );
154 142
155 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
156 144
157 QWidget *vTab; 145 QWidget *vTab;
158 vTab = new QWidget( tabWidget, "vTab" ); 146 vTab = new QWidget( tabWidget, "vTab" );
159 147
160 QGridLayout *Vlayout = new QGridLayout( vTab ); 148 QGridLayout *Vlayout = new QGridLayout( vTab );
161 Vlayout->setSpacing( 2 ); 149 Vlayout->setSpacing( 2 );
162 Vlayout->setMargin( 2 ); 150 Vlayout->setMargin( 2 );
163 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" ); 151 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" );
164 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 152 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
165 153
166 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 154 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
167 155
168 tabWidget->insertTab( vTab, tr( "Video" ) ); 156 tabWidget->insertTab( vTab, tr( "Video" ) );
169 157
170 //playlists list 158 //playlists list
171 QWidget *LTab; 159 QWidget *LTab;
172 LTab = new QWidget( tabWidget, "LTab" ); 160 LTab = new QWidget( tabWidget, "LTab" );
173 QGridLayout *Llayout = new QGridLayout( LTab ); 161 QGridLayout *Llayout = new QGridLayout( LTab );
174 Llayout->setSpacing( 2 ); 162 Llayout->setSpacing( 2 );
175 Llayout->setMargin( 2 ); 163 Llayout->setMargin( 2 );
176 164
177 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 165 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
178 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 166 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
179 167
180 tabWidget->insertTab( LTab, tr( "Lists" ) ); 168 tabWidget->insertTab( LTab, tr( "Lists" ) );
181 169
182 setCentralWidget( vbox5 ); 170 setCentralWidget( vbox5 );
183} 171}
184 172
185 173
186 174
187PlayListWidgetGui::~PlayListWidgetGui() { 175PlayListWidgetGui::~PlayListWidgetGui() {
188} 176}
189 177
190void PlayListWidgetGui::setView( char view ) { 178void PlayListWidgetGui::setView( char view ) {
191 if ( view == 'l' ) 179 if ( view == 'l' )
192 showMaximized(); 180 showMaximized();
193 else 181 else
194 hide(); 182 hide();
195} 183}
196 184
197 185
198void PlayListWidgetGui::setActiveWindow() { 186void PlayListWidgetGui::setActiveWindow() {
199 // qDebug("SETTING active window"); 187 // qDebug("SETTING active window");
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index c965b0d..c0cd37a 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -1,133 +1,129 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#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>
39#include <qpe/resource.h> 38#include <qpe/resource.h>
40#include <qpe/qpemenubar.h>
41 39
42#include <qtabwidget.h> 40#include <qtabwidget.h>
43#include <qpe/fileselector.h> 41#include <qpe/fileselector.h>
44#include <qpushbutton.h>
45#include <qpopupmenu.h>
46#include <qaction.h> 42#include <qaction.h>
43#include <qtoolbutton.h>
47#include <qslider.h> 44#include <qslider.h>
48#include <qlcdnumber.h> 45#include <qlcdnumber.h>
49 46
50class PlayListWidgetPrivate; 47class PlayListWidgetPrivate;
51class PlayListSelection; 48class PlayListSelection;
52class MediaPlayerState; 49class MediaPlayerState;
53class PlayListFileView; 50class PlayListFileView;
54 51
55class Config; 52class Config;
56class QPEToolBar; 53class QToolBar;
57class QListViewItem; 54class QListViewItem;
58class QListView; 55class QListView;
59class QPoint; 56class QPoint;
60class QAction; 57class QAction;
61class QLabel; 58class QLabel;
62 59
63class PlayListWidgetPrivate { 60class PlayListWidgetPrivate {
64public: 61public:
65 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 62 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
66 QFrame *playListFrame; 63 QFrame *playListFrame;
67 PlayListSelection *selectedFiles; 64 PlayListSelection *selectedFiles;
68 bool setDocumentUsed; 65 bool setDocumentUsed;
69}; 66};
70 67
71 68
72class ToolButton : public QToolButton { 69class ToolButton : public QToolButton {
73 Q_OBJECT 70 Q_OBJECT
74public: 71public:
75 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 72 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
76 : QToolButton( parent, name ) { 73 : QToolButton( parent, name ) {
77 setTextLabel( name ); 74 setTextLabel( name );
78 setPixmap( Resource::loadPixmap( icon ) ); 75 setPixmap( Resource::loadPixmap( icon ) );
79 setAutoRaise( TRUE ); 76 setAutoRaise( TRUE );
80 setFocusPolicy( QWidget::NoFocus ); 77 setFocusPolicy( QWidget::NoFocus );
81 setToggleButton( t ); 78 setToggleButton( t );
82 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 79 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
83 QPEMenuToolFocusManager::manager()->addWidget( this );
84 } 80 }
85}; 81};
86 82
87class MenuItem : public QAction { 83class MenuItem : public QAction {
88 84
89public: 85public:
90 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 86 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
91 : QAction( text, QString::null, 0, 0 ) { 87 : QAction( text, QString::null, 0, 0 ) {
92 connect( this, SIGNAL( activated() ), handler, slot ); 88 connect( this, SIGNAL( activated() ), handler, slot );
93 addTo( parent ); 89 addTo( parent );
94 } 90 }
95}; 91};
96 92
97class PlayListWidgetGui : public QMainWindow { 93class PlayListWidgetGui : public QMainWindow {
98 Q_OBJECT 94 Q_OBJECT
99public: 95public:
100 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 ); 96 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 );
101 ~PlayListWidgetGui(); 97 ~PlayListWidgetGui();
102 98
103protected: 99protected:
104 QTabWidget * tabWidget; 100 QTabWidget * tabWidget;
105 PlayListFileView *audioView, *videoView; 101 PlayListFileView *audioView, *videoView;
106 QListView *playlistView; 102 QListView *playlistView;
107 QLabel *libString; 103 QLabel *libString;
108 QPopupMenu *pmView ; 104 QPopupMenu *pmView ;
109 QPopupMenu *gammaMenu; 105 QPopupMenu *gammaMenu;
110 QSlider *gammaSlider; 106 QSlider *gammaSlider;
111 QLCDNumber *gammaLCD; 107 QLCDNumber *gammaLCD;
112 bool fromSetDocument; 108 bool fromSetDocument;
113 bool insanityBool; 109 bool insanityBool;
114 QString setDocFileRef; 110 QString setDocFileRef;
115 // retrieve the current playlist entry (media file link) 111 // retrieve the current playlist entry (media file link)
116 QPushButton *tbDeletePlaylist; 112 QPushButton *tbDeletePlaylist;
117 int selected; 113 int selected;
118 QPopupMenu *pmPlayList; 114 QPopupMenu *pmPlayList;
119 FileSelector* playLists; 115 FileSelector* playLists;
120 QPopupMenu *skinsMenu; 116 QPopupMenu *skinsMenu;
121 PlayListWidgetPrivate *d; // Private implementation data 117 PlayListWidgetPrivate *d; // Private implementation data
122 QVBox *vbox1; 118 QVBox *vbox1;
123 QVBox *vbox5; 119 QVBox *vbox5;
124 QPEToolBar *bar; 120 QToolBar *bar;
125 QWidget *playListTab; 121 QWidget *playListTab;
126 void setActiveWindow(); // need to handle this to show the right view 122 void setActiveWindow(); // need to handle this to show the right view
127 void setView( char ); 123 void setView( char );
128 124
129 MediaPlayerState &mediaPlayerState; 125 MediaPlayerState &mediaPlayerState;
130}; 126};
131 127
132#endif 128#endif
133 129
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 755cd22..c829e03 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,146 +1,136 @@
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..}^=.=       =       ; 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 <qpe/qpeapplication.h>
35#include <qpe/resource.h>
36#include <qpe/config.h>
37
38
39#include <qwidget.h>
40#include <qpainter.h>
41#include <qpixmap.h>
42#include <qslider.h>
43#include <qdrawutil.h>
44#include "videowidget.h" 34#include "videowidget.h"
45#include "mediaplayerstate.h" 35#include "mediaplayerstate.h"
46#include "playlistwidget.h" 36#include "playlistwidget.h"
47 37
48 38
49#ifdef Q_WS_QWS 39#ifdef Q_WS_QWS
50# define USE_DIRECT_PAINTER 40# define USE_DIRECT_PAINTER
51# include <qdirectpainter_qws.h> 41# include <qdirectpainter_qws.h>
52# include <qgfxraster_qws.h> 42# include <qgfxraster_qws.h>
53#endif 43#endif
54 44
55 45
56namespace 46namespace
57{ 47{
58 48
59const int xo = 2; // movable x offset 49const int xo = 2; // movable x offset
60const int yo = 0; // movable y offset 50const int yo = 0; // movable y offset
61 51
62const MediaWidget::SkinButtonInfo skinInfo[] = 52const MediaWidget::SkinButtonInfo skinInfo[] =
63{ 53{
64 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 54 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
65 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 55 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
66 { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, 56 { MediaWidget::Next, "fwd", MediaWidget::NormalButton },
67 { MediaWidget::Previous, "back", MediaWidget::NormalButton }, 57 { MediaWidget::Previous, "back", MediaWidget::NormalButton },
68 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 58 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
69 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 59 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
70 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } 60 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton }
71}; 61};
72 62
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 63const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74 64
75} 65}
76 66
77VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 67VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
78 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) 68 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
79{ 69{
80 setCaption( tr("OpiePlayer - Video") ); 70 setCaption( tr("OpiePlayer - Video") );
81 71
82 videoFrame = new XineVideoWidget ( this, "Video frame" ); 72 videoFrame = new XineVideoWidget ( this, "Video frame" );
83 73
84 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 74 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
85 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 75 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
86 76
87 slider = 0; 77 slider = 0;
88 78
89 loadSkin(); 79 loadSkin();
90 80
91 setLength( mediaPlayerState.length() ); 81 setLength( mediaPlayerState.length() );
92 setPosition( mediaPlayerState.position() ); 82 setPosition( mediaPlayerState.position() );
93 setFullscreen( mediaPlayerState.isFullscreen() ); 83 setFullscreen( mediaPlayerState.isFullscreen() );
94 setPlaying( mediaPlayerState.isPlaying() ); 84 setPlaying( mediaPlayerState.isPlaying() );
95} 85}
96 86
97 87
98VideoWidget::~VideoWidget() 88VideoWidget::~VideoWidget()
99{ 89{
100} 90}
101 91
102MediaWidget::GUIInfo VideoWidget::guiInfo() 92MediaWidget::GUIInfo VideoWidget::guiInfo()
103{ 93{
104 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount ); 94 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount );
105} 95}
106 96
107void VideoWidget::resizeEvent( QResizeEvent *e ) { 97void VideoWidget::resizeEvent( QResizeEvent *e ) {
108 int h = height(); 98 int h = height();
109 int w = width(); 99 int w = width();
110 //int Vh = 160; 100 //int Vh = 160;
111 //int Vw = 220; 101 //int Vw = 220;
112 102
113 slider->setFixedWidth( w - 20 ); 103 slider->setFixedWidth( w - 20 );
114 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 104 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
115 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 105 slider->setBackgroundOrigin( QWidget::ParentOrigin );
116 slider->setFocusPolicy( QWidget::NoFocus ); 106 slider->setFocusPolicy( QWidget::NoFocus );
117 slider->setBackgroundPixmap( backgroundPixmap ); 107 slider->setBackgroundPixmap( backgroundPixmap );
118 108
119 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 109 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
120 if(w>h) 110 if(w>h)
121 upperLeftOfButtonMask.ry() = 0; 111 upperLeftOfButtonMask.ry() = 0;
122 else 112 else
123 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 113 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
124 114
125 MediaWidget::resizeEvent( e ); 115 MediaWidget::resizeEvent( e );
126} 116}
127 117
128void VideoWidget::sliderPressed() { 118void VideoWidget::sliderPressed() {
129 videoSliderBeingMoved = TRUE; 119 videoSliderBeingMoved = TRUE;
130} 120}
131 121
132void VideoWidget::sliderReleased() { 122void VideoWidget::sliderReleased() {
133 videoSliderBeingMoved = FALSE; 123 videoSliderBeingMoved = FALSE;
134 if ( slider->width() == 0 ) { 124 if ( slider->width() == 0 ) {
135 return; 125 return;
136 } 126 }
137 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 127 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
138 mediaPlayerState.setPosition( val ); 128 mediaPlayerState.setPosition( val );
139} 129}
140 130
141void VideoWidget::setPosition( long i ) { 131void VideoWidget::setPosition( long i ) {
142 updateSlider( i, mediaPlayerState.length() ); 132 updateSlider( i, mediaPlayerState.length() );
143} 133}
144 134
145 135
146void VideoWidget::setLength( long max ) { 136void VideoWidget::setLength( long max ) {
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 84bc964..8c6896b 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,89 +1,85 @@
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..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef VIDEO_WIDGET_H 34#ifndef VIDEO_WIDGET_H
35#define VIDEO_WIDGET_H 35#define VIDEO_WIDGET_H
36 36
37#include <qwidget.h>
38#include <qimage.h>
39#include <qpixmap.h>
40#include "xinevideowidget.h" 37#include "xinevideowidget.h"
41
42#include "mediawidget.h" 38#include "mediawidget.h"
43 39
44class QPixmap; 40class QPixmap;
45class QSlider; 41class QSlider;
46 42
47class VideoWidget : public MediaWidget { 43class VideoWidget : public MediaWidget {
48 Q_OBJECT 44 Q_OBJECT
49public: 45public:
50 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 46 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
51 ~VideoWidget(); 47 ~VideoWidget();
52 48
53 static MediaWidget::GUIInfo guiInfo(); 49 static MediaWidget::GUIInfo guiInfo();
54 50
55 XineVideoWidget* vidWidget(); 51 XineVideoWidget* vidWidget();
56public slots: 52public slots:
57 void updateSlider( long, long ); 53 void updateSlider( long, long );
58 void sliderPressed( ); 54 void sliderPressed( );
59 void sliderReleased( ); 55 void sliderReleased( );
60 void setFullscreen( bool b ); 56 void setFullscreen( bool b );
61 virtual void makeVisible(); 57 virtual void makeVisible();
62 void backToNormal(); 58 void backToNormal();
63 void setPosition( long ); 59 void setPosition( long );
64 60
65public: 61public:
66 virtual void setPlaying( bool b); 62 virtual void setPlaying( bool b);
67 virtual void setLength( long ); 63 virtual void setLength( long );
68 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 64 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
69 65
70 virtual void loadSkin(); 66 virtual void loadSkin();
71 67
72signals: 68signals:
73 void moreClicked(); 69 void moreClicked();
74 void lessClicked(); 70 void lessClicked();
75 void sliderMoved( long ); 71 void sliderMoved( long );
76 void videoResized ( const QSize &s ); 72 void videoResized ( const QSize &s );
77 73
78protected: 74protected:
79 75
80 void resizeEvent( QResizeEvent * ); 76 void resizeEvent( QResizeEvent * );
81 void mouseReleaseEvent( QMouseEvent *event ); 77 void mouseReleaseEvent( QMouseEvent *event );
82 void keyReleaseEvent( QKeyEvent *e); 78 void keyReleaseEvent( QKeyEvent *e);
83 79
84private: 80private:
85// Ticker songInfo; 81// Ticker songInfo;
86 82
87 QSlider *slider; 83 QSlider *slider;
88 QImage *currentFrame; 84 QImage *currentFrame;
89 int scaledWidth; 85 int scaledWidth;
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 1c489e3..a392f4a 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,248 +1,248 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39
39#include "xinecontrol.h" 40#include "xinecontrol.h"
40#include "mediaplayerstate.h" 41#include "mediaplayerstate.h"
41#include "xinevideowidget.h" 42#include "xinevideowidget.h"
42 43
43XineControl::XineControl( XineVideoWidget *xineWidget, 44XineControl::XineControl( XineVideoWidget *xineWidget,
44 MediaPlayerState &_mediaPlayerState, 45 MediaPlayerState &_mediaPlayerState,
45 QObject *parent, const char *name ) 46 QObject *parent, const char *name )
46 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 47 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
47{ 48{
48 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); 49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
49 50
50 init(); 51 init();
51} 52}
52 53
53XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
54 MediaPlayerState &_mediaPlayerState, 55 MediaPlayerState &_mediaPlayerState,
55 QObject *parent, const char *name ) 56 QObject *parent, const char *name )
56 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
57{ 58{
58 xine->ensureInitialized(); 59 xine->ensureInitialized();
59 60
60 xine->setWidget( xineWidget ); 61 xine->setWidget( xineWidget );
61 62
62 init(); 63 init();
63} 64}
64 65
65void XineControl::init() 66void XineControl::init()
66{ 67{
67 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 68 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
68 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 69 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
69 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 70 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
70 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 71 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
71 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 72 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
72 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 73 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
73 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 74 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
74 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 75 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
75 76
76 disabledSuspendScreenSaver = FALSE; 77 disabledSuspendScreenSaver = FALSE;
77} 78}
78 79
79XineControl::~XineControl() { 80XineControl::~XineControl() {
80#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 81#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
81 if ( disabledSuspendScreenSaver ) { 82 if ( disabledSuspendScreenSaver ) {
82 disabledSuspendScreenSaver = FALSE; 83 disabledSuspendScreenSaver = FALSE;
83 // Re-enable the suspend mode 84 // Re-enable the suspend mode
84 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 85 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
85 } 86 }
86#endif 87#endif
87 delete libXine; 88 delete libXine;
88} 89}
89 90
90void XineControl::play( const QString& fileName ) { 91void XineControl::play( const QString& fileName ) {
92
91 hasVideoChannel = FALSE; 93 hasVideoChannel = FALSE;
92 hasAudioChannel = FALSE; 94 hasAudioChannel = FALSE;
93 m_fileName = fileName; 95 m_fileName = fileName;
94 96
95 qDebug("<<FILENAME: " + fileName + ">>>>"); 97 qDebug("<<FILENAME: " + fileName + ">>>>");
96 98
97 if ( !libXine->play( fileName, 0, 0 ) ) { 99 if ( !libXine->play( fileName, 0, 0 ) ) {
98 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
99 // toggle stop so the the play button is reset 101 // toggle stop so the the play button is reset
100 mediaPlayerState.setPlaying( false ); 102 mediaPlayerState.setPlaying( false );
101 return; 103 return;
102 } 104 }
103 mediaPlayerState.setPlaying( true ); 105 mediaPlayerState.setPlaying( true );
104 106
105 MediaPlayerState::DisplayType displayType; 107 MediaPlayerState::DisplayType displayType;
106 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
107 if ( !libXine->hasVideo() ) { 108 if ( !libXine->hasVideo() ) {
108 displayType = MediaPlayerState::Audio; 109 displayType = MediaPlayerState::Audio;
109 qDebug("HAS AUDIO"); 110 qDebug("HAS AUDIO");
110 libXine->setShowVideo( false ); 111 libXine->setShowVideo( false );
111 hasAudioChannel = TRUE; 112 hasAudioChannel = TRUE;
112 } else { 113 } else {
113 displayType = MediaPlayerState::Video; 114 displayType = MediaPlayerState::Video;
114 qDebug("HAS VIDEO"); 115 qDebug("HAS VIDEO");
115 libXine->setShowVideo( true ); 116 libXine->setShowVideo( true );
116 hasVideoChannel = TRUE; 117 hasVideoChannel = TRUE;
117 } 118 }
118 // determine if slider is shown 119 // determine if slider is shown
119 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 120 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
120 121
121 // which gui (video / audio) 122 // which gui (video / audio)
122 mediaPlayerState.setDisplayType( displayType ); 123 mediaPlayerState.setDisplayType( displayType );
123 124
124#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 125#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
125 if ( !disabledSuspendScreenSaver ) { 126 if ( !disabledSuspendScreenSaver ) {
126 disabledSuspendScreenSaver = TRUE; 127 disabledSuspendScreenSaver = TRUE;
127 // Stop the screen from blanking and power saving state 128 // Stop the screen from blanking and power saving state
128 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 129 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
129 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 130 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
130 } 131 }
131#endif 132#endif
132 133
133 length(); 134 length();
134 position(); 135 position();
135} 136}
136 137
137void XineControl::nextMedia() { 138void XineControl::nextMedia() {
138 mediaPlayerState.setNext(); 139 mediaPlayerState.setNext();
139} 140}
140 141
141void XineControl::setGamma( int value ) { 142void XineControl::setGamma( int value ) {
142 libXine->setGamma( value ); 143 libXine->setGamma( value );
143} 144}
144 145
145void XineControl::stop( bool isSet ) { 146void XineControl::stop( bool isSet ) {
146 if ( !isSet ) { 147 if ( !isSet ) {
147 libXine->stop(); 148 libXine->stop();
148 149
149#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 150#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
150 if ( disabledSuspendScreenSaver ) { 151 if ( disabledSuspendScreenSaver ) {
151 disabledSuspendScreenSaver = FALSE; 152 disabledSuspendScreenSaver = FALSE;
152 // Re-enable the suspend mode 153 // Re-enable the suspend mode
153 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 154 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
154 } 155 }
155#endif 156#endif
156 } 157 }
157} 158}
158 159
159/** 160/**
160 * Pause playback 161 * Pause playback
161 * @isSet 162 * @isSet
162 */ 163 */
163void XineControl::pause( bool isSet) { 164void XineControl::pause( bool isSet) {
164 libXine->pause( isSet ); 165 libXine->pause( isSet );
165} 166}
166 167
167 168
168/** 169/**
169 * get current time in playback 170 * get current time in playback
170 */ 171 */
171long XineControl::currentTime() { 172long XineControl::currentTime() {
172 // todo: jede sekunde überprüfen 173 // todo: jede sekunde überprüfen
173 m_currentTime = libXine->currentTime(); 174 m_currentTime = libXine->currentTime();
174 return m_currentTime; 175 return m_currentTime;
175 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 176 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
176} 177}
177 178
178/** 179/**
179 * Set the length of the media file 180 * Set the length of the media file
180 */ 181 */
181void XineControl::length() { 182void XineControl::length() {
182 m_length = libXine->length(); 183 m_length = libXine->length();
183 mediaPlayerState.setLength( m_length ); 184 mediaPlayerState.setLength( m_length );
184} 185}
185 186
186 187
187/** 188/**
188 * Reports the position the xine backend is at right now 189 * Reports the position the xine backend is at right now
189 * @return long the postion in seconds 190 * @return long the postion in seconds
190 */ 191 */
191long XineControl::position() { 192long XineControl::position() {
192 m_position = ( currentTime() ); 193 m_position = ( currentTime() );
193 mediaPlayerState.updatePosition( m_position ); 194 mediaPlayerState.updatePosition( m_position );
194 long emitPos = (long)m_position; 195 long emitPos = (long)m_position;
195 emit positionChanged( emitPos ); 196 emit positionChanged( emitPos );
196 if( mediaPlayerState.isPlaying() ) { 197 if( mediaPlayerState.isPlaying() ) {
197 // needs to be stopped the media is stopped 198 // needs to be stopped the media is stopped
198 QTimer::singleShot( 1000, this, SLOT( position() ) ); 199 QTimer::singleShot( 1000, this, SLOT( position() ) );
199 } 200 }
200 // qDebug("POSITION : %d", m_position);
201 return m_position; 201 return m_position;
202} 202}
203 203
204/** 204/**
205 * Set videoplayback to fullscreen 205 * Set videoplayback to fullscreen
206 * @param isSet 206 * @param isSet
207 */ 207 */
208void XineControl::setFullscreen( bool isSet ) { 208void XineControl::setFullscreen( bool isSet ) {
209 libXine->showVideoFullScreen( isSet ); 209 libXine->showVideoFullScreen( isSet );
210} 210}
211 211
212 212
213QString XineControl::getMetaInfo() { 213QString XineControl::getMetaInfo() {
214 214
215 QString returnString; 215 QString returnString;
216 216
217 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 217 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
218 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 218 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
219 } 219 }
220 220
221 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 221 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
222 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 222 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
223 } 223 }
224 224
225 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 225 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
226 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 226 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
227 } 227 }
228 228
229 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 229 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
230 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 230 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
231 } 231 }
232 232
233 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 233 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
234 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 234 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
235 } 235 }
236 236
237 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 237 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
238 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 238 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
239 } 239 }
240 return returnString; 240 return returnString;
241} 241}
242 242
243QString XineControl::getErrorCode() { 243QString XineControl::getErrorCode() {
244 244
245 int errorCode = libXine->error(); 245 int errorCode = libXine->error();
246 246
247 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 247 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
248 248
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 0e985d6..3f44f2e 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,86 +1,85 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#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 <qobject.h>
39 38
40#include "mediaplayerstate.h" 39#include "mediaplayerstate.h"
41 40
42class XineControl : public QObject { 41class XineControl : public QObject {
43 Q_OBJECT 42 Q_OBJECT
44public: 43public:
45 XineControl( XineVideoWidget *xineWidget, 44 XineControl( XineVideoWidget *xineWidget,
46 MediaPlayerState &_mediaPlayerState, 45 MediaPlayerState &_mediaPlayerState,
47 QObject *parent = 0, const char *name =0 ); 46 QObject *parent = 0, const char *name =0 );
48 // note that this constructor takes over ownership of the passed 47 // note that this constructor takes over ownership of the passed
49 // XINE::Lib object. 48 // XINE::Lib object.
50 XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 49 XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
51 MediaPlayerState &_mediaPlayerState, 50 MediaPlayerState &_mediaPlayerState,
52 QObject *parent = 0, const char *name =0 ); 51 QObject *parent = 0, const char *name =0 );
53 ~XineControl(); 52 ~XineControl();
54 53
55 bool hasVideo() const { return hasVideoChannel; } 54 bool hasVideo() const { return hasVideoChannel; }
56 bool hasAudio() const { return hasAudioChannel; } 55 bool hasAudio() const { return hasAudioChannel; }
57 56
58public slots: 57public slots:
59 void play( const QString& fileName ); 58 void play( const QString& fileName );
60 void stop( bool ); 59 void stop( bool );
61 60
62 /** 61 /**
63 * Pause the media stream 62 * Pause the media stream
64 * @param if pause or not 63 * @param if pause or not
65 */ 64 */
66 void pause( bool ); 65 void pause( bool );
67 66
68 /** 67 /**
69 * Set videos fullscreen 68 * Set videos fullscreen
70 * @param yes or no 69 * @param yes or no
71 */ 70 */
72 void setFullscreen( bool ); 71 void setFullscreen( bool );
73 72
74 /** 73 /**
75 * 74 *
76 */ 75 */
77 long currentTime(); 76 long currentTime();
78 void seekTo( long ); 77 void seekTo( long );
79 // get length of media file and set it 78 // get length of media file and set it
80 void length(); 79 void length();
81 long position(); 80 long position();
82 81
83 /** 82 /**
84 * Proceed to the next media file in playlist 83 * Proceed to the next media file in playlist
85 */ 84 */
86 void nextMedia(); 85 void nextMedia();
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb_arm2.c b/noncore/multimedia/opieplayer2/yuv2rgb_arm2.c
new file mode 100644
index 0000000..cbd32e8
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/yuv2rgb_arm2.c
@@ -0,0 +1,875 @@
1/*
2 * yuv2rgb_arm2.c
3 * Copyright (C) 2002 Frederic 'dilb' Boulay.
4 * All Rights Reserved.
5 *
6 * Author: Frederic Boulay <dilb@handhelds.org>
7 *
8 * you can redistribute this file and/or modify
9 * it under the terms of the GNU General Public License (version 2)
10 * as published by the Free Software Foundation.
11 *
12 * This file is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 *
22 * The function defined in this file, are derived from work done in the xine
23 * project.
24 * In order to improve performance, by strongly reducing memory bandwidth
25 * needed, the scaling functions are merged with the yuv2rgb function.
26 */
27
28#ifdef __arm__
29
30#include <stdio.h>
31#include <stdlib.h>
32#include <string.h>
33#include <inttypes.h>
34
35#include "yuv2rgb.h"
36#include <xine/xineutils.h>
37
38/* Prototypes of the "local" functions available here: */
39/* first prototype, function called when no scaling is needed: */
40static void arm_rgb16_noscale(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*);
41/* second prototype, function called when no horizontal scaling is needed: */
42static void arm_rgb16_step_dx_32768(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*);
43/* third prototype, function called when scaling is needed for zooming in: */
44static void arm_rgb16_step_dx_inf_32768(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*);
45/* fourth prototype, function called when scaling is needed for zooming out (between 1x and 2x): */
46static void arm_rgb16_step_dx_bet_32768_65536(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*);
47/* fifth prototype, function called when scaling is needed for zooming out (greater than 2x): */
48static void arm_rgb16_step_dx_sup_65536(yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*);
49/* sixth prototype, function where the decision of the scaling function to use is made.*/
50static void arm_rgb16_2 (yuv2rgb_t*, uint8_t*, uint8_t*, uint8_t*, uint8_t*);
51
52
53
54
55/* extern function: */
56
57/* Function: */
58void yuv2rgb_init_arm (yuv2rgb_factory_t *this)
59/* This function initialise the member yuv2rgb_fun, if everything is right
60the function optimised for the arm target should be used.*/
61 {
62 if (this->swapped)
63 return; /*no swapped pixel output upto now*/
64
65 switch (this->mode)
66 {
67 case MODE_16_RGB:
68 this->yuv2rgb_fun = arm_rgb16_2;
69 break;
70 default:
71 }
72 }
73
74
75
76/* local functions: */
77
78/* Function: */
79static void arm_rgb16_2 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
80/* This function takes care of applying the right scaling conversion
81(yuv2rgb is included in each scaling function!)*/
82 {
83 if (!this->do_scale)
84 {
85 arm_rgb16_noscale(this, _dst, _py, _pu, _pv);
86 return;
87 }
88 if (this->step_dx<32768)
89 {
90 arm_rgb16_step_dx_inf_32768(this, _dst, _py, _pu, _pv);
91 return;
92 }
93 if (this->step_dx==32768)
94 {
95 arm_rgb16_step_dx_32768(this, _dst, _py, _pu, _pv);
96 return;
97 }
98 if (this->step_dx<65536)
99 {
100 arm_rgb16_step_dx_bet_32768_65536(this, _dst, _py, _pu, _pv);
101 return;
102 }
103 arm_rgb16_step_dx_sup_65536(this, _dst, _py, _pu, _pv);
104 return;
105 }
106
107
108/* Function: */
109static void arm_rgb16_noscale(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
110/* This function is called when the source and the destination pictures have the same size.
111 In this case, scaling part is not needed.
112 (This code is probably far from being optimised, in particular, the asm
113 generated is not the most efficient, a pure asm version will probably
114 emerge sooner or later). But at least, this version is faster than what
115 was used before.*/
116 {
117 int height;
118
119 height=this->dest_height;
120
121 while (height>0)
122 {
123 uint16_t *r, *g, *b;
124 uint8_t *py, *py2, *pu, *pv;
125 uint16_t *dst, *dst2;
126 int width;
127 register uint8_t p1y, p1u, p1v;
128
129 height-=2;
130 width=this->dest_width;
131 dst = _dst;
132 dst2 = _dst + this->rgb_stride;
133 py = _py;
134 py2 = _py + this->y_stride;
135 pu = _pu;
136 pv = _pv;
137
138 while (width>0)
139 {
140 width-=2;
141 p1y=*py++;
142 p1u=*pu++;
143 p1v=*pv++;
144
145 r = this->table_rV[p1v];
146 g = (void *) (((uint8_t *)this->table_gU[p1u]) + this->table_gV[p1v]);
147 b = this->table_bU[p1u];
148
149 *dst++ = r[p1y] + g[p1y] + b[p1y];
150 p1y=*py++;
151 *dst++ = r[p1y] + g[p1y] + b[p1y];
152
153 p1y=*py2++;
154
155 *dst2++ = r[p1y] + g[p1y] + b[p1y];
156 p1y=*py2++;
157 *dst2++ = r[p1y] + g[p1y] + b[p1y];
158 }
159 _dst += (this->rgb_stride)<<1;
160 _py += (this->y_stride)<<1;
161 _pu += this->uv_stride;
162 _pv += this->uv_stride;
163 }
164 }
165
166
167/* Function: */
168static void arm_rgb16_step_dx_inf_32768(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
169/* This function is called when the destination picture is bigger than the size
170 of the source picture.
171*/
172 {
173 int recal_uv, height; /* Note about recal_uv: bit0 is for
174applying scale on u and v, bit1 is for increments of u and v pointers.*/
175 int dy;
176
177 dy = 0;
178 height = this->dest_height;
179 recal_uv=1; // 1 for evaluation of scale_line, needed the first time
180
181 while(1)
182 {
183 register int dxy;
184 register int dxuv;
185 register uint8_t p1y, p2y;
186 uint8_t dest1y, dest2y;
187 register uint8_t p1u, p2u;
188 register uint8_t p1v, p2v;
189 uint8_t dest1u;
190 uint8_t dest1v;
191 int width;
192 uint8_t *u_buffer;
193 uint8_t *v_buffer;
194 uint16_t *r, *g, *b;
195 uint8_t *py, *pu, *pv;
196 uint16_t *dst;
197
198 dxy = 0;
199 dxuv = 0;
200 width = this->dest_width;
201 u_buffer=this->u_buffer;
202 v_buffer=this->v_buffer;
203 dst = (uint16_t*)_dst;
204 py = _py;
205 pu = _pu;
206 pv = _pv;
207
208 //proceed with line scaling/conversion
209 if ((recal_uv&1)!=0)
210 {
211 recal_uv^=1; //reset bit0.
212 // init values:
213 p1u = *pu++;
214 p2u = *pu++;
215 p1v = *pv++;
216 p2v = *pv++;
217 p1y = *py++;
218 p2y = *py++;
219
220 //width loop (compute all data for a line).
221 while (width>0)
222 {
223 // proceed with u and v first (ok, and y too finally :)) [scaling part]:
224 // evaluate 1u, 1v, and 2y
225 //block1_uvy
226 dest1u=p1u + ((dxuv*(p2u-p1u))>>15);
227 dest1v=p1v + ((dxuv*(p2v-p1v))>>15);
228 // as u and v are evaluated, better save them now
229 *u_buffer++ = (uint8_t)dest1u;
230 *v_buffer++ = (uint8_t)dest1v;
231
232 dest1y=p1y + ((dxy*(p2y-p1y))>>15);
233
234 dxuv += this->step_dx;
235 dxy += this->step_dx;
236 if (dxuv > 32768)
237 {
238 dxuv -= 32768;
239 p1u = p2u;
240 p2u = *pu++; //idee pour asm, cf cas then, un merge est possible!!!
241 p1v = p2v;
242 p2v = *pv++;
243 }
244 if (dxy > 32768)
245 {
246 dxy -= 32768;
247 p1y = p2y;
248 p2y = *py++;
249 }
250 //end block1_uvy
251
252 //block2_y
253 dest2y=p1y + ((dxy*(p2y-p1y))>>15);
254
255 dxy += this->step_dx;
256 if (dxy > 32768)
257 {
258 dxy -= 32768;
259 p1y = p2y;
260 p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!!
261 }
262 //end block2_y
263
264 // proceed now with YUV2RGB [conversion part]:
265 // u and v are currently in dest1u and dest1v
266 // the 2 y are in dest1y and dest2y.
267 // RGB(0),DST1(0), RGB(1), DST1(1)
268 r = this->table_rV[dest1v];
269 g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]);
270 b = this->table_bU[dest1u];
271
272 *dst++ = r[dest1y] + g[dest1y] + b[dest1y];
273 *dst++ = r[dest2y] + g[dest2y] + b[dest2y];
274
275 width -=2;
276 }
277 }
278 else
279 {
280 // this case is simple, u and v are already evaluated,
281 // Note pour moi: r, g et b pourraient etre reutilises!!
282
283 // init values:
284 p1y = *py++;
285 p2y = *py++;
286
287 //width loop (compute all data for a line).
288 while (width>0)
289 {
290 // proceed with y [scaling part]:
291 // evaluate 2y
292 //block1_y
293 dest1y=p1y + ((dxy*(p2y-p1y))>>15);
294
295 dxy += this->step_dx;
296 if (dxy > 32768)
297 {
298 dxy -= 32768;
299 p1y = p2y;
300 p2y = *py++;
301 }
302 //end block1_uvy
303
304 //block2_y
305 dest2y=p1y + ((dxy*(p2y-p1y))>>15);
306
307 dxy += this->step_dx;
308 if (dxy > 32768)
309 {
310 dxy -= 32768;
311 p1y = p2y;
312 p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!!
313 }
314 //end block2_y
315
316 // proceed now with YUV2RGB [conversion part]:
317 // u and v are currently in dest1u and dest1v
318 // the 2 y are in dest1y and dest2y.
319 // RGB(0),DST1(0)
320 dest1u=*u_buffer++;
321 dest1v=*v_buffer++;
322 r = this->table_rV[dest1v];
323 g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]);
324 b = this->table_bU[dest1u];
325
326 *dst++ = r[dest1y] + g[dest1y] + b[dest1y];
327 *dst++ = r[dest2y] + g[dest2y] + b[dest2y];
328
329 width -=2;
330 }
331 }
332 // end of line scaling/conversion
333 dy += this->step_dy;
334 _dst += this->rgb_stride;
335
336 while (--height > 0 && dy < 32768)
337 {
338 xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast!
339 dy += this->step_dy;
340 _dst += this->rgb_stride;
341 }
342
343
344 if (height <= 0)
345 break;
346
347 do
348 {
349 dy -= 32768;
350 _py += this->y_stride;
351
352 recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/
353
354 if ((recal_uv&2)==0)
355 {
356 _pu += this->uv_stride;
357 _pv += this->uv_stride;
358 recal_uv|=1; // if update, then reevaluate scanline!
359 }
360 }
361 while( dy>=32768);
362 }
363 }
364
365
366
367/* Function: */
368static void arm_rgb16_step_dx_32768(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
369/* This function is called when the widht of the destination picture is the
370 same as the size of the source picture.
371*/
372 {
373 int recal_uv, height;
374 int dy;
375
376 dy = 0;
377 height=this->dest_height;
378 recal_uv=0;
379
380 while (1)
381 {
382 uint16_t *r, *g, *b;
383 uint8_t *py, *pu, *pv;
384 uint16_t *dst;
385 int width;
386 register uint8_t p1y, p1u, p1v;
387
388 width=this->dest_width;
389 dst = (uint16_t*)_dst;
390 py = _py;
391 pu = _pu;
392 pv = _pv;
393
394 while (width>0)
395 {
396 width-=2;
397 p1y=*py++;
398 p1u=*pu++;
399 p1v=*pv++;
400
401 r = this->table_rV[p1v];
402 g = (void *) (((uint8_t *)this->table_gU[p1u]) + this->table_gV[p1v]);
403 b = this->table_bU[p1u];
404
405 *dst++ = r[p1y] + g[p1y] + b[p1y];
406 p1y=*py++;
407 *dst++ = r[p1y] + g[p1y] + b[p1y];
408 }
409
410
411
412 // end of line scaling/conversion
413 dy += this->step_dy;
414 _dst += this->rgb_stride;
415
416 while (--height > 0 && dy < 32768)
417 {
418 xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast!
419 dy += this->step_dy;
420 _dst += this->rgb_stride;
421 }
422
423
424 if (height <= 0)
425 break;
426
427 do
428 {
429 dy -= 32768;
430 _py += this->y_stride;
431
432 recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/
433
434 if ((recal_uv&2)==0)
435 {
436 _pu += this->uv_stride;
437 _pv += this->uv_stride;
438 recal_uv|=1; // if update, then reevaluate scanline!
439 }
440 }
441 while( dy>=32768);
442 }
443 }
444
445
446
447/* Function: */
448static void arm_rgb16_step_dx_bet_32768_65536(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
449/* This function is called when the destination picture is between the size
450 of the source picture, and half its size.
451*/
452 {
453 int recal_uv, height; /* Note about recal_uv: bit0 is for
454applying scale on u and v, bit1 is for increments of u and v pointers.*/
455 int dy;
456
457 dy = 0;
458 height = this->dest_height;
459 recal_uv=1; // 1 for evaluation of scale_line, needed the first time
460
461 while(1)
462 {
463 register int dxy;
464 register int dxuv;
465 register uint8_t p1y, p2y;
466 uint8_t dest1y, dest2y;
467 register uint8_t p1u, p2u;
468 register uint8_t p1v, p2v;
469 uint8_t dest1u;
470 uint8_t dest1v;
471 int width;
472 uint8_t *u_buffer;
473 uint8_t *v_buffer;
474 uint16_t *r, *g, *b;
475 uint8_t *py, *pu, *pv;
476 uint16_t *dst;
477
478 dxy = 0;
479 dxuv = 0;
480 width = this->dest_width;
481 u_buffer=this->u_buffer;
482 v_buffer=this->v_buffer;
483 dst = (uint16_t*)_dst;
484 py = _py;
485 pu = _pu;
486 pv = _pv;
487
488 //proceed with line scaling/conversion
489 if ((recal_uv&1)!=0)
490 {
491 recal_uv^=1; //reset bit0.
492 // init values:
493 p1u = *pu++;
494 p2u = *pu++;
495 p1v = *pv++;
496 p2v = *pv++;
497 p1y = *py++;
498 p2y = *py++;
499
500 //width loop (compute all data for a line).
501 while (width>0)
502 {
503 // proceed with u and v first (ok, and y too finally :)) [scaling part]:
504 // evaluate 1u, 1v, and 2y
505 //block1_uvy
506 dest1u=p1u + ((dxuv*(p2u-p1u))>>15);
507 dest1v=p1v + ((dxuv*(p2v-p1v))>>15);
508 // as u and v are evaluated, better save them now
509 *u_buffer++ = (uint8_t)dest1u;
510 *v_buffer++ = (uint8_t)dest1v;
511
512 dest1y=p1y + ((dxy*(p2y-p1y))>>15);
513
514 dxuv += this->step_dx;
515 dxy += this->step_dx;
516 if (dxuv > 65536)
517 {
518 dxuv -= 65536;
519 p1u = *pu++;
520 p2u = *pu++;
521 p1v = *pv++;
522 p2v = *pv++;
523 }
524 else
525 {
526 dxuv -= 32768;
527 p1u = p2u;
528 p2u = *pu++; //idee pour asm, cf cas then, un merge est possible!!!
529 p1v = p2v;
530 p2v = *pv++;
531 }
532 if (dxy > 65536)
533 {
534 dxy -= 65536;
535 p1y = *py++;
536 p2y = *py++;
537 }
538 else
539 {
540 dxy -= 32768;
541 p1y = p2y;
542 p2y = *py++;
543 }
544 //end block1_uvy
545
546 //block2_y
547 dest2y=p1y + ((dxy*(p2y-p1y))>>15);
548
549 dxy += this->step_dx;
550 if (dxy > 65536)
551 {
552 dxy -= 65536;
553 p1y = *py++;
554 p2y = *py++;
555 }
556 else
557 {
558 dxy -= 32768;
559 p1y = p2y;
560 p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!!
561 }
562 //end block2_y
563
564 // proceed now with YUV2RGB [conversion part]:
565 // u and v are currently in dest1u and dest1v
566 // the 2 y are in dest1y and dest2y.
567 // RGB(0),DST1(0), RGB(1), DST1(1)
568 r = this->table_rV[dest1v];
569 g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]);
570 b = this->table_bU[dest1u];
571
572 *dst++ = r[dest1y] + g[dest1y] + b[dest1y];
573 *dst++ = r[dest2y] + g[dest2y] + b[dest2y];
574
575 width -=2;
576 }
577 }
578 else
579 {
580 // this case is simple, u and v are already evaluated,
581 // Note pour moi: r, g et b pourraient etre reutilises!!
582
583 // init values:
584 p1y = *py++;
585 p2y = *py++;
586
587 //width loop (compute all data for a line).
588 while (width>0)
589 {
590 // proceed with y [scaling part]:
591 // evaluate 2y
592 //block1_y
593 dest1y=p1y + ((dxy*(p2y-p1y))>>15);
594
595 dxy += this->step_dx;
596 if (dxy > 65536)
597 {
598 dxy -= 65536;
599 p1y = *py++;
600 p2y = *py++;
601 }
602 else
603 {
604 dxy -= 32768;
605 p1y = p2y;
606 p2y = *py++;
607 }
608 //end block1_uvy
609
610 //block2_y
611 dest2y=p1y + ((dxy*(p2y-p1y))>>15);
612
613 dxy += this->step_dx;
614 if (dxy > 65536)
615 {
616 dxy -= 65536;
617 p1y = *py++;
618 p2y = *py++;
619 }
620 else
621 {
622 dxy -= 32768;
623 p1y = p2y;
624 p2y = *py++; // idee pour asm, cf cas then, un merge est possible!!!
625 }
626 //end block2_y
627
628 // proceed now with YUV2RGB [conversion part]:
629 // u and v are currently in dest1u and dest1v
630 // the 2 y are in dest1y and dest2y.
631 // RGB(0),DST1(0)
632 dest1u=*u_buffer++;
633 dest1v=*v_buffer++;
634 r = this->table_rV[dest1v];
635 g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]);
636 b = this->table_bU[dest1u];
637
638 *dst++ = r[dest1y] + g[dest1y] + b[dest1y];
639 *dst++ = r[dest2y] + g[dest2y] + b[dest2y];
640
641 width -=2;
642 }
643 }
644 // end of line scaling/conversion
645 dy += this->step_dy;
646 _dst += this->rgb_stride;
647
648 while (--height > 0 && dy < 32768)
649 {
650 xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast!
651 dy += this->step_dy;
652 _dst += this->rgb_stride;
653 }
654
655
656 if (height <= 0)
657 break;
658
659 do
660 {
661 dy -= 32768;
662 _py += this->y_stride;
663
664 recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/
665
666 if ((recal_uv&2)==0)
667 {
668 _pu += this->uv_stride;
669 _pv += this->uv_stride;
670 recal_uv|=1; // if update, then reevaluate scanline!
671 }
672 }
673 while( dy>=32768);
674 }
675 }
676
677
678
679/* Function: */
680static void arm_rgb16_step_dx_sup_65536(yuv2rgb_t *this, uint8_t * _dst, uint8_t * _py, uint8_t * _pu, uint8_t * _pv)
681/* This function is called when the destination picture is smaller than half
682 the size of the source picture, and half its size.
683*/
684 {
685 int recal_uv, height; /* Note about recal_uv: bit0 is for
686applying scale on u and v, bit1 is for increments of u and v pointers.*/
687 int dy;
688
689 dy = 0;
690 height = this->dest_height;
691 recal_uv=1; // 1 for evaluation of scale_line, needed the first time
692
693 while(1)
694 {
695 register int dxy;
696 register int dxuv;
697 int offdxy, offdxuv;
698 register uint8_t p1y, p2y;
699 uint8_t dest1y, dest2y;
700 register uint8_t p1u, p2u;
701 register uint8_t p1v, p2v;
702 uint8_t dest1u;
703 uint8_t dest1v;
704 int width;
705 uint8_t *u_buffer;
706 uint8_t *v_buffer;
707 uint16_t *r, *g, *b;
708 uint8_t *py, *pu, *pv;
709 uint16_t *dst;
710
711 dxy = 0;
712 dxuv = 0;
713 width = this->dest_width;
714 u_buffer=this->u_buffer;
715 v_buffer=this->v_buffer;
716 dst = (uint16_t*)_dst;
717 py = _py;
718 pu = _pu;
719 pv = _pv;
720
721 //proceed with line scaling/conversion
722 if ((recal_uv&1)!=0)
723 {
724 recal_uv^=1; //reset bit0.
725 // init values:
726 p1u = *pu++;
727 p2u = *pu++;
728 p1v = *pv++;
729 p2v = *pv++;
730 p1y = *py++;
731 p2y = *py++;
732
733 //width loop (compute all data for a line).
734 while (width>0)
735 {
736 // proceed with u and v first (ok, and y too finally :)) [scaling part]:
737 // evaluate 1u, 1v, and 2y
738 //block1_uvy
739 dest1u=p1u + ((dxuv*(p2u-p1u))>>15);
740 dest1v=p1v + ((dxuv*(p2v-p1v))>>15);
741 // as u and v are evaluated, better save them now
742 *u_buffer++ = (uint8_t)dest1u;
743 *v_buffer++ = (uint8_t)dest1v;
744
745 dest1y=p1y + ((dxy*(p2y-p1y))>>15);
746
747 dxuv += this->step_dx;
748 dxy += this->step_dx;
749
750 offdxuv=((dxuv-1)>>15);
751 dxuv-=offdxuv<<15;
752 pu+=offdxuv-2;
753 pv+=offdxuv-2;
754 p1u = *pu++;
755 p2u = *pu++;
756 p1v = *pv++;
757 p2v = *pv++;
758 offdxy=((dxy-1)>>15);
759 dxy-=offdxy<<15;
760 py+=offdxy-2;
761 p1y = *py++;
762 p2y = *py++;
763
764 //block2_y
765 dest2y=p1y + ((dxy*(p2y-p1y))>>15);
766
767 dxy += this->step_dx;
768 offdxy=((dxy-1)>>15);
769 dxy-=offdxy<<15;
770 py+=offdxy-2;
771 p1y = *py++;
772 p2y = *py++;
773
774 // proceed now with YUV2RGB [conversion part]:
775 // u and v are currently in dest1u and dest1v
776 // the 2 y are in dest1y and dest2y.
777 // RGB(0),DST1(0), RGB(1), DST1(1)
778 r = this->table_rV[dest1v];
779 g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]);
780 b = this->table_bU[dest1u];
781
782 *dst++ = r[dest1y] + g[dest1y] + b[dest1y];
783 *dst++ = r[dest2y] + g[dest2y] + b[dest2y];
784
785 width -=2;
786 }
787 }
788 else
789 {
790 // this case is simple, u and v are already evaluated,
791 // Note pour moi: r, g et b pourraient etre reutilises!!
792
793 // init values:
794 p1y = *py++;
795 p2y = *py++;
796
797 //width loop (compute all data for a line).
798 while (width>0)
799 {
800 // proceed with y [scaling part]:
801 // evaluate 2y
802 //block1_y
803 dest1y=p1y + ((dxy*(p2y-p1y))>>15);
804
805 dxy += this->step_dx;
806 offdxy=((dxy-1)>>15);
807 dxy-=offdxy<<15;
808 py+=offdxy-2;
809 p1y = *py++;
810 p2y = *py++;
811
812 //end block1_uvy
813
814 //block2_y
815 dest2y=p1y + ((dxy*(p2y-p1y))>>15);
816
817 dxy += this->step_dx;
818 offdxy=((dxy-1)>>15);
819 dxy-=offdxy<<15;
820 py+=offdxy-2;
821 p1y = *py++;
822 p2y = *py++;
823 //end block2_y
824
825 // proceed now with YUV2RGB [conversion part]:
826 // u and v are currently in dest1u and dest1v
827 // the 2 y are in dest1y and dest2y.
828 // RGB(0),DST1(0)
829 dest1u=*u_buffer++;
830 dest1v=*v_buffer++;
831 r = this->table_rV[dest1v];
832 g = (void *) (((uint8_t *)this->table_gU[dest1u]) + this->table_gV[dest1v]);
833 b = this->table_bU[dest1u];
834
835 *dst++ = r[dest1y] + g[dest1y] + b[dest1y];
836 *dst++ = r[dest2y] + g[dest2y] + b[dest2y];
837
838 width -=2;
839 }
840 }
841 // end of line scaling/conversion
842 dy += this->step_dy;
843 _dst += this->rgb_stride;
844
845 while (--height > 0 && dy < 32768)
846 {
847 xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); // *2 because of int8 cast!
848 dy += this->step_dy;
849 _dst += this->rgb_stride;
850 }
851
852
853 if (height <= 0)
854 break;
855
856 do
857 {
858 dy -= 32768;
859 _py += this->y_stride;
860
861 recal_uv^=2; /*bit 0 for reevaluation of scanline, bit 1 for offset.*/
862
863 if ((recal_uv&2)==0)
864 {
865 _pu += this->uv_stride;
866 _pv += this->uv_stride;
867 recal_uv|=1; // if update, then reevaluate scanline!
868 }
869 }
870 while( dy>=32768);
871 }
872 }
873
874
875#endif