author | llornkcor <llornkcor> | 2002-02-25 05:10:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 05:10:32 (UTC) |
commit | 1bebd27631a6c9d1ab967cbb32dd4e796b3b0402 (patch) (side-by-side diff) | |
tree | 8ce49800cba26f6f2c33de74a71d4efe0338843f /core/multimedia/opieplayer/mediaplayerstate.cpp | |
parent | d948361c1b475fab4660b28fbf5ec21fd34d923f (diff) | |
download | opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.zip opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.tar.gz opie-1bebd27631a6c9d1ab967cbb32dd4e796b3b0402.tar.bz2 |
fixed 2
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayerstate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/mediaplayerstate.cpp | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 7e82166..13741f6 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp @@ -1,10 +1,10 @@ /********************************************************************** -** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. +** Copyright (C) 2000 Trolltech AS. All rights reserved. ** -** This file is part of the Qtopia Environment. +** 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. ** @@ -16,29 +16,30 @@ ** 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/mediaplayerplugininterface.h> #include <qpe/config.h> #include <qvaluelist.h> #include <qobject.h> #include <qdir.h> +#include "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) +//#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 ); @@ -92,16 +93,16 @@ static QValueList<MediaPlayerPlugin> pluginList; // Find the first decoder which supports this type of file MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { MediaPlayerDecoder *tmpDecoder = NULL; QValueList<MediaPlayerPlugin>::Iterator it; for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { - if ( (*it).decoder->isFileSupported( file ) ) { - tmpDecoder = (*it).decoder; - break; - } + if ( (*it).decoder->isFileSupported( file ) ) { + tmpDecoder = (*it).decoder; + break; + } } return decoder = tmpDecoder; } MediaPlayerDecoder *MediaPlayerState::curDecoder() { @@ -111,52 +112,56 @@ MediaPlayerDecoder *MediaPlayerState::curDecoder() { // ### 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() { #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; + (*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 ); + MediaPlayerPluginInterface *iface = 0; + QLibrary *lib = new QLibrary( path + "/" + *it ); - MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() )); + MediaPlayerDebug(( "querying: %s", QString( path + "/" + *it ).latin1() )); - if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { + if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { - MediaPlayerDebug(( "loading: %s", QString( path + "/" + *it ).latin1() )); + MediaPlayerDebug(( "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 ); + 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; + // ### hack to get true sample count + if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") ) + libmpeg3decoder = plugin.decoder; - } else { - delete lib; - } + } else { + delete lib; + } } #else pluginList.clear(); MediaPlayerPlugin plugin0; plugin0.iface = new LibMpeg3PluginImpl; @@ -175,11 +180,11 @@ void MediaPlayerState::loadPlugins() { plugin2.decoder = plugin2.iface->decoder(); plugin2.encoder = plugin2.iface->encoder(); pluginList.append( plugin2 ); #endif if ( pluginList.count() ) - MediaPlayerDebug(( "%i decoders found", pluginList.count() )); + MediaPlayerDebug(( "%i decoders found", pluginList.count() )); else - MediaPlayerDebug(( "No decoders found" )); + MediaPlayerDebug(( "No decoders found" )); } |