Пример #1
0
/** No descriptions */
void DubPlaylist::updateCurrent() {
    KFileItem* active = dub->getActiveFile();
    if ( active ) {
        currentItem = new DubPlaylistItem(*active);
        emit playCurrent();
    }
}
Пример #2
0
    void Player::playStream(const String& item, const xbmcgui::ListItem* plistitem, bool windowed)
    {
      XBMC_TRACE;
      DelayedCallGuard dc(languageHook);
      if (!item.empty())
      {
        // set fullscreen or windowed
        CMediaSettings::GetInstance().SetVideoStartWindowed(windowed);

        const AddonClass::Ref<xbmcgui::ListItem> listitem(plistitem);

        if (listitem.isSet())
        {
          // set m_strPath to the passed url
          listitem->item->SetPath(item.c_str());
          CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, 0, 0, static_cast<void*>(new CFileItem(*listitem->item)));
        }
        else
        {
          CFileItemList *l = new CFileItemList; //don't delete,
          l->Add(std::make_shared<CFileItem>(item, false));
          CApplicationMessenger::GetInstance().PostMsg(TMSG_MEDIA_PLAY, -1, -1, static_cast<void*>(l));
        }
      }
      else
        playCurrent(windowed);
    }
Пример #3
0
void YVPlayer::setPlaying(bool p) {
    m_playing = p;
    emit playingChanged();
    if (!p) {
        if (m_reply) {
            m_reply->deleteLater();
            m_reply = 0;
        } else if (m_ctxt) {
            mmr_stop(m_ctxt);
        }
        return;
    }

    if (!m_t.size()) {
        m_reply = m_nm->get(QNetworkRequest(QUrl::fromPercentEncoding(m_url.toLatin1())));
    } else {
        if (m_ctxt) {
            if (m_pos == -1) m_pos = 0;
            mmr_seek(m_ctxt, QString::number(m_pos ).toLatin1().data());
            mmr_play(m_ctxt);
        } else {
            playCurrent();
        }
    }
}
Пример #4
0
    void Player::playStream(const String& item, const xbmcgui::ListItem* plistitem, bool windowed)
    {
      XBMC_TRACE;
      DelayedCallGuard dc(languageHook);
      if (!item.empty())
      {
        // set fullscreen or windowed
        CMediaSettings::Get().SetVideoStartWindowed(windowed);

        // force a playercore before playing
        g_application.m_eForcedNextPlayer = playerCore;

        const AddonClass::Ref<xbmcgui::ListItem> listitem(plistitem);

        if (listitem.isSet())
        {
          // set m_strPath to the passed url
          listitem->item->SetPath(item.c_str());
          CApplicationMessenger::Get().PlayFile((const CFileItem)(*(listitem->item)), false);
        }
        else
        {
          CFileItem nextitem(item, false);
          CApplicationMessenger::Get().MediaPlay(nextitem.GetPath());
        }
      }
      else
        playCurrent(windowed);
    }
Пример #5
0
void MusicPlayer::start(const std::string& songSetName)
{
    // Start playing the specified music set
    if (songSetName != currentSongSet)
    {
        currentSongSet = songSetName;
        currentSongId = 0;
        shuffleSongs();
        playCurrent();
    }
}
Пример #6
0
void Player::SongFinished() {
	fprintf(stderr, "Song finished!\n");
	Mix_Music *last = current;
	if (next != NULL) {
		current = next;
		playCurrent();
	}

	Mix_FreeMusic(last);
	LoadNext();
}
Пример #7
0
    void Player::play(const Alternative<String, const PlayList* > & item,
                      const XBMCAddon::xbmcgui::ListItem* listitem, bool windowed, int startpos)
    {
      TRACE;

      if (Alternative<String, const PlayList*>::isNullReference(item))
        playCurrent(windowed);
      else if (item.which() == XBMCAddon::first)
        playStream(item.former(), listitem, windowed);
      else // item is a PlayListItem
        playPlaylist(item.later(),windowed,startpos);
    }
