aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Plate <elupus@ecce.se>2013-03-02 03:26:57 -0800
committerJoakim Plate <elupus@ecce.se>2013-03-02 03:26:57 -0800
commit87047e93e02375851505e9d6c420dd1225996bdb (patch)
tree7443f30ed9a8546a677c9260748d365cad17e532
parent406f32d0d2919112e74eedd32049dc38266cfe30 (diff)
parent2cd39f64858758880a12bcf749c5cfb0654e6d38 (diff)
Merge pull request #2269 from ace20022/getXxxStreamInfo
[IPlayer et al.] Replace various Getxxx methods with GetxxxStreamInfo methods
-rw-r--r--xbmc/GUIInfoManager.cpp36
-rw-r--r--xbmc/cores/IPlayer.h53
-rw-r--r--xbmc/cores/amlplayer/AMLPlayer.cpp113
-rw-r--r--xbmc/cores/amlplayer/AMLPlayer.h14
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.cpp123
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.h16
-rw-r--r--xbmc/cores/omxplayer/OMXPlayer.cpp130
-rw-r--r--xbmc/cores/omxplayer/OMXPlayer.h15
-rw-r--r--xbmc/cores/paplayer/PAPlayer.cpp16
-rw-r--r--xbmc/cores/paplayer/PAPlayer.h4
-rw-r--r--xbmc/interfaces/json-rpc/PlayerOperations.cpp51
-rw-r--r--xbmc/interfaces/legacy/Player.cpp25
-rw-r--r--xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp20
-rw-r--r--xbmc/video/windows/GUIWindowFullScreen.cpp42
14 files changed, 299 insertions, 359 deletions
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index 356e7353db..767e990583 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -1452,7 +1452,11 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
break;
case VIDEOPLAYER_VIDEO_CODEC:
if(g_application.IsPlaying() && g_application.m_pPlayer)
- strLabel = g_application.m_pPlayer->GetVideoCodecName();
+ {
+ SPlayerVideoStreamInfo info;
+ g_application.m_pPlayer->GetVideoStreamInfo(info);
+ strLabel = info.videoCodecName;
+ }
break;
case VIDEOPLAYER_VIDEO_RESOLUTION:
if(g_application.IsPlaying() && g_application.m_pPlayer)
@@ -1460,19 +1464,27 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
break;
case VIDEOPLAYER_AUDIO_CODEC:
if(g_application.IsPlaying() && g_application.m_pPlayer)
- strLabel = g_application.m_pPlayer->GetAudioCodecName();
+ {
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
+ strLabel = info.audioCodecName;
+ }
break;
case VIDEOPLAYER_VIDEO_ASPECT:
if (g_application.IsPlaying() && g_application.m_pPlayer)
{
- float aspect;
- g_application.m_pPlayer->GetVideoAspectRatio(aspect);
- strLabel = CStreamDetails::VideoAspectToAspectDescription(aspect);
+ SPlayerVideoStreamInfo info;
+ g_application.m_pPlayer->GetVideoStreamInfo(info);
+ strLabel = CStreamDetails::VideoAspectToAspectDescription(info.videoAspectRatio);
}
break;
case VIDEOPLAYER_AUDIO_CHANNELS:
if(g_application.IsPlaying() && g_application.m_pPlayer)
- strLabel.Format("%i", g_application.m_pPlayer->GetChannels());
+ {
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
+ strLabel.Format("%i", info.channels);
+ }
break;
case PLAYLIST_LENGTH:
case PLAYLIST_POSITION:
@@ -3343,6 +3355,10 @@ CStdString CGUIInfoManager::GetPlaylistLabel(int item) const
CStdString CGUIInfoManager::GetMusicLabel(int item)
{
if (!g_application.IsPlaying() || !m_currentFile->HasMusicInfoTag()) return "";
+
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
+
switch (item)
{
case MUSICPLAYER_PLAYLISTLEN:
@@ -3362,7 +3378,7 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
float fTimeSpan = (float)(CTimeUtils::GetFrameTime() - m_lastMusicBitrateTime);
if (fTimeSpan >= 500.0f)
{
- m_MusicBitrate = g_application.m_pPlayer->GetAudioBitrate();
+ m_MusicBitrate = info.bitrate;
m_lastMusicBitrateTime = CTimeUtils::GetFrameTime();
}
CStdString strBitrate = "";
@@ -3374,9 +3390,9 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
case MUSICPLAYER_CHANNELS:
{
CStdString strChannels = "";
- if (g_application.m_pPlayer->GetChannels() > 0)
+ if (info.channels > 0)
{
- strChannels.Format("%i", g_application.m_pPlayer->GetChannels());
+ strChannels.Format("%i", info.channels);
}
return strChannels;
}
@@ -3404,7 +3420,7 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
case MUSICPLAYER_CODEC:
{
CStdString strCodec;
- strCodec.Format("%s", g_application.m_pPlayer->GetAudioCodecName().c_str());
+ strCodec.Format("%s", info.audioCodecName);
return strCodec;
}
break;
diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h
index 10e1603d20..08c5aa260a 100644
--- a/xbmc/cores/IPlayer.h
+++ b/xbmc/cores/IPlayer.h
@@ -89,6 +89,44 @@ enum IPlayerSubtitleCapabilities
IPC_SUBS_OFFSET
};
+struct SPlayerAudioStreamInfo
+{
+ int bitrate;
+ int channels;
+ std::string language;
+ std::string name;
+ std::string audioCodecName;
+
+ SPlayerAudioStreamInfo()
+ {
+ bitrate = 0;
+ channels = 0;
+ }
+};
+
+struct SPlayerSubtitleStreamInfo
+{
+ std::string language;
+ std::string name;
+};
+
+struct SPlayerVideoStreamInfo
+{
+ int bitrate;
+ float videoAspectRatio;
+ std::string language;
+ std::string name;
+ std::string videoCodecName;
+ CRect SrcRect;
+ CRect DestRect;
+
+ SPlayerVideoStreamInfo()
+ {
+ bitrate = 0;
+ videoAspectRatio = 1.0f;
+ }
+};
+
class IPlayer
{
public:
@@ -122,8 +160,6 @@ public:
virtual void GetVideoInfo( CStdString& strVideoInfo) = 0;
virtual void GetGeneralInfo( CStdString& strVideoInfo) = 0;
virtual void Update(bool bPauseDrawing = false) = 0;
- virtual void GetVideoRect(CRect& SrcRect, CRect& DestRect) {}
- virtual void GetVideoAspectRatio(float& fAR) { fAR = 1.0f; }
virtual bool CanRecord() { return false;};
virtual bool IsRecording() { return false;};
virtual bool Record(bool bOnOff) { return false;};
@@ -135,19 +171,16 @@ public:
virtual float GetSubTitleDelay() { return 0.0f; }
virtual int GetSubtitleCount() { return 0; }
virtual int GetSubtitle() { return -1; }
- virtual void GetSubtitleName(int iStream, CStdString &strStreamName){};
- virtual void GetSubtitleLanguage(int iStream, CStdString &strStreamLang){};
+ virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info){};
virtual void SetSubtitle(int iStream){};
virtual bool GetSubtitleVisible(){ return false;};
virtual void SetSubtitleVisible(bool bVisible){};
- virtual bool GetSubtitleExtension(CStdString &strSubtitleExtension){ return false;};
virtual int AddSubtitle(const CStdString& strSubPath) {return -1;};
virtual int GetAudioStreamCount() { return 0; }
virtual int GetAudioStream() { return -1; }
- virtual void GetAudioStreamName(int iStream, CStdString &strStreamName){};
virtual void SetAudioStream(int iStream){};
- virtual void GetAudioStreamLanguage(int iStream, CStdString &strLanguage){};
+ virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info){};
virtual TextCacheStruct_t* GetTeletextCache() { return NULL; };
virtual void LoadPage(int p, int sp, unsigned char* buffer) {};
@@ -168,14 +201,10 @@ public:
\brief total time in milliseconds
*/
virtual int64_t GetTotalTime() { return 0; }
- virtual int GetAudioBitrate(){ return 0;}
- virtual int GetVideoBitrate(){ return 0;}
+ virtual void GetVideoStreamInfo(SPlayerVideoStreamInfo &info){};
virtual int GetSourceBitrate(){ return 0;}
- virtual int GetChannels(){ return 0;};
virtual int GetBitsPerSample(){ return 0;};
virtual int GetSampleRate(){ return 0;};
- virtual CStdString GetAudioCodecName(){ return "";}
- virtual CStdString GetVideoCodecName(){ return "";}
virtual int GetPictureWidth(){ return 0;}
virtual int GetPictureHeight(){ return 0;}
virtual bool GetStreamDetails(CStreamDetails &details){ return false;}
diff --git a/xbmc/cores/amlplayer/AMLPlayer.cpp b/xbmc/cores/amlplayer/AMLPlayer.cpp
index f18423f9cd..09f62c9926 100644
--- a/xbmc/cores/amlplayer/AMLPlayer.cpp
+++ b/xbmc/cores/amlplayer/AMLPlayer.cpp
@@ -846,25 +846,6 @@ int CAMLPlayer::GetAudioStream()
return m_audio_index;
}
-void CAMLPlayer::GetAudioStreamName(int iStream, CStdString &strStreamName)
-{
- //CLog::Log(LOGDEBUG, "CAMLPlayer::GetAudioStreamName");
- CSingleLock lock(m_aml_csection);
-
- strStreamName.Format("Undefined");
-
- if (iStream > (int)m_audio_streams.size() || iStream < 0)
- return;
-
- if ( m_audio_streams[iStream]->language.size())
- {
- CStdString name;
- g_LangCodeExpander.Lookup( name, m_audio_streams[iStream]->language);
- strStreamName = name;
- }
-
-}
-
void CAMLPlayer::SetAudioStream(int SetAudioStream)
{
//CLog::Log(LOGDEBUG, "CAMLPlayer::SetAudioStream");
@@ -926,35 +907,33 @@ int CAMLPlayer::GetSubtitle()
return -1;
}
-void CAMLPlayer::GetSubtitleName(int iStream, CStdString &strStreamName)
+void CAMLPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info)
{
CSingleLock lock(m_aml_csection);
- strStreamName = "";
-
- if (iStream > (int)m_subtitle_streams.size() || iStream < 0)
+ if (index > (int)m_subtitle_streams.size() -1 || index < 0)
return;
if (m_subtitle_streams[m_subtitle_index]->source == STREAM_SOURCE_NONE)
{
- if ( m_subtitle_streams[iStream]->language.size())
+ if ( m_subtitle_streams[index]->language.size())
{
CStdString name;
- g_LangCodeExpander.Lookup(name, m_subtitle_streams[iStream]->language);
- strStreamName = name;
+ g_LangCodeExpander.Lookup(name, m_subtitle_streams[index]->language);
+ info.name = name;
}
else
- strStreamName = g_localizeStrings.Get(13205); // Unknown
+ info.name = g_localizeStrings.Get(13205); // Unknown
}
else
{
if(m_subtitle_streams[m_subtitle_index]->name.length() > 0)
- strStreamName = m_subtitle_streams[m_subtitle_index]->name;
+ info.name = m_subtitle_streams[m_subtitle_index]->name;
else
- strStreamName = g_localizeStrings.Get(13205); // Unknown
+ info.name = g_localizeStrings.Get(13205); // Unknown
}
if (m_log_level > 5)
- CLog::Log(LOGDEBUG, "CAMLPlayer::GetSubtitleName, iStream(%d)", iStream);
+ CLog::Log(LOGDEBUG, "CAMLPlayer::GetSubtitleName, iStream(%d)", index);
}
void CAMLPlayer::SetSubtitle(int iStream)
@@ -1016,16 +995,6 @@ void CAMLPlayer::Update(bool bPauseDrawing)
g_renderManager.Update(bPauseDrawing);
}
-void CAMLPlayer::GetVideoRect(CRect& SrcRect, CRect& DestRect)
-{
- g_renderManager.GetVideoRect(SrcRect, DestRect);
-}
-
-void CAMLPlayer::GetVideoAspectRatio(float &fAR)
-{
- fAR = g_renderManager.GetAspectRatio();
-}
-
int CAMLPlayer::GetChapterCount()
{
return m_chapter_count;
@@ -1128,22 +1097,41 @@ __int64 CAMLPlayer::GetTotalTime()
return m_duration_ms;
}
-int CAMLPlayer::GetAudioBitrate()
+void CAMLPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
{
CSingleLock lock(m_aml_csection);
- if (m_audio_streams.size() == 0 || m_audio_index > (int)(m_audio_streams.size() - 1))
- return 0;
+ if (index < 0 || m_audio_streams.size() == 0 || index > (int)(m_audio_streams.size() - 1))
+ return;
+
+ info.bitrate = m_audio_streams[index]->bit_rate;
+
+ if ( m_audio_streams[index]->language.size())
+ info.language = m_audio_streams[index]->language;
+
+ info.channels = m_audio_streams[index]->channel;
- return m_audio_streams[m_audio_index]->bit_rate;
+ info.audioCodecName = AudioCodecName(m_audio_streams[index]->format);
+
+ info.name.Format("Undefined");
+
+ if ( m_audio_streams[index]->language.size())
+ {
+ CStdString name;
+ g_LangCodeExpander.Lookup( name, m_audio_streams[index]->language);
+ info.name = name;
+ }
}
-int CAMLPlayer::GetVideoBitrate()
+void CAMLPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
{
CSingleLock lock(m_aml_csection);
if (m_video_streams.size() == 0 || m_video_index > (int)(m_video_streams.size() - 1))
- return 0;
+ return;
- return m_video_streams[m_video_index]->bit_rate;
+ info.bitrate = m_video_streams[m_video_index]->bit_rate;
+ info.videoCodecName = VideoCodecName(m_video_streams[m_video_index]->format);
+ info.videoAspectRatio = g_renderManager.GetAspectRatio();
+ g_renderManager.GetVideoRect(info.SrcRect, info.DestRect);
}
int CAMLPlayer::GetSourceBitrate()
@@ -1152,15 +1140,6 @@ int CAMLPlayer::GetSourceBitrate()
return 0;
}
-int CAMLPlayer::GetChannels()
-{
- CSingleLock lock(m_aml_csection);
- if (m_audio_streams.size() == 0 || m_audio_index > (int)(m_audio_streams.size() - 1))
- return 0;
-
- return m_audio_streams[m_audio_index]->channel;
-}
-
int CAMLPlayer::GetBitsPerSample()
{
CLog::Log(LOGDEBUG, "CAMLPlayer::GetBitsPerSample");
@@ -1176,28 +1155,6 @@ int CAMLPlayer::GetSampleRate()
return m_audio_streams[m_audio_index]->sample_rate;
}
-CStdString CAMLPlayer::GetAudioCodecName()
-{
- CStdString strAudioCodec = "";
- if (m_audio_streams.size() == 0 || m_audio_index > (int)(m_audio_streams.size() - 1))
- return strAudioCodec;
-
- strAudioCodec = AudioCodecName(m_audio_streams[m_audio_index]->format);
-
- return strAudioCodec;
-}
-
-CStdString CAMLPlayer::GetVideoCodecName()
-{
- CStdString strVideoCodec = "";
- if (m_video_streams.size() == 0 || m_video_index > (int)(m_video_streams.size() - 1))
- return strVideoCodec;
-
- strVideoCodec = VideoCodecName(m_video_streams[m_video_index]->format);
-
- return strVideoCodec;
-}
-
int CAMLPlayer::GetPictureWidth()
{
//CLog::Log(LOGDEBUG, "CAMLPlayer::GetPictureWidth(%d)", m_video_width);
diff --git a/xbmc/cores/amlplayer/AMLPlayer.h b/xbmc/cores/amlplayer/AMLPlayer.h
index e33973d3c6..56557a8565 100644
--- a/xbmc/cores/amlplayer/AMLPlayer.h
+++ b/xbmc/cores/amlplayer/AMLPlayer.h
@@ -88,8 +88,6 @@ public:
virtual void GetVideoInfo(CStdString &strVideoInfo);
virtual void GetGeneralInfo(CStdString &strVideoInfo) {};
virtual void Update(bool bPauseDrawing);
- virtual void GetVideoRect(CRect& SrcRect, CRect& DestRect);
- virtual void GetVideoAspectRatio(float &fAR);
virtual bool CanRecord() {return false;};
virtual bool IsRecording() {return false;};
virtual bool Record(bool bOnOff) {return false;};
@@ -101,18 +99,15 @@ public:
virtual float GetSubTitleDelay();
virtual int GetSubtitleCount();
virtual int GetSubtitle();
- virtual void GetSubtitleName(int iStream, CStdString &strStreamName);
+ virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
virtual void SetSubtitle(int iStream);
virtual bool GetSubtitleVisible();
virtual void SetSubtitleVisible(bool bVisible);
- virtual bool GetSubtitleExtension(CStdString &strSubtitleExtension) { return false; }
virtual int AddSubtitle(const CStdString& strSubPath);
virtual int GetAudioStreamCount();
virtual int GetAudioStream();
- virtual void GetAudioStreamName(int iStream, CStdString &strStreamName);
virtual void SetAudioStream(int iStream);
- virtual void GetAudioStreamLanguage(int iStream, CStdString &strLanguage) {};
virtual TextCacheStruct_t* GetTeletextCache() {return NULL;};
virtual void LoadPage(int p, int sp, unsigned char* buffer) {};
@@ -126,14 +121,11 @@ public:
virtual void SeekTime(__int64 iTime = 0);
virtual __int64 GetTime();
virtual __int64 GetTotalTime();
- virtual int GetAudioBitrate();
- virtual int GetVideoBitrate();
+ virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
+ virtual void GetVideoStreamInfo(SPlayerVideoStreamInfo &info);
virtual int GetSourceBitrate();
- virtual int GetChannels();
virtual int GetBitsPerSample();
virtual int GetSampleRate();
- virtual CStdString GetAudioCodecName();
- virtual CStdString GetVideoCodecName();
virtual int GetPictureWidth();
virtual int GetPictureHeight();
virtual bool GetStreamDetails(CStreamDetails &details);
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index 1fdb4d9338..dcf63bfd31 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -103,14 +103,6 @@ void CSelectionStreams::Clear(StreamType type, StreamSource source)
}
}
-void CDVDPlayer::GetAudioStreamLanguage(int iStream, CStdString &strLanguage)
-{
- strLanguage = "";
- SelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
- if(s.language.length() > 0)
- strLanguage = s.language;
-}
-
SelectionStream& CSelectionStreams::Get(StreamType type, int index)
{
CSingleLock lock(m_section);
@@ -2687,24 +2679,25 @@ int CDVDPlayer::GetSubtitle()
return m_SelectionStreams.IndexOf(STREAM_SUBTITLE, *this);
}
-void CDVDPlayer::GetSubtitleName(int iStream, CStdString &strStreamName)
+void CDVDPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info)
{
- strStreamName = "";
- SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+ if (index < 0 || index > (int) GetSubtitleCount() - 1)
+ return;
+
+ SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
if(s.name.length() > 0)
- strStreamName = s.name;
+ info.name = s.name;
else
- strStreamName = g_localizeStrings.Get(13205); // Unknown
+ info.name = g_localizeStrings.Get(13205); // Unknown
if(s.type == STREAM_NONE)
- strStreamName += "(Invalid)";
-}
+ info.name += "(Invalid)";
-void CDVDPlayer::GetSubtitleLanguage(int iStream, CStdString &strStreamLang)
-{
- SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+ CStdString strStreamLang;
if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
- strStreamLang = g_localizeStrings.Get(13205); // Unknown
+ info.language = g_localizeStrings.Get(13205); // Unknown
+ else
+ info.language = strStreamLang;
}
void CDVDPlayer::SetSubtitle(int iStream)
@@ -2744,19 +2737,6 @@ int CDVDPlayer::GetAudioStream()
return m_SelectionStreams.IndexOf(STREAM_AUDIO, *this);
}
-void CDVDPlayer::GetAudioStreamName(int iStream, CStdString& strStreamName)
-{
- strStreamName = "";
- SelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
- if(s.name.length() > 0)
- strStreamName += s.name;
- else
- strStreamName += "Unknown";
-
- if(s.type == STREAM_NONE)
- strStreamName += " (Invalid)";
-}
-
void CDVDPlayer::SetAudioStream(int iStream)
{
m_messenger.Put(new CDVDMsgPlayerSetAudioStream(iStream));
@@ -3588,7 +3568,7 @@ bool CDVDPlayer::OnAction(const CAction &action)
case ACTION_MOUSE_LEFT_CLICK:
{
CRect rs, rd;
- GetVideoRect(rs, rd);
+ m_dvdPlayerVideo.GetVideoRect(rs, rd);
CPoint pt(action.GetAmount(), action.GetAmount(1));
if (!rd.PtInRect(pt))
return false; // out of bounds
@@ -3813,14 +3793,16 @@ double CDVDPlayer::GetQueueTime()
return max(a, v) * 8000.0 / 100;
}
-int CDVDPlayer::GetAudioBitrate()
+void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
{
- return m_dvdPlayerAudio.GetAudioBitrate();
-}
+ info.bitrate = m_dvdPlayerVideo.GetVideoBitrate();
-int CDVDPlayer::GetVideoBitrate()
-{
- return m_dvdPlayerVideo.GetVideoBitrate();
+ CStdString retVal;
+ if (m_pDemuxer && (m_CurrentVideo.id != -1))
+ m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
+ info.videoCodecName = retVal;
+ info.videoAspectRatio = m_dvdPlayerVideo.GetAspectRatio();
+ m_dvdPlayerVideo.GetVideoRect(info.SrcRect, info.DestRect);
}
int CDVDPlayer::GetSourceBitrate()
@@ -3831,6 +3813,40 @@ int CDVDPlayer::GetSourceBitrate()
return 0;
}
+void CDVDPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
+{
+ if (index < 0 || index > GetAudioStreamCount() - 1 )
+ return;
+
+ if (index == GetAudioStream())
+ info.bitrate = m_dvdPlayerAudio.GetAudioBitrate();
+ else
+ info.bitrate = m_pDemuxer->GetStreamFromAudioId(index)->iBitRate;
+
+ SelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, index);
+ if(s.language.length() > 0)
+ info.language = s.language;
+
+ if(s.name.length() > 0)
+ info.name = s.name;
+ else
+ info.name += "Unknown";
+
+ if(s.type == STREAM_NONE)
+ info.name += " (Invalid)";
+
+ if (m_pDemuxer)
+ {
+ CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStreamFromAudioId(index));
+ if (stream)
+ {
+ info.channels = stream->iChannels;
+ CStdString codecName;
+ m_pDemuxer->GetStreamCodecName(stream->iId, codecName);
+ info.audioCodecName = codecName;
+ }
+ }
+}
int CDVDPlayer::AddSubtitleFile(const std::string& filename, const std::string& subfilename, CDemuxStream::EFlags flags)
{
@@ -4043,33 +4059,6 @@ bool CDVDPlayer::Record(bool bOnOff)
return false;
}
-int CDVDPlayer::GetChannels()
-{
- if (m_pDemuxer && (m_CurrentAudio.id != -1))
- {
- CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStream(m_CurrentAudio.id));
- if (stream)
- return stream->iChannels;
- }
- return -1;
-}
-
-CStdString CDVDPlayer::GetAudioCodecName()
-{
- CStdString retVal;
- if (m_pDemuxer && (m_CurrentAudio.id != -1))
- m_pDemuxer->GetStreamCodecName(m_CurrentAudio.id, retVal);
- return retVal;
-}
-
-CStdString CDVDPlayer::GetVideoCodecName()
-{
- CStdString retVal;
- if (m_pDemuxer && (m_CurrentVideo.id != -1))
- m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
- return retVal;
-}
-
int CDVDPlayer::GetPictureWidth()
{
if (m_pDemuxer && (m_CurrentVideo.id != -1))
@@ -4099,7 +4088,7 @@ bool CDVDPlayer::GetStreamDetails(CStreamDetails &details)
bool result=CDVDFileInfo::DemuxerToStreamDetails(m_pInputStream, m_pDemuxer, details);
if (result && details.GetStreamCount(CStreamDetail::VIDEO) > 0) // this is more correct (dvds in particular)
{
- GetVideoAspectRatio(((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect);
+ ((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect = m_dvdPlayerVideo.GetAspectRatio();
((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_iDuration = GetTotalTime() / 1000;
}
return result;
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h
index ec09bc88af..715f748af5 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.h
+++ b/xbmc/cores/dvdplayer/DVDPlayer.h
@@ -193,8 +193,6 @@ public:
virtual void GetVideoInfo(CStdString& strVideoInfo);
virtual void GetGeneralInfo( CStdString& strVideoInfo);
virtual void Update(bool bPauseDrawing) { m_dvdPlayerVideo.Update(bPauseDrawing); }
- virtual void GetVideoRect(CRect& SrcRect, CRect& DestRect) { m_dvdPlayerVideo.GetVideoRect(SrcRect, DestRect); }
- virtual void GetVideoAspectRatio(float& fAR) { fAR = m_dvdPlayerVideo.GetAspectRatio(); }
virtual bool CanRecord();
virtual bool IsRecording();
virtual bool CanPause();
@@ -206,19 +204,15 @@ public:
virtual float GetSubTitleDelay();
virtual int GetSubtitleCount();
virtual int GetSubtitle();
- virtual void GetSubtitleName(int iStream, CStdString &strStreamName);
- virtual void GetSubtitleLanguage(int iStream, CStdString &strStreamLang);
+ virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
virtual void SetSubtitle(int iStream);
virtual bool GetSubtitleVisible();
virtual void SetSubtitleVisible(bool bVisible);
- virtual bool GetSubtitleExtension(CStdString &strSubtitleExtension) { return false; }
virtual int AddSubtitle(const CStdString& strSubPath);
virtual int GetAudioStreamCount();
virtual int GetAudioStream();
- virtual void GetAudioStreamName(int iStream, CStdString &strStreamName);
virtual void SetAudioStream(int iStream);
- virtual void GetAudioStreamLanguage(int iStream, CStdString &strLanguage);
virtual TextCacheStruct_t* GetTeletextCache();
virtual void LoadPage(int p, int sp, unsigned char* buffer);
@@ -234,15 +228,13 @@ public:
virtual void ToFFRW(int iSpeed);
virtual bool OnAction(const CAction &action);
virtual bool HasMenu();
- virtual int GetAudioBitrate();
- virtual int GetVideoBitrate();
+
virtual int GetSourceBitrate();
- virtual int GetChannels();
- virtual CStdString GetAudioCodecName();
- virtual CStdString GetVideoCodecName();
+ virtual void GetVideoStreamInfo(SPlayerVideoStreamInfo &info);
virtual int GetPictureWidth();
virtual int GetPictureHeight();
virtual bool GetStreamDetails(CStreamDetails &details);
+ virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
virtual bool GetCurrentSubtitle(CStdString& strSubtitle);
diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp
index 340bbb2fdc..bd4a32b6ad 100644
--- a/xbmc/cores/omxplayer/OMXPlayer.cpp
+++ b/xbmc/cores/omxplayer/OMXPlayer.cpp
@@ -104,14 +104,6 @@ void COMXSelectionStreams::Clear(StreamType type, StreamSource source)
}
}
-void COMXPlayer::GetAudioStreamLanguage(int iStream, CStdString &strLanguage)
-{
- strLanguage = "";
- OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
- if(s.language.length() > 0)
- strLanguage = s.language;
-}
-
OMXSelectionStream& COMXSelectionStreams::Get(StreamType type, int index)
{
CSingleLock lock(m_section);
@@ -2698,24 +2690,25 @@ int COMXPlayer::GetSubtitle()
return m_SelectionStreams.IndexOf(STREAM_SUBTITLE, *this);
}
-void COMXPlayer::GetSubtitleName(int iStream, CStdString &strStreamName)
+void COMXPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
{
- strStreamName = "";
- OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+ if (index < 0 || index > (int) GetSubtitleCount() - 1)
+ return;
+
+ OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
if(s.name.length() > 0)
- strStreamName = s.name;
+ info.name = s.name;
else
- strStreamName = g_localizeStrings.Get(13205); // Unknown
+ info.name = g_localizeStrings.Get(13205); // Unknown
if(s.type == STREAM_NONE)
- strStreamName += "(Invalid)";
-}
+ info.name += "(Invalid)";
-void COMXPlayer::GetSubtitleLanguage(int iStream, CStdString &strStreamLang)
-{
- OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+ CStdString strStreamLang;
if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
- strStreamLang = g_localizeStrings.Get(13205); // Unknown
+ info.language = g_localizeStrings.Get(13205); // Unknown
+ else
+ info.language = strStreamLang;
}
void COMXPlayer::SetSubtitle(int iStream)
@@ -2754,19 +2747,6 @@ int COMXPlayer::GetAudioStream()
{
return m_SelectionStreams.IndexOf(STREAM_AUDIO, *this);
}
-
-void COMXPlayer::GetAudioStreamName(int iStream, CStdString &strStreamName)
-{
- strStreamName = "";
- OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
- if(s.name.length() > 0)
- strStreamName += s.name;
- else
- strStreamName += "Unknown";
-
- if(s.type == STREAM_NONE)
- strStreamName += " (Invalid)";
-}
void COMXPlayer::SetAudioStream(int iStream)
{
@@ -3574,7 +3554,7 @@ bool COMXPlayer::OnAction(const CAction &action)
case ACTION_MOUSE_LEFT_CLICK:
{
CRect rs, rd;
- GetVideoRect(rs, rd);
+ g_renderManager.GetVideoRect(rs, rd);
CPoint pt(action.GetAmount(), action.GetAmount(1));
if (!rd.PtInRect(pt))
return false; // out of bounds
@@ -3799,14 +3779,51 @@ double COMXPlayer::GetQueueTime()
return max(a, v) * 8000.0 / 100;
}
-int COMXPlayer::GetAudioBitrate()
+void COMXPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
{
- return m_player_audio.GetAudioBitrate();
+ if (index < 0 || index > GetAudioStreamCount() - 1)
+ return;
+
+ if (index == GetAudioStream())
+ info.bitrate = m_player_audio.GetAudioBitrate();
+ else
+ info.bitrate = m_pDemuxer->GetStreamFromAudioId(index)->iBitRate;
+
+ OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, index);
+ if(s.language.length() > 0)
+ info.language = s.language;
+
+ if(s.name.length() > 0)
+ info.name = s.name;
+ else
+ info.name += "Unknown";
+
+ if(s.type == STREAM_NONE)
+ info.name += " (Invalid)";
+
+ if (m_pDemuxer)
+ {
+ CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStreamFromAudioId(index));
+ if (stream)
+ {
+ info.channels = stream->iChannels;
+ CStdString codecName;
+ m_pDemuxer->GetStreamCodecName(stream->iId, codecName);
+ info.audioCodecName = codecName;
+ }
+ }
}
-int COMXPlayer::GetVideoBitrate()
+void COMXPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
{
- return m_player_video.GetVideoBitrate();
+ info.bitrate = m_player_video.GetVideoBitrate();
+
+ CStdString retVal;
+ if (m_pDemuxer && (m_CurrentVideo.id != -1))
+ m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
+ info.videoCodecName = retVal;
+ info.videoAspectRatio = g_renderManager.GetAspectRatio();
+ g_renderManager.GetVideoRect(info.SrcRect, info.DestRect);
}
int COMXPlayer::GetSourceBitrate()
@@ -4027,33 +4044,6 @@ bool COMXPlayer::Record(bool bOnOff)
return false;
}
-int COMXPlayer::GetChannels()
-{
- if (m_pDemuxer && (m_CurrentAudio.id != -1))
- {
- CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStream(m_CurrentAudio.id));
- if (stream)
- return stream->iChannels;
- }
- return -1;
-}
-
-CStdString COMXPlayer::GetAudioCodecName()
-{
- CStdString retVal;
- if (m_pDemuxer && (m_CurrentAudio.id != -1))
- m_pDemuxer->GetStreamCodecName(m_CurrentAudio.id, retVal);
- return retVal;
-}
-
-CStdString COMXPlayer::GetVideoCodecName()
-{
- CStdString retVal;
- if (m_pDemuxer && (m_CurrentVideo.id != -1))
- m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
- return retVal;
-}
-
int COMXPlayer::GetPictureWidth()
{
if (m_pDemuxer && (m_CurrentVideo.id != -1))
@@ -4083,7 +4073,7 @@ bool COMXPlayer::GetStreamDetails(CStreamDetails &details)
bool result=CDVDFileInfo::DemuxerToStreamDetails(m_pInputStream, m_pDemuxer, details);
if (result && details.GetStreamCount(CStreamDetail::VIDEO) > 0) // this is more correct (dvds in particular)
{
- GetVideoAspectRatio(((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect);
+ ((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect = g_renderManager.GetAspectRatio();
((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_iDuration = GetTotalTime() / 1000;
}
return result;
@@ -4132,11 +4122,6 @@ bool COMXPlayer::CachePVRStream(void) const
g_advancedSettings.m_bPVRCacheInDvdPlayer;
}
-void COMXPlayer::GetVideoRect(CRect& SrcRect, CRect& DestRect)
-{
- g_renderManager.GetVideoRect(SrcRect, DestRect);
-}
-
void COMXPlayer::SetMute(bool bOnOff)
{
m_current_mute = bOnOff;
@@ -4171,11 +4156,6 @@ void COMXPlayer::Update(bool bPauseDrawing)
g_renderManager.Update(bPauseDrawing);
}
-void COMXPlayer::GetVideoAspectRatio(float &fAR)
-{
- fAR = g_renderManager.GetAspectRatio();
-}
-
void COMXPlayer::GetRenderFeatures(std::vector<int> &renderFeatures)
{
renderFeatures.push_back(RENDERFEATURE_STRETCH);
diff --git a/xbmc/cores/omxplayer/OMXPlayer.h b/xbmc/cores/omxplayer/OMXPlayer.h
index 39e41a46e4..40d9a0508d 100644
--- a/xbmc/cores/omxplayer/OMXPlayer.h
+++ b/xbmc/cores/omxplayer/OMXPlayer.h
@@ -235,8 +235,6 @@ public:
virtual void GetVideoInfo(CStdString &strVideoInfo);
virtual void GetGeneralInfo(CStdString &strVideoInfo);
virtual void Update(bool bPauseDrawing);
- virtual void GetVideoRect(CRect& SrcRect, CRect& DestRect);
- virtual void GetVideoAspectRatio(float &fAR);
virtual void UpdateApplication(double timeout);
virtual bool CanRecord();
virtual bool IsRecording();
@@ -249,19 +247,15 @@ public:
virtual float GetSubTitleDelay();
virtual int GetSubtitleCount();
virtual int GetSubtitle();
- virtual void GetSubtitleName(int iStream, CStdString &strStreamName);
- virtual void GetSubtitleLanguage(int iStream, CStdString &strStreamLang);
+ virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
virtual void SetSubtitle(int iStream);
virtual bool GetSubtitleVisible();
virtual void SetSubtitleVisible(bool bVisible);
- virtual bool GetSubtitleExtension(CStdString &strSubtitleExtension) { return false; }
virtual int AddSubtitle(const CStdString& strSubPath);
virtual int GetAudioStreamCount();
virtual int GetAudioStream();
- virtual void GetAudioStreamName(int iStream, CStdString &strStreamName);
virtual void SetAudioStream(int iStream);
- virtual void GetAudioStreamLanguage(int iStream, CStdString &strLanguage);
virtual TextCacheStruct_t* GetTeletextCache();
virtual void LoadPage(int p, int sp, unsigned char* buffer);
@@ -276,12 +270,9 @@ public:
virtual int64_t GetTime();
virtual int64_t GetTotalTime();
virtual void ToFFRW(int iSpeed = 0);
- virtual int GetAudioBitrate();
- virtual int GetVideoBitrate();
+ virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
+ virtual void GetVideoStreamInfo(SPlayerVideoStreamInfo &info);
virtual int GetSourceBitrate();
- virtual int GetChannels();
- virtual CStdString GetAudioCodecName();
- virtual CStdString GetVideoCodecName();
virtual int GetPictureWidth();
virtual int GetPictureHeight();
virtual bool GetStreamDetails(CStreamDetails &details);
diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp
index 8a57c55543..69cbf26645 100644
--- a/xbmc/cores/paplayer/PAPlayer.cpp
+++ b/xbmc/cores/paplayer/PAPlayer.cpp
@@ -824,11 +824,6 @@ int PAPlayer::GetCacheLevel() const
return m_playerGUIData.m_cacheLevel;
}
-int PAPlayer::GetChannels()
-{
- return m_playerGUIData.m_channelCount;
-}
-
int PAPlayer::GetBitsPerSample()
{
return m_playerGUIData.m_bitsPerSample;
@@ -839,14 +834,11 @@ int PAPlayer::GetSampleRate()
return m_playerGUIData.m_sampleRate;
}
-CStdString PAPlayer::GetAudioCodecName()
-{
- return m_playerGUIData.m_codec;
-}
-
-int PAPlayer::GetAudioBitrate()
+void PAPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
{
- return m_playerGUIData.m_audioBitrate;
+ info.bitrate = m_playerGUIData.m_audioBitrate;
+ info.channels = m_playerGUIData.m_channelCount;
+ info.audioCodecName = m_playerGUIData.m_codec;
}
bool PAPlayer::CanSeek()
diff --git a/xbmc/cores/paplayer/PAPlayer.h b/xbmc/cores/paplayer/PAPlayer.h
index 124bf28f03..a740f61946 100644
--- a/xbmc/cores/paplayer/PAPlayer.h
+++ b/xbmc/cores/paplayer/PAPlayer.h
@@ -63,11 +63,9 @@ public:
virtual void ToFFRW(int iSpeed = 0);
virtual int GetCacheLevel() const;
virtual int64_t GetTotalTime();
- virtual int GetAudioBitrate();
- virtual int GetChannels();
+ virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
virtual int GetBitsPerSample();
virtual int GetSampleRate();
- virtual CStdString GetAudioCodecName();
virtual int64_t GetTime();
virtual void SeekTime(int64_t iTime = 0);
virtual bool SkipNext();
diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
index 4b240a650e..c629d626b5 100644
--- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp
+++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -1361,17 +1361,15 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
int index = g_application.m_pPlayer->GetAudioStream();
if (index >= 0)
{
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(index, info);
+
result["index"] = index;
- CStdString value;
- g_application.m_pPlayer->GetAudioStreamName(index, value);
- result["name"] = value;
- value.Empty();
- g_application.m_pPlayer->GetAudioStreamLanguage(index, value);
- result["language"] = value;
-
- result["codec"] = g_application.m_pPlayer->GetAudioCodecName();
- result["bitrate"] = g_application.m_pPlayer->GetAudioBitrate();
- result["channels"] = g_application.m_pPlayer->GetChannels();
+ result["name"] = info.name;
+ result["language"] = info.language;
+ result["codec"] = info.audioCodecName;
+ result["bitrate"] = info.bitrate;
+ result["channels"] = info.channels;
}
}
else
@@ -1394,14 +1392,13 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
{
for (int index = 0; index < g_application.m_pPlayer->GetAudioStreamCount(); index++)
{
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(index, info);
+
CVariant audioStream(CVariant::VariantTypeObject);
audioStream["index"] = index;
- CStdString value;
- g_application.m_pPlayer->GetAudioStreamName(index, value);
- audioStream["name"] = value;
- value.Empty();
- g_application.m_pPlayer->GetAudioStreamLanguage(index, value);
- audioStream["language"] = value;
+ audioStream["name"] = info.name;
+ audioStream["language"] = info.language;
result.append(audioStream);
}
@@ -1441,13 +1438,12 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
int index = g_application.m_pPlayer->GetSubtitle();
if (index >= 0)
{
+ SPlayerSubtitleStreamInfo info;
+ g_application.m_pPlayer->GetSubtitleStreamInfo(index, info);
+
result["index"] = index;
- CStdString value;
- g_application.m_pPlayer->GetSubtitleName(index, value);
- result["name"] = value;
- value.Empty();
- g_application.m_pPlayer->GetSubtitleLanguage(index, value);
- result["language"] = value;
+ result["name"] = info.name;
+ result["language"] = info.language;
}
}
else
@@ -1471,14 +1467,13 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
{
for (int index = 0; index < g_application.m_pPlayer->GetSubtitleCount(); index++)
{
+ SPlayerSubtitleStreamInfo info;
+ g_application.m_pPlayer->GetSubtitleStreamInfo(index, info);
+
CVariant subtitle(CVariant::VariantTypeObject);
subtitle["index"] = index;
- CStdString value;
- g_application.m_pPlayer->GetSubtitleName(index, value);
- subtitle["name"] = value;
- value.Empty();
- g_application.m_pPlayer->GetSubtitleLanguage(index, value);
- subtitle["language"] = value;
+ subtitle["name"] = info.name;
+ subtitle["language"] = info.language;
result.append(subtitle);
}
diff --git a/xbmc/interfaces/legacy/Player.cpp b/xbmc/interfaces/legacy/Player.cpp
index 62e5c25283..d91d69304f 100644
--- a/xbmc/interfaces/legacy/Player.cpp
+++ b/xbmc/interfaces/legacy/Player.cpp
@@ -393,9 +393,10 @@ namespace XBMCAddon
TRACE;
if (g_application.m_pPlayer)
{
+ SPlayerSubtitleStreamInfo info;
+ g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
int i = g_application.m_pPlayer->GetSubtitle();
- CStdString strName;
- g_application.m_pPlayer->GetSubtitleName(i, strName);
+ CStdString strName = info.name;
if (strName == "Unknown(Invalid)")
strName = "";
@@ -424,11 +425,12 @@ namespace XBMCAddon
std::vector<String>* ret = new std::vector<String>(subtitleCount);
for (int iStream=0; iStream < subtitleCount; iStream++)
{
- CStdString strName;
+ SPlayerSubtitleStreamInfo info;
+ g_application.m_pPlayer->GetSubtitleStreamInfo(iStream, info);
+
CStdString FullLang;
- g_application.m_pPlayer->GetSubtitleName(iStream, strName);
- if (!g_LangCodeExpander.Lookup(FullLang, strName))
- FullLang = strName;
+ if (!g_LangCodeExpander.Lookup(FullLang, info.name))
+ FullLang = info.name;
(*ret)[iStream] = FullLang;
}
return ret;
@@ -457,13 +459,14 @@ namespace XBMCAddon
int streamCount = g_application.m_pPlayer->GetAudioStreamCount();
std::vector<String>* ret = new std::vector<String>(streamCount);
for (int iStream=0; iStream < streamCount; iStream++)
- {
- CStdString strName;
+ {
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(iStream, info);
+
CStdString FullLang;
- g_application.m_pPlayer->GetAudioStreamLanguage(iStream, strName);
- g_LangCodeExpander.Lookup(FullLang, strName);
+ g_LangCodeExpander.Lookup(FullLang, info.language);
if (FullLang.IsEmpty())
- g_application.m_pPlayer->GetAudioStreamName(iStream, FullLang);
+ FullLang = info.name;
(*ret)[iStream] = FullLang;
}
return ret;
diff --git a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
index ccd465d4ff..ac4d6a623f 100644
--- a/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
+++ b/xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
@@ -162,7 +162,11 @@ void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id)
{
CStdString strItem;
CStdString strName;
- g_application.m_pPlayer->GetAudioStreamName(i, strName);
+
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(i, info);
+
+ strName = info.name;
if (strName.length() == 0)
strName = "Unnamed";
@@ -198,17 +202,17 @@ void CGUIDialogAudioSubtitleSettings::AddSubtitleStreams(unsigned int id)
// cycle through each subtitle and add it to our entry list
for (int i = 0; i <= setting.max; ++i)
{
+ SPlayerSubtitleStreamInfo info;
+ g_application.m_pPlayer->GetSubtitleStreamInfo(i, info);
+
CStdString strItem;
- CStdString strName;
- g_application.m_pPlayer->GetSubtitleName(i, strName);
+ CStdString strName = info.name;
+
if (strName.length() == 0)
strName = "Unnamed";
- CStdString strLanguage;
- g_application.m_pPlayer->GetSubtitleLanguage(i, strLanguage);
-
- if (strName != strLanguage)
- strName.Format("%s [%s]", strName.c_str(), strLanguage.c_str());
+ if (strName != info.language)
+ strName.Format("%s [%s]", strName.c_str(), info.language.c_str());
strItem.Format("%s (%i/%i)", strName.c_str(), i + 1, (int)setting.max + 1);
diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp
index a314ad99cf..fb116286c8 100644
--- a/xbmc/video/windows/GUIWindowFullScreen.cpp
+++ b/xbmc/video/windows/GUIWindowFullScreen.cpp
@@ -226,10 +226,11 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
CStdString sub, lang;
if (g_settings.m_currentVideoSettings.m_SubtitleOn)
{
- g_application.m_pPlayer->GetSubtitleName(g_application.m_pPlayer->GetSubtitle(),sub);
- g_application.m_pPlayer->GetSubtitleLanguage(g_application.m_pPlayer->GetSubtitle(),lang);
- if (sub != lang)
- sub.Format("%s [%s]", sub.c_str(), lang.c_str());
+ SPlayerSubtitleStreamInfo info;
+ g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
+ sub = info.name;
+ if (sub != info.language)
+ sub.Format("%s [%s]", sub.c_str(), info.language.c_str());
}
else
sub = g_localizeStrings.Get(1223);
@@ -279,10 +280,11 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
CStdString sub, lang;
if (g_settings.m_currentVideoSettings.m_SubtitleOn)
{
- g_application.m_pPlayer->GetSubtitleName(g_settings.m_currentVideoSettings.m_SubtitleStream,sub);
- g_application.m_pPlayer->GetSubtitleLanguage(g_settings.m_currentVideoSettings.m_SubtitleStream,lang);
- if (sub != lang)
- sub.Format("%s [%s]", sub.c_str(), lang.c_str());
+ SPlayerSubtitleStreamInfo info;
+ g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
+ sub = info.name;
+ if (sub != info.language)
+ sub.Format("%s [%s]", sub.c_str(), info.language.c_str());
}
else
sub = g_localizeStrings.Get(1223);
@@ -364,7 +366,9 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
g_settings.m_currentVideoSettings.m_AudioStream = 0;
g_application.m_pPlayer->SetAudioStream(g_settings.m_currentVideoSettings.m_AudioStream); // Set the audio stream to the one selected
CStdString aud;
- g_application.m_pPlayer->GetAudioStreamName(g_settings.m_currentVideoSettings.m_AudioStream,aud);
+ SPlayerAudioStreamInfo info;
+ g_application.m_pPlayer->GetAudioStreamInfo(g_settings.m_currentVideoSettings.m_AudioStream, info);
+ aud = info.name;
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime);
return true;
}
@@ -947,10 +951,8 @@ void CGUIWindowFullScreen::FrameMove()
OnMessage(msg);
}
// show sizing information
- CRect SrcRect, DestRect;
- float fAR;
- g_application.m_pPlayer->GetVideoRect(SrcRect, DestRect);
- g_application.m_pPlayer->GetVideoAspectRatio(fAR);
+ SPlayerVideoStreamInfo info;
+ g_application.m_pPlayer->GetVideoStreamInfo(info);
{
// Splitres scaling factor
RESOLUTION res = g_graphicsContext.GetVideoResolution();
@@ -959,9 +961,9 @@ void CGUIWindowFullScreen::FrameMove()
CStdString strSizing;
strSizing.Format(g_localizeStrings.Get(245),
- (int)SrcRect.Width(), (int)SrcRect.Height(),
- (int)(DestRect.Width() * xscale), (int)(DestRect.Height() * yscale),
- g_settings.m_fZoomAmount, fAR*g_settings.m_fPixelRatio,
+ (int)info.SrcRect.Width(), (int)info.SrcRect.Height(),
+ (int)(info.DestRect.Width() * xscale), (int)(info.DestRect.Height() * yscale),
+ g_settings.m_fZoomAmount, info.videoAspectRatio*g_settings.m_fPixelRatio,
g_settings.m_fPixelRatio, g_settings.m_fVerticalShift);
CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW2);
msg.SetLabel(strSizing);
@@ -1118,13 +1120,13 @@ void CGUIWindowFullScreen::RenderTTFSubtitles()
y = (float) g_settings.m_ResInfo[res].iSubtitles - textHeight;
else
{
- CRect SrcRect, DestRect;
- g_application.m_pPlayer->GetVideoRect(SrcRect, DestRect);
+ SPlayerVideoStreamInfo info;
+ g_application.m_pPlayer->GetVideoStreamInfo(info);
if ((subalign == SUBTITLE_ALIGN_TOP_INSIDE) || (subalign == SUBTITLE_ALIGN_TOP_OUTSIDE))
- y = DestRect.y1;
+ y = info.DestRect.y1;
else
- y = DestRect.y2;
+ y = info.DestRect.y2;
// use the manual distance to the screenbottom as an offset to the automatic location
if ((subalign == SUBTITLE_ALIGN_BOTTOM_INSIDE) || (subalign == SUBTITLE_ALIGN_TOP_OUTSIDE))