Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #5084 from popcornmix/dvdrefactor

[players] Make omxplayer be derived from dvdplayer [RFC]
  • Loading branch information...
commit 661706dc4a27b223d14bc463e5e71489d598b477 2 parents d3f48dd + 2d11034
@FernetMenta FernetMenta authored
Showing with 729 additions and 5,254 deletions.
  1. +12 −1 language/English/strings.po
  2. +9 −0 system/settings/settings.xml
  3. +4 −21 xbmc/ApplicationPlayer.cpp
  4. +0 −3  xbmc/ApplicationPlayer.h
  5. +0 −2  xbmc/addons/Visualisation.cpp
  6. +0 −2  xbmc/cores/DummyVideoPlayer.h
  7. +0 −2  xbmc/cores/ExternalPlayer/ExternalPlayer.h
  8. +6 −6 xbmc/cores/IPlayer.h
  9. +0 −20 xbmc/cores/dvdplayer/DVDAudio.cpp
  10. +0 −5 xbmc/cores/dvdplayer/DVDAudio.h
  11. +463 −142 xbmc/cores/dvdplayer/DVDPlayer.cpp
  12. +70 −9 xbmc/cores/dvdplayer/DVDPlayer.h
  13. +3 −5 xbmc/cores/dvdplayer/DVDPlayerAudio.h
  14. +3 −1 xbmc/cores/dvdplayer/DVDPlayerVideo.h
  15. +79 −1 xbmc/cores/dvdplayer/IDVDPlayer.h
  16. +1 −2  xbmc/cores/omxplayer/Makefile.in
  17. +0 −20 xbmc/cores/omxplayer/OMXAudio.cpp
  18. +0 −4 xbmc/cores/omxplayer/OMXAudio.h
  19. +0 −4,432 xbmc/cores/omxplayer/OMXPlayer.cpp
  20. +0 −508 xbmc/cores/omxplayer/OMXPlayer.h
  21. +26 −12 xbmc/cores/omxplayer/OMXPlayerAudio.cpp
  22. +2 −4 xbmc/cores/omxplayer/OMXPlayerAudio.h
  23. +20 −13 xbmc/cores/omxplayer/OMXPlayerVideo.cpp
  24. +2 −2 xbmc/cores/omxplayer/OMXPlayerVideo.h
  25. +3 −2 xbmc/cores/omxplayer/OMXVideo.cpp
  26. +1 −1  xbmc/cores/omxplayer/OMXVideo.h
  27. +2 −2 xbmc/cores/omxplayer/omxplayer_advancedsettings.xml
  28. +0 −14 xbmc/cores/playercorefactory/PlayerCoreConfig.h
  29. +0 −7 xbmc/cores/playercorefactory/PlayerCoreFactory.cpp
  30. +0 −6 xbmc/cores/playercorefactory/PlayerCoreFactory.h
  31. +19 −5 xbmc/linux/OMXClock.cpp
  32. +1 −0  xbmc/linux/OMXClock.h
  33. +3 −0  xbmc/settings/SettingConditions.cpp
