2 * Copyright (C) 2005-2013 Team XBMC
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)
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.
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/>.
21 #include "DVDInputStreamFFmpeg.h"
22 #include "xbmc/playlists/PlayListM3U.h"
23 #include "settings/Settings.h"
25 #include "utils/log.h"
27 using namespace XFILE;
29 CDVDInputStreamFFmpeg::CDVDInputStreamFFmpeg()
30 : CDVDInputStream(DVDSTREAM_TYPE_FFMPEG)
38 CDVDInputStreamFFmpeg::~CDVDInputStreamFFmpeg()
43 bool CDVDInputStreamFFmpeg::IsEOF()
51 bool CDVDInputStreamFFmpeg::Open(const char* strFile, const std::string& content)
53 CFileItem item(strFile, false);
55 if (item.IsInternetStream() && item.IsType(".m3u8"))
57 // get the available bandwidth and determine the most appropriate stream
58 int bandwidth = CSettings::Get().GetInt("network.bandwidth");
61 selected = PLAYLIST::CPlayListM3U::GetBestBandwidthStream(strFile, bandwidth);
62 if (selected.compare(strFile) != 0)
64 CLog::Log(LOGINFO, "CDVDInputStreamFFmpeg: Auto-selecting %s based on configured bandwidth.", selected.c_str());
65 strFile = selected.c_str();
69 if (!CDVDInputStream::Open(strFile, content))
76 if(strnicmp(strFile, "udp://", 6) == 0
77 || strnicmp(strFile, "rtp://", 6) == 0)
83 if(strnicmp(strFile, "tcp://", 6) == 0)
91 // close file and reset everyting
92 void CDVDInputStreamFFmpeg::Close()
94 CDVDInputStream::Close();
97 int CDVDInputStreamFFmpeg::Read(uint8_t* buf, int buf_size)
102 int64_t CDVDInputStreamFFmpeg::GetLength()
107 int64_t CDVDInputStreamFFmpeg::Seek(int64_t offset, int whence)