author | harlekin <harlekin> | 2002-09-04 10:27:35 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-04 10:27:35 (UTC) |
commit | 04da91b7a4451366cb005c1e2bb4f649283cc7f9 (patch) (unidiff) | |
tree | cb3a963e49adf96fa90e5a042ba0e411819d56c0 | |
parent | ab38f9c573c39be3c5ea909dd4eafed319fa9dff (diff) | |
download | opie-04da91b7a4451366cb005c1e2bb4f649283cc7f9.zip opie-04da91b7a4451366cb005c1e2bb4f649283cc7f9.tar.gz opie-04da91b7a4451366cb005c1e2bb4f649283cc7f9.tar.bz2 |
do not go to playlist in between 2 audio streams
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index d18fde5..0137ae5 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -32,154 +32,146 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qpe/qcopenvelope_qws.h> | 36 | #include <qpe/qcopenvelope_qws.h> |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include "xinecontrol.h" | 38 | #include "xinecontrol.h" |
39 | #include "mediaplayerstate.h" | 39 | #include "mediaplayerstate.h" |
40 | #include "videowidget.h" | 40 | #include "videowidget.h" |
41 | 41 | ||
42 | extern MediaPlayerState *mediaPlayerState; | 42 | extern MediaPlayerState *mediaPlayerState; |
43 | extern VideoWidget *videoUI; | 43 | extern VideoWidget *videoUI; |
44 | XineControl::XineControl( QObject *parent, const char *name ) | 44 | XineControl::XineControl( QObject *parent, const char *name ) |
45 | : QObject( parent, name ) { | 45 | : QObject( parent, name ) { |
46 | libXine = new XINE::Lib(videoUI->vidWidget() ); | 46 | libXine = new XINE::Lib(videoUI->vidWidget() ); |
47 | 47 | ||
48 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); | 48 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); |
49 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 49 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
50 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 50 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
52 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 52 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
53 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 53 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
54 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 54 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
55 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 55 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
56 | 56 | ||
57 | disabledSuspendScreenSaver = FALSE; | 57 | disabledSuspendScreenSaver = FALSE; |
58 | } | 58 | } |
59 | 59 | ||
60 | XineControl::~XineControl() { | 60 | XineControl::~XineControl() { |
61 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 61 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
62 | if ( disabledSuspendScreenSaver ) { | 62 | if ( disabledSuspendScreenSaver ) { |
63 | disabledSuspendScreenSaver = FALSE; | 63 | disabledSuspendScreenSaver = FALSE; |
64 | // Re-enable the suspend mode | 64 | // Re-enable the suspend mode |
65 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 65 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
66 | } | 66 | } |
67 | #endif | 67 | #endif |
68 | delete libXine; | 68 | delete libXine; |
69 | } | 69 | } |
70 | 70 | ||
71 | void XineControl::play( const QString& fileName ) { | 71 | void XineControl::play( const QString& fileName ) { |
72 | hasVideoChannel=FALSE; | 72 | hasVideoChannel=FALSE; |
73 | hasAudioChannel=FALSE; | 73 | hasAudioChannel=FALSE; |
74 | m_fileName = fileName; | 74 | m_fileName = fileName; |
75 | 75 | ||
76 | //qDebug("<<FILENAME: " + fileName + ">>>>"); | 76 | //qDebug("<<FILENAME: " + fileName + ">>>>"); |
77 | 77 | ||
78 | libXine->play( fileName ); | 78 | libXine->play( fileName ); |
79 | mediaPlayerState->setPlaying( true ); | 79 | mediaPlayerState->setPlaying( true ); |
80 | // default to audio view until we know how to handle video | ||
81 | // MediaDetect mdetect; | ||
82 | char whichGui = mdetect.videoOrAudio( fileName ); | 80 | char whichGui = mdetect.videoOrAudio( fileName ); |
83 | if (whichGui == 'f') { | 81 | if (whichGui == 'f') { |
84 | qDebug("Nicht erkannter Dateityp"); | 82 | qDebug("Nicht erkannter Dateityp"); |
85 | return; | 83 | return; |
86 | } | 84 | } |
87 | |||
88 | if (whichGui == 'a') { | 85 | if (whichGui == 'a') { |
89 | libXine->setShowVideo( false ); | 86 | libXine->setShowVideo( false ); |
90 | hasAudioChannel=TRUE; | 87 | hasAudioChannel=TRUE; |
91 | } else { | 88 | } else { |
92 | libXine->setShowVideo( true ); | 89 | libXine->setShowVideo( true ); |
93 | hasVideoChannel=TRUE; | 90 | hasVideoChannel=TRUE; |
94 | } | 91 | } |
95 | |||
96 | // determine if slider is shown | 92 | // determine if slider is shown |
97 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); | 93 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); |
98 | // which gui (video / audio) | 94 | // which gui (video / audio) |
99 | mediaPlayerState->setView( whichGui ); | 95 | mediaPlayerState->setView( whichGui ); |
100 | 96 | ||
101 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 97 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
102 | if ( !disabledSuspendScreenSaver ) { | 98 | if ( !disabledSuspendScreenSaver ) { |
103 | disabledSuspendScreenSaver = TRUE; | 99 | disabledSuspendScreenSaver = TRUE; |
104 | // Stop the screen from blanking and power saving state | 100 | // Stop the screen from blanking and power saving state |
105 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) | 101 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) |
106 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 102 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
107 | } | 103 | } |
108 | #endif | 104 | #endif |
109 | 105 | ||
110 | length(); | 106 | length(); |
111 | position(); | 107 | position(); |
112 | } | 108 | } |
113 | 109 | ||
114 | void XineControl::nextMedia() { | 110 | void XineControl::nextMedia() { |
115 | mediaPlayerState->setNext(); | 111 | mediaPlayerState->setNext(); |
116 | } | 112 | } |
117 | 113 | ||
118 | void XineControl::setGamma( int value ) { | 114 | void XineControl::setGamma( int value ) { |
119 | libXine->setGamma( value ); | 115 | libXine->setGamma( value ); |
120 | } | 116 | } |
121 | 117 | ||
122 | void XineControl::stop( bool isSet ) { | 118 | void XineControl::stop( bool isSet ) { |
123 | if ( !isSet) { | 119 | if ( !isSet) { |
124 | libXine->stop( ); | 120 | libXine->stop( ); |
125 | mediaPlayerState->setList(); | ||
126 | // mediaPlayerState->setPlaying( false ); | ||
127 | 121 | ||
128 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 122 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
129 | if ( disabledSuspendScreenSaver ) { | 123 | if ( disabledSuspendScreenSaver ) { |
130 | disabledSuspendScreenSaver = FALSE; | 124 | disabledSuspendScreenSaver = FALSE; |
131 | // Re-enable the suspend mode | 125 | // Re-enable the suspend mode |
132 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 126 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
133 | } | 127 | } |
134 | #endif | 128 | #endif |
135 | 129 | ||
136 | } else { | ||
137 | // play again | ||
138 | } | 130 | } |
139 | } | 131 | } |
140 | 132 | ||
141 | /** | 133 | /** |
142 | * Pause playback | 134 | * Pause playback |
143 | * @isSet | 135 | * @isSet |
144 | */ | 136 | */ |
145 | void XineControl::pause( bool isSet) { | 137 | void XineControl::pause( bool isSet) { |
146 | if (isSet) { | 138 | if (isSet) { |
147 | libXine->pause(); | 139 | libXine->pause(); |
148 | } else { | 140 | } else { |
149 | libXine->play( m_fileName, 0, m_currentTime); | 141 | libXine->play( m_fileName, 0, m_currentTime); |
150 | } | 142 | } |
151 | } | 143 | } |
152 | 144 | ||
153 | 145 | ||
154 | /** | 146 | /** |
155 | * get current time in playback | 147 | * get current time in playback |
156 | */ | 148 | */ |
157 | long XineControl::currentTime() { | 149 | long XineControl::currentTime() { |
158 | // todo: jede sekunde überprüfen | 150 | // todo: jede sekunde überprüfen |
159 | m_currentTime = libXine->currentTime(); | 151 | m_currentTime = libXine->currentTime(); |
160 | return m_currentTime; | 152 | return m_currentTime; |
161 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); | 153 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); |
162 | } | 154 | } |
163 | 155 | ||
164 | /** | 156 | /** |
165 | * Set the length of the media file | 157 | * Set the length of the media file |
166 | */ | 158 | */ |
167 | void XineControl::length() { | 159 | void XineControl::length() { |
168 | m_length = libXine->length(); | 160 | m_length = libXine->length(); |
169 | mediaPlayerState->setLength( m_length ); | 161 | mediaPlayerState->setLength( m_length ); |
170 | } | 162 | } |
171 | 163 | ||
172 | 164 | ||
173 | /** | 165 | /** |
174 | * Reports the position the xine backend is at right now | 166 | * Reports the position the xine backend is at right now |
175 | * @return long the postion in seconds | 167 | * @return long the postion in seconds |
176 | */ | 168 | */ |
177 | long XineControl::position() { | 169 | long XineControl::position() { |
178 | m_position = ( currentTime() ); | 170 | m_position = ( currentTime() ); |
179 | mediaPlayerState->updatePosition( m_position ); | 171 | mediaPlayerState->updatePosition( m_position ); |
180 | long emitPos = (long)m_position; | 172 | long emitPos = (long)m_position; |
181 | emit positionChanged( emitPos ); | 173 | emit positionChanged( emitPos ); |
182 | if(mediaPlayerState->isPlaying) | 174 | if(mediaPlayerState->isPlaying) |
183 | // needs to be stopped the media is stopped | 175 | // needs to be stopped the media is stopped |
184 | QTimer::singleShot( 1000, this, SLOT( position() ) ); | 176 | QTimer::singleShot( 1000, this, SLOT( position() ) ); |
185 | // qDebug("POSITION : %d", m_position); | 177 | // qDebug("POSITION : %d", m_position); |