コード例 #1
0
bool DecoderHandler::next(void)
{
    if (done())
        return false;

    if (m_meta.Format() == "cast")
    {
        m_playlist_pos = random() % m_playlist.size();
    }
    else
    {
        m_playlist_pos++;
    }

    PlayListFileEntry *entry = m_playlist.get(m_playlist_pos);

    if (QFileInfo(entry->File()).isAbsolute())
        m_url = QUrl::fromLocalFile(entry->File());
    else
        m_url.setUrl(entry->File());

    LOG(VB_PLAYBACK, LOG_INFO, QString("Now playing '%1'").arg(m_url.toString()));

    deleteIOFactory();
    createIOFactory(m_url);

    if (! haveIOFactory())
        return false;

    getIOFactory()->addListener(this);
    getIOFactory()->start();
    m_state = ACTIVE;

    return true;
}
コード例 #2
0
ファイル: decoderhandler.cpp プロジェクト: faginbagin/mythtv
bool DecoderHandler::next(void)
{
    if (done())
        return false;

    if (m_meta.Format() == "cast")
    {
        m_playlist_pos = random() % m_playlist.size();
    }
    else
    {
        m_playlist_pos++;
    }

    PlayListFileEntry *entry = m_playlist.get(m_playlist_pos);

    if (QFileInfo(entry->File()).isAbsolute())
        m_url = QUrl::fromLocalFile(entry->File());
    else
        m_url.setUrl(entry->File());

    LOG(VB_PLAYBACK, LOG_INFO, QString("Now playing '%1'").arg(m_url.toString()));

    // we use the avfdecoder for everything except CD tracks
    if (m_url.toString().endsWith(".cda"))
        doConnectDecoder(m_url, ".cda");
    else
    {
        // we don't know what format radio stations are so fake a format
        // and hope avfdecoder can decode it
        doConnectDecoder(m_url, ".mp3");
    }

    m_state = ACTIVE;

    return true;
}