diff options
-rw-r--r-- | xbmc/GUIInfoManager.cpp | 20 | ||||
-rw-r--r-- | xbmc/addons/InputStream.cpp | 1 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h | 2 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 1 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/IVideoPlayer.h | 1 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoPlayer.cpp | 5 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp | 7 | ||||
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoPlayerAudio.h | 1 | ||||
-rw-r--r-- | xbmc/guiinfo/GUIInfoLabels.h | 2 |
9 files changed, 30 insertions, 10 deletions
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 0fb6b3bd53..f50d0c3b8f 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -2131,8 +2131,10 @@ const infomap videoplayer[] = {{ "title", VIDEOPLAYER_TITLE }, { "videocodec", VIDEOPLAYER_VIDEO_CODEC }, { "videoresolution", VIDEOPLAYER_VIDEO_RESOLUTION }, { "videoaspect", VIDEOPLAYER_VIDEO_ASPECT }, + { "videobitrate", VIDEOPLAYER_VIDEO_BITRATE }, { "audiocodec", VIDEOPLAYER_AUDIO_CODEC }, { "audiochannels", VIDEOPLAYER_AUDIO_CHANNELS }, + { "audiobitrate", VIDEOPLAYER_AUDIO_BITRATE }, { "audiolanguage", VIDEOPLAYER_AUDIO_LANG }, { "hasteletext", VIDEOPLAYER_HASTELETEXT }, { "lastplayed", VIDEOPLAYER_LASTPLAYED }, @@ -6176,6 +6178,24 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string * strLabel = StringUtils::Format("%i", m_audioInfo.channels); } break; + case VIDEOPLAYER_AUDIO_BITRATE: + if(g_application.m_pPlayer->IsPlaying()) + { + std::string strBitrate = ""; + if (m_audioInfo.bitrate > 0) + strBitrate = StringUtils::Format("%li", lrint(static_cast<double>(m_audioInfo.bitrate) / 1000.0)); + return strBitrate; + } + break; + case VIDEOPLAYER_VIDEO_BITRATE: + if(g_application.m_pPlayer->IsPlaying()) + { + std::string strBitrate = ""; + if (m_videoInfo.bitrate > 0) + strBitrate = StringUtils::Format("%li", lrint(static_cast<double>(m_videoInfo.bitrate) / 1000.0)); + return strBitrate; + } + break; case VIDEOPLAYER_AUDIO_LANG: if(g_application.m_pPlayer->IsPlaying()) { diff --git a/xbmc/addons/InputStream.cpp b/xbmc/addons/InputStream.cpp index adaafcb697..bf16dd76a5 100644 --- a/xbmc/addons/InputStream.cpp +++ b/xbmc/addons/InputStream.cpp @@ -321,6 +321,7 @@ void CInputStream::UpdateStreams() videoStream->iHeight = stream.m_Height; videoStream->fAspect = stream.m_Aspect; videoStream->stereo_mode = "mono"; + videoStream->iBitRate = stream.m_BitRate; demuxStream = videoStream; } else if (stream.m_streamType == INPUTSTREAM_INFO::TYPE_SUBTITLE) diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h index 7ba76fb7b0..f2a5349d32 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h @@ -153,6 +153,7 @@ public: type = STREAM_VIDEO; iOrientation = 0; iBitsPerPixel = 0; + iBitRate = 0; } virtual ~CDemuxStreamVideo() {} @@ -166,6 +167,7 @@ public: bool bForcedAspect; // aspect is forced from container int iOrientation; // orientation of the video in degrees counter clockwise int iBitsPerPixel; + int iBitRate; std::string stereo_mode; // expected stereo mode }; diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp index d4886d238a..a00a362239 100644 --- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp @@ -1397,6 +1397,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx) st->fAspect = SelectAspect(pStream, st->bForcedAspect) * pStream->codec->width / pStream->codec->height; st->iOrientation = 0; st->iBitsPerPixel = pStream->codec->bits_per_coded_sample; + st->iBitRate = pStream->codecpar->bit_rate; AVDictionaryEntry *rtag = av_dict_get(pStream->metadata, "rotate", NULL, 0); if (rtag) diff --git a/xbmc/cores/VideoPlayer/IVideoPlayer.h b/xbmc/cores/VideoPlayer/IVideoPlayer.h index 0b676c9b61..689798245c 100644 --- a/xbmc/cores/VideoPlayer/IVideoPlayer.h +++ b/xbmc/cores/VideoPlayer/IVideoPlayer.h @@ -132,7 +132,6 @@ public: virtual void SetMute(bool bOnOff) {}; virtual void SetDynamicRangeCompression(long drc) = 0; virtual std::string GetPlayerInfo() = 0; - virtual int GetAudioBitrate() = 0; virtual int GetAudioChannels() = 0; virtual double GetCurrentPts() = 0; virtual bool IsStalled() const = 0; diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp index 1745976353..f297067124 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp @@ -533,6 +533,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: s.width = ((CDemuxStreamVideo*)stream)->iWidth; s.height = ((CDemuxStreamVideo*)stream)->iHeight; s.stereo_mode = ((CDemuxStreamVideo*)stream)->stereo_mode; + s.bitrate = ((CDemuxStreamVideo*)stream)->iBitRate; } if(stream->type == STREAM_AUDIO) { @@ -545,6 +546,7 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer, std:: s.name += type; } s.channels = ((CDemuxStreamAudio*)stream)->iChannels; + s.bitrate = ((CDemuxStreamAudio*)stream)->iBitRate; } Update(s); } @@ -3422,7 +3424,6 @@ void CVideoPlayer::UpdateStreamInfos() if (streamId >= 0 && streamId < GetVideoStreamCount()) { SelectionStream& s = m_SelectionStreams.Get(STREAM_VIDEO, streamId); - s.bitrate = m_VideoPlayerVideo->GetVideoBitrate(); s.aspect_ratio = m_renderManager.GetAspectRatio(); CRect viewRect; m_renderManager.GetVideoRect(s.SrcRect, s.DestRect, viewRect); @@ -3456,13 +3457,13 @@ void CVideoPlayer::UpdateStreamInfos() if (streamId >= 0 && streamId < GetAudioStreamCount()) { SelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, streamId); - s.bitrate = m_VideoPlayerAudio->GetAudioBitrate(); s.channels = m_VideoPlayerAudio->GetAudioChannels(); CDemuxStream* stream = m_pDemuxer->GetStream(m_CurrentAudio.demuxerId, m_CurrentAudio.id); if (stream && stream->type == STREAM_AUDIO) { s.codec = m_pDemuxer->GetStreamCodecName(stream->demuxerId, stream->uniqueId); + s.bitrate = ((CDemuxStreamAudio*)stream)->iBitRate; } } } diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp index e2698f31c2..a40c6191e5 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp +++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp @@ -210,7 +210,7 @@ void CVideoPlayerAudio::UpdatePlayerInfo() { std::ostringstream s; s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel()) << "%"; - s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0; + s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)m_audioStats.GetBitrate() / 1024.0; //print the inverse of the resample ratio, since that makes more sense //if the resample ratio is 0.5, then we're playing twice as fast @@ -618,11 +618,6 @@ std::string CVideoPlayerAudio::GetPlayerInfo() return m_info.info; } -int CVideoPlayerAudio::GetAudioBitrate() -{ - return (int)m_audioStats.GetBitrate(); -} - int CVideoPlayerAudio::GetAudioChannels() { return m_streaminfo.channels; diff --git a/xbmc/cores/VideoPlayer/VideoPlayerAudio.h b/xbmc/cores/VideoPlayer/VideoPlayerAudio.h index 7f8197a22e..ca1da99a23 100644 --- a/xbmc/cores/VideoPlayer/VideoPlayerAudio.h +++ b/xbmc/cores/VideoPlayer/VideoPlayerAudio.h @@ -60,7 +60,6 @@ public: std::string GetPlayerInfo(); - int GetAudioBitrate(); int GetAudioChannels(); // holds stream information for current playing stream diff --git a/xbmc/guiinfo/GUIInfoLabels.h b/xbmc/guiinfo/GUIInfoLabels.h index a58e08c428..4ead134d79 100644 --- a/xbmc/guiinfo/GUIInfoLabels.h +++ b/xbmc/guiinfo/GUIInfoLabels.h @@ -204,6 +204,8 @@ #define MUSICPLAYER_CONTRIBUTOR_AND_ROLE 240 #define MUSICPLAYER_DBID 241 +#define VIDEOPLAYER_AUDIO_BITRATE 248 +#define VIDEOPLAYER_VIDEO_BITRATE 249 #define VIDEOPLAYER_TITLE 250 #define VIDEOPLAYER_GENRE 251 #define VIDEOPLAYER_DIRECTOR 252 |