Пример #8
0
    void Player::play(const Alternative<String, const PlayList* > & item,
                      const XBMCAddon::xbmcgui::ListItem* listitem, bool windowed, int startpos)
    {
      XBMC_TRACE;

      if (&item == &defaultPlayParameter)
        playCurrent(windowed);
      else if (item.which() == XBMCAddon::first)
        playStream(item.former(), listitem, windowed);
      else // item is a PlayListItem
        playPlaylist(item.later(),windowed,startpos);
    }
Пример #9
0
void Player::Play() {
	if (MusicPaused) {
		Mix_ResumeMusic();
		MusicPaused = false;
	} else {
		//Get first song to play

		//TEMP: just grab test song
		current = Mix_LoadMUS("song.flac");
		next = Mix_LoadMUS("next.flac");
		if (!current) {
			fprintf(stderr, "Error opening music file: %s\n", SDL_GetError());
			exit(1);
		}

		playCurrent();
	}
}
Пример #10
0
    void Player::playPlaylist(const PlayList* playlist, bool windowed)
    {
      TRACE;
      if (playlist != NULL)
      {
        // set fullscreen or windowed
        g_settings.m_bStartVideoWindowed = windowed;

        // force a playercore before playing
        g_application.m_eForcedNextPlayer = playerCore;

        // play a python playlist (a playlist from playlistplayer.cpp)
        iPlayList = playlist->getPlayListId();
        g_playlistPlayer.SetCurrentPlaylist(iPlayList);
        CApplicationMessenger::Get().PlayListPlayerPlay();
      }
      else
        playCurrent(windowed);
    }
Пример #11
0
    void Player::playPlaylist(const PlayList* playlist, bool windowed, int startpos)
    {
      XBMC_TRACE;
      DelayedCallGuard dc(languageHook);
      if (playlist != NULL)
      {
        // set fullscreen or windowed
        CMediaSettings::GetInstance().SetVideoStartWindowed(windowed);

        // play a python playlist (a playlist from playlistplayer.cpp)
        iPlayList = playlist->getPlayListId();
        CServiceBroker::GetPlaylistPlayer().SetCurrentPlaylist(iPlayList);
        if (startpos > -1)
          CServiceBroker::GetPlaylistPlayer().SetCurrentSong(startpos);
        CApplicationMessenger::GetInstance().SendMsg(TMSG_PLAYLISTPLAYER_PLAY, startpos);
      }
      else
        playCurrent(windowed);
    }
Пример #12
0
    void Player::playPlaylist(const PlayList* playlist, bool windowed)
    {
      TRACE;
      DelayedCallGuard dc(languageHook);
      if (playlist != NULL)
      {
        // set fullscreen or windowed
        CMediaSettings::Get().SetVideoStartWindowed(windowed);

        // force a playercore before playing
        g_application.m_eForcedNextPlayer = playerCore;

        // play a python playlist (a playlist from playlistplayer.cpp)
        iPlayList = playlist->getPlayListId();
        g_playlistPlayer.SetCurrentPlaylist(iPlayList);
        CApplicationMessenger::Get().PlayListPlayerPlay();
      }
      else
        playCurrent(windowed);
    }
