summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/mediaplayerstate.cpp
authorllornkcor <llornkcor>2003-06-11 22:11:38 (UTC)
committer llornkcor <llornkcor>2003-06-11 22:11:38 (UTC)
commit24097a2790fd7bb241a0a8da24ef2996e4f4ad15 (patch) (unidiff)
tree142e0fb758067bc9a601b3bd2dabdff27675c0f3 /core/multimedia/opieplayer/mediaplayerstate.cpp
parent188319af82322c84f02e1abb848d908ca8f9e26c (diff)
downloadopie-24097a2790fd7bb241a0a8da24ef2996e4f4ad15.zip
opie-24097a2790fd7bb241a0a8da24ef2996e4f4ad15.tar.gz
opie-24097a2790fd7bb241a0a8da24ef2996e4f4ad15.tar.bz2
fix setDoc for playlists and others. remove qDebugs
Diffstat (limited to 'core/multimedia/opieplayer/mediaplayerstate.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp
index cf166d6..6823076 100644
--- a/core/multimedia/opieplayer/mediaplayerstate.cpp
+++ b/core/multimedia/opieplayer/mediaplayerstate.cpp
@@ -66,129 +66,129 @@ void MediaPlayerState::readConfig( Config& cfg ) {
66 isPaused = FALSE; 66 isPaused = FALSE;
67 curPosition = 0; 67 curPosition = 0;
68 curLength = 0; 68 curLength = 0;
69 curView = 'l'; 69 curView = 'l';
70} 70}
71 71
72 72
73void MediaPlayerState::writeConfig( Config& cfg ) const { 73void MediaPlayerState::writeConfig( Config& cfg ) const {
74 cfg.setGroup("Options"); 74 cfg.setGroup("Options");
75 cfg.writeEntry("FullScreen", isFullscreen ); 75 cfg.writeEntry("FullScreen", isFullscreen );
76 cfg.writeEntry("Scaling", isScaled ); 76 cfg.writeEntry("Scaling", isScaled );
77 cfg.writeEntry("Looping", isLooping ); 77 cfg.writeEntry("Looping", isLooping );
78 cfg.writeEntry("Shuffle", isShuffled ); 78 cfg.writeEntry("Shuffle", isShuffled );
79 cfg.writeEntry("UsePlayList", usePlaylist ); 79 cfg.writeEntry("UsePlayList", usePlaylist );
80} 80}
81 81
82 82
83struct MediaPlayerPlugin { 83struct MediaPlayerPlugin {
84#ifndef QT_NO_COMPONENT 84#ifndef QT_NO_COMPONENT
85 QLibrary *library; 85 QLibrary *library;
86#endif 86#endif
87 MediaPlayerPluginInterface *iface; 87 MediaPlayerPluginInterface *iface;
88 MediaPlayerDecoder *decoder; 88 MediaPlayerDecoder *decoder;
89 MediaPlayerEncoder *encoder; 89 MediaPlayerEncoder *encoder;
90}; 90};
91 91
92 92
93static QValueList<MediaPlayerPlugin> pluginList; 93static QValueList<MediaPlayerPlugin> pluginList;
94 94
95 95
96// Find the first decoder which supports this type of file 96// Find the first decoder which supports this type of file
97MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { 97MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) {
98 MediaPlayerDecoder *tmpDecoder = NULL; 98 MediaPlayerDecoder *tmpDecoder = NULL;
99 QValueList<MediaPlayerPlugin>::Iterator it; 99 QValueList<MediaPlayerPlugin>::Iterator it;
100 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 100 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
101 if ( (*it).decoder->isFileSupported( file ) ) { 101 if ( (*it).decoder->isFileSupported( file ) ) {
102 tmpDecoder = (*it).decoder; 102 tmpDecoder = (*it).decoder;
103 break; 103 break;
104 } 104 }
105 } 105 }
106 if(file.left(4)=="http") 106 if(file.left(4)=="http")
107 isStreaming = TRUE; 107 isStreaming = TRUE;
108 else 108 else
109 isStreaming = FALSE; 109 isStreaming = FALSE;
110 return decoder = tmpDecoder; 110 return decoder = tmpDecoder;
111} 111}
112 112
113 113
114MediaPlayerDecoder *MediaPlayerState::curDecoder() { 114MediaPlayerDecoder *MediaPlayerState::curDecoder() {
115 return decoder; 115 return decoder;
116} 116}
117 117
118 118
119// ### hack to get true sample count 119// ### hack to get true sample count
120MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { 120MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
121 return libmpeg3decoder; 121 return libmpeg3decoder;
122} 122}
123 123
124// ### hack to get true sample count 124// ### hack to get true sample count
125// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { 125// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
126// return libwavdecoder; 126// return libwavdecoder;
127// } 127// }
128 128
129void MediaPlayerState::loadPlugins() { 129void MediaPlayerState::loadPlugins() {
130 qDebug("load plugins"); 130 // qDebug("load plugins");
131#ifndef QT_NO_COMPONENT 131#ifndef QT_NO_COMPONENT
132 QValueList<MediaPlayerPlugin>::Iterator mit; 132 QValueList<MediaPlayerPlugin>::Iterator mit;
133 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 133 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
134 (*mit).iface->release(); 134 (*mit).iface->release();
135 (*mit).library->unload(); 135 (*mit).library->unload();
136 delete (*mit).library; 136 delete (*mit).library;
137 } 137 }
138 pluginList.clear(); 138 pluginList.clear();
139 139
140 QString path = QPEApplication::qpeDir() + "/plugins/codecs"; 140 QString path = QPEApplication::qpeDir() + "/plugins/codecs";
141 QDir dir( path, "lib*.so" ); 141 QDir dir( path, "lib*.so" );
142 QStringList list = dir.entryList(); 142 QStringList list = dir.entryList();
143 QStringList::Iterator it; 143 QStringList::Iterator it;
144 for ( it = list.begin(); it != list.end(); ++it ) { 144 for ( it = list.begin(); it != list.end(); ++it ) {
145 MediaPlayerPluginInterface *iface = 0; 145 MediaPlayerPluginInterface *iface = 0;
146 QLibrary *lib = new QLibrary( path + "/" + *it ); 146 QLibrary *lib = new QLibrary( path + "/" + *it );
147// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 147// qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
148 148
149 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) { 149 if ( lib->queryInterface( IID_MediaPlayerPlugin, (QUnknownInterface**)&iface ) == QS_OK ) {
150 150
151// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 151// qDebug( "loading: %s", QString( path + "/" + *it ).latin1() );
152 152
153 MediaPlayerPlugin plugin; 153 MediaPlayerPlugin plugin;
154 plugin.library = lib; 154 plugin.library = lib;
155 plugin.iface = iface; 155 plugin.iface = iface;
156 plugin.decoder = plugin.iface->decoder(); 156 plugin.decoder = plugin.iface->decoder();
157 plugin.encoder = plugin.iface->encoder(); 157 plugin.encoder = plugin.iface->encoder();
158 pluginList.append( plugin ); 158 pluginList.append( plugin );
159 159
160 // ### hack to get true sample count 160 // ### hack to get true sample count
161 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") ) 161 if ( plugin.decoder->pluginName() == QString("LibMpeg3Plugin") )
162 libmpeg3decoder = plugin.decoder; 162 libmpeg3decoder = plugin.decoder;
163 163
164 } else { 164 } else {
165 delete lib; 165 delete lib;
166 } 166 }
167 } 167 }
168#else 168#else
169 pluginList.clear(); 169 pluginList.clear();
170 170
171 MediaPlayerPlugin plugin0; 171 MediaPlayerPlugin plugin0;
172 plugin0.iface = new LibMpeg3PluginImpl; 172 plugin0.iface = new LibMpeg3PluginImpl;
173 plugin0.decoder = plugin0.iface->decoder(); 173 plugin0.decoder = plugin0.iface->decoder();
174 plugin0.encoder = plugin0.iface->encoder(); 174 plugin0.encoder = plugin0.iface->encoder();
175 pluginList.append( plugin0 ); 175 pluginList.append( plugin0 );
176 176
177 MediaPlayerPlugin plugin1; 177 MediaPlayerPlugin plugin1;
178 plugin1.iface = new LibMadPluginImpl; 178 plugin1.iface = new LibMadPluginImpl;
179 plugin1.decoder = plugin1.iface->decoder(); 179 plugin1.decoder = plugin1.iface->decoder();
180 plugin1.encoder = plugin1.iface->encoder(); 180 plugin1.encoder = plugin1.iface->encoder();
181 pluginList.append( plugin1 ); 181 pluginList.append( plugin1 );
182 182
183 MediaPlayerPlugin plugin2; 183 MediaPlayerPlugin plugin2;
184 plugin2.iface = new WavPluginImpl; 184 plugin2.iface = new WavPluginImpl;
185 plugin2.decoder = plugin2.iface->decoder(); 185 plugin2.decoder = plugin2.iface->decoder();
186 plugin2.encoder = plugin2.iface->encoder(); 186 plugin2.encoder = plugin2.iface->encoder();
187 pluginList.append( plugin2 ); 187 pluginList.append( plugin2 );
188#endif 188#endif
189 189
190 if ( pluginList.count() ) 190 if ( pluginList.count() )
191 MediaPlayerDebug(( "%i decoders found", pluginList.count() )); 191 MediaPlayerDebug(( "%i decoders found", pluginList.count() ));
192 else 192 else
193 MediaPlayerDebug(( "No decoders found" )); 193 MediaPlayerDebug(( "No decoders found" ));
194} 194}