Commit 0f995e47192a30e30134e0e46b5454d1be3b2e20
- Diff rendering mode:
- inline
- side by side
ChangeLog
(2 / 6)
|   | |||
| 3 | 3 | (c) 2002-2004 the amaroK authors. | |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | VERSION 1.1: | ||
| 7 | FIX: GStreamer engine must not allow non-audio filetypes in playlist. | ||
| 8 | ADD: Icon for "Menu" button in toolbar. Improves Usability. | ||
| 9 | |||
| 10 | 6 | VERSION 1.0.1: | |
| 11 | 7 | FIX: Short dropouts after starting a stream with GStreamer. | |
| 12 | 8 | FIX: amaroK starting invisible when systray icon is disabled. | |
| 13 | FIX: Playlist analyzer looks freaky on some systems (BR 83671). | ||
| 14 | FIX: Display filename in title column for wav files (BR 83650). | ||
| 9 | FIX: Playlist analyzer looks freaky on some systems. (BR 83671) | ||
| 10 | FIX: Display filename in title column for wav files. (BR 83650) | ||
| 15 | 11 | FIX: Don't show crash dialog when no engine plugins are found. | |
| 16 | 12 | FIX: Compile issue for KDE < 3.2.1 users. Sorry :( | |
| 17 | 13 |
README
(2 / 2)
|   | |||
| 92 | 92 | "Run with highest possible priority", and increase the size of the sound | |
| 93 | 93 | buffer (warning, see the next FAQ!) You should also enusre that your | |
| 94 | 94 | artswrapper is suid: | |
| 95 | |||
| 95 | |||
| 96 | 96 | $ su | |
| 97 | 97 | $ chmod a+rsx /path/to/kde/bin/artswrapper | |
| 98 | |||
| 98 | |||
| 99 | 99 | Finally you will benefit from installing kdemultimedia in its entirety to get | |
| 100 | 100 | the faster aRts codecs (eg. libarts_mpeglib.so, etc.) | |
| 101 | 101 |
amarok.lsm
(1 / 1)
|   | |||
| 1 | 1 | Begin3 | |
| 2 | 2 | Title: amarok | |
| 3 | Version: 1.1 | ||
| 3 | Version: 1.0.1 | ||
| 4 | 4 | Entered-date: | |
| 5 | 5 | Description: Audio player for KDE | |
| 6 | 6 | Keywords: player multimedia kde mp3 ogg audio music arts |
src/actionclasses.cpp
(8 / 24)
|   | |||
| 1 | 1 | // Maintainer: Max Howell <max.howell@methylblue.com>, (C) 2004 | |
| 2 | 2 | // Copyright: See COPYING file that comes with this distribution | |
| 3 | 3 | ||
| 4 | #ifdef HAVE_CONFIG_H | ||
| 5 | #include <config.h> //HAVE_XMMS definition | ||
| 6 | #endif | ||
| 7 | |||
| 4 | 8 | #include "actionclasses.h" | |
| 5 | 9 | #include "amarokconfig.h" | |
| 6 | 10 | #include "app.h" //actionCollection() and a SLOT | |
| 7 | #include "config.h" //HAVE_XMMS definition | ||
| 8 | 11 | #include "enginecontroller.h" | |
| 9 | 12 | #include "playlistwindow.h" //need amaroK::ToolBar | |
| 10 | #include "scriptmanager.h" | ||
| 11 | #include "socketserver.h" //Vis::Selector::showInstance( | ||
| 13 | #include "socketserver.h" //Vis::Selector::showInstance() | ||
| 12 | 14 | ||
| 13 | 15 | #include <kaction.h> | |
| 14 | 16 | #include <khelpmenu.h> | |
| … | … | ||
| 69 | 69 | button->setPopup( amaroK::Menu::instance() ); | |
| 70 | 70 | button->setName( "toolbutton_amarok_menu" ); | |
| 71 | 71 | button->setIcon( "configure" ); | |
| 72 | |||
| 72 | |||
| 73 | 73 | return containerCount() - 1; | |
| 74 | 74 | } | |
| 75 | 75 | else return -1; | |
| … | … | ||
| 90 | 90 | insertItem( i18n( "&Visualizations..." ), ID_SHOW_VIS_SELECTOR ); | |
| 91 | 91 | ||
| 92 | 92 | insertSeparator(); | |
| 93 | |||
| 94 | insertItem( i18n( "&Scripts..." ), ID_SHOW_SCRIPT_SELECTOR ); | ||
| 95 | insertItem( i18n( "&JavaScript Console" ), ID_SHOW_SCRIPT_CONSOLE ); | ||
| 96 | |||
| 97 | #ifndef HAVE_KJSEMBED | ||
| 98 | setItemEnabled( ID_SHOW_SCRIPT_SELECTOR, false ); | ||
| 99 | setItemEnabled( ID_SHOW_SCRIPT_CONSOLE, false ); | ||
| 100 | #endif | ||
| 101 | |||
| 102 | insertSeparator(); | ||
| 103 | |||
| 93 | |||
| 104 | 94 | insertItem( i18n( "Configure &Effects..." ), pApp, SLOT( slotConfigEffects() ) ); | |
| 105 | 95 | insertItem( i18n( "Configure &Decoder..." ), ID_CONF_DECODER ); | |
| 106 | 96 | ||
| … | … | ||
| 152 | 152 | case ID_SHOW_VIS_SELECTOR: | |
| 153 | 153 | Vis::Selector::instance()->show(); //doing it here means we delay creation of the widget | |
| 154 | 154 | break; | |
| 155 | #ifdef HAVE_KJSEMBED | ||
| 156 | case ID_SHOW_SCRIPT_SELECTOR: | ||
| 157 | ScriptManager::Manager::instance()->showSelector(); | ||
| 158 | break; | ||
| 159 | case ID_SHOW_SCRIPT_CONSOLE: | ||
| 160 | ScriptManager::Manager::instance()->showConsole(); | ||
| 161 | break; | ||
| 162 | #endif | ||
| 163 | 155 | } | |
| 164 | 156 | } | |
| 165 | 157 | ||
| … | … | ||
| 265 | 265 | m_slider->setFixedHeight( 35 ); | |
| 266 | 266 | m_slider->setMaxValue( amaroK::VOLUME_MAX ); | |
| 267 | 267 | m_slider->setValue( amaroK::VOLUME_MAX - AmarokConfig::masterVolume() ); | |
| 268 | QToolTip::add( m_slider, i18n( "Volume control" ) ); | ||
| 268 | QToolTip::add( m_slider, i18n( "Volume Control" ) ); | ||
| 269 | 269 | connect( m_slider, SIGNAL(valueChanged( int )), SLOT(sliderMoved( int )) ); | |
| 270 | 270 | connect( bar, SIGNAL(wheelMoved( int )), SLOT(wheelMoved( int )) ); | |
| 271 | 271 |
src/amarokcore/Makefile.am
(0 / 1)
|   | |||
| 1 | 1 | INCLUDES = \ | |
| 2 | -I$(top_builddir)/amarok/src \ | ||
| 3 | 2 | -I$(top_srcdir)/amarok/src \ | |
| 4 | 3 | -I$(top_srcdir)/amarok/src/engine \ | |
| 5 | 4 | -I$(top_srcdir)/amarok/src/plugin \ |
src/amarokcore/amarok.kcfg
(0 / 7)
|   | |||
| 185 | 185 | <default>true</default> | |
| 186 | 186 | <whatsthis>Enable/Disable shoutcast metadata fetching. If set, amaroK displays metadata also for shoutcast streams.</whatsthis> | |
| 187 | 187 | </entry> | |
| 188 | <entry key="Thread Priority" type="Int"> | ||
| 189 | <label>Priority of GStreamer pipeline thread</label> | ||
| 190 | <default>2</default> | ||
| 191 | <min>0</min> | ||
| 192 | <max>3</max> | ||
| 193 | <whatsthis>The priority of the thread for GStreamer, a value between 0 (low) and 3 (high).</whatsthis> | ||
| 194 | </entry> | ||
| 195 | 188 | </group> | |
| 196 | 189 | ||
| 197 | 190 | <group name="OSD"> |
|   | |||
| 67 | 67 | m_rows = limit( uint(double(height()+1) / (HEIGHT+1)), MAX_ROWS, MIN_ROWS ); | |
| 68 | 68 | ||
| 69 | 69 | const uint PRE = 1, PRO = 1; //PRE and PRO allow us to restrict the range somewhat | |
| 70 | for( uint z = 0; z < m_rows; ++z ) | ||
| 70 | for( uint z = 0; z < m_rows; ++z )\ | ||
| 71 | 71 | { | |
| 72 | 72 | lvlMapper[z] = 1-(log10(PRE+z) / log10(PRE+m_rows+PRO)); | |
| 73 | 73 | } |
src/app.cpp
(60 / 27)
|   | |||
| 18 | 18 | #include "amarokconfig.h" | |
| 19 | 19 | #include "amarokdcophandler.h" | |
| 20 | 20 | #include "app.h" | |
| 21 | #include "config.h" | ||
| 22 | 21 | #include "configdialog.h" | |
| 23 | 22 | #include "effectwidget.h" | |
| 24 | 23 | #include "enginebase.h" | |
| … | … | ||
| 29 | 29 | #include "playlistwindow.h" | |
| 30 | 30 | #include "plugin.h" | |
| 31 | 31 | #include "pluginmanager.h" | |
| 32 | #include "scriptmanager.h" | ||
| 33 | 32 | #include "socketserver.h" | |
| 34 | 33 | #include "systray.h" | |
| 35 | 34 | #include "tracktooltip.h" //engineNewMetaData() | |
| … | … | ||
| 67 | 67 | m_pTray = new amaroK::TrayIcon( m_pPlaylistWindow ); | |
| 68 | 68 | (void) new Vis::SocketServer( this ); | |
| 69 | 69 | ||
| 70 | #ifdef HAVE_KJSEMBED | ||
| 71 | (void) new ScriptManager::Manager( this ); | ||
| 72 | // Export symbols to KJSEmbed | ||
| 73 | ScriptManager::Manager::instance()->addObject( this ); | ||
| 74 | ScriptManager::Manager::instance()->addObject( m_pDcopHandler ); | ||
| 75 | #endif | ||
| 76 | |||
| 77 | 70 | m_pPlaylistWindow->init(); //creates the playlist, browsers, etc. | |
| 78 | 71 | initGlobalShortcuts(); | |
| 79 | 72 | ||
| … | … | ||
| 201 | 201 | } | |
| 202 | 202 | ||
| 203 | 203 | ||
| 204 | void App::initEngine() | ||
| 205 | { | ||
| 206 | kdDebug() << "BEGIN " << k_funcinfo << endl; | ||
| 207 | |||
| 208 | const QString query = "[X-KDE-amaroK-plugintype] == 'engine' and Name == '%1'"; | ||
| 209 | amaroK::Plugin* plugin = PluginManager::createFromQuery( query.arg( AmarokConfig::soundSystem() ) ); | ||
| 210 | |||
| 211 | if ( !plugin ) | ||
| 212 | { | ||
| 213 | kdWarning() << "Cannot load the: " << AmarokConfig::soundSystem() << " plugin. Trying another engine..\n"; | ||
| 214 | |||
| 215 | //try to invoke _any_ engine plugin | ||
| 216 | plugin = PluginManager::createFromQuery( "[X-KDE-amaroK-plugintype] == 'engine'" ); | ||
| 217 | |||
| 218 | if ( !plugin ) | ||
| 219 | { | ||
| 220 | KMessageBox::error( m_pPlaylistWindow, i18n( | ||
| 221 | "<p>amaroK could not find any sound-engine plugins. " | ||
| 222 | "It is likely that amaroK is installed under the wrong prefix, please fix your installation using:" | ||
| 223 | "<pre>cd /path/to/amarok/source-code/<br>" | ||
| 224 | "su -c \"make uninstall\"<br>" | ||
| 225 | "./configure --prefix=`kde-config --prefix` && su -c \"make install\"</pre>" | ||
| 226 | "More information can be found in the README file. For further assistance join us at #amarok on irc.freenode.net." ) ); | ||
| 227 | |||
| 228 | ::exit( EXIT_SUCCESS ); | ||
| 229 | } | ||
| 230 | |||
| 231 | AmarokConfig::setSoundSystem( PluginManager::getService( plugin )->name() ); | ||
| 232 | kdDebug() << "Setting soundSystem to: " << AmarokConfig::soundSystem() << endl; | ||
| 233 | } | ||
| 234 | |||
| 235 | // feed engine to controller | ||
| 236 | EngineBase* const engine = (EngineBase*)plugin; | ||
| 237 | bool restartArts = AmarokConfig::version() != APP_VERSION; | ||
| 238 | |||
| 239 | engine->init( restartArts, amaroK::SCOPE_SIZE, AmarokConfig::rememberEffects() ); | ||
| 240 | EngineController::setEngine( engine ); //will set engine's volume | ||
| 241 | |||
| 242 | //NOTE applySettings() must be called now to ensure mixer settings are set | ||
| 243 | |||
| 244 | kdDebug() << "END " << k_funcinfo << endl; | ||
| 245 | } | ||
| 246 | |||
| 247 | |||
| 204 | 248 | #include <kaction.h> | |
| 205 | 249 | #include <kshortcutlist.h> | |
| 206 | 250 | void App::initGlobalShortcuts() | |
| … | … | ||
| 260 | 260 | ec, SLOT( playPause() ), true, true ); | |
| 261 | 261 | m_pGlobalAccel->insert( "stop", i18n( "Stop" ), 0, KKey("WIN+v"), 0, | |
| 262 | 262 | ec, SLOT( stop() ), true, true ); | |
| 263 | m_pGlobalAccel->insert( "next", i18n( "Next Track" ), 0, KKey("WIN+b"), 0, | ||
| 263 | m_pGlobalAccel->insert( "next", i18n( "Next track" ), 0, KKey("WIN+b"), 0, | ||
| 264 | 264 | ec, SLOT( next() ), true, true ); | |
| 265 | m_pGlobalAccel->insert( "prev", i18n( "Previous Track" ), 0, KKey("WIN+z"), 0, | ||
| 265 | m_pGlobalAccel->insert( "prev", i18n( "Previous track" ), 0, KKey("WIN+z"), 0, | ||
| 266 | 266 | ec, SLOT( previous() ), true, true ); | |
| 267 | m_pGlobalAccel->insert( "volup", i18n( "Increase Volume" ), 0, KKey("WIN+KP_Add"), 0, | ||
| 267 | m_pGlobalAccel->insert( "volup", i18n( "Increase volume" ), 0, KKey("WIN+KP_Add"), 0, | ||
| 268 | 268 | ec, SLOT( increaseVolume() ), true, true ); | |
| 269 | m_pGlobalAccel->insert( "voldn", i18n( "Decrease Volume" ), 0, KKey("WIN+KP_Subtract"), 0, | ||
| 269 | m_pGlobalAccel->insert( "voldn", i18n( "Decrease volume" ), 0, KKey("WIN+KP_Subtract"), 0, | ||
| 270 | 270 | ec, SLOT( decreaseVolume() ), true, true ); | |
| 271 | m_pGlobalAccel->insert( "playlist_add", i18n( "Add Media" ), 0, KKey("WIN+a"), 0, | ||
| 271 | m_pGlobalAccel->insert( "playlist_add", i18n( "Add media" ), 0, KKey("WIN+a"), 0, | ||
| 272 | 272 | m_pPlaylistWindow, SLOT( slotAddLocation() ), true, true ); | |
| 273 | m_pGlobalAccel->insert( "show", i18n( "Toggle Playlist Window" ), 0, KKey("WIN+p"), 0, | ||
| 273 | m_pGlobalAccel->insert( "show", i18n( "Toggle the Playlist Window" ), 0, KKey("WIN+p"), 0, | ||
| 274 | 274 | m_pPlaylistWindow, SLOT( showHide() ), true, true ); | |
| 275 | m_pGlobalAccel->insert( "osd", i18n( "Show OSD" ), 0, KKey("WIN+o"), 0, | ||
| 275 | m_pGlobalAccel->insert( "osd", i18n( "Show the OSD" ), 0, KKey("WIN+o"), 0, | ||
| 276 | 276 | m_pOSD, SLOT( forceShowTrack() ), true, true ); | |
| 277 | 277 | ||
| 278 | 278 | m_pGlobalAccel->setConfigGroup( "Shortcuts" ); | |
| … | … | ||
| 396 | 396 | setupColors(); | |
| 397 | 397 | ||
| 398 | 398 | ||
| 399 | //on startup we need to show the window, but only if it wasn't hidden on exit | ||
| 400 | //and always if the trayicon isn't showing | ||
| 401 | if( firstTime && (!amaroK::config()->readBoolEntry( "HiddenOnExit", false ) || !AmarokConfig::showTrayIcon()) ) | ||
| 399 | if( firstTime && !amaroK::config()->readBoolEntry( "HiddenOnExit", false ) ) | ||
| 402 | 400 | { | |
| 403 | 401 | mainWindow()->show(); | |
| 404 | 402 | ||
| … | … | ||
| 404 | 404 | kapp->eventLoop()->processEvents( QEventLoop::ExcludeUserInput ); | |
| 405 | 405 | } | |
| 406 | 406 | ||
| 407 | |||
| 407 | |||
| 408 | 408 | { //<Engine> | |
| 409 | //TODO move loading of engine and initEngine() to engineController; it can handle things better | ||
| 410 | |||
| 409 | 411 | EngineBase *engine = EngineController::engine(); | |
| 410 | 412 | const bool b = QCString( engine->name() ) == "Dummy"; | |
| 411 | 413 | ||
| 412 | 414 | if( b || AmarokConfig::soundSystem() != PluginManager::getService( engine )->name() ) | |
| 413 | 415 | { | |
| 414 | 416 | if( !b ) PluginManager::unload( engine ); | |
| 415 | EngineController::instance()->loadEngine(); | ||
| 417 | |||
| 418 | initEngine(); | ||
| 416 | 419 | engine = EngineController::engine(); | |
| 417 | // Invalidate extension cache | ||
| 418 | Playlist::s_extensionCache.clear(); | ||
| 419 | 420 | ||
| 420 | 421 | AmarokConfig::setHardwareMixer( engine->initMixer( AmarokConfig::hardwareMixer() ) ); | |
| 421 | 422 | } | |
| … | … | ||
| 428 | 428 | engine->setDefaultSoundDevice( !AmarokConfig::customSoundDevice() ); | |
| 429 | 429 | engine->setRestoreEffects( AmarokConfig::rememberEffects() ); | |
| 430 | 430 | engine->setVolume( AmarokConfig::masterVolume() ); | |
| 431 | engine->setThreadPriority( AmarokConfig::threadPriority() ); | ||
| 432 | 431 | //TODO deprecate/improve | |
| 433 | 432 | engine->setXfadeLength( AmarokConfig::crossfade() ? AmarokConfig::crossfadeLength() : 0 ); | |
| 434 | 433 | } //</Engine> | |
| … | … | ||
| 553 | 553 | //FIXME this isn't a good way to determine if there is a currentTrack, need playlist() function | |
| 554 | 554 | const bool b = EngineController::engine()->loaded(); | |
| 555 | 555 | ||
| 556 | popup.insertItem( i18n( "&Append to Playlist" ), 101 ); | ||
| 557 | popup.insertItem( i18n( "Append && &play" ), 102 ); | ||
| 558 | if( b ) popup.insertItem( i18n( "&Queue After Current Track" ), 103 ); | ||
| 556 | popup.insertItem( i18n( "&Append to playlist" ), 101 ); | ||
| 557 | popup.insertItem( i18n( "Append and &play" ), 102 ); | ||
| 558 | if( b ) popup.insertItem( i18n( "&Queue after current track" ), 103 ); | ||
| 559 | 559 | popup.insertSeparator(); | |
| 560 | 560 | popup.insertItem( i18n( "&Cancel" ), 0 ); | |
| 561 | 561 |
src/engine/gst/gstengine.cpp
(48 / 45)
|   | |||
| 17 | 17 | ||
| 18 | 18 | #include "enginebase.h" | |
| 19 | 19 | #include "gstengine.h" | |
| 20 | #include "gstuade.h" | ||
| 21 | 20 | #include "streamsrc.h" | |
| 22 | 21 | ||
| 23 | 22 | #include <math.h> //interpolate() | |
| … | … | ||
| 50 | 50 | GstEngine::error_msg; | |
| 51 | 51 | ||
| 52 | 52 | GstEngine* | |
| 53 | GstEngine::s_instance; | ||
| 53 | GstEngine::self; | ||
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | 56 | void | |
| … | … | ||
| 60 | 60 | ||
| 61 | 61 | //this is the Qt equivalent to an idle function: delay the call until all events are finished, | |
| 62 | 62 | //otherwise gst will crash horribly | |
| 63 | QTimer::singleShot( 0, instance(), SLOT( stopAtEnd() ) ); | ||
| 63 | QTimer::singleShot( 0, self, SLOT( stopAtEnd() ) ); | ||
| 64 | 64 | } | |
| 65 | 65 | ||
| 66 | 66 | ||
| … | … | ||
| 68 | 68 | GstEngine::handoff_cb( GstElement*, GstBuffer* buf, gpointer ) | |
| 69 | 69 | { | |
| 70 | 70 | int channels = 2; //2 == default, if we cannot determine the value from gst | |
| 71 | GstCaps* caps = gst_pad_get_caps( gst_element_get_pad( instance()->m_spider, "src_0" ) ); | ||
| 71 | GstCaps* caps = gst_pad_get_caps( gst_element_get_pad( self->m_spider, "src_0" ) ); | ||
| 72 | 72 | ||
| 73 | 73 | for ( int i = 0; i < gst_caps_get_size( caps ); i++ ) { | |
| 74 | 74 | GstStructure* structure = gst_caps_get_structure( caps, i ); | |
| … | … | ||
| 87 | 87 | ||
| 88 | 88 | //divide length by 2 for casting from 8bit to 16bit, and divide by number of channels | |
| 89 | 89 | for ( ulong i = 0; i < GST_BUFFER_SIZE( buf ) / 2 / channels; i += channels ) { | |
| 90 | if ( instance()->m_scopeBufIndex == instance()->m_scopeBuf.size() ) { | ||
| 91 | instance()->m_scopeBufIndex = 0; | ||
| 90 | if ( self->m_scopeBufIndex == self->m_scopeBuf.size() ) { | ||
| 91 | self->m_scopeBufIndex = 0; | ||
| 92 | 92 | // kdDebug() << k_funcinfo << "m_scopeBuf overflow!\n"; | |
| 93 | 93 | } | |
| 94 | 94 | ||
| … | … | ||
| 98 | 98 | //convert uint-16 to float and write into buf | |
| 99 | 99 | temp += ( float ) ( data[ i + j ] - 32768 ) / 32768.0; | |
| 100 | 100 | } | |
| 101 | instance()->m_scopeBuf[ instance()->m_scopeBufIndex++ ] = temp; | ||
| 101 | self->m_scopeBuf[ self->m_scopeBufIndex++ ] = temp; | ||
| 102 | 102 | } | |
| 103 | 103 | } | |
| 104 | 104 | } | |
| 105 | 105 | ||
| 106 | 106 | ||
| 107 | 107 | void | |
| 108 | GstEngine::typefindFound_cb( GstElement* /*typefind*/, GstCaps* /*caps*/, GstElement* /*pipeline*/ ) | ||
| 109 | { | ||
| 110 | // kdDebug() << "GstEngine::typefindFound" << endl; | ||
| 111 | |||
| 112 | self->m_typefindResult = true; | ||
| 113 | } | ||
| 114 | |||
| 115 | // const GList *elements = gst_registry_pool_feature_list( GST_TYPE_ELEMENT_FACTORY ); | ||
| 116 | // | ||
| 117 | // while ( elements != NULL ) | ||
| 118 | // { | ||
| 119 | // factory = (GstElementFactory *) elements->data; | ||
| 120 | // const gchar *klass = gst_element_factory_get_klass( factory ); | ||
| 121 | // elements = elements->next; | ||
| 122 | // } | ||
| 123 | |||
| 124 | |||
| 125 | void | ||
| 108 | 126 | GstEngine::error_cb( GstElement* /*element*/, GstElement* /*source*/, GError* error, gchar* /*debug*/, gpointer /*data*/ ) | |
| 109 | 127 | { | |
| 110 | 128 | kdDebug() << k_funcinfo << endl; | |
| 111 | 129 | ||
| 112 | QTimer::singleShot( 0, instance(), SLOT( handleError() ) ); | ||
| 130 | QTimer::singleShot( 0, self, SLOT( handleError() ) ); | ||
| 113 | 131 | } | |
| 114 | 132 | ||
| 115 | 133 | ||
| … | … | ||
| 167 | 167 | { | |
| 168 | 168 | kdDebug() << "BEGIN " << k_funcinfo << endl; | |
| 169 | 169 | ||
| 170 | s_instance = this; | ||
| 170 | self = this; | ||
| 171 | 171 | m_mixerHW = -1; //initialize | |
| 172 | 172 | ||
| 173 | 173 | m_scopeBuf.resize( SCOPEBUF_SIZE ); | |
| … | … | ||
| 194 | 194 | bool | |
| 195 | 195 | GstEngine::canDecode( const KURL &url, mode_t, mode_t ) | |
| 196 | 196 | { | |
| 197 | bool success = false; | ||
| 198 | GstElement *pipeline, *filesrc, *spider, *audioconvert, *audioscale, *audiosink; | ||
| 197 | GstElement* pipeline; | ||
| 198 | GstElement* filesrc; | ||
| 199 | GstElement* typefind; | ||
| 200 | m_typefindResult = false; | ||
| 199 | 201 | ||
| 200 | 202 | /* create a new pipeline to hold the elements */ | |
| 201 | 203 | pipeline = gst_pipeline_new( "pipeline" ); | |
| 204 | |||
| 202 | 205 | /* create a disk reader */ | |
| 203 | if ( !( filesrc = gst_element_factory_make( "filesrc", "filesrc" ) ) ) goto error; | ||
| 206 | if ( !( filesrc = gst_element_factory_make( "filesrc", "disk_source" ) ) ) goto error; | ||
| 204 | 207 | gst_bin_add ( GST_BIN ( pipeline ), filesrc ); | |
| 205 | if ( !( spider = gst_element_factory_make( "spider", "spider" ) ) ) goto error; | ||
| 206 | gst_bin_add ( GST_BIN ( pipeline ), spider ); | ||
| 207 | if ( !( audioconvert = gst_element_factory_make( "audioconvert", "audioconvert" ) ) ) goto error; | ||
| 208 | gst_bin_add ( GST_BIN ( pipeline ), audioconvert ); | ||
| 209 | if ( !( audioscale = gst_element_factory_make( "audioscale", "audioscale" ) ) ) goto error; | ||
| 210 | gst_bin_add ( GST_BIN ( pipeline ), audioscale ); | ||
| 211 | if ( !( audiosink = gst_element_factory_make( m_soundOutput.latin1(), "audiosink" ) ) ) goto error; | ||
| 212 | gst_bin_add ( GST_BIN ( pipeline ), audiosink ); | ||
| 213 | |||
| 214 | /* setting device property for AudioSink*/ | ||
| 215 | if ( !m_defaultSoundDevice && !m_soundDevice.isEmpty() ) | ||
| 216 | g_object_set( G_OBJECT ( audiosink ), "device", m_soundDevice.latin1(), NULL ); | ||
| 217 | |||
| 208 | |||
| 209 | if ( !( typefind = gst_element_factory_make( "typefind", "typefind" ) ) ) goto error; | ||
| 210 | gst_bin_add ( GST_BIN ( pipeline ), typefind ); | ||
| 211 | |||
| 218 | 212 | g_object_set( G_OBJECT( filesrc ), "location", (const char*) QFile::encodeName( url.path() ), NULL ); | |
| 213 | gst_element_link_many( filesrc, typefind, NULL ); | ||
| 219 | 214 | ||
| 220 | gst_element_link_many( filesrc, spider, audioconvert, audioscale, audiosink, NULL ); | ||
| 215 | g_signal_connect ( G_OBJECT( typefind ), "have-type", G_CALLBACK( typefindFound_cb ), pipeline ); | ||
| 221 | 216 | gst_element_set_state( pipeline, GST_STATE_PLAYING ); | |
| 222 | 217 | ||
| 223 | // Try to iterate over the bin, if it works gst can decode our file | ||
| 224 | if ( gst_bin_iterate ( GST_BIN ( pipeline ) ) ) | ||
| 225 | success = true; | ||
| 226 | |||
| 218 | // Iterate over the pipeline until operation is finished | ||
| 219 | while ( gst_bin_iterate ( GST_BIN ( pipeline ) ) ); | ||
| 220 | |||
| 227 | 221 | gst_element_set_state( pipeline, GST_STATE_NULL ); | |
| 228 | 222 | gst_object_unref( GST_OBJECT( pipeline ) ); | |
| 229 | 223 | ||
| 230 | return success; | ||
| 224 | return m_typefindResult; | ||
| 231 | 225 | ||
| 232 | 226 | error: | |
| 233 | 227 | kdWarning() << "GStreamer element factory does not work. " << endl | |
| … | … | ||
| 301 | 301 | ||
| 302 | 302 | /* create a new pipeline (thread) to hold the elements */ | |
| 303 | 303 | m_thread = gst_thread_new ( "thread" ); | |
| 304 | g_object_set( G_OBJECT( m_thread ), "priority", m_threadPriority, NULL ); | ||
| 305 | |||
| 306 | kdDebug() << "Thread scheduling priority: " << m_threadPriority << endl; | ||
| 304 | g_object_set( G_OBJECT( m_thread ), "priority", 2, NULL ); | ||
| 305 | |||
| 307 | 306 | kdDebug() << "Sound output method: " << m_soundOutput << endl; | |
| 308 | 307 | ||
| 309 | 308 | if ( !( m_audiosink = createElement( m_soundOutput.latin1(), "play_audio" ) ) ) return; | |
| … | … | ||
| 325 | 325 | m_filesrc = GST_ELEMENT( gst_streamsrc_new( m_streamBuf, &m_streamBufIndex ) ); | |
| 326 | 326 | gst_bin_add ( GST_BIN ( m_thread ), m_filesrc ); | |
| 327 | 327 | } | |
| 328 | |||
| 329 | //TODO HACK | ||
| 330 | if ( url.path().contains( "_uade" ) ) { | ||
| 331 | m_spider = GST_ELEMENT( gst_uade_new() ); | ||
| 332 | g_object_set( G_OBJECT( m_spider ), "location", (const char*) ( QFile::encodeName( url.path() ) ), NULL ); | ||
| 333 | } | ||
| 334 | else | ||
| 335 | if ( !( m_spider = createElement( "spider", "spider" ) ) ) return; | ||
| 336 | |||
| 328 | |||
| 329 | if ( !( m_spider = createElement( "spider", "spider" ) ) ) return; | ||
| 337 | 330 | if ( !( m_identity = createElement( "identity", "rawscope" ) ) ) return; | |
| 338 | 331 | if ( !( m_volumeElement = createElement( "volume", "volume" ) ) ) return; | |
| 339 | 332 | if ( !( m_audioconvert = createElement( "audioconvert", "audioconvert" ) ) ) return; | |
| … | … | ||
| 429 | 429 | { | |
| 430 | 430 | if ( m_streamBufIndex + size > STREAMBUF_SIZE ) { | |
| 431 | 431 | size = STREAMBUF_SIZE - m_streamBufIndex; | |
| 432 | kdDebug() << "Stream buffer overflow!" << endl; | ||
| 432 | // kdDebug() << "Stream buffer overflow!" << endl; | ||
| 433 | 433 | } | |
| 434 | 434 | ||
| 435 | 435 | // Copy data into stream buffer | |
| … | … | ||
| 465 | 465 | /* stop the thread */ | |
| 466 | 466 | gst_element_set_state ( m_thread, GST_STATE_READY ); | |
| 467 | 467 | ||
| 468 | emit endOfTrack(); | ||
| 468 | emit stopped(); | ||
| 469 | 469 | } | |
| 470 | 470 | ||
| 471 | 471 |
src/playlistwindow.cpp
(3 / 10)
|   | |||
| 126 | 126 | m_lineEdit = new KLineEdit( hbox ); | |
| 127 | 127 | ||
| 128 | 128 | hbox->setMargin( 4 ); | |
| 129 | button->setIconSet( SmallIconSet( QApplication::reverseLayout() ? "clear_left" : "locationbar_erase" ) ); | ||
| 129 | button->setIconSet( SmallIconSet( "locationbar_erase.png" ) ); | ||
| 130 | 130 | m_lineEdit->setFrame( QFrame::Sunken ); | |
| 131 | 131 | m_lineEdit->installEventFilter( this ); //we intercept keyEvents | |
| 132 | 132 | ||
| … | … | ||
| 166 | 166 | m_browsers->addBrowser( new ContextBrowser( "ContextBrowser" ), i18n( "Context" ), "info" ); | |
| 167 | 167 | m_browsers->addBrowser( new SearchBrowser( "SearchBrowser" ), i18n( "Search" ), "find" ); | |
| 168 | 168 | ||
| 169 | #define PLAYLIST_BROWSER 1 | ||
| 170 | 169 | #ifdef PLAYLIST_BROWSER | |
| 171 | m_browsers->addBrowser( new PlaylistBrowser( "PlaylistBrowser" ), i18n( "Playlist" ), "midi" ); | ||
| 170 | m_browsers->addBrowser( m_playlist->browser(), i18n( "Playlist" ), "midi" ); | ||
| 172 | 171 | #endif | |
| 173 | 172 | ||
| 174 | 173 | { //<StreamBrowser> | |
| … | … | ||
| 463 | 463 | const KWin::WindowInfo info = KWin::windowInfo( winId() ); | |
| 464 | 464 | const uint desktop = KWin::currentDesktop(); | |
| 465 | 465 | const bool isOnThisDesktop = info.isOnDesktop( desktop ); | |
| 466 | |||
| 466 | 467 | #if KDE_IS_VERSION(3,2,1) | |
| 467 | 468 | const bool isShaded = info.hasState( NET::Shaded ); | |
| 468 | 469 | #else | |
| 469 | 470 | const bool isShaded = false; | |
| 470 | 471 | #endif | |
| 471 | 472 | ||
| 472 | |||
| 473 | 473 | if( isShaded ) | |
| 474 | 474 | { | |
| 475 | 475 | KWin::clearState( winId(), NET::Shaded ); | |
| … | … | ||
| 520 | 520 | pApp->applySettings(); | |
| 521 | 521 | ||
| 522 | 522 | amaroK::config()->writeEntry( "XMLFile", xml ); | |
| 523 | } | ||
| 524 | |||
| 525 | |||
| 526 | void amaroK::ToolBar::mousePressEvent( QMouseEvent *e ) | ||
| 527 | { | ||
| 528 | if( e->button() == RightButton ) amaroK::Menu::instance()->popup( e->globalPos() ); | ||
| 529 | 523 | } | |
| 530 | 524 | ||
| 531 | 525 | #include "playlistwindow.moc" |

