summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/mediaplayerstate.cpp
authorar <ar>2004-05-02 17:04:41 (UTC)
committer ar <ar>2004-05-02 17:04:41 (UTC)
commit4d3379027557e251201b531896974a69ae4c665a (patch) (unidiff)
tree6e813be1aa29131f8f8e91f532f38f8a381e38f4 /core/multimedia/opieplayer/mediaplayerstate.cpp
parentf8add41b2e0b0371754521b44d95f87fa70a6ff2 (diff)
downloadopie-4d3379027557e251201b531896974a69ae4c665a.zip
opie-4d3379027557e251201b531896974a69ae4c665a.tar.gz
opie-4d3379027557e251201b531896974a69ae4c665a.tar.bz2
- convert qDebug to odebug
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayerstate.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index 5bfb87e..b700cd1 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -1,59 +1,63 @@
1/********************************************************************** 1/**********************************************************************
2 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 2 ** Copyright (C) 2000 Trolltech AS. All rights reserved.
3 ** 3 **
4 ** This file is part of Qtopia Environment. 4 ** This file is part of Qtopia Environment.
5 ** 5 **
6 ** This file may be distributed and/or modified under the terms of the 6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software 7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the 8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file. 9 ** packaging of this file.
10 ** 10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 ** 13 **
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>
21#include <qpe/qlibrary.h>
22#include <qpe/config.h>
23#include <qdir.h>
24#include <qpe/mediaplayerplugininterface.h>
25#include "mediaplayerstate.h"
26
27
28 20
29#ifdef QT_NO_COMPONENT 21#ifdef QT_NO_COMPONENT
30// Plugins which are compiled in when no plugin architecture available 22// Plugins which are compiled in when no plugin architecture available
31#include "libmad/libmadpluginimpl.h" 23#include "libmad/libmadpluginimpl.h"
32#include "libmpeg3/libmpeg3pluginimpl.h" 24#include "libmpeg3/libmpeg3pluginimpl.h"
33#include "wavplugin/wavpluginimpl.h" 25#include "wavplugin/wavpluginimpl.h"
34#endif 26#endif
35 27
28#include "mediaplayerstate.h"
29
30/* OPIE */
31#include <qpe/qpeapplication.h>
32#include <qpe/qlibrary.h>
33#include <qpe/config.h>
34#include <qpe/mediaplayerplugininterface.h>
35#include <opie2/odebug.h>
36
37/* QT */
38#include <qdir.h>
39
36 40
37//#define MediaPlayerDebug(x) qDebug x 41//#define MediaPlayerDebug(x) qDebug x
38#define MediaPlayerDebug(x) 42#define MediaPlayerDebug(x)
39 43
40 44
41MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 45MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
42 : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) { 46 : QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) {
43 Config cfg( "OpiePlayer" ); 47 Config cfg( "OpiePlayer" );
44 readConfig( cfg ); 48 readConfig( cfg );
45 loadPlugins(); 49 loadPlugins();
46} 50}
47 51
48 52
49MediaPlayerState::~MediaPlayerState() { 53MediaPlayerState::~MediaPlayerState() {
50 Config cfg( "OpiePlayer" ); 54 Config cfg( "OpiePlayer" );
51 writeConfig( cfg ); 55 writeConfig( cfg );
52} 56}
53 57
54 58
55void MediaPlayerState::readConfig( Config& cfg ) { 59void MediaPlayerState::readConfig( Config& cfg ) {
56 cfg.setGroup("Options"); 60 cfg.setGroup("Options");
57 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 61 isFullscreen = cfg.readBoolEntry( "FullScreen" );
58 isScaled = cfg.readBoolEntry( "Scaling" ); 62 isScaled = cfg.readBoolEntry( "Scaling" );
59 isLooping = cfg.readBoolEntry( "Looping" ); 63 isLooping = cfg.readBoolEntry( "Looping" );
@@ -104,70 +108,70 @@ MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) {
104 if(file.left(4)=="http") 108 if(file.left(4)=="http")
105 isStreaming = TRUE; 109 isStreaming = TRUE;
106 else 110 else
107 isStreaming = FALSE; 111 isStreaming = FALSE;
108 return decoder = tmpDecoder; 112 return decoder = tmpDecoder;
109} 113}
110 114
111 115
112MediaPlayerDecoder *MediaPlayerState::curDecoder() { 116MediaPlayerDecoder *MediaPlayerState::curDecoder() {
113 return decoder; 117 return decoder;
114} 118}
115 119
116 120
117// ### hack to get true sample count 121// ### hack to get true sample count
118MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { 122MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
119 return libmpeg3decoder; 123 return libmpeg3decoder;
120} 124}
121 125
122// ### hack to get true sample count 126// ### hack to get true sample count
123// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { 127// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
124// return libwavdecoder; 128// return libwavdecoder;
125// } 129// }
126 130
127void MediaPlayerState::loadPlugins() { 131void MediaPlayerState::loadPlugins() {
128 // qDebug("load plugins"); 132 // odebug << "load plugins" << oendl;
129#ifndef QT_NO_COMPONENT 133#ifndef QT_NO_COMPONENT
130 QValueList<MediaPlayerPlugin>::Iterator mit; 134 QValueList<MediaPlayerPlugin>::Iterator mit;
131 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 135 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
132 (*mit).iface->release(); 136 (*mit).iface->release();
133 (*mit).library->unload(); 137 (*mit).library->unload();
134 delete (*mit).library; 138 delete (*mit).library;
135 } 139 }
136 pluginList.clear(); 140 pluginList.clear();
137 141
138 QString path = QPEApplication::qpeDir() + "/plugins/codecs"; 142 QString path = QPEApplication::qpeDir() + "/plugins/codecs";
139 QDir dir( path, "lib*.so" ); 143 QDir dir( path, "lib*.so" );
140 QStringList list = dir.entryList(); 144 QStringList list = dir.entryList();
141 QStringList::Iterator it; 145 QStringList::Iterator it;
142 for ( it = list.begin(); it != list.end(); ++it ) { 146 for ( it = list.begin(); it != list.end(); ++it ) {
143 MediaPlayerPluginInterface *iface = 0; 147 MediaPlayerPluginInterface *iface = 0;
144 QLibrary *lib = new QLibrary( path + "/" + *it ); 148 QLibrary *lib = new QLibrary( path + "/" + *it );
145// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 149// odebug << "querying: " << QString( path + "/" + *it ) << "" << oendl;
146 150
147 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { 151 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
148 152
149// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 153// odebug << "loading: " << QString( path + "/" + *it ) << "" << oendl;
150 154
151 MediaPlayerPlugin plugin; 155 MediaPlayerPlugin plugin;
152 plugin.library = lib; 156 plugin.library = lib;
153 plugin.iface = iface; 157 plugin.iface = iface;
154 plugin.decoder = plugin.iface->decoder(); 158 plugin.decoder = plugin.iface->decoder();
155 plugin.encoder = plugin.iface->encoder(); 159 plugin.encoder = plugin.iface->encoder();
156 pluginList.append( plugin ); 160 pluginList.append( plugin );
157 161
158 // ### hack to get true sample count 162 // ### hack to get true sample count
159 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") ) 163 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") )
160 libmpeg3decoder = plugin.decoder; 164 libmpeg3decoder = plugin.decoder;
161 165
162 } else { 166 } else {
163 delete lib; 167 delete lib;
164 } 168 }
165 } 169 }
166#else 170#else
167 pluginList.clear(); 171 pluginList.clear();
168 172
169 MediaPlayerPlugin plugin0; 173 MediaPlayerPlugin plugin0;
170 plugin0.iface = new LibMpeg3PluginImpl; 174 plugin0.iface = new LibMpeg3PluginImpl;
171 plugin0.decoder = plugin0.iface->decoder(); 175 plugin0.decoder = plugin0.iface->decoder();
172 plugin0.encoder = plugin0.iface->encoder(); 176 plugin0.encoder = plugin0.iface->encoder();
173 pluginList.append( plugin0 ); 177 pluginList.append( plugin0 );