diff options
| author | manuel <manuel@mausz.at> | 2015-03-04 00:23:39 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2015-03-04 00:23:39 +0100 |
| commit | 9d11b08ad61b1f0d6d7023ce403285d8662efaed (patch) | |
| tree | 5bc0c947d9e10d3e8c9dc1e6b26f3d6599f0cea1 /xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h | |
| parent | c159d9f91f1573901868100a9464527a5a71575b (diff) | |
| download | kodi-pvr-build-9d11b08ad61b1f0d6d7023ce403285d8662efaed.tar.gz kodi-pvr-build-9d11b08ad61b1f0d6d7023ce403285d8662efaed.tar.bz2 kodi-pvr-build-9d11b08ad61b1f0d6d7023ce403285d8662efaed.zip | |
sync with upstream
Diffstat (limited to 'xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h')
| -rw-r--r-- | xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h | 172 |
1 files changed, 0 insertions, 172 deletions
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h deleted file mode 100644 index d180e40..0000000 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h +++ /dev/null | |||
| @@ -1,172 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (C) 2005-2013 Team XBMC | ||
| 5 | * http://xbmc.org | ||
| 6 | * | ||
| 7 | * This Program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | * any later version. | ||
| 11 | * | ||
| 12 | * This Program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with XBMC; see the file COPYING. If not, see | ||
| 19 | * <http://www.gnu.org/licenses/>. | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include "DVDDemux.h" | ||
| 24 | #include "threads/CriticalSection.h" | ||
| 25 | #include "threads/SystemClock.h" | ||
| 26 | #include <map> | ||
| 27 | #include <vector> | ||
| 28 | |||
| 29 | extern "C" { | ||
| 30 | #include "libavformat/avformat.h" | ||
| 31 | } | ||
| 32 | |||
| 33 | class CDVDDemuxFFmpeg; | ||
| 34 | class CURL; | ||
| 35 | |||
| 36 | class CDemuxStreamVideoFFmpeg | ||
| 37 | : public CDemuxStreamVideo | ||
| 38 | { | ||
| 39 | CDVDDemuxFFmpeg *m_parent; | ||
| 40 | AVStream* m_stream; | ||
| 41 | public: | ||
| 42 | CDemuxStreamVideoFFmpeg(CDVDDemuxFFmpeg *parent, AVStream* stream) | ||
| 43 | : m_parent(parent) | ||
| 44 | , m_stream(stream) | ||
| 45 | {} | ||
| 46 | virtual void GetStreamInfo(std::string& strInfo); | ||
| 47 | }; | ||
| 48 | |||
| 49 | |||
| 50 | class CDemuxStreamAudioFFmpeg | ||
| 51 | : public CDemuxStreamAudio | ||
| 52 | { | ||
| 53 | CDVDDemuxFFmpeg *m_parent; | ||
| 54 | AVStream* m_stream; | ||
| 55 | public: | ||
| 56 | CDemuxStreamAudioFFmpeg(CDVDDemuxFFmpeg *parent, AVStream* stream) | ||
| 57 | : m_parent(parent) | ||
| 58 | , m_stream(stream) | ||
| 59 | {} | ||
| 60 | std::string m_description; | ||
| 61 | |||
| 62 | virtual void GetStreamInfo(std::string& strInfo); | ||
| 63 | virtual void GetStreamName(std::string& strInfo); | ||
| 64 | }; | ||
| 65 | |||
| 66 | class CDemuxStreamSubtitleFFmpeg | ||
| 67 | : public CDemuxStreamSubtitle | ||
| 68 | { | ||
| 69 | CDVDDemuxFFmpeg *m_parent; | ||
| 70 | AVStream* m_stream; | ||
| 71 | public: | ||
| 72 | CDemuxStreamSubtitleFFmpeg(CDVDDemuxFFmpeg *parent, AVStream* stream) | ||
| 73 | : m_parent(parent) | ||
| 74 | , m_stream(stream) | ||
| 75 | {} | ||
| 76 | std::string m_description; | ||
| 77 | |||
| 78 | virtual void GetStreamInfo(std::string& strInfo); | ||
| 79 | virtual void GetStreamName(std::string& strInfo); | ||
| 80 | |||
| 81 | }; | ||
| 82 | |||
| 83 | #define FFMPEG_FILE_BUFFER_SIZE 32768 // default reading size for ffmpeg | ||
| 84 | #define FFMPEG_DVDNAV_BUFFER_SIZE 2048 // for dvd's | ||
| 85 | |||
| 86 | struct StereoModeConversionMap; | ||
| 87 | |||
| 88 | class CDVDDemuxFFmpeg : public CDVDDemux | ||
| 89 | { | ||
| 90 | public: | ||
| 91 | CDVDDemuxFFmpeg(); | ||
| 92 | virtual ~CDVDDemuxFFmpeg(); | ||
| 93 | |||
| 94 | bool Open(CDVDInputStream* pInput, bool streaminfo = true, bool fileinfo = false); | ||
| 95 | void Dispose(); | ||
| 96 | void Reset(); | ||
| 97 | void Flush(); | ||
| 98 | void Abort(); | ||
| 99 | void SetSpeed(int iSpeed); | ||
| 100 | virtual std::string GetFileName(); | ||
| 101 | |||
| 102 | DemuxPacket* Read(); | ||
| 103 | |||
| 104 | bool SeekTime(int time, bool backwords = false, double* startpts = NULL); | ||
| 105 | bool SeekByte(int64_t pos); | ||
| 106 | int GetStreamLength(); | ||
| 107 | CDemuxStream* GetStream(int iStreamId); | ||
| 108 | int GetNrOfStreams(); | ||
| 109 | |||
| 110 | bool SeekChapter(int chapter, double* startpts = NULL); | ||
| 111 | int GetChapterCount(); | ||
| 112 | int GetChapter(); | ||
| 113 | void GetChapterName(std::string& strChapterName, int chapterIdx=-1); | ||
| 114 | int64_t GetChapterPos(int chapterIdx=-1); | ||
| 115 | virtual void GetStreamCodecName(int iStreamId, std::string &strName); | ||
| 116 | |||
| 117 | bool Aborted(); | ||
| 118 | |||
| 119 | AVFormatContext* m_pFormatContext; | ||
| 120 | CDVDInputStream* m_pInput; | ||
| 121 | |||
| 122 | protected: | ||
| 123 | friend class CDemuxStreamAudioFFmpeg; | ||
| 124 | friend class CDemuxStreamVideoFFmpeg; | ||
| 125 | friend class CDemuxStreamSubtitleFFmpeg; | ||
| 126 | |||
| 127 | int ReadFrame(AVPacket *packet); | ||
| 128 | CDemuxStream* AddStream(int iId); | ||
| 129 | void AddStream(int iId, CDemuxStream* stream); | ||
| 130 | CDemuxStream* GetStreamInternal(int iStreamId); | ||
| 131 | void CreateStreams(unsigned int program = UINT_MAX); | ||
| 132 | void DisposeStreams(); | ||
| 133 | void ParsePacket(AVPacket *pkt); | ||
| 134 | bool IsVideoReady(); | ||
| 135 | void ResetVideoStreams(); | ||
| 136 | |||
| 137 | AVDictionary *GetFFMpegOptionsFromURL(const CURL &url); | ||
| 138 | double ConvertTimestamp(int64_t pts, int den, int num); | ||
| 139 | void UpdateCurrentPTS(); | ||
| 140 | bool IsProgramChange(); | ||
| 141 | |||
| 142 | std::string GetStereoModeFromMetadata(AVDictionary *pMetadata); | ||
| 143 | std::string ConvertCodecToInternalStereoMode(const std::string &mode, const StereoModeConversionMap *conversionMap); | ||
| 144 | |||
| 145 | void GetL16Parameters(int &channels, int &samplerate); | ||
| 146 | |||
| 147 | CCriticalSection m_critSection; | ||
| 148 | std::map<int, CDemuxStream*> m_streams; | ||
| 149 | std::vector<std::map<int, CDemuxStream*>::iterator> m_stream_index; | ||
| 150 | |||
| 151 | AVIOContext* m_ioContext; | ||
| 152 | |||
| 153 | double m_currentPts; // used for stream length estimation | ||
| 154 | bool m_bMatroska; | ||
| 155 | bool m_bAVI; | ||
| 156 | int m_speed; | ||
| 157 | unsigned m_program; | ||
| 158 | XbmcThreads::EndTime m_timeout; | ||
| 159 | |||
| 160 | // Due to limitations of ffmpeg, we only can detect a program change | ||
| 161 | // with a packet. This struct saves the packet for the next read and | ||
| 162 | // signals STREAMCHANGE to player | ||
| 163 | struct | ||
| 164 | { | ||
| 165 | AVPacket pkt; // packet ffmpeg returned | ||
| 166 | int result; // result from av_read_packet | ||
| 167 | }m_pkt; | ||
| 168 | |||
| 169 | bool m_streaminfo; | ||
| 170 | bool m_checkvideo; | ||
| 171 | }; | ||
| 172 | |||
