summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp')
-rw-r--r--xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp153
1 files changed, 0 insertions, 153 deletions
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
deleted file mode 100644
index f909c32..0000000
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#include "system.h"
22#include "DVDFactoryDemuxer.h"
23
24#include "DVDInputStreams/DVDInputStream.h"
25#include "DVDInputStreams/DVDInputStreamHttp.h"
26#include "DVDInputStreams/DVDInputStreamPVRManager.h"
27
28#include "DVDDemuxFFmpeg.h"
29#include "DVDDemuxShoutcast.h"
30#ifdef HAS_FILESYSTEM_HTSP
31#include "DVDDemuxHTSP.h"
32#endif
33#include "DVDDemuxBXA.h"
34#include "DVDDemuxCDDA.h"
35#include "DVDDemuxPVRClient.h"
36#include "pvr/PVRManager.h"
37#include "pvr/addons/PVRClients.h"
38
39using namespace std;
40using namespace PVR;
41
42CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool fileinfo)
43{
44 if (!pInputStream)
45 return NULL;
46
47 // Try to open the AirTunes demuxer
48 if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FILE) && pInputStream->GetContent().compare("audio/x-xbmc-pcm") == 0 )
49 {
50 // audio/x-xbmc-pcm this is the used codec for AirTunes
51 // (apples audio only streaming)
52 unique_ptr<CDVDDemuxBXA> demuxer(new CDVDDemuxBXA());
53 if(demuxer->Open(pInputStream))
54 return demuxer.release();
55 else
56 return NULL;
57 }
58
59 // Try to open CDDA demuxer
60 if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FILE) && pInputStream->GetContent().compare("application/octet-stream") == 0)
61 {
62 std::string filename = pInputStream->GetFileName();
63 if (filename.substr(0, 7) == "cdda://")
64 {
65 CLog::Log(LOGDEBUG, "DVDFactoryDemuxer: Stream is probably CD audio. Creating CDDA demuxer.");
66
67 unique_ptr<CDVDDemuxCDDA> demuxer(new CDVDDemuxCDDA());
68 if (demuxer->Open(pInputStream))
69 {
70 return demuxer.release();
71 }
72 }
73 }
74
75 if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTTP))
76 {
77 CDVDInputStreamHttp* pHttpStream = (CDVDInputStreamHttp*)pInputStream;
78 CHttpHeader *header = pHttpStream->GetHttpHeader();
79
80 /* check so we got the meta information as requested in our http header */
81 if( header->GetValue("icy-metaint").length() > 0 )
82 {
83 unique_ptr<CDVDDemuxShoutcast> demuxer(new CDVDDemuxShoutcast());
84 if(demuxer->Open(pInputStream))
85 return demuxer.release();
86 else
87 return NULL;
88 }
89 }
90
91#ifdef HAS_FILESYSTEM_HTSP
92 if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTSP))
93 {
94 unique_ptr<CDVDDemuxHTSP> demuxer(new CDVDDemuxHTSP());
95 if(demuxer->Open(pInputStream))
96 return demuxer.release();
97 else
98 return NULL;
99 }
100#endif
101
102 bool streaminfo = true; /* Look for streams before playback */
103 if (pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER))
104 {
105 CDVDInputStreamPVRManager* pInputStreamPVR = (CDVDInputStreamPVRManager*)pInputStream;
106 CDVDInputStream* pOtherStream = pInputStreamPVR->GetOtherStream();
107
108 /* Don't parse the streaminfo for some cases of streams to reduce the channel switch time */
109 bool useFastswitch = URIUtils::IsUsingFastSwitch(pInputStream->GetFileName());
110 streaminfo = !useFastswitch;
111
112 if(pOtherStream)
113 {
114 /* Used for MediaPortal PVR addon (uses PVR otherstream for playback of rtsp streams) */
115 if (pOtherStream->IsStreamType(DVDSTREAM_TYPE_FFMPEG))
116 {
117 unique_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg());
118 if(demuxer->Open(pOtherStream, streaminfo))
119 return demuxer.release();
120 else
121 return NULL;
122 }
123 }
124
125 /* Use PVR demuxer only for live streams */
126 if (URIUtils::IsPVRChannel(pInputStream->GetFileName()))
127 {
128 std::shared_ptr<CPVRClient> client;
129 if (g_PVRClients->GetPlayingClient(client) &&
130 client->HandlesDemuxing())
131 {
132 unique_ptr<CDVDDemuxPVRClient> demuxer(new CDVDDemuxPVRClient());
133 if(demuxer->Open(pInputStream))
134 return demuxer.release();
135 else
136 return NULL;
137 }
138 }
139 }
140
141 if (pInputStream->IsStreamType(DVDSTREAM_TYPE_FFMPEG))
142 {
143 bool useFastswitch = URIUtils::IsUsingFastSwitch(pInputStream->GetFileName());
144 streaminfo = !useFastswitch;
145 }
146
147 unique_ptr<CDVDDemuxFFmpeg> demuxer(new CDVDDemuxFFmpeg());
148 if(demuxer->Open(pInputStream, streaminfo, fileinfo))
149 return demuxer.release();
150 else
151 return NULL;
152}
153