Diffstat (limited to 'core/multimedia/opieplayer/mediaplayerstate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/mediaplayerstate.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 13741f6..a960c49 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp | |||
@@ -14,28 +14,29 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/qlibrary.h> | 21 | #include <qpe/qlibrary.h> |
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qvaluelist.h> | 23 | #include <qvaluelist.h> |
24 | #include <qobject.h> | 24 | #include <qobject.h> |
25 | #include <qdir.h> | 25 | #include <qdir.h> |
26 | #include "mediaplayerplugininterface.h" | 26 | #include <qpe/mediaplayerplugininterface.h> |
27 | #include "mediaplayerstate.h" | 27 | #include "mediaplayerstate.h" |
28 | 28 | ||
29 | 29 | ||
30 | |||
30 | #ifdef QT_NO_COMPONENT | 31 | #ifdef QT_NO_COMPONENT |
31 | // Plugins which are compiled in when no plugin architecture available | 32 | // Plugins which are compiled in when no plugin architecture available |
32 | #include "libmad/libmadpluginimpl.h" | 33 | #include "libmad/libmadpluginimpl.h" |
33 | #include "libmpeg3/libmpeg3pluginimpl.h" | 34 | #include "libmpeg3/libmpeg3pluginimpl.h" |
34 | #include "wavplugin/wavpluginimpl.h" | 35 | #include "wavplugin/wavpluginimpl.h" |
35 | #endif | 36 | #endif |
36 | 37 | ||
37 | 38 | ||
38 | //#define MediaPlayerDebug(x) qDebug x | 39 | //#define MediaPlayerDebug(x) qDebug x |
39 | #define MediaPlayerDebug(x) | 40 | #define MediaPlayerDebug(x) |
40 | 41 | ||
41 | 42 | ||
@@ -51,24 +52,25 @@ MediaPlayerState::~MediaPlayerState() { | |||
51 | Config cfg( "MediaPlayer" ); | 52 | Config cfg( "MediaPlayer" ); |
52 | writeConfig( cfg ); | 53 | writeConfig( cfg ); |
53 | } | 54 | } |
54 | 55 | ||
55 | 56 | ||
56 | void MediaPlayerState::readConfig( Config& cfg ) { | 57 | void MediaPlayerState::readConfig( Config& cfg ) { |
57 | cfg.setGroup("Options"); | 58 | cfg.setGroup("Options"); |
58 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); | 59 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); |
59 | isScaled = cfg.readBoolEntry( "Scaling" ); | 60 | isScaled = cfg.readBoolEntry( "Scaling" ); |
60 | isLooping = cfg.readBoolEntry( "Looping" ); | 61 | isLooping = cfg.readBoolEntry( "Looping" ); |
61 | isShuffled = cfg.readBoolEntry( "Shuffle" ); | 62 | isShuffled = cfg.readBoolEntry( "Shuffle" ); |
62 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | 63 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); |
64 | usePlaylist = TRUE; | ||
63 | isPlaying = FALSE; | 65 | isPlaying = FALSE; |
64 | isPaused = FALSE; | 66 | isPaused = FALSE; |
65 | curPosition = 0; | 67 | curPosition = 0; |
66 | curLength = 0; | 68 | curLength = 0; |
67 | curView = 'l'; | 69 | curView = 'l'; |
68 | } | 70 | } |
69 | 71 | ||
70 | 72 | ||
71 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 73 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
72 | cfg.setGroup("Options"); | 74 | cfg.setGroup("Options"); |
73 | cfg.writeEntry("FullScreen", isFullscreen ); | 75 | cfg.writeEntry("FullScreen", isFullscreen ); |
74 | cfg.writeEntry("Scaling", isScaled ); | 76 | cfg.writeEntry("Scaling", isScaled ); |
@@ -112,47 +114,46 @@ MediaPlayerDecoder *MediaPlayerState::curDecoder() { | |||
112 | 114 | ||
113 | // ### hack to get true sample count | 115 | // ### hack to get true sample count |
114 | MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { | 116 | MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { |
115 | return libmpeg3decoder; | 117 | return libmpeg3decoder; |
116 | } | 118 | } |
117 | 119 | ||
118 | // ### hack to get true sample count | 120 | // ### hack to get true sample count |
119 | // MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { | 121 | // MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { |
120 | // return libwavdecoder; | 122 | // return libwavdecoder; |
121 | // } | 123 | // } |
122 | 124 | ||
123 | void MediaPlayerState::loadPlugins() { | 125 | void MediaPlayerState::loadPlugins() { |
124 | 126 | qDebug("load plugins"); | |
125 | #ifndef QT_NO_COMPONENT | 127 | #ifndef QT_NO_COMPONENT |
126 | QValueList<MediaPlayerPlugin>::Iterator mit; | 128 | QValueList<MediaPlayerPlugin>::Iterator mit; |
127 | for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { | 129 | for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { |
128 | (*mit).iface->release(); | 130 | (*mit).iface->release(); |
129 | (*mit).library->unload(); | 131 | (*mit).library->unload(); |
130 | delete (*mit).library; | 132 | delete (*mit).library; |
131 | } | 133 | } |
132 | pluginList.clear(); | 134 | pluginList.clear(); |
133 | 135 | ||
134 | QString path = QPEApplication::qpeDir() + "/plugins/codecs"; | 136 | QString path = QPEApplication::qpeDir() + "/plugins/codecs"; |
135 | QDir dir( path, "lib*.so" ); | 137 | QDir dir( path, "lib*.so" ); |
136 | QStringList list = dir.entryList(); | 138 | QStringList list = dir.entryList(); |
137 | QStringList::Iterator it; | 139 | QStringList::Iterator it; |
138 | for ( it = list.begin(); it != list.end(); ++it ) { | 140 | for ( it = list.begin(); it != list.end(); ++it ) { |
139 | MediaPlayerPluginInterface *iface = 0; | 141 | MediaPlayerPluginInterface *iface = 0; |
140 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 142 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
141 | 143 | // qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | |
142 | MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() )); | ||
143 | 144 | ||
144 | if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { | 145 | if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { |
145 | 146 | ||
146 | MediaPlayerDebug(( "loading: %s", QString( path + "/" + *it ).latin1() )); | 147 | // qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); |
147 | 148 | ||
148 | MediaPlayerPlugin plugin; | 149 | MediaPlayerPlugin plugin; |
149 | plugin.library = lib; | 150 | plugin.library = lib; |
150 | plugin.iface = iface; | 151 | plugin.iface = iface; |
151 | plugin.decoder = plugin.iface->decoder(); | 152 | plugin.decoder = plugin.iface->decoder(); |
152 | plugin.encoder = plugin.iface->encoder(); | 153 | plugin.encoder = plugin.iface->encoder(); |
153 | pluginList.append( plugin ); | 154 | pluginList.append( plugin ); |
154 | 155 | ||
155 | // ### hack to get true sample count | 156 | // ### hack to get true sample count |
156 | if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") ) | 157 | if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") ) |
157 | libmpeg3decoder = plugin.decoder; | 158 | libmpeg3decoder = plugin.decoder; |
158 | 159 | ||