void DecoderIOFactoryShoutCast::periodicallyCheckBuffered(void) { LOG(VB_NETWORK, LOG_INFO, QString("DecoderIOFactoryShoutCast: prebuffered %1/%2KB") .arg(m_input->bytesAvailable()/1024).arg(m_prebuffer/1024)); if (m_input->bytesAvailable() < m_prebuffer || m_input->bytesAvailable() == 0) return; ShoutCastResponse response; m_input->getResponse(response); LOG(VB_PLAYBACK, LOG_INFO, QString("contents '%1'").arg(response.getContent())); if (response.getContent() == "audio/mpeg") doConnectDecoder("create-mp3-decoder.mp3"); else if (response.getContent() == "audio/aacp") doConnectDecoder("create-aac-decoder.m4a"); else if (response.getContent() == "application/ogg") doConnectDecoder("create-ogg-decoder.ogg"); else if (response.getContent() == "audio/aac") doConnectDecoder("create-aac-decoder.aac"); else { doFailed(tr("Unsupported content type for ShoutCast stream: %1") .arg (response.getContent())); } m_timer->disconnect(); m_timer->stop(); m_lastStatusTime.start(); }
void DecoderIOFactoryFile::start(void) { QString sourcename = getMetadata().Filename(); VERBOSE(VB_PLAYBACK, QString("DecoderIOFactory: Opening Local File %1").arg(sourcename)); m_input = new QFile(sourcename); doConnectDecoder(getUrl().toLocalFile()); }
void DecoderIOFactorySG::start(void) { QString url = getUrl().toString(); LOG(VB_PLAYBACK, LOG_INFO, QString("DecoderIOFactorySG: Opening Myth URL %1").arg(url)); m_input = new MusicSGIODevice(url); doConnectDecoder(getUrl().path()); }
void DecoderIOFactoryFile::start(void) { QString sourcename = m_handler->getMetadata().Filename(); LOG(VB_PLAYBACK, LOG_INFO, QString("DecoderIOFactory: Opening Local File %1").arg(sourcename)); m_input = new QFile(sourcename); doConnectDecoder(m_handler->getUrl().toLocalFile()); }
void DecoderIOFactorySG::start(void) { QString url = m_handler->getUrl().toString(); LOG(VB_PLAYBACK, LOG_INFO, QString("DecoderIOFactorySG: Opening Myth URL %1").arg(url)); m_input = new MusicSGIODevice(url); QString path = m_handler->getUrl().path(); if (m_handler->getUrl().hasFragment()) path += '#' + m_handler->getUrl().fragment(); doConnectDecoder(path); }
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; }
void DecoderIOFactoryUrl::doStart(void) { doConnectDecoder(getUrl()); m_started = true; }
void DecoderIOFactoryUrl::doStart(void) { doConnectDecoder(m_handler->getUrl().toString()); m_started = true; }