View
13 language/English/strings.po
@@ -6196,7 +6196,18 @@ msgctxt "#13457"
msgid "Prefer VAAPI render method"
msgstr ""
-#empty strings from id 13458 to 13499
+#: system/settings/settings.xml
+msgctxt "#13458"
+msgid "Allow hardware acceleration (OMXPlayer)"
+msgstr ""
+
+#. Description of setting "Videos -> Playback -> Allow hardware acceleration (OMXPlayer)" with label #13457
+#: system/settings/settings.xml
+msgctxt "#13459"
+msgid "Use OMXPlayer for decoding of video files."
+msgstr ""
+
+#empty strings from id 13460 to 13499
#: system/settings/settings.xml
msgctxt "#13500"
View
9 system/settings/settings.xml
@@ -752,6 +752,15 @@
<default>true</default>
<control type="toggle" />
</setting>
+ <setting id="videoplayer.useomxplayer" type="boolean" label="13458" help="13459">
+ <requirement>HAS_OMXPLAYER</requirement>
+ <dependencies>
+ <dependency type="enable" setting="videoplayer.decodingmethod" operator="is">1</dependency>
+ </dependencies>
+ <level>2</level>
+ <default>true</default>
+ <control type="toggle" />
+ </setting>
<setting id="videoplayer.useomx" type="boolean" label="13430" help="36161">
<requirement>HAVE_LIBOPENMAX</requirement>
<dependencies>
View
25 xbmc/ApplicationPlayer.cpp
@@ -64,9 +64,6 @@ void CApplicationPlayer::ClosePlayerGapless(PLAYERCOREID newCore)
return;
bool gaplessSupported = (m_eCurrentPlayer == EPC_DVDPLAYER || m_eCurrentPlayer == EPC_PAPLAYER);
-#if defined(HAS_OMXPLAYER)
- gaplessSupported = gaplessSupported || (m_eCurrentPlayer == EPC_OMXPLAYER);
-#endif
gaplessSupported = gaplessSupported && (m_eCurrentPlayer == newCore);
if (!gaplessSupported)
{
@@ -116,20 +113,6 @@ bool CApplicationPlayer::HasPlayer() const
return player != NULL;
}
-void CApplicationPlayer::RegisterAudioCallback(IAudioCallback* pCallback)
-{
- boost::shared_ptr<IPlayer> player = GetInternal();
- if (player)
- player->RegisterAudioCallback(pCallback);
-}
-
-void CApplicationPlayer::UnRegisterAudioCallback()
-{
- boost::shared_ptr<IPlayer> player = GetInternal();
- if (player)
- player->UnRegisterAudioCallback();
-}
-
int CApplicationPlayer::GetChapter()
{
boost::shared_ptr<IPlayer> player = GetInternal();
@@ -621,28 +604,28 @@ void CApplicationPlayer::GetRenderFeatures(std::vector<int> &renderFeatures)
{
boost::shared_ptr<IPlayer> player = GetInternal();
if (player)
- player->GetRenderFeatures(renderFeatures);
+ player->OMXGetRenderFeatures(renderFeatures);
}
void CApplicationPlayer::GetDeinterlaceMethods(std::vector<int> &deinterlaceMethods)
{
boost::shared_ptr<IPlayer> player = GetInternal();
if (player)
- player->GetDeinterlaceMethods(deinterlaceMethods);
+ player->OMXGetDeinterlaceMethods(deinterlaceMethods);
}
void CApplicationPlayer::GetDeinterlaceModes(std::vector<int> &deinterlaceModes)
{
boost::shared_ptr<IPlayer> player = GetInternal();
if (player)
- player->GetDeinterlaceModes(deinterlaceModes);
+ player->OMXGetDeinterlaceModes(deinterlaceModes);
}
void CApplicationPlayer::GetScalingMethods(std::vector<int> &scalingMethods)
{
boost::shared_ptr<IPlayer> player = GetInternal();
if (player)
- player->GetScalingMethods(scalingMethods);
+ player->OMXGetScalingMethods(scalingMethods);
}
void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
View
3  xbmc/ApplicationPlayer.h
@@ -37,7 +37,6 @@ namespace PVR
class CPVRChannel;
}
-class IAudioCallback;
class CAction;
class CPlayerOptions;
class CStreamDetails;
@@ -133,7 +132,6 @@ class CApplicationPlayer
void Pause();
bool QueueNextFile(const CFileItem &file);
bool Record(bool bOnOff);
- void RegisterAudioCallback(IAudioCallback* pCallback);
void Seek(bool bPlus = true, bool bLargeStep = false, bool bChapterOverride = false);
int SeekChapter(int iChapter);
void SeekPercentage(float fPercent = 0);
@@ -150,5 +148,4 @@ class CApplicationPlayer
void SetVolume(float volume);
bool SwitchChannel(const PVR::CPVRChannel &channel);
void ToFFRW(int iSpeed = 0);
- void UnRegisterAudioCallback();
};
View
2  xbmc/addons/Visualisation.cpp
@@ -109,7 +109,6 @@ bool CVisualisation::Create(int x, int y, int w, int h, void *device)
CreateBuffers();
- g_application.m_pPlayer->RegisterAudioCallback(this);
CAEFactory::RegisterAudioCallback(this);
return true;
@@ -174,7 +173,6 @@ void CVisualisation::Render()
void CVisualisation::Stop()
{
- g_application.m_pPlayer->UnRegisterAudioCallback();
CAEFactory::UnregisterAudioCallback();
if (Initialized())
{
View
2  xbmc/cores/DummyVideoPlayer.h
@@ -28,8 +28,6 @@ class CDummyVideoPlayer : public IPlayer, public CThread
public:
CDummyVideoPlayer(IPlayerCallback& callback);
virtual ~CDummyVideoPlayer();
- virtual void RegisterAudioCallback(IAudioCallback* pCallback) {}
- virtual void UnRegisterAudioCallback() {}
virtual bool OpenFile(const CFileItem& file, const CPlayerOptions &options);
virtual bool CloseFile();
virtual bool IsPlaying() const;
View
2  xbmc/cores/ExternalPlayer/ExternalPlayer.h
@@ -35,8 +35,6 @@ class CExternalPlayer : public IPlayer, public CThread
CExternalPlayer(IPlayerCallback& callback);
virtual ~CExternalPlayer();
virtual bool Initialize(TiXmlElement* pConfig);
- virtual void RegisterAudioCallback(IAudioCallback* pCallback) {}
- virtual void UnRegisterAudioCallback() {}
virtual bool OpenFile(const CFileItem& file, const CPlayerOptions &options);
virtual bool CloseFile(bool reopen = false);
virtual bool IsPlaying() const;
View
12 xbmc/cores/IPlayer.h
@@ -128,8 +128,6 @@ class IPlayer
IPlayer(IPlayerCallback& callback): m_callback(callback){};
virtual ~IPlayer(){};
virtual bool Initialize(TiXmlElement* pConfig) { return true; };
- virtual void RegisterAudioCallback(IAudioCallback* pCallback) {};
- virtual void UnRegisterAudioCallback() {};
virtual bool OpenFile(const CFileItem& file, const CPlayerOptions& options){ return false;}
virtual bool QueueNextFile(const CFileItem &file) { return false; }
virtual void OnNothingToQueueNotify() {}
@@ -221,22 +219,24 @@ class IPlayer
virtual bool SwitchChannel(const PVR::CPVRChannel &channel) { return false; }
+ // Note: the following "OMX" methods are deprecated and will be removed in the future
+ // They should be handled by the video renderer, not the player
/*!
\brief If the player uses bypass mode, define its rendering capabilities
*/
- virtual void GetRenderFeatures(std::vector<int> &renderFeatures) {};
+ virtual void OMXGetRenderFeatures(std::vector<int> &renderFeatures) {};
/*!
\brief If the player uses bypass mode, define its deinterlace algorithms
*/
- virtual void GetDeinterlaceMethods(std::vector<int> &deinterlaceMethods) {};
+ virtual void OMXGetDeinterlaceMethods(std::vector<int> &deinterlaceMethods) {};
/*!
\brief If the player uses bypass mode, define how deinterlace is set
*/
- virtual void GetDeinterlaceModes(std::vector<int> &deinterlaceModes) {};
+ virtual void OMXGetDeinterlaceModes(std::vector<int> &deinterlaceModes) {};
/*!
\brief If the player uses bypass mode, define its scaling capabilities
*/
- virtual void GetScalingMethods(std::vector<int> &scalingMethods) {};
+ virtual void OMXGetScalingMethods(std::vector<int> &scalingMethods) {};
/*!
\brief define the audio capabilities of the player (default=all)
*/
View
20 xbmc/cores/dvdplayer/DVDAudio.cpp
@@ -95,7 +95,6 @@ CDVDAudio::CDVDAudio(volatile bool &bStop)
: m_bStop(bStop)
{
m_pAudioStream = NULL;
- m_pAudioCallback = NULL;
m_bPassthrough = false;
m_iBitsPerSample = 0;
m_iBitrate = 0;
@@ -146,9 +145,6 @@ bool CDVDAudio::Create(const DVDAudioFrame &audioframe, AVCodecID codec, bool ne
SetDynamicRangeCompression((long)(CMediaSettings::Get().GetCurrentVideoSettings().m_VolumeAmplification * 100));
- if (m_pAudioCallback)
- RegisterAudioCallback(m_pAudioCallback);
-
return true;
}
@@ -225,22 +221,6 @@ void CDVDAudio::Drain()
m_pAudioStream->Drain(true);
}
-void CDVDAudio::RegisterAudioCallback(IAudioCallback* pCallback)
-{
- CSingleLock lock (m_critSection);
- m_pAudioCallback = pCallback;
- if (m_pAudioStream)
- m_pAudioStream->RegisterAudioCallback(pCallback);
-}
-
-void CDVDAudio::UnRegisterAudioCallback()
-{
- CSingleLock lock (m_critSection);
- if (m_pAudioStream)
- m_pAudioStream->UnRegisterAudioCallback();
- m_pAudioCallback = NULL;
-}
-
void CDVDAudio::SetVolume(float volume)
{
CSingleLock lock (m_critSection);
View
5 xbmc/cores/dvdplayer/DVDAudio.h
@@ -52,7 +52,6 @@ class CPTSOutputQueue
};
class CSingleLock;
-class IAudioCallback;
class CDVDAudio
{
@@ -60,9 +59,6 @@ class CDVDAudio
CDVDAudio(volatile bool& bStop);
~CDVDAudio();
- void RegisterAudioCallback(IAudioCallback* pCallback);
- void UnRegisterAudioCallback();
-
void SetVolume(float fVolume);
void SetDynamicRangeCompression(long drc);
float GetCurrentAttenuation();
@@ -97,7 +93,6 @@ class CDVDAudio
bool m_bPaused;
volatile bool& m_bStop;
- IAudioCallback* m_pAudioCallback; //the viz audio callback
//counter that will go from 0 to m_iSpeed-1 and reset, data will only be output when speedstep is 0
//int m_iSpeedStep;
};
View
605 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -85,6 +85,11 @@
#include "utils/LangCodeExpander.h"
#include "video/VideoReferenceClock.h"
+#ifdef HAS_OMXPLAYER
+#include "cores/omxplayer/OMXPlayerAudio.h"
+#include "cores/omxplayer/OMXPlayerVideo.h"
+#endif
+
using namespace std;
using namespace PVR;
@@ -483,6 +488,39 @@ void CSelectionStreams::Update(CDVDInputStream* input, CDVDDemux* demuxer)
}
}
+void CDVDPlayer::CreatePlayers()
+{
+ if (m_players_created)
+ return;
+
+ if (m_omxplayer_mode)
+ {
+#ifdef HAS_OMXPLAYER
+ m_dvdPlayerVideo = new OMXPlayerVideo(&m_OmxPlayerState.av_clock, &m_overlayContainer, m_messenger);
+ m_dvdPlayerAudio = new OMXPlayerAudio(&m_OmxPlayerState.av_clock, m_messenger);
+#endif
+ }
+ else
+ {
+ m_dvdPlayerVideo = new CDVDPlayerVideo(&m_clock, &m_overlayContainer, m_messenger);
+ m_dvdPlayerAudio = new CDVDPlayerAudio(&m_clock, m_messenger);
+ }
+ m_dvdPlayerSubtitle = new CDVDPlayerSubtitle(&m_overlayContainer);
+ m_dvdPlayerTeletext = new CDVDTeletextData();
+ m_players_created = true;
+}
+
+void CDVDPlayer::DestroyPlayers()
+{
+ if (!m_players_created)
+ return;
+ delete m_dvdPlayerVideo;
+ delete m_dvdPlayerAudio;
+ delete m_dvdPlayerSubtitle;
+ delete m_dvdPlayerTeletext;
+ m_players_created = false;
+}
+
CDVDPlayer::CDVDPlayer(IPlayerCallback& callback)
: IPlayer(callback),
CThread("DVDPlayer"),
@@ -491,13 +529,10 @@ CDVDPlayer::CDVDPlayer(IPlayerCallback& callback)
m_CurrentSubtitle(STREAM_SUBTITLE, DVDPLAYER_SUBTITLE),
m_CurrentTeletext(STREAM_TELETEXT, DVDPLAYER_TELETEXT),
m_messenger("player"),
- m_dvdPlayerVideo(&m_clock, &m_overlayContainer, m_messenger),
- m_dvdPlayerAudio(&m_clock, m_messenger),
- m_dvdPlayerSubtitle(&m_overlayContainer),
- m_dvdPlayerTeletext(),
m_ready(true),
m_DemuxerPausePending(false)
{
+ m_players_created = false;
m_pDemuxer = NULL;
m_pSubtitleDemuxer = NULL;
m_pInputStream = NULL;
@@ -516,11 +551,30 @@ CDVDPlayer::CDVDPlayer(IPlayerCallback& callback)
m_HasAudio = false;
memset(&m_SpeedState, 0, sizeof(m_SpeedState));
+
+ // omxplayer variables
+ m_OmxPlayerState.video_fifo = 0;
+ m_OmxPlayerState.audio_fifo = 0;
+ m_OmxPlayerState.last_check_time = 0.0;
+ m_OmxPlayerState.stamp = 0.0;
+ m_OmxPlayerState.bOmxWaitVideo = false;
+ m_OmxPlayerState.bOmxWaitAudio = false;
+ m_OmxPlayerState.bOmxSentEOFs = false;
+ m_OmxPlayerState.threshold = 0.2f;
+ m_OmxPlayerState.current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode;
+#ifdef HAS_OMXPLAYER
+ m_omxplayer_mode = CSettings::Get().GetBool("videoplayer.useomxplayer");
+#else
+ m_omxplayer_mode = false;
+#endif
+
+ CreatePlayers();
}
CDVDPlayer::~CDVDPlayer()
{
CloseFile();
+ DestroyPlayers();
}
bool CDVDPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options)
@@ -812,7 +866,7 @@ bool CDVDPlayer::ReadPacket(DemuxPacket*& packet, CDemuxStream*& stream)
{
// check if we should read from subtitle demuxer
- if( m_pSubtitleDemuxer && m_dvdPlayerSubtitle.AcceptsData() )
+ if( m_pSubtitleDemuxer && m_dvdPlayerSubtitle->AcceptsData() )
{
packet = m_pSubtitleDemuxer->Read();
@@ -837,6 +891,16 @@ bool CDVDPlayer::ReadPacket(DemuxPacket*& packet, CDemuxStream*& stream)
}
}
+ if (m_omxplayer_mode)
+ {
+ // reset eos state when we get a packet (e.g. for case of seek after eos)
+ if (packet && stream)
+ {
+ m_OmxPlayerState.bOmxWaitVideo = false;
+ m_OmxPlayerState.bOmxWaitAudio = false;
+ m_OmxPlayerState.bOmxSentEOFs = false;
+ }
+ }
// read a data frame from stream.
if(m_pDemuxer)
packet = m_pDemuxer->Read();
@@ -982,6 +1046,120 @@ void CDVDPlayer::CheckBetterStream(CCurrentStream& current, CDemuxStream* stream
OpenStream(current, stream->iId, stream->source);
}
+void CDVDPlayer::OMXDoProcessing()
+{
+#ifdef HAS_OMXPLAYER
+ double now = CDVDClock::GetAbsoluteClock();
+ if (m_OmxPlayerState.last_check_time == 0.0 || m_OmxPlayerState.last_check_time + DVD_MSEC_TO_TIME(20) <= now)
+ {
+ m_OmxPlayerState.last_check_time = now;
+ m_OmxPlayerState.stamp = m_OmxPlayerState.av_clock.OMXMediaTime();
+ const bool m_Pause = m_playSpeed == DVD_PLAYSPEED_PAUSE;
+ const bool not_accepts_data = (!m_dvdPlayerAudio->AcceptsData() && m_CurrentAudio.id >= 0) ||
+ (!m_dvdPlayerVideo->AcceptsData() && m_CurrentVideo.id >= 0);
+ /* when the video/audio fifos are low, we pause clock, when high we resume */
+ double audio_pts = floor(m_dvdPlayerAudio->GetCurrentPts());
+ double video_pts = floor(m_dvdPlayerVideo->GetCurrentPts());
+
+ float audio_fifo = audio_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6;
+ float video_fifo = video_pts / DVD_TIME_BASE - m_OmxPlayerState.stamp * 1e-6;
+ float threshold = 0.1f;
+ bool audio_fifo_low = false, video_fifo_low = false, audio_fifo_high = false, video_fifo_high = false;
+
+ // if deinterlace setting has changed, we should close and open video
+ if (m_OmxPlayerState.current_deinterlace != CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode)
+ {
+ CloseStream(m_CurrentVideo, false);
+ OpenStream(m_CurrentVideo, m_CurrentVideo.id, m_CurrentVideo.source);
+ if (m_State.canseek)
+ m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true, true, true));
+ m_OmxPlayerState.current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode;
+ }
+
+ m_OmxPlayerState.video_fifo = (int)(100.0*(m_dvdPlayerVideo->GetDecoderBufferSize()-m_dvdPlayerVideo->GetDecoderFreeSpace())/m_dvdPlayerVideo->GetDecoderBufferSize());
+ m_OmxPlayerState.audio_fifo = (int)(100.0*audio_fifo/m_dvdPlayerAudio->GetCacheTotal());
+
+ #ifdef _DEBUG
+ static unsigned count;
+ if ((count++ & 7) == 0)
+ {
+ char response[80];
+ if (m_dvdPlayerVideo->GetDecoderBufferSize() && m_dvdPlayerAudio->GetCacheTotal())
+ vc_gencmd(response, sizeof response, "render_bar 4 video_fifo %d %d %d %d",
+ m_OmxPlayerState.video_fifo,
+ (int)(100.0*video_fifo/m_dvdPlayerAudio->GetCacheTotal()),
+ 0, 100);
+ if (m_dvdPlayerAudio->GetCacheTotal())
+ vc_gencmd(response, sizeof response, "render_bar 5 audio_fifo %d %d %d %d",
+ m_OmxPlayerState.audio_fifo,
+ (int)(100.0*m_dvdPlayerAudio->GetDelay()/m_dvdPlayerAudio->GetCacheTotal()),
+ 0, 100);
+ vc_gencmd(response, sizeof response, "render_bar 6 video_queue %d %d %d %d",
+ m_dvdPlayerVideo->GetLevel(), 0, 0, 100);
+ vc_gencmd(response, sizeof response, "render_bar 7 audio_queue %d %d %d %d",
+ m_dvdPlayerAudio->GetLevel(), 0, 0, 100);
+ }
+ #endif
+ if (audio_pts != DVD_NOPTS_VALUE)
+ {
+ audio_fifo_low = m_HasAudio && audio_fifo < threshold;
+ audio_fifo_high = audio_pts != DVD_NOPTS_VALUE && audio_fifo >= m_OmxPlayerState.threshold;
+ }
+ if (video_pts != DVD_NOPTS_VALUE)
+ {
+ video_fifo_low = m_HasVideo && video_fifo < threshold;
+ video_fifo_high = video_pts != DVD_NOPTS_VALUE && video_fifo >= m_OmxPlayerState.threshold;
+ }
+ if (!m_HasAudio && m_HasVideo)
+ audio_fifo_high = true;
+ if (!m_HasVideo && m_HasAudio)
+ video_fifo_high = true;
+
+ #ifdef _DEBUG
+ CLog::Log(LOGDEBUG, "%s::%s M:%.6f-%.6f (A:%.6f V:%.6f) PEF:%d%d%d S:%.2f A:%.2f V:%.2f/T:%.2f (A:%d%d V:%d%d) A:%d%% V:%d%% (%.2f,%.2f)", "CDVDPlayer", __FUNCTION__,
+ m_OmxPlayerState.stamp*1e-6, m_OmxPlayerState.av_clock.OMXClockAdjustment()*1e-6, audio_pts*1e-6, video_pts*1e-6, m_OmxPlayerState.av_clock.OMXIsPaused(), m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_playSpeed * (1.0f/DVD_PLAYSPEED_NORMAL),
+ audio_pts == DVD_NOPTS_VALUE ? 0.0:audio_fifo, video_pts == DVD_NOPTS_VALUE ? 0.0:video_fifo, m_OmxPlayerState.threshold,
+ audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high,
+ m_dvdPlayerAudio->GetLevel(), m_dvdPlayerVideo->GetLevel(), m_dvdPlayerAudio->GetDelay(), (float)m_dvdPlayerAudio->GetCacheTotal());
+ #endif
+
+ if(!m_Pause && (m_OmxPlayerState.bOmxSentEOFs || not_accepts_data || (audio_fifo_high && video_fifo_high) || m_playSpeed != DVD_PLAYSPEED_NORMAL))
+ {
+ if (m_OmxPlayerState.av_clock.OMXIsPaused())
+ {
+ CLog::Log(LOGDEBUG, "%s::%s Resume %.2f,%.2f (A:%d%d V:%d%d) EOF:%d FULL:%d T:%.2f", "CDVDPlayer", __FUNCTION__, audio_fifo, video_fifo,
+ audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_OmxPlayerState.threshold);
+ m_OmxPlayerState.av_clock.OMXResume();
+ }
+ }
+ else if ((m_Pause || audio_fifo_low || video_fifo_low) && m_playSpeed == DVD_PLAYSPEED_NORMAL)
+ {
+ if (!m_OmxPlayerState.av_clock.OMXIsPaused())
+ {
+ if (!m_Pause)
+ m_OmxPlayerState.threshold = std::min(2.0f*m_OmxPlayerState.threshold, 16.0f);
+ CLog::Log(LOGDEBUG, "%s::%s Pause %.2f,%.2f (A:%d%d V:%d%d) EOF:%d FULL:%d T:%.2f", "CDVDPlayer", __FUNCTION__, audio_fifo, video_fifo,
+ audio_fifo_low, audio_fifo_high, video_fifo_low, video_fifo_high, m_OmxPlayerState.bOmxSentEOFs, not_accepts_data, m_OmxPlayerState.threshold);
+ m_OmxPlayerState.av_clock.OMXPause();
+ }
+ }
+ }
+#endif
+}
+
+bool CDVDPlayer::OMXStillPlaying()
+{
+ if (m_omxplayer_mode)
+ {
+ // wait for omx components to finish
+ if(m_OmxPlayerState.bOmxWaitVideo && !m_dvdPlayerVideo->IsEOS())
+ return true;
+ if(m_OmxPlayerState.bOmxWaitAudio && !m_dvdPlayerAudio->IsEOS())
+ return true;
+ }
+ return false;
+}
+
void CDVDPlayer::Process()
{
if (!OpenInputStream())
@@ -1011,7 +1189,19 @@ void CDVDPlayer::Process()
}
// allow renderer to switch to fullscreen if requested
- m_dvdPlayerVideo.EnableFullscreen(m_PlayerOptions.fullscreen);
+ m_dvdPlayerVideo->EnableFullscreen(m_PlayerOptions.fullscreen);
+
+ if (m_omxplayer_mode)
+ {
+ if (!m_OmxPlayerState.av_clock.OMXInitialize(&m_clock))
+ m_bAbortRequest = true;
+ if (CSettings::Get().GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF)
+ m_OmxPlayerState.av_clock.HDMIClockSync();
+ m_OmxPlayerState.av_clock.OMXStateIdle();
+ m_OmxPlayerState.av_clock.OMXStateExecute();
+ m_OmxPlayerState.av_clock.OMXStop();
+ m_OmxPlayerState.av_clock.OMXPause();
+ }
OpenDefaultStreams();
@@ -1099,6 +1289,9 @@ void CDVDPlayer::Process()
while (!m_bAbortRequest)
{
+ if (m_omxplayer_mode)
+ OMXDoProcessing();
+
// handle messages send to this thread, like seek or demuxer reset requests
HandleMessages();
@@ -1133,8 +1326,8 @@ void CDVDPlayer::Process()
OpenDefaultStreams();
// never allow first frames after open to be skipped
- if( m_dvdPlayerVideo.IsInited() )
- m_dvdPlayerVideo.SendMessage(new CDVDMsg(CDVDMsg::VIDEO_NOSKIP));
+ if( m_dvdPlayerVideo->IsInited() )
+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::VIDEO_NOSKIP));
if (CachePVRStream())
SetCaching(CACHESTATE_PVR);
@@ -1153,14 +1346,14 @@ void CDVDPlayer::Process()
UpdateApplication(1000);
// make sure we run subtitle process here
- m_dvdPlayerSubtitle.Process(m_clock.GetClock() + m_State.time_offset - m_dvdPlayerVideo.GetSubtitleDelay(), m_State.time_offset);
+ m_dvdPlayerSubtitle->Process(m_clock.GetClock() + m_State.time_offset - m_dvdPlayerVideo->GetSubtitleDelay(), m_State.time_offset);
if (CheckDelayedChannelEntry())
continue;
// if the queues are full, no need to read more
- if ((!m_dvdPlayerAudio.AcceptsData() && m_CurrentAudio.id >= 0) ||
- (!m_dvdPlayerVideo.AcceptsData() && m_CurrentVideo.id >= 0))
+ if ((!m_dvdPlayerAudio->AcceptsData() && m_CurrentAudio.id >= 0) ||
+ (!m_dvdPlayerVideo->AcceptsData() && m_CurrentVideo.id >= 0))
{
if(m_pDemuxer && m_DemuxerPausePending)
{
@@ -1173,8 +1366,8 @@ void CDVDPlayer::Process()
}
// always yield to players if they have data levels > 50 percent
- if((m_dvdPlayerAudio.GetLevel() > 50 || m_CurrentAudio.id < 0)
- && (m_dvdPlayerVideo.GetLevel() > 50 || m_CurrentVideo.id < 0))
+ if((m_dvdPlayerAudio->GetLevel() > 50 || m_CurrentAudio.id < 0)
+ && (m_dvdPlayerVideo->GetLevel() > 50 || m_CurrentVideo.id < 0))
Sleep(0);
DemuxPacket* pPacket = NULL;
@@ -1232,14 +1425,24 @@ void CDVDPlayer::Process()
}
// make sure we tell all players to finish it's data
+ if (m_omxplayer_mode && !m_OmxPlayerState.bOmxSentEOFs)
+ {
+ if(m_CurrentAudio.inited)
+ m_OmxPlayerState.bOmxWaitAudio = true;
+
+ if(m_CurrentVideo.inited)
+ m_OmxPlayerState.bOmxWaitVideo = true;
+
+ m_OmxPlayerState.bOmxSentEOFs = true;
+ }
if(m_CurrentAudio.inited)
- m_dvdPlayerAudio.SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF));
+ m_dvdPlayerAudio->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF));
if(m_CurrentVideo.inited)
- m_dvdPlayerVideo.SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF));
+ m_dvdPlayerVideo->SendMessage (new CDVDMsg(CDVDMsg::GENERAL_EOF));
if(m_CurrentSubtitle.inited)
- m_dvdPlayerSubtitle.SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF));
+ m_dvdPlayerSubtitle->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF));
if(m_CurrentTeletext.inited)
- m_dvdPlayerTeletext.SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF));
+ m_dvdPlayerTeletext->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_EOF));
m_CurrentAudio.inited = false;
m_CurrentVideo.inited = false;
m_CurrentSubtitle.inited = false;
@@ -1249,8 +1452,9 @@ void CDVDPlayer::Process()
SetCaching(CACHESTATE_DONE);
// while players are still playing, keep going to allow seekbacks
- if(m_dvdPlayerAudio.HasData()
- || m_dvdPlayerVideo.HasData())
+ if(m_dvdPlayerAudio->HasData()
+ || m_dvdPlayerVideo->HasData()
+ || OMXStillPlaying())
{
Sleep(100);
continue;
@@ -1372,17 +1576,17 @@ void CDVDPlayer::ProcessAudioData(CDemuxStream* pStream, DemuxPacket* pPacket)
else if (m_Edl.InCut(DVD_TIME_TO_MSEC(m_CurrentAudio.dts + m_offset_pts), &cut) && cut.action == CEdl::MUTE // Inside EDL mute
&& !m_EdlAutoSkipMarkers.mute) // Mute not already triggered
{
- m_dvdPlayerAudio.SendMessage(new CDVDMsgBool(CDVDMsg::AUDIO_SILENCE, true));
+ m_dvdPlayerAudio->SendMessage(new CDVDMsgBool(CDVDMsg::AUDIO_SILENCE, true));
m_EdlAutoSkipMarkers.mute = true;
}
else if (!m_Edl.InCut(DVD_TIME_TO_MSEC(m_CurrentAudio.dts + m_offset_pts), &cut) // Outside of any EDL
&& m_EdlAutoSkipMarkers.mute) // But the mute hasn't been removed yet
{
- m_dvdPlayerAudio.SendMessage(new CDVDMsgBool(CDVDMsg::AUDIO_SILENCE, false));
+ m_dvdPlayerAudio->SendMessage(new CDVDMsgBool(CDVDMsg::AUDIO_SILENCE, false));
m_EdlAutoSkipMarkers.mute = false;
}
- m_dvdPlayerAudio.SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
+ m_dvdPlayerAudio->SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
}
void CDVDPlayer::ProcessVideoData(CDemuxStream* pStream, DemuxPacket* pPacket)
@@ -1405,7 +1609,7 @@ void CDVDPlayer::ProcessVideoData(CDemuxStream* pStream, DemuxPacket* pPacket)
if (CheckSceneSkip(m_CurrentVideo))
drop = true;
- m_dvdPlayerVideo.SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
+ m_dvdPlayerVideo->SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
}
void CDVDPlayer::ProcessSubData(CDemuxStream* pStream, DemuxPacket* pPacket)
@@ -1421,10 +1625,10 @@ void CDVDPlayer::ProcessSubData(CDemuxStream* pStream, DemuxPacket* pPacket)
if (CheckSceneSkip(m_CurrentSubtitle))
drop = true;
- m_dvdPlayerSubtitle.SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
+ m_dvdPlayerSubtitle->SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
if(m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD))
- m_dvdPlayerSubtitle.UpdateOverlayInfo((CDVDInputStreamNavigator*)m_pInputStream, LIBDVDNAV_BUTTON_NORMAL);
+ m_dvdPlayerSubtitle->UpdateOverlayInfo((CDVDInputStreamNavigator*)m_pInputStream, LIBDVDNAV_BUTTON_NORMAL);
}
void CDVDPlayer::ProcessTeletextData(CDemuxStream* pStream, DemuxPacket* pPacket)
@@ -1440,7 +1644,7 @@ void CDVDPlayer::ProcessTeletextData(CDemuxStream* pStream, DemuxPacket* pPacket
if (CheckSceneSkip(m_CurrentTeletext))
drop = true;
- m_dvdPlayerTeletext.SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
+ m_dvdPlayerTeletext->SendMessage(new CDVDMsgDemuxerPacket(pPacket, drop));
}
bool CDVDPlayer::GetCachingTimes(double& level, double& delay, double& offset)
@@ -1510,8 +1714,8 @@ void CDVDPlayer::HandlePlaySpeed()
}
else
{
- if ((!m_dvdPlayerAudio.AcceptsData() && m_CurrentAudio.id >= 0)
- || (!m_dvdPlayerVideo.AcceptsData() && m_CurrentVideo.id >= 0))
+ if ((!m_dvdPlayerAudio->AcceptsData() && m_CurrentAudio.id >= 0)
+ || (!m_dvdPlayerVideo->AcceptsData() && m_CurrentVideo.id >= 0))
caching = CACHESTATE_INIT;
}
}
@@ -1526,8 +1730,8 @@ void CDVDPlayer::HandlePlaySpeed()
// handle situation that we get no data on one stream
if(m_CurrentAudio.id >= 0 && m_CurrentVideo.id >= 0)
{
- if ((!m_dvdPlayerAudio.AcceptsData() && !m_CurrentVideo.started)
- || (!m_dvdPlayerVideo.AcceptsData() && !m_CurrentAudio.started))
+ if ((!m_dvdPlayerAudio->AcceptsData() && !m_CurrentVideo.started)
+ || (!m_dvdPlayerVideo->AcceptsData() && !m_CurrentAudio.started))
{
caching = CACHESTATE_DONE;
}
@@ -1538,10 +1742,10 @@ void CDVDPlayer::HandlePlaySpeed()
{
bool bGotAudio(m_pDemuxer->GetNrOfAudioStreams() > 0);
bool bGotVideo(m_pDemuxer->GetNrOfVideoStreams() > 0);
- bool bAudioLevelOk(m_dvdPlayerAudio.GetLevel() > g_advancedSettings.m_iPVRMinAudioCacheLevel);
- bool bVideoLevelOk(m_dvdPlayerVideo.GetLevel() > g_advancedSettings.m_iPVRMinVideoCacheLevel);
- bool bAudioFull(!m_dvdPlayerAudio.AcceptsData());
- bool bVideoFull(!m_dvdPlayerVideo.AcceptsData());
+ bool bAudioLevelOk(m_dvdPlayerAudio->GetLevel() > g_advancedSettings.m_iPVRMinAudioCacheLevel);
+ bool bVideoLevelOk(m_dvdPlayerVideo->GetLevel() > g_advancedSettings.m_iPVRMinVideoCacheLevel);
+ bool bAudioFull(!m_dvdPlayerAudio->AcceptsData());
+ bool bVideoFull(!m_dvdPlayerVideo->AcceptsData());
if (/* if all streams got at least g_advancedSettings.m_iPVRMinCacheLevel in their buffers, we're done */
((bGotVideo || bGotAudio) && (!bGotAudio || bAudioLevelOk) && (!bGotVideo || bVideoLevelOk)) ||
@@ -1549,8 +1753,8 @@ void CDVDPlayer::HandlePlaySpeed()
(bAudioFull || bVideoFull))
{
CLog::Log(LOGDEBUG, "set caching from pvr to done. audio (%d) = %d. video (%d) = %d",
- bGotAudio, m_dvdPlayerAudio.GetLevel(),
- bGotVideo, m_dvdPlayerVideo.GetLevel());
+ bGotAudio, m_dvdPlayerAudio->GetLevel(),
+ bGotVideo, m_dvdPlayerVideo->GetLevel());
caching = CACHESTATE_DONE;
}
@@ -1558,17 +1762,17 @@ void CDVDPlayer::HandlePlaySpeed()
{
/* ensure that automatically started players are stopped while caching */
if (m_CurrentAudio.started)
- m_dvdPlayerAudio.SetSpeed(DVD_PLAYSPEED_PAUSE);
+ m_dvdPlayerAudio->SetSpeed(DVD_PLAYSPEED_PAUSE);
if (m_CurrentVideo.started)
- m_dvdPlayerVideo.SetSpeed(DVD_PLAYSPEED_PAUSE);
+ m_dvdPlayerVideo->SetSpeed(DVD_PLAYSPEED_PAUSE);
}
}
if(caching == CACHESTATE_PLAY)
{
// if all enabled streams have started playing we are done
- if((m_CurrentVideo.id < 0 || !m_dvdPlayerVideo.IsStalled())
- && (m_CurrentAudio.id < 0 || !m_dvdPlayerAudio.IsStalled()))
+ if((m_CurrentVideo.id < 0 || !m_dvdPlayerVideo->IsStalled())
+ && (m_CurrentAudio.id < 0 || !m_dvdPlayerAudio->IsStalled()))
caching = CACHESTATE_DONE;
}
@@ -1586,10 +1790,10 @@ void CDVDPlayer::HandlePlaySpeed()
}
else if (m_CurrentVideo.id >= 0
&& m_CurrentVideo.inited == true
- && m_SpeedState.lastpts != m_dvdPlayerVideo.GetCurrentPts()
+ && m_SpeedState.lastpts != m_dvdPlayerVideo->GetCurrentPts()
&& m_SpeedState.lasttime != GetTime())
{
- m_SpeedState.lastpts = m_dvdPlayerVideo.GetCurrentPts();
+ m_SpeedState.lastpts = m_dvdPlayerVideo->GetCurrentPts();
m_SpeedState.lasttime = (double) GetTime();
// check how much off clock video is when ff/rw:ing
// a problem here is that seeking isn't very accurate
@@ -1624,13 +1828,13 @@ bool CDVDPlayer::CheckStartCaching(CCurrentStream& current)
if(IsInMenu())
return false;
- if((current.type == STREAM_AUDIO && m_dvdPlayerAudio.IsStalled())
- || (current.type == STREAM_VIDEO && m_dvdPlayerVideo.IsStalled()))
+ if((current.type == STREAM_AUDIO && m_dvdPlayerAudio->IsStalled())
+ || (current.type == STREAM_VIDEO && m_dvdPlayerVideo->IsStalled()))
{
if (CachePVRStream())
{
- if ((current.type == STREAM_AUDIO && current.started && m_dvdPlayerAudio.GetLevel() == 0) ||
- (current.type == STREAM_VIDEO && current.started && m_dvdPlayerVideo.GetLevel() == 0))
+ if ((current.type == STREAM_AUDIO && current.started && m_dvdPlayerAudio->GetLevel() == 0) ||
+ (current.type == STREAM_VIDEO && current.started && m_dvdPlayerVideo->GetLevel() == 0))
{
CLog::Log(LOGDEBUG, "%s stream stalled. start buffering", current.type == STREAM_AUDIO ? "audio" : "video");
SetCaching(CACHESTATE_PVR);
@@ -1639,8 +1843,8 @@ bool CDVDPlayer::CheckStartCaching(CCurrentStream& current)
}
// don't start caching if it's only a single stream that has run dry
- if(m_dvdPlayerAudio.GetLevel() > 50
- || m_dvdPlayerVideo.GetLevel() > 50)
+ if(m_dvdPlayerAudio->GetLevel() > 50
+ || m_dvdPlayerVideo->GetLevel() > 50)
return false;
if(current.inited)
@@ -1879,7 +2083,7 @@ void CDVDPlayer::CheckAutoSceneSkip()
|| m_CurrentVideo.dts == DVD_NOPTS_VALUE)
return;
- const int64_t clock = DVD_TIME_TO_MSEC(min(m_CurrentAudio.dts, m_CurrentVideo.dts) + m_offset_pts);
+ const int64_t clock = m_omxplayer_mode ? GetTime() : DVD_TIME_TO_MSEC(min(m_CurrentAudio.dts, m_CurrentVideo.dts) + m_offset_pts);
CEdl::Cut cut;
if(!m_Edl.InCut(clock, &cut))
@@ -1949,15 +2153,15 @@ void CDVDPlayer::SynchronizePlayers(unsigned int sources)
CDVDMsgGeneralSynchronize* message = new CDVDMsgGeneralSynchronize(timeout, sources);
if (m_CurrentAudio.id >= 0)
- m_dvdPlayerAudio.SendMessage(message->Acquire());
+ m_dvdPlayerAudio->SendMessage(message->Acquire());
if (m_CurrentVideo.id >= 0)
- m_dvdPlayerVideo.SendMessage(message->Acquire());
+ m_dvdPlayerVideo->SendMessage(message->Acquire());
/* TODO - we have to rewrite the sync class, to not require
all other players waiting for subtitle, should only
be the oposite way
if (m_CurrentSubtitle.id >= 0)
- m_dvdPlayerSubtitle.SendMessage(message->Acquire());
+ m_dvdPlayerSubtitle->SendMessage(message->Acquire());
*/
message->Release();
}
@@ -1965,13 +2169,13 @@ void CDVDPlayer::SynchronizePlayers(unsigned int sources)
IDVDStreamPlayer* CDVDPlayer::GetStreamPlayer(unsigned int target)
{
if(target == DVDPLAYER_AUDIO)
- return &m_dvdPlayerAudio;
+ return m_dvdPlayerAudio;
if(target == DVDPLAYER_VIDEO)
- return &m_dvdPlayerVideo;
+ return m_dvdPlayerVideo;
if(target == DVDPLAYER_SUBTITLE)
- return &m_dvdPlayerSubtitle;
+ return m_dvdPlayerSubtitle;
if(target == DVDPLAYER_TELETEXT)
- return &m_dvdPlayerTeletext;
+ return m_dvdPlayerTeletext;
return NULL;
}
@@ -2006,6 +2210,13 @@ void CDVDPlayer::OnExit()
m_messenger.End();
+ if (m_omxplayer_mode)
+ {
+ m_OmxPlayerState.av_clock.OMXStop();
+ m_OmxPlayerState.av_clock.OMXStateIdle();
+ m_OmxPlayerState.av_clock.OMXDeinitialize();
+ }
+
m_bStop = true;
// if we didn't stop playing, advance to the next item in xbmc's playlist
if(m_PlayerOptions.identify == false)
@@ -2228,8 +2439,8 @@ void CDVDPlayer::HandleMessages()
m_playSpeed = speed;
m_caching = CACHESTATE_DONE;
m_clock.SetSpeed(speed);
- m_dvdPlayerAudio.SetSpeed(speed);
- m_dvdPlayerVideo.SetSpeed(speed);
+ m_dvdPlayerAudio->SetSpeed(speed);
+ m_dvdPlayerVideo->SetSpeed(speed);
// We can't pause demuxer until our buffers are full. Doing so will result in continued
// calls to Read() which may then block indefinitely (CDVDInputStreamRTMP for example).
@@ -2239,6 +2450,23 @@ void CDVDPlayer::HandleMessages()
if (!m_DemuxerPausePending)
m_pDemuxer->SetSpeed(speed);
}
+
+ if (m_omxplayer_mode)
+ {
+ int old_speed = m_playSpeed;
+ // when switching from trickplay to normal, we may not have a full set of reference frames
+ // in decoder and we may get corrupt frames out. Seeking to current time will avoid this.
+ if ( (speed != DVD_PLAYSPEED_PAUSE && speed != DVD_PLAYSPEED_NORMAL) ||
+ (old_speed != DVD_PLAYSPEED_PAUSE && old_speed != DVD_PLAYSPEED_NORMAL) )
+ {
+ m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), (speed < 0), true, true, false, true));
+ }
+ else
+ m_OmxPlayerState.av_clock.OMXPause();
+
+ m_OmxPlayerState.av_clock.OMXSetSpeed(speed);
+ CLog::Log(LOGDEBUG, "%s::%s CDVDMsg::PLAYER_SETSPEED speed : %d (%d)", "CDVDPlayer", __FUNCTION__, speed, old_speed);
+ }
}
else if (pMsg->IsType(CDVDMsg::PLAYER_CHANNEL_SELECT_NUMBER) && m_messenger.GetPacketCount(CDVDMsg::PLAYER_CHANNEL_SELECT_NUMBER) == 0)
{
@@ -2327,6 +2555,18 @@ void CDVDPlayer::HandleMessages()
if(player == DVDPLAYER_VIDEO)
m_CurrentVideo.started = true;
CLog::Log(LOGDEBUG, "CDVDPlayer::HandleMessages - player started %d", player);
+
+ if (m_omxplayer_mode)
+ {
+ if ((player == DVDPLAYER_AUDIO || player == DVDPLAYER_VIDEO) &&
+ ((m_playSpeed != DVD_PLAYSPEED_PAUSE && m_playSpeed != DVD_PLAYSPEED_NORMAL) || !m_HasAudio || m_CurrentAudio.started) &&
+ (!m_HasVideo || m_CurrentVideo.started))
+ {
+ CLog::Log(LOGDEBUG, "%s::%s player started RESET", "CDVDPlayer", __FUNCTION__);
+ m_OmxPlayerState.av_clock.OMXReset(m_HasVideo, m_playSpeed != DVD_PLAYSPEED_NORMAL && m_playSpeed != DVD_PLAYSPEED_PAUSE ? false:m_HasAudio);
+ }
+ CLog::Log(LOGDEBUG, "%s::%s player started %d (s:%d a:%d v:%d)", "CDVDPlayer", __FUNCTION__, player, m_playSpeed, m_CurrentAudio.started, m_CurrentVideo.started);
+ }
}
else if (pMsg->IsType(CDVDMsg::PLAYER_DISPLAYTIME))
{
@@ -2335,7 +2575,7 @@ void CDVDPlayer::HandleMessages()
CSingleLock lock(m_StateSection);
/* prioritize data from video player, but only accept data *
* after it has been started to avoid race conditions after seeks */
- if(m_CurrentVideo.started)
+ if(m_CurrentVideo.started && !m_dvdPlayerVideo->SubmittedEOS())
{
if(state.player == DVDPLAYER_VIDEO)
m_State = state;
@@ -2372,10 +2612,14 @@ void CDVDPlayer::SetCaching(ECacheState state)
|| state == CACHESTATE_PVR)
{
m_clock.SetSpeed(DVD_PLAYSPEED_PAUSE);
- m_dvdPlayerAudio.SetSpeed(DVD_PLAYSPEED_PAUSE);
- m_dvdPlayerAudio.SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
- m_dvdPlayerVideo.SetSpeed(DVD_PLAYSPEED_PAUSE);
- m_dvdPlayerVideo.SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
+
+ if (m_omxplayer_mode)
+ m_OmxPlayerState.av_clock.OMXPause();
+
+ m_dvdPlayerAudio->SetSpeed(DVD_PLAYSPEED_PAUSE);
+ m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
+ m_dvdPlayerVideo->SetSpeed(DVD_PLAYSPEED_PAUSE);
+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
if (state == CACHESTATE_PVR)
m_pInputStream->ResetScanTimeout((unsigned int) CSettings::Get().GetInt("pvrplayback.scantime") * 1000);
@@ -2385,8 +2629,8 @@ void CDVDPlayer::SetCaching(ECacheState state)
||(state == CACHESTATE_DONE && m_caching != CACHESTATE_PLAY))
{
m_clock.SetSpeed(m_playSpeed);
- m_dvdPlayerAudio.SetSpeed(m_playSpeed);
- m_dvdPlayerVideo.SetSpeed(m_playSpeed);
+ m_dvdPlayerAudio->SetSpeed(m_playSpeed);
+ m_dvdPlayerVideo->SetSpeed(m_playSpeed);
m_pInputStream->ResetScanTimeout(0);
}
m_caching = state;
@@ -2399,8 +2643,8 @@ void CDVDPlayer::SetPlaySpeed(int speed)
else
m_playSpeed = speed;
- m_dvdPlayerAudio.SetSpeed(speed);
- m_dvdPlayerVideo.SetSpeed(speed);
+ m_dvdPlayerAudio->SetSpeed(speed);
+ m_dvdPlayerVideo->SetSpeed(speed);
SynchronizeDemuxer(100);
}
@@ -2453,7 +2697,7 @@ bool CDVDPlayer::HasAudio() const
bool CDVDPlayer::IsPassthrough() const
{
- return m_dvdPlayerAudio.IsPassthrough();
+ return m_dvdPlayerAudio->IsPassthrough();
}
bool CDVDPlayer::CanSeek()
@@ -2466,7 +2710,7 @@ void CDVDPlayer::Seek(bool bPlus, bool bLargeStep, bool bChapterOverride)
{
if( m_playSpeed == DVD_PLAYSPEED_PAUSE && bPlus && !bLargeStep)
{
- if (m_dvdPlayerVideo.StepFrame())
+ if (m_dvdPlayerVideo->StepFrame())
return;
}
if (!m_State.canseek)
@@ -2601,7 +2845,7 @@ void CDVDPlayer::GetAudioInfo(std::string& strAudioInfo)
{ CSingleLock lock(m_StateSection);
strAudioInfo = StringUtils::Format("D(%s)", m_StateInput.demux_audio.c_str());
}
- strAudioInfo += StringUtils::Format("\nP(%s)", m_dvdPlayerAudio.GetPlayerInfo().c_str());
+ strAudioInfo += StringUtils::Format("\nP(%s)", m_dvdPlayerAudio->GetPlayerInfo().c_str());
}
void CDVDPlayer::GetVideoInfo(std::string& strVideoInfo)
@@ -2609,44 +2853,83 @@ void CDVDPlayer::GetVideoInfo(std::string& strVideoInfo)
{ CSingleLock lock(m_StateSection);
strVideoInfo = StringUtils::Format("D(%s)", m_StateInput.demux_video.c_str());
}
- strVideoInfo += StringUtils::Format("\nP(%s)", m_dvdPlayerVideo.GetPlayerInfo().c_str());
+ strVideoInfo += StringUtils::Format("\nP(%s)", m_dvdPlayerVideo->GetPlayerInfo().c_str());
}
void CDVDPlayer::GetGeneralInfo(std::string& strGeneralInfo)
{
if (!m_bStop)
{
- double dDelay = m_dvdPlayerVideo.GetDelay() / DVD_TIME_BASE - g_renderManager.GetDisplayLatency();
+ if (m_omxplayer_mode)
+ {
+ double dDelay = m_dvdPlayerAudio->GetDelay();
- double apts = m_dvdPlayerAudio.GetCurrentPts();
- double vpts = m_dvdPlayerVideo.GetCurrentPts();
- double dDiff = 0;
+ double apts = m_dvdPlayerAudio->GetCurrentPts();
+ double vpts = m_dvdPlayerVideo->GetCurrentPts();
+ double dDiff = 0;
- if( apts != DVD_NOPTS_VALUE && vpts != DVD_NOPTS_VALUE )
- dDiff = (apts - vpts) / DVD_TIME_BASE;
+ if( apts != DVD_NOPTS_VALUE && vpts != DVD_NOPTS_VALUE )
+ dDiff = (apts - vpts) / DVD_TIME_BASE;
- std::string strEDL = StringUtils::Format(", edl:%s", m_Edl.GetInfo().c_str());
+ CStdString strEDL;
+ strEDL += StringUtils::Format(", edl:%s", m_Edl.GetInfo().c_str());
- std::string strBuf;
- CSingleLock lock(m_StateSection);
- if(m_StateInput.cache_bytes >= 0)
- {
- strBuf += StringUtils::Format(" cache:%s %2.0f%%"
- , StringUtils::SizeToString(m_State.cache_bytes).c_str()
- , m_State.cache_level * 100);
- if(m_playSpeed == 0 || m_caching == CACHESTATE_FULL)
- strBuf += StringUtils::Format(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay));
+ CStdString strBuf;
+ CSingleLock lock(m_StateSection);
+ if(m_StateInput.cache_bytes >= 0)
+ {
+ strBuf += StringUtils::Format(" cache:%s %2.0f%%"
+ , StringUtils::SizeToString(m_State.cache_bytes).c_str()
+ , m_State.cache_level * 100);
+ if(m_playSpeed == 0 || m_caching == CACHESTATE_FULL)
+ strBuf += StringUtils::Format(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay));
+ }
+
+ strGeneralInfo = StringUtils::Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s af:%d%% vf:%d%% amp:% 5.2f )"
+ , dDelay
+ , dDiff
+ , strEDL.c_str()
+ , (int)(CThread::GetRelativeUsage()*100)
+ , (int)(m_dvdPlayerAudio->GetRelativeUsage()*100)
+ , (int)(m_dvdPlayerVideo->GetRelativeUsage()*100)
+ , strBuf.c_str()
+ , m_OmxPlayerState.audio_fifo
+ , m_OmxPlayerState.video_fifo
+ , m_dvdPlayerAudio->GetDynamicRangeAmplification());
}
+ else
+ {
+ double dDelay = m_dvdPlayerVideo->GetDelay() / DVD_TIME_BASE - g_renderManager.GetDisplayLatency();
- strGeneralInfo = StringUtils::Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s )"
- , dDelay
- , dDiff
- , strEDL.c_str()
- , (int)(CThread::GetRelativeUsage()*100)
- , (int)(m_dvdPlayerAudio.GetRelativeUsage()*100)
- , (int)(m_dvdPlayerVideo.GetRelativeUsage()*100)
- , strBuf.c_str());
+ double apts = m_dvdPlayerAudio->GetCurrentPts();
+ double vpts = m_dvdPlayerVideo->GetCurrentPts();
+ double dDiff = 0;
+ if( apts != DVD_NOPTS_VALUE && vpts != DVD_NOPTS_VALUE )
+ dDiff = (apts - vpts) / DVD_TIME_BASE;
+
+ std::string strEDL = StringUtils::Format(", edl:%s", m_Edl.GetInfo().c_str());
+
+ std::string strBuf;
+ CSingleLock lock(m_StateSection);
+ if(m_StateInput.cache_bytes >= 0)
+ {
+ strBuf += StringUtils::Format(" cache:%s %2.0f%%"
+ , StringUtils::SizeToString(m_State.cache_bytes).c_str()
+ , m_State.cache_level * 100);
+ if(m_playSpeed == 0 || m_caching == CACHESTATE_FULL)
+ strBuf += StringUtils::Format(" %d sec", DVD_TIME_TO_SEC(m_State.cache_delay));
+ }
+
+ strGeneralInfo = StringUtils::Format("C( ad:% 6.3f, a/v:% 6.3f%s, dcpu:%2i%% acpu:%2i%% vcpu:%2i%%%s )"
+ , dDelay
+ , dDiff
+ , strEDL.c_str()
+ , (int)(CThread::GetRelativeUsage()*100)
+ , (int)(m_dvdPlayerAudio->GetRelativeUsage()*100)
+ , (int)(m_dvdPlayerVideo->GetRelativeUsage()*100)
+ , strBuf.c_str());
+ }
}
}
@@ -2678,22 +2961,22 @@ float CDVDPlayer::GetCachePercentage()
void CDVDPlayer::SetAVDelay(float fValue)
{
- m_dvdPlayerVideo.SetDelay( (fValue * DVD_TIME_BASE) ) ;
+ m_dvdPlayerVideo->SetDelay( (fValue * DVD_TIME_BASE) ) ;
}
float CDVDPlayer::GetAVDelay()
{
- return (float) m_dvdPlayerVideo.GetDelay() / (float)DVD_TIME_BASE;
+ return (float) m_dvdPlayerVideo->GetDelay() / (float)DVD_TIME_BASE;
}
void CDVDPlayer::SetSubTitleDelay(float fValue)
{
- m_dvdPlayerVideo.SetSubtitleDelay(-fValue * DVD_TIME_BASE);
+ m_dvdPlayerVideo->SetSubtitleDelay(-fValue * DVD_TIME_BASE);
}
float CDVDPlayer::GetSubTitleDelay()
{
- return (float) -m_dvdPlayerVideo.GetSubtitleDelay() / DVD_TIME_BASE;
+ return (float) -m_dvdPlayerVideo->GetSubtitleDelay() / DVD_TIME_BASE;
}
// priority: 1: libdvdnav, 2: external subtitles, 3: muxed subtitles
@@ -2735,7 +3018,7 @@ bool CDVDPlayer::GetSubtitleVisible()
return pStream->IsSubtitleStreamEnabled();
}
- return m_dvdPlayerVideo.IsSubtitleEnabled();
+ return m_dvdPlayerVideo->IsSubtitleEnabled();
}
void CDVDPlayer::SetSubtitleVisible(bool bVisible)
@@ -2745,7 +3028,7 @@ void CDVDPlayer::SetSubtitleVisible(bool bVisible)
void CDVDPlayer::SetSubtitleVisibleInternal(bool bVisible)
{
- m_dvdPlayerVideo.EnableSubtitle(bVisible);
+ m_dvdPlayerVideo->EnableSubtitle(bVisible);
if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD))
static_cast<CDVDInputStreamNavigator*>(m_pInputStream)->EnableSubtitleStream(bVisible);
@@ -2772,7 +3055,7 @@ TextCacheStruct_t* CDVDPlayer::GetTeletextCache()
if (m_CurrentTeletext.id < 0)
return 0;
- return m_dvdPlayerTeletext.GetTeletextCache();
+ return m_dvdPlayerTeletext->GetTeletextCache();
}
void CDVDPlayer::LoadPage(int p, int sp, unsigned char* buffer)
@@ -2780,7 +3063,7 @@ void CDVDPlayer::LoadPage(int p, int sp, unsigned char* buffer)
if (m_CurrentTeletext.id < 0)
return;
- return m_dvdPlayerTeletext.LoadPage(p, sp, buffer);
+ return m_dvdPlayerTeletext->LoadPage(p, sp, buffer);
}
void CDVDPlayer::SeekTime(int64_t iTime)
@@ -2851,7 +3134,7 @@ bool CDVDPlayer::OpenStream(CCurrentStream& current, int iStream, int source, bo
m_pSubtitleDemuxer = demux.release();
}
- double pts = m_dvdPlayerVideo.GetCurrentPts();
+ double pts = m_dvdPlayerVideo->GetCurrentPts();
if(pts == DVD_NOPTS_VALUE)
pts = m_CurrentVideo.dts;
if(pts == DVD_NOPTS_VALUE)
@@ -2964,10 +3247,10 @@ bool CDVDPlayer::OpenAudioStream(CDVDStreamInfo& hint, bool reset)
m_HasAudio = true;
/* we are potentially going to be waiting on this */
- m_dvdPlayerAudio.SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
+ m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
/* audio normally won't consume full cpu, so let it have prio */
- m_dvdPlayerAudio.SetPriority(GetPriority()+1);
+ m_dvdPlayerAudio->SetPriority(GetPriority()+1);
return true;
}
@@ -3001,7 +3284,7 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset)
m_HasVideo = true;
/* we are potentially going to be waiting on this */
- m_dvdPlayerVideo.SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
#if defined(TARGET_DARWIN)
// Apple thread scheduler works a little different than Linux. It
@@ -3011,11 +3294,11 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset)
// the CoreAudio audio device handler thread. We do the same for
// the DVDPlayerVideo thread so it can run to sleep without getting
// swapped out by a busy OS.
- m_dvdPlayerVideo.SetPriority(GetSchedRRPriority());
+ m_dvdPlayerVideo->SetPriority(GetSchedRRPriority());
#else
/* use same priority for video thread as demuxing thread, as */
/* otherwise demuxer will starve if video consumes the full cpu */
- m_dvdPlayerVideo.SetPriority(GetPriority());
+ m_dvdPlayerVideo->SetPriority(GetPriority());
#endif
return true;
@@ -3060,7 +3343,7 @@ bool CDVDPlayer::AdaptForcedSubtitles()
bool CDVDPlayer::OpenTeletextStream(CDVDStreamInfo& hint)
{
- if (!m_dvdPlayerTeletext.CheckStream(hint))
+ if (!m_dvdPlayerTeletext->CheckStream(hint))
return false;
if(!OpenStreamPlayer(m_CurrentTeletext, hint, true))
@@ -3144,19 +3427,19 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
if(queued)
{
- m_dvdPlayerAudio.SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
- m_dvdPlayerVideo.SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
- m_dvdPlayerVideo.SendMessage(new CDVDMsg(CDVDMsg::VIDEO_NOSKIP));
- m_dvdPlayerSubtitle.SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
- m_dvdPlayerTeletext.SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
+ m_dvdPlayerAudio->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::VIDEO_NOSKIP));
+ m_dvdPlayerSubtitle->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
+ m_dvdPlayerTeletext->SendMessage(new CDVDMsg(CDVDMsg::GENERAL_RESET));
SynchronizePlayers(SYNCSOURCE_ALL);
}
else
{
- m_dvdPlayerAudio.Flush();
- m_dvdPlayerVideo.Flush();
- m_dvdPlayerSubtitle.Flush();
- m_dvdPlayerTeletext.Flush();
+ m_dvdPlayerAudio->Flush();
+ m_dvdPlayerVideo->Flush();
+ m_dvdPlayerSubtitle->Flush();
+ m_dvdPlayerTeletext->Flush();
// clear subtitle and menu overlays
m_overlayContainer.Clear();
@@ -3166,8 +3449,8 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
{
// make sure players are properly flushed, should put them in stalled state
CDVDMsgGeneralSynchronize* msg = new CDVDMsgGeneralSynchronize(1000, 0);
- m_dvdPlayerAudio.SendMessage(msg->Acquire(), 1);
- m_dvdPlayerVideo.SendMessage(msg->Acquire(), 1);
+ m_dvdPlayerAudio->SendMessage(msg->Acquire(), 1);
+ m_dvdPlayerVideo->SendMessage(msg->Acquire(), 1);
msg->Wait(&m_bStop, 0);
msg->Release();
@@ -3191,6 +3474,15 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
CSingleLock lock(m_StateSection);
m_State = m_StateInput;
}
+
+ if (m_omxplayer_mode)
+ {
+ m_OmxPlayerState.av_clock.OMXFlush();
+ if (!queued)
+ m_OmxPlayerState.av_clock.OMXStop();
+ m_OmxPlayerState.av_clock.OMXPause();
+ m_OmxPlayerState.av_clock.OMXMediaTime(0.0);
+ }
}
// since we call ffmpeg functions to decode, this is being called in the same thread as ::Process() is
@@ -3207,7 +3499,7 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
else if(iMessage == 3)
m_dvd.iSelectedSPUStream = *(int*)pData;
else if(iMessage == 4)
- m_dvdPlayerVideo.EnableSubtitle(*(int*)pData ? true: false);
+ m_dvdPlayerVideo->EnableSubtitle(*(int*)pData ? true: false);
else if(iMessage == 5)
{
if (m_dvd.state != DVDSTATE_STILL)
@@ -3221,7 +3513,7 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
unsigned int time = 0;
if( m_CurrentVideo.stream && m_dvd.iDVDStillTime > 0 )
{
- time = (unsigned int)(m_dvdPlayerVideo.GetOutputDelay() / ( DVD_TIME_BASE / 1000 ));
+ time = (unsigned int)(m_dvdPlayerVideo->GetOutputDelay() / ( DVD_TIME_BASE / 1000 ));
if( time < 10000 && time > 0 )
m_dvd.iDVDStillTime += time;
}
@@ -3270,7 +3562,7 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
unsigned int time = 0;
if( m_CurrentVideo.stream && m_dvd.iDVDStillTime > 0 )
{
- time = (unsigned int)(m_dvdPlayerVideo.GetOutputDelay() / ( DVD_TIME_BASE / 1000 ));
+ time = (unsigned int)(m_dvdPlayerVideo->GetOutputDelay() / ( DVD_TIME_BASE / 1000 ));
if( time < 10000 && time > 0 )
m_dvd.iDVDStillTime += time;
}
@@ -3284,7 +3576,7 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
break;
case DVDNAV_SPU_CLUT_CHANGE:
{
- m_dvdPlayerSubtitle.SendMessage(new CDVDMsgSubtitleClutChange((uint8_t*)pData));
+ m_dvdPlayerSubtitle->SendMessage(new CDVDMsgSubtitleClutChange((uint8_t*)pData));
}
break;
case DVDNAV_SPU_STREAM_CHANGE:
@@ -3324,7 +3616,7 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
//dvdnav_highlight_event_t* pInfo = (dvdnav_highlight_event_t*)pData;
int iButton = pStream->GetCurrentButton();
CLog::Log(LOGDEBUG, "DVDNAV_HIGHLIGHT: Highlight button %d\n", iButton);
- m_dvdPlayerSubtitle.UpdateOverlayInfo((CDVDInputStreamNavigator*)m_pInputStream, LIBDVDNAV_BUTTON_NORMAL);
+ m_dvdPlayerSubtitle->UpdateOverlayInfo((CDVDInputStreamNavigator*)m_pInputStream, LIBDVDNAV_BUTTON_NORMAL);
}
break;
case DVDNAV_VTS_CHANGE:
@@ -3337,8 +3629,8 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
//Force an aspect ratio that is set in the dvdheaders if available
m_CurrentVideo.hint.aspect = pStream->GetVideoAspectRatio();
- if( m_dvdPlayerVideo.IsInited() )
- m_dvdPlayerVideo.SendMessage(new CDVDMsgDouble(CDVDMsg::VIDEO_SET_ASPECT, m_CurrentVideo.hint.aspect));
+ if( m_dvdPlayerVideo->IsInited() )
+ m_dvdPlayerVideo->SendMessage(new CDVDMsgDouble(CDVDMsg::VIDEO_SET_ASPECT, m_CurrentVideo.hint.aspect));
m_SelectionStreams.Clear(STREAM_NONE, STREAM_SOURCE_NAV);
m_SelectionStreams.Update(m_pInputStream, m_pDemuxer);
@@ -3353,8 +3645,8 @@ int CDVDPlayer::OnDVDNavResult(void* pData, int iMessage)
m_dvd.state = DVDSTATE_NORMAL;
- if( m_dvdPlayerVideo.IsInited() )
- m_dvdPlayerVideo.SendMessage(new CDVDMsg(CDVDMsg::VIDEO_NOSKIP));
+ if( m_dvdPlayerVideo->IsInited() )
+ m_dvdPlayerVideo->SendMessage(new CDVDMsg(CDVDMsg::VIDEO_NOSKIP));
}
break;
case DVDNAV_NAV_PACKET:
@@ -3543,7 +3835,7 @@ bool CDVDPlayer::OnAction(const CAction &action)
case ACTION_MOUSE_LEFT_CLICK:
{
CRect rs, rd;
- m_dvdPlayerVideo.GetVideoRect(rs, rd);
+ m_dvdPlayerVideo->GetVideoRect(rs, rd);
CPoint pt(action.GetAmount(), action.GetAmount(1));
if (!rd.PtInRect(pt))
return false; // out of bounds
@@ -3572,7 +3864,7 @@ bool CDVDPlayer::OnAction(const CAction &action)
CLog::Log(LOGDEBUG, " - button select");
// show button pushed overlay
if(m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD))
- m_dvdPlayerSubtitle.UpdateOverlayInfo((CDVDInputStreamNavigator*)m_pInputStream, LIBDVDNAV_BUTTON_CLICKED);
+ m_dvdPlayerSubtitle->UpdateOverlayInfo((CDVDInputStreamNavigator*)m_pInputStream, LIBDVDNAV_BUTTON_CLICKED);
pMenus->ActivateButton();
}
@@ -3746,14 +4038,14 @@ int CDVDPlayer::GetCacheLevel() const
double CDVDPlayer::GetQueueTime()
{
- int a = m_dvdPlayerAudio.GetLevel();
- int v = m_dvdPlayerVideo.GetLevel();
+ int a = m_dvdPlayerAudio->GetLevel();
+ int v = m_dvdPlayerVideo->GetLevel();
return max(a, v) * 8000.0 / 100;
}
void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
{
- info.bitrate = m_dvdPlayerVideo.GetVideoBitrate();
+ info.bitrate = m_dvdPlayerVideo->GetVideoBitrate();
std::string retVal;
if (m_pDemuxer && (m_CurrentVideo.id != -1))
@@ -3767,9 +4059,9 @@ void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
}
}
info.videoCodecName = retVal;
- info.videoAspectRatio = m_dvdPlayerVideo.GetAspectRatio();
- m_dvdPlayerVideo.GetVideoRect(info.SrcRect, info.DestRect);
- info.stereoMode = m_dvdPlayerVideo.GetStereoMode();
+ info.videoAspectRatio = m_dvdPlayerVideo->GetAspectRatio();
+ m_dvdPlayerVideo->GetVideoRect(info.SrcRect, info.DestRect);
+ info.stereoMode = m_dvdPlayerVideo->GetStereoMode();
if (info.stereoMode == "mono")
info.stereoMode = "";
}
@@ -3789,8 +4081,8 @@ void CDVDPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
if (index == GetAudioStream())
{
- info.bitrate = m_dvdPlayerAudio.GetAudioBitrate();
- info.channels = m_dvdPlayerAudio.GetAudioChannels();
+ info.bitrate = m_dvdPlayerAudio->GetAudioBitrate();
+ info.channels = m_dvdPlayerAudio->GetAudioChannels();
}
else if (m_pDemuxer)
{
@@ -4083,7 +4375,7 @@ bool CDVDPlayer::GetStreamDetails(CStreamDetails &details)
* and UpdatePlayState() has been called at least once. In this case dvdplayer duration/AR will
* return 0 and we'll have to fallback to the (less accurate) info from the demuxer.
*/
- float aspect = m_dvdPlayerVideo.GetAspectRatio();
+ float aspect = m_dvdPlayerVideo->GetAspectRatio();
if (aspect > 0.0f)
((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect = aspect;
@@ -4100,7 +4392,7 @@ bool CDVDPlayer::GetStreamDetails(CStreamDetails &details)
std::string CDVDPlayer::GetPlayingTitle()
{
/* Currently we support only Title Name from Teletext line 30 */
- TextCacheStruct_t* ttcache = m_dvdPlayerTeletext.GetTeletextCache();
+ TextCacheStruct_t* ttcache = m_dvdPlayerTeletext->GetTeletextCache();
if (ttcache && !ttcache->line30.empty())
return ttcache->line30;
@@ -4131,3 +4423,32 @@ bool CDVDPlayer::CachePVRStream(void) const
!g_PVRManager.IsPlayingRecording() &&
g_advancedSettings.m_bPVRCacheInDvdPlayer;
}
+
+void CDVDPlayer::OMXGetRenderFeatures(std::vector<int> &renderFeatures)
+{
+ if (m_omxplayer_mode)
+ {
+ renderFeatures.push_back(RENDERFEATURE_STRETCH);
+ renderFeatures.push_back(RENDERFEATURE_CROP);
+ renderFeatures.push_back(RENDERFEATURE_PIXEL_RATIO);
+ renderFeatures.push_back(RENDERFEATURE_ZOOM);
+ }
+}
+
+void CDVDPlayer::OMXGetDeinterlaceMethods(std::vector<int> &deinterlaceMethods)
+{
+ if (m_omxplayer_mode)
+ {
+ deinterlaceMethods.push_back(VS_INTERLACEMETHOD_DEINTERLACE);
+ }
+}
+
+void CDVDPlayer::OMXGetDeinterlaceModes(std::vector<int> &deinterlaceModes)
+{
+ if (m_omxplayer_mode)
+ {
+ deinterlaceModes.push_back(VS_DEINTERLACEMODE_AUTO);
+ deinterlaceModes.push_back(VS_DEINTERLACEMODE_OFF);
+ deinterlaceModes.push_back(VS_DEINTERLACEMODE_FORCE);
+ }
+}
View
79 xbmc/cores/dvdplayer/DVDPlayer.h
@@ -42,6 +42,34 @@
#include "utils/StreamDetails.h"
#include "threads/SystemClock.h"
+#ifdef HAS_OMXPLAYER
+#include "OMXCore.h"
+#include "OMXClock.h"
+#include "linux/RBP.h"
+#else
+
+// dummy class to avoid ifdefs where calls are made
+class OMXClock
+{
+public:
+ bool OMXInitialize(CDVDClock *clock) { return false; }
+ void OMXDeinitialize() {}
+ bool OMXIsPaused() { return false; }
+ bool OMXStop(bool lock = true) { return false; }
+ bool OMXStep(int steps = 1, bool lock = true) { return false; }
+ bool OMXReset(bool has_video, bool has_audio, bool lock = true) { return false; }
+ double OMXMediaTime(bool lock = true) { return 0.0; }
+ double OMXClockAdjustment(bool lock = true) { return 0.0; }
+ bool OMXMediaTime(double pts, bool lock = true) { return false; }
+ bool OMXPause(bool lock = true) { return false; }
+ bool OMXResume(bool lock = true) { return false; }
+ bool OMXSetSpeed(int speed, bool lock = true, bool pause_resume = false) { return false; }
+ bool OMXFlush(bool lock = true) { return false; }
+ bool OMXStateExecute(bool lock = true) { return false; }
+ void OMXStateIdle(bool lock = true) {}
+ bool HDMIClockSync(bool lock = true) { return false; }
+};
+#endif
class CDVDInputStream;
@@ -189,11 +217,9 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
virtual float GetPercentage();
virtual float GetCachePercentage();
- virtual void RegisterAudioCallback(IAudioCallback* pCallback) { m_dvdPlayerAudio.RegisterAudioCallback(pCallback); }
- virtual void UnRegisterAudioCallback() { m_dvdPlayerAudio.UnRegisterAudioCallback(); }
- virtual void SetVolume(float nVolume) { m_dvdPlayerAudio.SetVolume(nVolume); }
- virtual void SetMute(bool bOnOff) { m_dvdPlayerAudio.SetMute(bOnOff); }
- virtual void SetDynamicRangeCompression(long drc) { m_dvdPlayerAudio.SetDynamicRangeCompression(drc); }
+ virtual void SetVolume(float nVolume) { m_dvdPlayerAudio->SetVolume(nVolume); }
+ virtual void SetMute(bool bOnOff) { m_dvdPlayerAudio->SetMute(bOnOff); }
+ virtual void SetDynamicRangeCompression(long drc) { m_dvdPlayerAudio->SetDynamicRangeCompression(drc); }
virtual void GetAudioInfo(std::string& strAudioInfo);
virtual void GetVideoInfo(std::string& strVideoInfo);
virtual void GetGeneralInfo(std::string& strVideoInfo);
@@ -259,6 +285,15 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
virtual int GetCacheLevel() const ;
virtual int OnDVDNavResult(void* pData, int iMessage);
+
+ // Note: the following "OMX" methods are deprecated and will be removed in the future
+ // They should be handled by the video renderer, not the player
+ virtual void OMXGetRenderFeatures(std::vector<int> &renderFeatures);
+ virtual void OMXGetDeinterlaceMethods(std::vector<int> &deinterlaceMethods);
+ virtual void OMXGetDeinterlaceModes(std::vector<int> &deinterlaceModes);
+
+ virtual bool ControlsVolume() {return m_omxplayer_mode;}
+
protected:
friend class CSelectionStreams;
@@ -266,6 +301,11 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
virtual void OnExit();
virtual void Process();
+ void CreatePlayers();
+ void DestroyPlayers();
+ void OMXDoProcessing();
+ bool OMXStillPlaying();
+
bool OpenStream(CCurrentStream& current, int iStream, int source, bool reset = true);
bool OpenStreamPlayer(CCurrentStream& current, CDVDStreamInfo& hint, bool reset);
bool OpenAudioStream(CDVDStreamInfo& hint, bool reset = true);
@@ -339,6 +379,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
void UpdateClockMaster();
double m_UpdateApplication;
+ bool m_players_created;
bool m_bAbortRequest;
std::string m_filename; // holds the actual filename
@@ -367,10 +408,10 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
CDVDMessageQueue m_messenger; // thread messenger
- CDVDPlayerVideo m_dvdPlayerVideo; // video part
- CDVDPlayerAudio m_dvdPlayerAudio; // audio part
- CDVDPlayerSubtitle m_dvdPlayerSubtitle; // subtitle part
- CDVDTeletextData m_dvdPlayerTeletext; // teletext part
+ IDVDStreamPlayerVideo *m_dvdPlayerVideo; // video part
+ IDVDStreamPlayerAudio *m_dvdPlayerAudio; // audio part
+ CDVDPlayerSubtitle *m_dvdPlayerSubtitle; // subtitle part
+ CDVDTeletextData *m_dvdPlayerTeletext; // teletext part
CDVDClock m_clock; // master clock
CDVDOverlayContainer m_overlayContainer;
@@ -406,6 +447,10 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
friend class CDVDPlayerVideo;
friend class CDVDPlayerAudio;
+#ifdef HAS_OMXPLAYER
+ friend class OMXPlayerVideo;
+ friend class OMXPlayerAudio;
+#endif
struct SPlayerState
{
@@ -496,4 +541,20 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
bool m_HasAudio;
bool m_DemuxerPausePending;
+
+ // omxplayer variables
+ struct SOmxPlayerState
+ {
+ OMXClock av_clock; // openmax clock component
+ EDEINTERLACEMODE current_deinterlace; // whether deinterlace is currently enabled
+ bool bOmxWaitVideo; // whether we need to wait for video to play out on EOS
+ bool bOmxWaitAudio; // whether we need to wait for audio to play out on EOS
+ bool bOmxSentEOFs; // flag if we've send EOFs to audio/video players
+ float threshold; // current fifo threshold required to come out of buffering
+ int video_fifo; // video fifo to gpu level
+ int audio_fifo; // audio fifo to gpu level
+ double last_check_time; // we periodically check for gpu underrun
+ double stamp; // last media timestamp
+ } m_OmxPlayerState;
+ bool m_omxplayer_mode; // using omxplayer acceleration
};
View
8 xbmc/cores/dvdplayer/DVDPlayerAudio.h
@@ -36,7 +36,6 @@
class CDVDPlayer;
class CDVDAudioCodec;
-class IAudioCallback;
class CDVDAudioCodec;
#define DECODE_FLAG_DROP 1
@@ -102,7 +101,7 @@ class CDVDErrorAverage
XbmcThreads::EndTime m_timer;
};
-class CDVDPlayerAudio : public CThread, public IDVDStreamPlayer
+class CDVDPlayerAudio : public CThread, public IDVDStreamPlayerAudio
{
public:
CDVDPlayerAudio(CDVDClock* pClock, CDVDMessageQueue& parent);
@@ -111,9 +110,6 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayer
bool OpenStream(CDVDStreamInfo &hints);
void CloseStream(bool bWaitForBuffers);
- void RegisterAudioCallback(IAudioCallback* pCallback) { m_dvdAudio.RegisterAudioCallback(pCallback); }
- void UnRegisterAudioCallback() { m_dvdAudio.UnRegisterAudioCallback(); }
-
void SetSpeed(int speed);
void Flush();
@@ -146,6 +142,8 @@ class CDVDPlayerAudio : public CThread, public IDVDStreamPlayer
bool IsStalled() const { return m_stalled; }
bool IsEOS() { return false; }
bool IsPassthrough() const;
+ double GetDelay() { return 0.0; }
+ double GetCacheTotal() { return 0.0; }
protected:
virtual void OnStartup();
View
4 xbmc/cores/dvdplayer/DVDPlayerVideo.h
@@ -37,7 +37,7 @@ class CDVDOverlayCodecCC;
#define VIDEO_PICTURE_QUEUE_SIZE 1
-class CDVDPlayerVideo : public CThread, public IDVDStreamPlayer
+class CDVDPlayerVideo : public CThread, public IDVDStreamPlayerVideo
{
public:
CDVDPlayerVideo( CDVDClock* pClock
@@ -78,10 +78,12 @@ class CDVDPlayerVideo : public CThread, public IDVDStreamPlayer
bool IsStalled() const { return m_stalled; }
bool IsEOS() { return false; }
+ bool SubmittedEOS() const { return false; }
double GetCurrentPts() { return m_iCurrentPts; }
double GetOutputDelay(); /* returns the expected delay, from that a packet is put in queue */
+ int GetDecoderFreeSpace() { return 0; }
std::string GetPlayerInfo();
int GetVideoBitrate();
std::string GetStereoMode();
View
80 xbmc/cores/dvdplayer/IDVDPlayer.h
@@ -23,6 +23,9 @@
#include "DVDStreamInfo.h"
#include "DVDMessageQueue.h"
+template <typename T> class CRectGen;
+typedef CRectGen<float> CRect;
+
class DVDNavResult;
class IDVDPlayer
@@ -35,10 +38,85 @@ class IDVDPlayer
class IDVDStreamPlayer
{
public:
+ virtual ~IDVDStreamPlayer() {}
virtual bool OpenStream(CDVDStreamInfo &hint) = 0;
virtual void CloseStream(bool bWaitForBuffers) = 0;
- virtual void SendMessage(CDVDMsg* pMsg, int priority) = 0;
+ virtual void SendMessage(CDVDMsg* pMsg, int priority = 0) = 0;
virtual bool IsInited() const = 0;
virtual bool AcceptsData() const = 0;
virtual bool IsStalled() const = 0;
};
+
+class CDVDVideoCodec;
+
+class IDVDStreamPlayerVideo : public IDVDStreamPlayer
+{
+public:
+ ~IDVDStreamPlayerVideo() {}
+ float GetRelativeUsage() { return 0.0f; }
+ bool SetPriority(const int iPriority) { return true; }
+ virtual bool OpenStream(CDVDStreamInfo &hint) = 0;
+ virtual void CloseStream(bool bWaitForBuffers) = 0;
+ virtual bool StepFrame() = 0;
+ virtual void Flush() = 0;
+ virtual void WaitForBuffers() = 0;
+ virtual bool AcceptsData() const = 0;
+ virtual bool HasData() const = 0;
+ virtual int GetLevel() const = 0;
+ virtual bool IsInited() const = 0;
+ virtual void SendMessage(CDVDMsg* pMsg, int priority = 0) = 0;
+ virtual void EnableSubtitle(bool bEnable) = 0;
+ virtual bool IsSubtitleEnabled() = 0;
+ virtual void EnableFullscreen(bool bEnable) = 0;
+#ifdef HAS_VIDEO_PLAYBACK
+ virtual void GetVideoRect(CRect& SrcRect, CRect& DestRect) const = 0;
+ virtual float GetAspectRatio() = 0;
+#endif
+ virtual double GetDelay() = 0;
+ virtual void SetDelay(double delay) = 0;
+ virtual double GetSubtitleDelay() = 0;
+ virtual void SetSubtitleDelay(double delay) = 0;
+ virtual bool IsStalled() const = 0;
+ virtual double GetCurrentPts() = 0;
+ virtual double GetOutputDelay() = 0;
+ virtual std::string GetPlayerInfo() = 0;
+ virtual int GetVideoBitrate() = 0;
+ virtual std::string GetStereoMode() = 0;
+ virtual void SetSpeed(int iSpeed) = 0;
+ virtual int GetDecoderBufferSize() { return 0; }
+ virtual int GetDecoderFreeSpace() = 0;
+ virtual bool IsEOS() = 0;
+ virtual bool SubmittedEOS() const = 0;
+};
+
+class CDVDAudioCodec;
+class IDVDStreamPlayerAudio : public IDVDStreamPlayer
+{
+public:
+ ~IDVDStreamPlayerAudio() {}
+ float GetRelativeUsage() { return 0.0f; }
+ bool SetPriority(const int iPriority) { return true; }
+ virtual bool OpenStream(CDVDStreamInfo &hints) = 0;
+ virtual void CloseStream(bool bWaitForBuffers) = 0;
+ virtual void SetSpeed(int speed) = 0;
+ virtual void Flush() = 0;
+ virtual void WaitForBuffers() = 0;
+ virtual bool AcceptsData() const = 0;
+ virtual bool HasData() const = 0;
+ virtual int GetLevel() const = 0;
+ virtual bool IsInited() const = 0;
+ virtual void SendMessage(CDVDMsg* pMsg, int priority = 0) = 0;
+ virtual void SetVolume(float fVolume) = 0;
+ virtual void SetMute(bool bOnOff) = 0;
+ 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;
+ virtual bool IsPassthrough() const = 0;
+ virtual double GetDelay() = 0;
+ virtual double GetCacheTotal() = 0;
+ virtual float GetDynamicRangeAmplification() const = 0;
+ virtual bool IsEOS() = 0;
+};
View
3  xbmc/cores/omxplayer/Makefile.in
@@ -1,7 +1,6 @@
CXXFLAGS += -D__STDC_FORMAT_MACROS
-SRCS = OMXPlayer.cpp
-SRCS += OMXAudio.cpp
+SRCS = OMXAudio.cpp
SRCS += OMXVideo.cpp
SRCS += OMXAudioCodecOMX.cpp
SRCS += OMXPlayerAudio.cpp
View
20 xbmc/cores/omxplayer/OMXAudio.cpp
@@ -65,7 +65,6 @@ static const uint16_t DTSFSCod [] = {0, 8000, 16000, 32000, 0, 0, 11025, 22050
//////////////////////////////////////////////////////////////////////
//***********************************************************************************************
COMXAudio::COMXAudio() :
- m_pCallback (NULL ),
m_Initialized (false ),
m_CurrentVolume (0 ),
m_Mute (false ),
@@ -1393,25 +1392,6 @@ int COMXAudio::SetPlaySpeed(int iSpeed)
return 0;
}
-void COMXAudio::RegisterAudioCallback(IAudioCallback *pCallback)
-{
- CSingleLock lock (m_critSection);
- if(!m_Passthrough && !m_HWDecode)
- {
- m_pCallback = pCallback;
- if (m_pCallback)
- m_pCallback->OnInitialize(2, m_SampleRate, 32);
- }
- else
- m_pCallback = NULL;
-}
-
-void COMXAudio::UnRegisterAudioCallback()
-{
- CSingleLock lock (m_critSection);
- m_pCallback = NULL;
-}
-
unsigned int COMXAudio::GetAudioRenderingLatency() const
{
CSingleLock lock (m_critSection);
View
4 xbmc/cores/omxplayer/OMXAudio.h
@@ -29,7 +29,6 @@
#include "cores/AudioEngine/Utils/AEAudioFormat.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
-#include "cores/IAudioCallback.h"
#include "linux/PlatformDefs.h"
#include "DVDStreamInfo.h"
@@ -55,8 +54,6 @@ extern "C" {
class COMXAudio
{
public:
- void UnRegisterAudioCallback();
- void RegisterAudioCallback(IAudioCallback* pCallback);
unsigned int GetChunkLen();
float GetDelay();
float GetCacheTime();
@@ -101,7 +98,6 @@ class COMXAudio
float GetMaxLevel(double &pts);
private:
- IAudioCallback* m_pCallback;
bool m_Initialized;
float m_CurrentVolume;
bool m_Mute;
View
4,432 xbmc/cores/omxplayer/OMXPlayer.cpp
0 additions, 4,432 deletions not shown
View
508 xbmc/cores/omxplayer/OMXPlayer.h
@@ -1,508 +0,0 @@
-#pragma once
-/*
- * Copyright (C) 2011-2013 Team XBMC
- * http://xbmc.org
- *
- * This Program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This Program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with XBMC; see the file COPYING. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "cores/IPlayer.h"
-#include "threads/Thread.h"
-
-#include "cores/dvdplayer/IDVDPlayer.h"
-
-#include "DVDMessageQueue.h"
-#include "OMXCore.h"
-#include "OMXClock.h"
-#include "OMXPlayerAudio.h"
-#include "OMXPlayerVideo.h"
-#include "DVDPlayerSubtitle.h"
-#include "DVDPlayerTeletext.h"
-
-//#include "DVDChapterReader.h"
-#include "DVDSubtitles/DVDFactorySubtitle.h"
-#include "utils/BitstreamStats.h"
-
-#include "linux/DllBCM.h"
-#include "Edl.h"
-#include "FileItem.h"
-#include "threads/SingleLock.h"
-
-class COMXPlayer;
-class OMXPlayerVideo;
-class OMXPlayerAudio;
-
-namespace PVR
-{
- class CPVRChannel;
-}
-
-#define DVDSTATE_NORMAL 0x00000001 // normal dvd state
-#define DVDSTATE_STILL 0x00000002 // currently displaying a still frame
-#define DVDSTATE_WAIT 0x00000003 // waiting for demuxer read error
-#define DVDSTATE_SEEK 0x00000004 // we are finishing a seek request
-
-class COMXCurrentStream
-{
-public:
- int id; // demuxerid of current playing stream
- int source;
- double dts; // last dts from demuxer, used to find disncontinuities
- double dur; // last frame expected duration
- double dts_state; // when did we last send a playback state update
- CDVDStreamInfo hint; // stream hints, used to notice stream changes
- void* stream; // pointer or integer, identifying stream playing. if it changes stream changed
- int changes; // remembered counter from stream to track codec changes
- bool inited;
- bool started; // has the player started
- const StreamType type;
- const int player;
- // stuff to handle starting after seek
- double startpts;
-
- COMXCurrentStream(StreamType t, int i)
- : type(t)
- , player(i)
- {
- Clear();
- }
-
- void Clear()
- {
- id = -1;
- source = STREAM_SOURCE_NONE;
- dts = DVD_NOPTS_VALUE;
- dts_state = DVD_NOPTS_VALUE;
- dur = DVD_NOPTS_VALUE;
- hint.Clear();
- stream = NULL;
- changes = 0;
- inited = false;
- started = false;
- startpts = DVD_NOPTS_VALUE;
- }
-
- double dts_end()
- {
- if(dts == DVD_NOPTS_VALUE)
- return DVD_NOPTS_VALUE;
- if(dur == DVD_NOPTS_VALUE)
- return dts;
- return dts + dur;
- }
-};
-
-typedef struct
-{
- StreamType type;
- int type_index;
- std::string filename;
- std::string filename2; // for vobsub subtitles, 2 files are necessary (idx/sub)
- std::string language;
- std::string name;
- CDemuxStream::EFlags flags;
- int source;
- int id;
- std::string codec;
- int channels;
-} OMXSelectionStream;
-
-typedef std::vector<OMXSelectionStream> OMXSelectionStreams;
-
-class COMXSelectionStreams
-{
- CCriticalSection m_section;
- OMXSelectionStream m_invalid;
-public:
- COMXSelectionStreams()
- {
- m_invalid.id = -1;
- m_invalid.source = STREAM_SOURCE_NONE;
- m_invalid.type = STREAM_NONE;
- }
- std::vector<OMXSelectionStream> m_Streams;
-
- int IndexOf (StreamType type, int source, int id) const;
- int IndexOf (StreamType type, COMXPlayer& p) const;
- int Count (StreamType type) const { return IndexOf(type, STREAM_SOURCE_NONE, -1) + 1; }
- OMXSelectionStream& Get (StreamType type, int index);
- bool Get (StreamType type, CDemuxStream::EFlags flag, OMXSelectionStream& out);
-
- OMXSelectionStreams Get(StreamType type);
- template<typename Compare> OMXSelectionStreams Get(StreamType type, Compare compare)
- {
- OMXSelectionStreams streams = Get(type);
- std::stable_sort(streams.begin(), streams.end(), compare);
- return streams;
- }
-
- void Clear (StreamType type, StreamSource source);
- int Source (StreamSource source, std::string filename);
-
- void Update (OMXSelectionStream& s);
- void Update (CDVDInputStream* input, CDVDDemux* demuxer);
-};
-
-
-#define DVDPLAYER_AUDIO 1
-#define DVDPLAYER_VIDEO 2
-#define DVDPLAYER_SUBTITLE 3
-#define DVDPLAYER_TELETEXT 4
-
-class COMXPlayer : public IPlayer, public CThread, public IDVDPlayer
-{
-public:
- COMXPlayer(IPlayerCallback& callback);
- virtual ~COMXPlayer();
- virtual bool OpenFile(const CFileItem& file, const CPlayerOptions &options);
- virtual bool CloseFile(bool reopen = false);
- virtual bool IsPlaying() const;
- virtual void Pause();
- virtual bool IsPaused() const;
- virtual bool HasVideo() const;
- virtual bool HasAudio() const;
- virtual bool IsPassthrough() const;
- virtual bool CanSeek();
- virtual void Seek(bool bPlus, bool bLargeStep, bool bChapterOverride);
- virtual bool SeekScene(bool bPlus = true);
- virtual void SeekPercentage(float iPercent);
- virtual float GetPercentage();
- virtual float GetCachePercentage();
-
- virtual void RegisterAudioCallback(IAudioCallback* pCallback) { m_omxPlayerAudio.RegisterAudioCallback(pCallback); }
- virtual void UnRegisterAudioCallback() { m_omxPlayerAudio.UnRegisterAudioCallback(); }
- virtual void SetVolume(float nVolume) { m_omxPlayerAudio.SetVolume(nVolume); }
- virtual void SetDynamicRangeCompression(long drc) { m_omxPlayerAudio.SetDynamicRangeCompression(drc); }
- virtual void SetMute(bool bOnOff) { m_omxPlayerAudio.SetMute(bOnOff); }
- virtual bool ControlsVolume() {return true;}
- virtual void GetAudioInfo(std::string &strAudioInfo);
- virtual void GetVideoInfo(std::string &strVideoInfo);
- virtual void GetGeneralInfo(std::string &strVideoInfo);
- virtual bool CanRecord();
- virtual bool IsRecording();
- virtual bool CanPause();
- virtual bool Record(bool bOnOff);
- virtual void SetAVDelay(float fValue = 0.0f);
- virtual float GetAVDelay();
-
- virtual void SetSubTitleDelay(float fValue = 0.0f);
- virtual float GetSubTitleDelay();
- virtual int GetSubtitleCount();
- virtual int GetSubtitle();
- virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
- virtual void SetSubtitle(int iStream);
- virtual bool GetSubtitleVisible();
- virtual void SetSubtitleVisible(bool bVisible);
- virtual int AddSubtitle(const std::string& strSubPath);
-
- virtual int GetAudioStreamCount();
- virtual int GetAudioStream();
- virtual void SetAudioStream(int iStream);
-
- virtual TextCacheStruct_t* GetTeletextCache();
- virtual void LoadPage(int p, int sp, unsigned char* buffer);
-
- virtual int GetChapterCount();
- virtual int GetChapter();
- virtual void GetChapterName(std::string& strChapterName);
- virtual int SeekChapter(int iChapter);
-
- virtual void SeekTime(int64_t iTime);
- virtual int64_t