bool CDVDDemuxShoutcast::Open(CDVDInputStream* pInput) { Dispose(); m_pInput = pInput; // the input stream should be a http stream if (!pInput->IsStreamType(DVDSTREAM_TYPE_HTTP)) return false; CDVDInputStreamHttp* pInputStreamHttp = (CDVDInputStreamHttp*)pInput; CHttpHeader* pHeader = pInputStreamHttp->GetHttpHeader(); std::string strMetaInt = pHeader->GetValue(ICY_METAINTERVAL); std::string strMimeType = pHeader->GetMimeType(); // create new demuxer stream m_pDemuxStream = new CDemuxStreamAudioShoutcast(); m_pDemuxStream->iId = 0; m_pDemuxStream->iPhysicalId = 0; m_pDemuxStream->iDuration = 0; m_pDemuxStream->iChannels = 2; m_pDemuxStream->iSampleRate = 0; // set meta interval m_iMetaStreamInterval = atoi(strMetaInt.c_str()); if (stricmp(strMimeType.c_str(), CONTENT_TYPE_AAC) == 0 || stricmp(strMimeType.c_str(), CONTENT_TYPE_AACPLUS) == 0) { // need an aac decoder first m_pDemuxStream->codec = AV_CODEC_ID_AAC; } else // (stricmp(strMimeType, CONTENT_TYPE_MP3) == 0) { // default to mp3 m_pDemuxStream->codec = AV_CODEC_ID_MP3; } return true; }
CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool fileinfo) { if (!pInputStream) return NULL; // Try to open the AirTunes demuxer if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FILE) && pInputStream->GetContent().compare("audio/x-xbmc-pcm") == 0 ) { // audio/x-xbmc-pcm this is the used codec for AirTunes // (apples audio only streaming) unique_ptr<CDVDDemuxBXA> demuxer(new CDVDDemuxBXA()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTTP)) { CDVDInputStreamHttp* pHttpStream = (CDVDInputStreamHttp*)pInputStream; CHttpHeader *header = pHttpStream->GetHttpHeader(); /* check so we got the meta information as requested in our http header */ if( header->GetValue("icy-metaint").length() > 0 ) { unique_ptr<CDVDDemuxShoutcast> demuxer(new CDVDDemuxShoutcast()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } } bool streaminfo = true; /* Look for streams before playback */ if (pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { CDVDInputStreamPVRManager* pInputStreamPVR = (CDVDInputStreamPVRManager*)pInputStream; CDVDInputStream* pOtherStream = pInputStreamPVR->GetOtherStream(); /* Don't parse the streaminfo for some cases of streams to reduce the channel switch time */ bool useFastswitch = URIUtils::IsUsingFastSwitch(pInputStream->GetFileName()); streaminfo = !useFastswitch; if(pOtherStream) { /* Used for MediaPortal PVR addon (uses PVR otherstream for playback of rtsp streams) */ if (pOtherStream->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) { unique_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pOtherStream, streaminfo)) return demuxer.release(); else return NULL; } } /* Use PVR demuxer only for live streams */ if (URIUtils::IsPVRChannel(pInputStream->GetFileName())) { std::shared_ptr<CPVRClient> client; if (g_PVRClients->GetPlayingClient(client) && client->HandlesDemuxing()) { unique_ptr<CDVDDemuxPVRClient> demuxer(new CDVDDemuxPVRClient()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } } } if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) { bool useFastswitch = URIUtils::IsUsingFastSwitch(pInputStream->GetFileName()); streaminfo = !useFastswitch; } unique_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pInputStream, streaminfo, fileinfo)) return demuxer.release(); else return NULL; }
CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream) { if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTTP)) { CDVDInputStreamHttp* pHttpStream = (CDVDInputStreamHttp*)pInputStream; CHttpHeader *header = pHttpStream->GetHttpHeader(); /* check so we got the meta information as requested in our http header */ if( header->GetValue("icy-metaint").length() > 0 ) { auto_ptr<CDVDDemuxShoutcast> demuxer(new CDVDDemuxShoutcast()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } } #ifdef HAS_FILESYSTEM_HTSP if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTSP)) { auto_ptr<CDVDDemuxHTSP> demuxer(new CDVDDemuxHTSP()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } #endif if (pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { CDVDInputStreamPVRManager* pInputStreamPVR = (CDVDInputStreamPVRManager*)pInputStream; CDVDInputStream* pOtherStream = pInputStreamPVR->GetOtherStream(); if(pOtherStream) { /* Used for MediaPortal PVR addon (uses PVR otherstream for playback of rtsp streams) */ if (pOtherStream->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) { auto_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pOtherStream)) return demuxer.release(); else return NULL; } } std::string filename = pInputStream->GetFileName(); /* Use PVR demuxer only for live streams */ if (filename.substr(0, 14) == "pvr://channels") { PVR_SERVERPROPS *pProps = g_PVRManager.GetCurrentClientProps(); if (pProps && pProps->HandleDemuxing) { auto_ptr<CDVDDemuxPVRClient> demuxer(new CDVDDemuxPVRClient()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } } } auto_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; }
CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream) { // Try to open the AirTunes demuxer if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FILE) && pInputStream->GetContent().compare("audio/x-xbmc-pcm") == 0 ) { // audio/x-xbmc-pcm this is the used codec for AirTunes // (apples audio only streaming) auto_ptr<CDVDDemuxBXA> demuxer(new CDVDDemuxBXA()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } if (pInputStream->IsStreamType(DVDSTREAM_TYPE_SPOTIFY)) { auto_ptr<CDVDDemuxSpotify> demuxer(new CDVDDemuxSpotify()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTTP)) { CDVDInputStreamHttp* pHttpStream = (CDVDInputStreamHttp*)pInputStream; CHttpHeader *header = pHttpStream->GetHttpHeader(); /* check so we got the meta information as requested in our http header */ if( header->GetValue("icy-metaint").length() > 0 ) { auto_ptr<CDVDDemuxShoutcast> demuxer(new CDVDDemuxShoutcast()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } } #ifdef HAS_FILESYSTEM_HTSP if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTSP)) { auto_ptr<CDVDDemuxHTSP> demuxer(new CDVDDemuxHTSP()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } #endif if (pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { CDVDInputStreamPVRManager* pInputStreamPVR = (CDVDInputStreamPVRManager*)pInputStream; CDVDInputStream* pOtherStream = pInputStreamPVR->GetOtherStream(); if(pOtherStream) { /* Used for MediaPortal PVR addon (uses PVR otherstream for playback of rtsp streams) */ if (pOtherStream->IsStreamType(DVDSTREAM_TYPE_FFMPEG)) { auto_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pOtherStream)) return demuxer.release(); else return NULL; } } std::string filename = pInputStream->GetFileName(); /* Use PVR demuxer only for live streams */ if (filename.substr(0, 14) == "pvr://channels") { boost::shared_ptr<CPVRClient> client; if (g_PVRClients->GetPlayingClient(client) && client->HandlesDemuxing()) { auto_ptr<CDVDDemuxPVRClient> demuxer(new CDVDDemuxPVRClient()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; } } } auto_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg()); if(demuxer->Open(pInputStream)) return demuxer.release(); else return NULL; }