summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/mediaplayerstate.cpp
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayerstate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp11
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
@@ -2,85 +2,87 @@
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <qpe/config.h>
#include <qvaluelist.h>
#include <qobject.h>
#include <qdir.h>
-#include "mediaplayerplugininterface.h"
+#include <qpe/mediaplayerplugininterface.h>
#include "mediaplayerstate.h"
+
#ifdef QT_NO_COMPONENT
// Plugins which are compiled in when no plugin architecture available
#include "libmad/libmadpluginimpl.h"
#include "libmpeg3/libmpeg3pluginimpl.h"
#include "wavplugin/wavpluginimpl.h"
#endif
//#define MediaPlayerDebug(x) qDebug x
#define MediaPlayerDebug(x)
MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
: QObject( parent, name ), decoder( NULL ), libmpeg3decoder( NULL ) {
Config cfg( "MediaPlayer" );
readConfig( cfg );
loadPlugins();
}
MediaPlayerState::~MediaPlayerState() {
Config cfg( "MediaPlayer" );
writeConfig( cfg );
}
void MediaPlayerState::readConfig( Config& cfg ) {
cfg.setGroup("Options");
isFullscreen = cfg.readBoolEntry( "FullScreen" );
isScaled = cfg.readBoolEntry( "Scaling" );
isLooping = cfg.readBoolEntry( "Looping" );
isShuffled = cfg.readBoolEntry( "Shuffle" );
usePlaylist = cfg.readBoolEntry( "UsePlayList" );
+ usePlaylist = TRUE;
isPlaying = FALSE;
isPaused = FALSE;
curPosition = 0;
curLength = 0;
curView = 'l';
}
void MediaPlayerState::writeConfig( Config& cfg ) const {
cfg.setGroup("Options");
cfg.writeEntry("FullScreen", isFullscreen );
cfg.writeEntry("Scaling", isScaled );
cfg.writeEntry("Looping", isLooping );
cfg.writeEntry("Shuffle", isShuffled );
cfg.writeEntry("UsePlayList", usePlaylist );
}
struct MediaPlayerPlugin {
#ifndef QT_NO_COMPONENT
QLibrary *library;
#endif
MediaPlayerPluginInterface *iface;
MediaPlayerDecoder *decoder;
@@ -100,71 +102,70 @@ MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) {
tmpDecoder = (*it).decoder;
break;
}
}
return decoder = tmpDecoder;
}
MediaPlayerDecoder *MediaPlayerState::curDecoder() {
return decoder;
}
// ### hack to get true sample count
MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
return libmpeg3decoder;
}
// ### hack to get true sample count
// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
// return libwavdecoder;
// }
void MediaPlayerState::loadPlugins() {
-
+ qDebug("load plugins");
#ifndef QT_NO_COMPONENT
QValueList<MediaPlayerPlugin>::Iterator mit;
for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
(*mit).iface->release();
(*mit).library->unload();
delete (*mit).library;
}
pluginList.clear();
QString path = QPEApplication::qpeDir() + "/plugins/codecs";
QDir dir( path, "lib*.so" );
QStringList list = dir.entryList();
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
MediaPlayerPluginInterface *iface = 0;
QLibrary *lib = new QLibrary( path + "/" + *it );
-
- MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() ));
+// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
- MediaPlayerDebug(( "loading: %s", QString( path + "/" + *it ).latin1() ));
+// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
MediaPlayerPlugin plugin;
plugin.library = lib;
plugin.iface = iface;
plugin.decoder = plugin.iface->decoder();
plugin.encoder = plugin.iface->encoder();
pluginList.append( plugin );
// ### hack to get true sample count
if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") )
libmpeg3decoder = plugin.decoder;
} else {
delete lib;
}
}
#else
pluginList.clear();
MediaPlayerPlugin plugin0;
plugin0.iface = new LibMpeg3PluginImpl;
plugin0.decoder = plugin0.iface->decoder();
plugin0.encoder = plugin0.iface->encoder();
pluginList.append( plugin0 );