Пример #13
0
mainwindow::mainwindow(){
    currentState=0;
    hd = new helpdialog;
    m=new mediaobject;
    setupUi(this);
    setWindowTitle("Music Player");
    m=new mediaobject;
    QObject::connect(actionAbout, SIGNAL(triggered()), this, SLOT(helpShow()));
    QObject::connect(actionExit,SIGNAL(triggered()),this,SLOT(close()));
    QObject::connect(actionAdd_Files,SIGNAL(triggered()),this,SLOT(addFiles()));
    QObject::connect(buttonPause,SIGNAL(clicked()),this,SLOT(pauseFile()));
    QObject::connect(buttonPlay,SIGNAL(clicked()),this,SLOT(playCurrent()));
    QObject::connect(buttonStop,SIGNAL(clicked()),m->mobj,SLOT(stop()));
    QObject::connect(m,SIGNAL(currentSourceChanged(Phonon::MediaSource)),this,SLOT(fetchNext(Phonon::MediaSource)));
    QObject::connect(m->mobj,SIGNAL(aboutToFinish()),this,SLOT(aboutToFinish()));
    QObject::connect(m->mobj,SIGNAL(stateChanged(Phonon::State,Phonon::State)),this,SLOT(metaStateChanged(Phonon::State,Phonon::State)));
    seekSlider->setMediaObject(m->mobj);
    volumeSlider->setAudioOutput(m->audioOutput);
    show();
    // Signal and slots for help -> AboutUs

    //m->setQueue(list);
}
Пример #14
0
void DubPlaylist::setCurrent(const PlaylistItem &play)
{
    currentItem=play;
    emit playCurrent();
}
Пример #15
0
void KaraokeWidget::playCurrent()
{
    if ( pSongQueue->isEmpty() )
    {
        Logger::debug("KaraokeWidget::playCurrent nothing to play");
        pNotification->clearOnScreenMessage();
        return;
    }

    SongQueueItem current = pSongQueue->current();

    // This shouldn't happen
    if ( current.state == SongQueueItem::STATE_NOT_READY )
        abort();

    // If current song is not ready yet, show the notification and wait until it is
    if ( current.state == SongQueueItem::STATE_GETTING_READY )
    {
        Logger::debug("KaraokeWidget::playCurrent want %s play but it is not ready yet", qPrintable( current.file) );

        // While we're converting MIDI, ensure other songs are stopped
        m_karaokeMutex.lock();

        if ( m_karaoke )
        {
            m_karaoke->stop();
            delete m_karaoke;
            m_karaoke = 0;
        }

        m_karaokeMutex.unlock();

        pNotification->setOnScreenMessage( current.stateText() );
        QTimer::singleShot( 500, this, SLOT( playCurrent() ) );
        return;
    }

    Logger::debug("KaraokeWidget::playCurrent %s", qPrintable( current.file) );
    pNotification->clearOnScreenMessage();
    KaraokeSong * karfile = new KaraokeSong( this, current );

    // Pause the background while loading song (prevents GStreamer errors)
    m_background->pause( true );

    try
    {
        if ( !karfile->open() )
        {
            // Resume background
            m_background->pause( false );

            delete karfile;
            return;
        }
    }
    catch ( const QString& ex )
    {
        // Resume background
        m_background->pause( false );
        Logger::error("KaraokeWidget::playCurrent %s: exception %s", qPrintable( current.file), qPrintable(ex) );

        MessageBoxAutoClose::critical(
                    "Cannot play file",
                    tr("Cannot play file %1:\n%2") .arg( current.file ) .arg( ex ) );

        delete karfile;

        // Kick the current song out of queue
        pActionHandler->dequeueSong( current.id );
        return;
    }

    m_karaokeMutex.lock();

    if ( m_karaoke )
    {
        qWarning("BUG: new karaoke is started while the old is not stoppped!");
        m_karaoke->stop();
        delete m_karaoke;
    }

    m_karaoke = karfile;
    m_karaokeMutex.unlock();

    Logger::debug("KaraokeWidget: waiting for the song being loaded");
}
Пример #16
0
void Oblique::setCurrent(const PlaylistItem &item)
{
	if (!item) return;
	mSelector->setCurrent(*static_cast<Item*>(const_cast<PlaylistItemData*>(item.data())));
	emit playCurrent();
}
Пример #17
0
void DubPlaylist::setCurrent(const KFileItem* file, bool play) {
    Q_ASSERT(file);
    currentItem = new DubPlaylistItem(*file);
    if (play)
        emit playCurrent();
}