XBMC源代码简析 5:视频播放器(dvdplayer)- 解复用器(以ffmpeg为例) - 将夜 - 博客园本文我们分析XBMC中视频播放器(dvdplayer)中的解复用器部分。由于解复用器种类很多,不可能一一分析,因此以ffmpeg解复用器为例进行分析。XBMC解复用器部分文件目录如下图所示:在这里我们看一下解复用器中的FFMPEG解复用器。对应DVDDemux. FFmpeg. h和DVDDemux. FFmpeg. cpp之前的分析类文章在解复用器这方面已经做过详细的分析了。在此就不多叙述了,代码很清晰。重点的地方已经标上了注释。DVDDemux.
Could Not Find Codec Parameters For Xbmc Repositories
Could Not Find Codec Parameters For Xbmc Android
FFmpeg. h源代码如下所示: #include "DVDDemux. Dll. Av. Format. h" #include "Dll. Av. Codec. h" #include "Dll. Av. Util. h" #include "threads/Critical.
Section. h" #include "threads/System. Clock. h" #include < map> class CDVDDemux. FFmpeg; class CURL; class CDemux. Stream. Video. FFmpeg : public CDemux. Stream. Video { CDVDDemux.
CLog::Log(LOGERROR, '%s - Error, could not open file %s', __FUNCTION__, CURL::GetRedacted(strFile).c_str()). CLog::Log(LOGWARNING, 'could not find codec if. XBMC分析系列文章: XBMC源代码分析 1:整体结构以及编译方法 XBMC源代码分析 2:Addons(皮肤Skin) XBMC源代码分析 3:核心部分(core)-综述 XBMC. From the log: 17:28:34 T:4376 WARNING: could not find codec parameters for rtmp. Contribute to Twitch.tv-on-XBMC development by creating an account on GitHub. . (buf), st->codec, 0); av_log(ic, AV_LOG_WARNING, 'Could not find codec parameters for stream %d (%s): %s\n' 'Consider increasing the value for the. . &options) < 0) { CLog::Log(LOGDEBUG, 'Error, could not open file %s', CURL ::GetRedacted(strFile).c_str()); Dispose(); m_dllAvUtil.av_dict_free(&options.
FFmpeg *m_parent; AVStream* m_stream; public: CDemux. Stream. Video. FFmpeg(CDVDDemux. FFmpeg *parent, AVStream* stream) : m_parent(parent) , m_stream(stream) {} virtual void Get. Stream. Info(std: :string& str. Info); }; class CDemux.
Stream. Audio. FFmpeg : public CDemux. Stream. Audio { CDVDDemux. FFmpeg *m_parent; AVStream* m_stream; public: CDemux. Stream. Audio. FFmpeg(CDVDDemux. FFmpeg *parent, AVStream* stream) : m_parent(parent) , m_stream(stream) {} std: :string m_description; virtual void Get. Stream. Info(std: :string& str. Info); virtual void Get.
XBMC - 'could not find codec parameters for /dev/sr0'. could not find codec parameters for /dev/sr0 20:29:45 T:140206225180416. could not find filesystem '/dev. Codec Issue? #7. Closed. could not find codec parameters for http:// nor is the K-Lite Codec Pack. XBMC.
Stream. Name(std: :string& str. Info); }; class CDemux. Stream. Subtitle. FFmpeg : public CDemux. Stream. Subtitle { CDVDDemux. FFmpeg *m_parent; AVStream* m_stream; public: CDemux.
Stream. Subtitle. FFmpeg(CDVDDemux.
FFmpeg *parent, AVStream* stream) : m_parent(parent) , m_stream(stream) {} std: :string m_description; virtual void Get. Stream. Info(std: :string& str.
Info); virtual void Get. Stream. Name(std: :string& str. Info); }; #define FFMPEG_FILE_BUFFER_SIZE 3. FFMPEG_DVDNAV_BUFFER_SIZE 2. CDVDDemux. FFmpeg : public CDVDDemux { public: CDVDDemux. FFmpeg(); virtual ~CDVDDemux.
FFmpeg(); bool Open(CDVDInput. Stream* p. Input); void Dispose(); void Reset(); void Flush(); void Abort(); void Set. Speed(int i. Speed); virtual std: :string Get.
File. Name(); Demux. Packet* Read(); bool Seek. Time(int time, bool backwords = false, double* startpts = NULL); bool Seek. Byte(int. 64_t pos); int Get.
Stream. Length(); CDemux. Stream* Get. Stream(int i.
Stream. Id); int Get. Nr. Of. Streams(); bool Seek. Chapter(int chapter, double* startpts = NULL); int Get. Chapter. Count(); int Get. Chapter(); void Get.
Chapter. Name(std: :string& str. Chapter. Name); virtual void Get. Stream. Codec. Name(int i.
Stream. Id, CStd. String & str. Name); bool Aborted(); AVFormat. Context* m_p. Format. Context; CDVDInput. Stream* m_p. Input; protected: friend class CDemux. Stream. Audio. FFmpeg; friend class CDemux.
Stream. Video. FFmpeg; friend class CDemux. Stream. Subtitle. FFmpeg; int Read. Frame(AVPacket *packet); CDemux. Stream* Add. Stream(int i. Id); void Add.
Stream(int i. Id, CDemux. Stream* stream); CDemux. Stream* Get. Stream.
Internal(int i. Stream. Id); void Create. Streams(unsigned int program = UINT_MAX); void Dispose. Streams(); AVDictionary *Get. FFMpeg. Options. From.
URL(const CURL & url); double Convert. Timestamp(int. 64_t pts, int den, int num); void Update. Current. PTS(); bool Is. Program. Change(); CCritical. Section m_crit. Section; std: :map< int, CDemux.
Stream*> m_streams; std: :vector< std: :map< int, CDemux. Stream*> :: iterator> m_stream_index; AVIOContext* m_io. Context; Dll. Av. Format m_dll.
Av. Format; Dll. Av. Codec m_dll. Av. Codec; Dll.
Av. Util m_dll. Av. Util; double m_i. Current. Pts; bool m_b.
Matroska; bool m_b. AVI; int m_speed; unsigned m_program; Xbmc. Threads: :End. Time m_timeout; struct { AVPacket pkt; int result; }m_pkt; }; 该类中以下几个函数包含了解复用器的几个功能。 bool Open(CDVDInput. Stream* p. Input); //打开 void Dispose(); //关闭 void Reset(); //复位 void Flush(); 我们查看一下这几个函数的源代码。Open() bool CDVDDemux. FFmpeg: :Open(CDVDInput. Stream* p. Input) { AVInput.
Format* iformat = NULL; std: :string str. File; m_i. Current. Pts = DVD_NOPTS_VALUE; m_speed = DVD_PLAYSPEED_NORMAL; m_program = UINT_MAX; const AVIOInterrupt.
CB int_cb = { interrupt_cb, this }; if (! Input) return false; if (! Av. Util. Load() || ! Av. Codec. Load() || !
Av. Format. Load()) { CLog: :Log(LOGERROR,"CDVDDemux. FFmpeg: :Open - failed to load ffmpeg libraries"); return false; } m_dll.
Av. Format. av_register_all(); m_p. Input = p. Input; str. File = m_p. Input- > Get. File. Name(); bool streaminfo = true; if( m_p. Input- > Get. Content().
Input- > Get. Content(); if ( content. Av. Format. av_find_input_format("mpeg"); else if( content. Av. Format. av_find_input_format("mpeg"); else if( content. Av. Format. av_find_input_format("mpegts"); else if( content. Av. Format. av_find_input_format("mjpeg"); } m_p. Format. Context = m_dll. Av. Format. avformat_alloc_context(); m_p.
Format. Context- > interrupt_callback = int_cb; m_timeout. Set(3. 00. 00); if( m_p. Input- > Is. Stream.
Type(DVDSTREAM_TYPE_FFMPEG) ) { CURL url = m_p. Input- > Get. URL(); CStd. String protocol = url. Get. Protocol(); AVDictionary *options = Get. FFMpeg. Options. From. URL(url); int result=- 1; if (protocol.
Equals("mms")) { url. Set. Protocol("mmsh"); url. Set. Protocol. Options(""); result = m_dll. Av. Format. avformat_open_input(& m_p. Format. Context, url. Get(). c_str(), iformat, & options); if (result < 0) { url.
Set. Protocol("mmst"); str. File = url. Get(); } } if (result < 0 & & m_dll. Av. Format. avformat_open_input(& m_p. Format. Context, str. File. c_str(), iformat, & options) < 0 ) { CLog: :Log(LOGDEBUG, "Error, could not open file %s", CURL: :Get.
Redacted(str. File). Dispose(); m_dll. Av. Util. av_dict_free(& options); return false; } m_dll. Av. Util. av_dict_free(& options); } else { unsigned char* buffer = (unsigned char*)m_dll. Av. Util. av_malloc(FFMPEG_FILE_BUFFER_SIZE); m_io. Context = m_dll. Av. Format. avio_alloc_context(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, this, dvd_file_read, NULL, dvd_file_seek); m_io.
Context- > max_packet_size = m_p. Input- > Get. Block. Size(); if(m_io. Context- > max_packet_size) m_io. Context- > max_packet_size *= FFMPEG_FILE_BUFFER_SIZE / m_io.
Context- > max_packet_size; if(m_p. Input- > Seek(0, SEEK_POSSIBLE) == 0) m_io. Context- > seekable = 0; if( iformat == NULL ) { bool try. SPDIFonly = (m_p. Input- > Get. Content() == "audio/x- spdif- compressed"); if (! SPDIFonly) m_dll.
Av. Format. av_probe_input_buffer(m_io. Context, & iformat, str. File. c_str(), NULL, 0, 0); if (try.
SPDIFonly || (iformat & & strcmp(iformat- > name, "wav") == 0)) { AVProbe. Data pd; uint. FFMPEG_FILE_BUFFER_SIZE + AVPROBE_PADDING_SIZE]; pd. File. c_str(); pd.
Av. Format. avio_read(m_io. Context, pd. buf, m_io. Context- > max_packet_size ? m_io. Context- > max_packet_size : m_io. Context- > buffer_size); if (pd. CLog: :Log(LOGERROR, "%s - error reading from input stream, %s", __FUNCTION__, CURL: :Get. Redacted(str. File).
AVPROBE_PADDING_SIZE); m_dll. Av. Format. avio_seek(m_io. Context , 0, SEEK_SET); if (try. SPDIFonly || (iformat & & strcmp(iformat- > name, "wav") == 0 & & ! Settings. m_dvdplayer. Ignore. DTSin. WAV)) { AVInput. Format *iformat. 2; iformat.
Av. Format. av_find_input_format("spdif"); if (iformat. AVPROBE_SCORE_MAX / 4) { iformat = iformat. Av. Format. av_find_input_format("dts"); if (iformat.
AVPROBE_SCORE_MAX / 4) { iformat = iformat. SPDIFonly) { CLog: :Log(LOGDEBUG, "%s - not spdif or dts file, fallbacking", __FUNCTION__); return false; } } } } if(! Input- > Get. Content(); if( content. Av. Format. av_find_input_format("aac"); else if( content. Av. Format. av_find_input_format("aac"); else if( content. Av. Format. av_find_input_format("flv"); else if( content.
Av. Format. av_find_input_format("flv"); } if (! CLog: :Log(LOGERROR, "%s - error probing input format, %s", __FUNCTION__, CURL: :Get. Redacted(str. File). CLog: :Log(LOGDEBUG, "%s - probing detected format [%s]", __FUNCTION__, iformat- > name); else CLog: :Log(LOGDEBUG, "%s - probing detected unnamed format", __FUNCTION__); } } m_p. Format. Context- > pb = m_io.
Context; if (m_dll. Av. Format. avformat_open_input(& m_p. Format. Context, str. File. c_str(), iformat, NULL) < 0) { CLog: :Log(LOGERROR, "%s - Error, could not open file %s", __FUNCTION__, CURL: :Get. Redacted(str. File). Dispose(); return false; } } if (g_advanced. Settings. m_video.
Fps. Detect == 0) m_p. Format. Context- > fps_probe_size = 0; if (iformat & & (strcmp(iformat- > name, "mjpeg") == 0) & & m_io.
Context- > seekable == 0) m_p. Format. Context- > max_analyze_duration = 5. Matroska = strncmp(m_p.