Permalink
Browse files

Merge branch 'master' of ssh://github.com/MediaPortal/MediaPortal-1

  • Loading branch information...
regeszter committed Aug 19, 2017
2 parents ac68dd8 + d9912f4 commit 19671da4410b43bf17658c5eb67714e7f7619560
Showing with 216 additions and 317 deletions.
  1. +49 −49 DirectShowFilters/DirectShowHelper/source/MadPresenter.cpp
  2. +32 −16 DirectShowFilters/DirectShowHelper/source/MadPresenter.h
  3. +4 −4 DirectShowFilters/DirectShowHelper/source/callback.h
  4. +4 −1 TvEngine3/TVLibrary/TvPlugin/TvPlugin/TvOSD.cs
  5. +0 −8 mediaportal/Core/MusicPlayer/BASS/BassAudioEngine.cs
  6. +12 −27 mediaportal/Core/PlayList/PlayListPlayer.cs
  7. +0 −4 mediaportal/Core/Player/AudioPlayerVMR.cs
  8. +0 −4 mediaportal/Core/Player/AudioPlayerWMP9.cs
  9. +3 −5 mediaportal/Core/Player/BDPlayer.cs
  10. +3 −4 mediaportal/Core/Player/BaseStreamBufferPlayer.cs
  11. +0 −5 mediaportal/Core/Player/BaseTSReaderPlayer.cs
  12. +1 −24 mediaportal/Core/Player/DVDPlayer.cs
  13. +2 −1 mediaportal/Core/Player/DVDPlayer9.cs
  14. +0 −5 mediaportal/Core/Player/DummyPlayer.cs
  15. +4 −9 mediaportal/Core/Player/IPlayer.cs
  16. +12 −9 mediaportal/Core/Player/PlaneScene.cs
  17. +1 −13 mediaportal/Core/Player/RTSPPlayer.cs
  18. +0 −4 mediaportal/Core/Player/StreamBufferPlayer9.cs
  19. +1 −0 mediaportal/Core/Player/TSReaderPlayer.cs
  20. +38 −44 mediaportal/Core/Player/VMR9.cs
  21. +0 −25 mediaportal/Core/Player/VideoPlayerVMR7.cs
  22. +1 −0 mediaportal/Core/Player/VideoPlayerVMR9.cs
  23. +20 −22 mediaportal/Core/Player/g_player.cs
  24. +4 −1 mediaportal/Core/guilib/GraphicContext.cs
  25. +15 −17 mediaportal/MediaPortal.Application/D3D.cs
  26. +9 −15 mediaportal/MediaPortal.Application/MediaPortal.cs
  27. +1 −1 mediaportal/WindowPlugins/GUIVideos/GUIVideoPlaylist.cs
@@ -55,12 +55,16 @@ MPMadPresenter::MPMadPresenter(IVMR9Callback* pCallback, DWORD width, DWORD heig
Log("MPMadPresenter::Constructor() - instance 0x%x", this);
m_pShutdown = false;
m_pDevice->GetRenderTarget(0, &m_pSurfaceDevice);
// Store device surface MP GUI for later
m_pCallback->RestoreDeviceSurface(reinterpret_cast<LONG>(m_pSurfaceDevice));
Log("MPMadPresenter::Constructor() Store Device Surface");
}
MPMadPresenter::~MPMadPresenter()
{
{
CAutoLock cAutoLock(this);
// TODO need to be commented to avoid deadlock.
//CAutoLock cAutoLock(this);
if (m_pSRCB)
{
@@ -93,7 +97,8 @@ MPMadPresenter::~MPMadPresenter()
Log("MPMadPresenter::Destructor() - m_pMad release 1");
if (m_pMad)
{
m_pMad.FullRelease();
// Let's try to do a m_pMad.Release() instead of m_pMad.FullRelease() (somehow it can take long time otherwise)
m_pMad.Release();
}
Log("MPMadPresenter::Destructor() - m_pMad release 2");
@@ -335,20 +340,13 @@ void MPMadPresenter::ConfigureMadvr()
HRESULT MPMadPresenter::Shutdown()
{
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
CAutoLock lock(this);
Log("MPMadPresenter::Shutdown() start");
if (m_pCallback)
{
m_pCallback->SetSubtitleDevice(reinterpret_cast<DWORD>(nullptr));
m_pCallback->SetSubtitleDevice(reinterpret_cast<LONG>(nullptr));
Log("MPMadPresenter::Shutdown() reset subtitle device");
m_pCallback->RestoreDeviceSurface(reinterpret_cast<DWORD>(m_pSurfaceDevice));
Log("MPMadPresenter::Shutdown() RestoreDeviceSurface");
m_pCallback->DestroyHWnd(m_hWnd);
Log("MPMadPresenter::Shutdown() send DestroyHWnd on C# side");
m_pCallback->Release();
Log("MPMadPresenter::Shutdown() m_pCallback release");
m_pCallback = nullptr;
}
// Restore windowed overlay settings
@@ -742,7 +740,7 @@ HRESULT MPMadPresenter::RenderOsd(LPCSTR name, REFERENCE_TIME frameStart, RECT*
{
if (SUCCEEDED(hr = m_pMadD3DDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &SurfaceMadVr)))
{
if (SUCCEEDED(hr = m_pCallback->RenderFrame(videoWidth, videoHeight, videoWidth, videoHeight, reinterpret_cast<DWORD>(SurfaceMadVr))))
if (SUCCEEDED(hr = m_pCallback->RenderFrame(videoWidth, videoHeight, videoWidth, videoHeight, reinterpret_cast<LONG>(SurfaceMadVr))))
{
SurfaceMadVr->Release();
}
@@ -807,7 +805,7 @@ void MPMadPresenter::RenderToTexture(IDirect3DTexture9* pTexture)
IDirect3DSurface9* pSurface = nullptr; // This will be released by C# side
if (SUCCEEDED(hr = pTexture->GetSurfaceLevel(0, &pSurface)))
{
if (SUCCEEDED(hr = m_pCallback->SetRenderTarget(reinterpret_cast<DWORD>(pSurface))))
if (SUCCEEDED(hr = m_pCallback->SetRenderTarget(reinterpret_cast<LONG>(pSurface))))
{
// TODO is it needed ?
hr = m_pDevice->Clear(0, nullptr, D3DCLEAR_TARGET, D3DXCOLOR(0, 0, 0, 0), 1.0f, 0);
@@ -1002,60 +1000,62 @@ HRESULT MPMadPresenter::SetDeviceOsd(IDirect3DDevice9* pD3DDev)
//m_pSubPicQueue = nullptr;
//m_pAllocator = nullptr;
if (m_pCallback)
m_pCallback->SetSubtitleDevice(reinterpret_cast<DWORD>(pD3DDev));
m_pCallback->SetSubtitleDevice(reinterpret_cast<LONG>(pD3DDev));
}
return S_OK;
}
HRESULT MPMadPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
{
HRESULT hr = S_FALSE;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
HRESULT hr = S_FALSE;
if (m_pShutdown)
{
Log("MPMadPresenter::SetDevice() shutdown");
return hr;
}
if (m_pShutdown)
{
Log("MPMadPresenter::SetDevice() shutdown");
return hr;
}
// Lock madVR thread while Shutdown()
//CAutoLock lock(&m_dsLock);
// Lock madVR thread while Shutdown()
//CAutoLock lock(&m_dsLock);
CAutoLock cAutoLock(this);
CAutoLock cAutoLock(this);
Log("MPMadPresenter::SetDevice() device 0x:%x", pD3DDev);
Log("MPMadPresenter::SetDevice() device 0x:%x", pD3DDev);
if (!pD3DDev)
{
if (m_pMadD3DDev) m_pMadD3DDev->Release();
m_pMadD3DDev = nullptr;
}
if (!pD3DDev)
{
if (m_pMadD3DDev) m_pMadD3DDev->Release();
m_pMadD3DDev = nullptr;
}
m_pMadD3DDev = static_cast<IDirect3DDevice9Ex*>(pD3DDev);
m_pMadD3DDev = static_cast<IDirect3DDevice9Ex*>(pD3DDev);
if (m_pMadD3DDev)
{
m_deviceState.SetDevice(m_pMadD3DDev);
if (m_pMadD3DDev)
{
m_deviceState.SetDevice(m_pMadD3DDev);
if (SUCCEEDED(hr = m_pDevice->CreateTexture(m_dwGUIWidth, m_dwGUIHeight, 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_pMPTextureGui.p, &m_hSharedGuiHandle)))
if (SUCCEEDED(hr = m_pDevice->CreateTexture(m_dwGUIWidth, m_dwGUIHeight, 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_pMPTextureOsd.p, &m_hSharedOsdHandle)))
if (SUCCEEDED(hr = m_pDevice->CreateTexture(m_dwGUIWidth, m_dwGUIHeight, 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_pMPTextureGui.p, &m_hSharedGuiHandle)))
if (SUCCEEDED(hr = m_pDevice->CreateTexture(m_dwGUIWidth, m_dwGUIHeight, 0, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &m_pMPTextureOsd.p, &m_hSharedOsdHandle)))
m_pInitOSDRender = false;
}
else
{
if (m_pCallback)
m_pInitOSDRender = false;
}
else
{
m_pCallback->SetSubtitleDevice((DWORD)m_pMadD3DDev);
Log("MPMadPresenter::SetDevice() reset subtitle device");
if (m_pCallback)
{
m_pCallback->SetSubtitleDevice(reinterpret_cast<LONG>(m_pMadD3DDev));
Log("MPMadPresenter::SetDevice() reset subtitle device");
}
Log("MPMadPresenter::SetDevice() Shutdown() 1");
m_deviceState.Shutdown();
Log("MPMadPresenter::SetDevice() Shutdown() 2");
}
Log("MPMadPresenter::SetDevice() Shutdown() 1");
m_deviceState.Shutdown();
Log("MPMadPresenter::SetDevice() Shutdown() 2");
}
Log("MPMadPresenter::SetDevice() init madVR Window");
Log("MPMadPresenter::SetDevice() init madVR Window");
return hr;
return hr;
}
}
HRESULT MPMadPresenter::Render(REFERENCE_TIME frameStart, int left, int top, int right, int bottom, int width, int height)
@@ -1105,7 +1105,7 @@ HRESULT MPMadPresenter::RenderEx3(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop,
}
if (m_pCallback)
{
m_pCallback->SetSubtitleDevice((DWORD)m_pMadD3DDev);
m_pCallback->SetSubtitleDevice(reinterpret_cast<LONG>(m_pMadD3DDev));
Log("%s : SetDevice() SetSubtitleDevice for D3D : 0x:%x", __FUNCTION__, m_pMadD3DDev);
}
@@ -69,20 +69,26 @@ class MPMadPresenter : public CUnknown, public CCritSec
STDMETHODIMP ClearBackground(LPCSTR name, REFERENCE_TIME frameStart, RECT *fullOutputRect, RECT *activeVideoRect)
{
CAutoLock cAutoLock(this);
return m_pDXRAP ? m_pDXRAP->ClearBackground(name, frameStart, fullOutputRect, activeVideoRect) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAP ? m_pDXRAP->ClearBackground(name, frameStart, fullOutputRect, activeVideoRect) : E_UNEXPECTED;
}
}
STDMETHODIMP RenderOsd(LPCSTR name, REFERENCE_TIME frameStart, RECT *fullOutputRect, RECT *activeVideoRect)
{
CAutoLock cAutoLock(this);
return m_pDXRAP ? m_pDXRAP->RenderOsd(name, frameStart, fullOutputRect, activeVideoRect) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAP ? m_pDXRAP->RenderOsd(name, frameStart, fullOutputRect, activeVideoRect) : E_UNEXPECTED;
}
}
STDMETHODIMP SetDevice(IDirect3DDevice9* pD3DDev)
{
CAutoLock cAutoLock(this);
return m_pDXRAP ? m_pDXRAP->SetDeviceOsd(pD3DDev) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAP ? m_pDXRAP->SetDeviceOsd(pD3DDev) : E_UNEXPECTED;
}
}
};
@@ -110,32 +116,42 @@ class MPMadPresenter : public CUnknown, public CCritSec
STDMETHODIMP SetDevice(IDirect3DDevice9* pD3DDev)
{
CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->SetDevice(pD3DDev) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->SetDevice(pD3DDev) : E_UNEXPECTED;
}
}
STDMETHODIMP Render(REFERENCE_TIME rtStart, int left, int top, int right, int bottom, int width, int height)
{
CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->Render(rtStart, left, top, right, bottom, width, height) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->Render(rtStart, left, top, right, bottom, width, height) : E_UNEXPECTED;
}
}
STDMETHODIMP RenderEx(REFERENCE_TIME frameStart, REFERENCE_TIME frameStop, REFERENCE_TIME avgTimePerFrame, int left, int top, int right, int bottom, int width, int height)
{
CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->Render(frameStart, left, top, right, bottom, width, height) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->Render(frameStart, left, top, right, bottom, width, height) : E_UNEXPECTED;
}
}
STDMETHODIMP RenderEx2(REFERENCE_TIME frameStart, REFERENCE_TIME frameStop, REFERENCE_TIME avgTimePerFrame, RECT croppedVideoRect, RECT originalVideoRect, RECT viewportRect, const double videoStretchFactor = 1.0)
{
CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->Render(frameStart, croppedVideoRect.left, croppedVideoRect.top, croppedVideoRect.right, croppedVideoRect.bottom, viewportRect.top, viewportRect.right) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->Render(frameStart, croppedVideoRect.left, croppedVideoRect.top, croppedVideoRect.right, croppedVideoRect.bottom, viewportRect.top, viewportRect.right) : E_UNEXPECTED;
}
}
STDMETHODIMP RenderEx3(REFERENCE_TIME frameStart, REFERENCE_TIME frameStop, REFERENCE_TIME avgTimePerFrame, RECT croppedVideoRect, RECT originalVideoRect, RECT viewportRect, const double videoStretchFactor = 1.0, int xOffsetInPixels = 0, DWORD flags = 0)
{
CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->RenderEx3(std::move(frameStart), std::move(frameStop), std::move(avgTimePerFrame), std::move(croppedVideoRect), std::move(originalVideoRect), std::move(viewportRect), std::move(videoStretchFactor), xOffsetInPixels) : E_UNEXPECTED;
{ // Scope for autolock for the local variable (lock, which when deleted releases the lock)
//CAutoLock cAutoLock(this);
return m_pDXRAPSUB ? m_pDXRAPSUB->RenderEx3(std::move(frameStart), std::move(frameStop), std::move(avgTimePerFrame), std::move(croppedVideoRect), std::move(originalVideoRect), std::move(viewportRect), std::move(videoStretchFactor), xOffsetInPixels) : E_UNEXPECTED;
}
}
};
@@ -22,14 +22,14 @@ DECLARE_INTERFACE_(IVMR9Callback, IUnknown)
STDMETHOD(SetSampleTime)(REFERENCE_TIME nsSampleTime)PURE;
STDMETHOD(RenderGui)(WORD cx, WORD cy, WORD arx, WORD ary)PURE;
STDMETHOD(RenderOverlay)(WORD cx, WORD cy, WORD arx, WORD ary)PURE;
STDMETHOD(SetRenderTarget)(DWORD pTarget)PURE;
STDMETHOD(SetSubtitleDevice)(DWORD pDevice)PURE;
STDMETHOD(SetRenderTarget)(LONG pTarget)PURE;
STDMETHOD(SetSubtitleDevice)(LONG pDevice)PURE;
STDMETHOD(RenderSubtitle)(REFERENCE_TIME frameStart, int left, int top, int right, int bottom, int width, int height, int xOffsetInPixels)PURE;
STDMETHOD(RenderFrame)(WORD cx, WORD cy, WORD arx, WORD ary, DWORD pTargetmadVr)PURE;
STDMETHOD(RenderFrame)(WORD cx, WORD cy, WORD arx, WORD ary, LONG pTargetmadVr)PURE;
STDMETHOD(ForceOsdUpdate)(BOOL pForce)PURE;
STDMETHOD(IsFullScreen)()PURE;
STDMETHOD(IsUiVisible)()PURE;
STDMETHOD(RestoreDeviceSurface)(DWORD pSurfaceDevice)PURE;
STDMETHOD(RestoreDeviceSurface)(LONG pSurfaceDevice)PURE;
STDMETHOD(ReduceMadvrFrame)()PURE;
STDMETHOD(DestroyHWnd)(HWND phWnd)PURE;
};
@@ -542,7 +542,10 @@ public override bool OnMessage(GUIMessage message)
detail = details[0];
break;
}
GUIPropertyManager.SetProperty("#TV.TuningDetails.FreeToAir", detail.FreeToAir.ToString());
if (detail != null)
{
GUIPropertyManager.SetProperty("#TV.TuningDetails.FreeToAir", detail.FreeToAir.ToString());
}
}
}
}
@@ -1803,14 +1803,6 @@ public override void Stop()
_commandRegistered.Wait();
}
/// <summary>
/// Stopping Playback
/// </summary>
public override void StopMadVr()
{
Stop();
}
/// <summary>
/// Handle Stop of a song
/// </summary>
@@ -469,13 +469,6 @@ public void PlayNext(bool setFullScreenVideo)
iSong = 0;
}
// Tell is a next file that doesn't need the final stop on dispose for madVR
if (GUIGraphicsContext.VideoRenderer == GUIGraphicsContext.VideoRendererType.madVR &&
GUIGraphicsContext.InVmr9Render)
{
GUIGraphicsContext.keepExclusiveModeOn = setFullScreenVideo;
}
if (!Play(iSong, setFullScreenVideo))
{
if (!g_Player.Playing)
@@ -509,13 +502,6 @@ public void PlayPrevious(bool setFullScreenVideo)
iSong = playlist.Count - 1;
}
// Tell is a next file that doesn't need the final stop on dispose for madVR
if (GUIGraphicsContext.VideoRenderer == GUIGraphicsContext.VideoRendererType.madVR &&
GUIGraphicsContext.InVmr9Render)
{
GUIGraphicsContext.keepExclusiveModeOn = setFullScreenVideo;
}
if (!Play(iSong, setFullScreenVideo))
{
if (!g_Player.Playing)
@@ -626,19 +612,18 @@ public bool Play(int iSong, bool setFullScreenVideo)
// return without checking playResult
return Play(iSong, true);
}
break;
case PlayListType.PLAYLIST_VIDEO:
case PlayListType.PLAYLIST_VIDEO_TEMP:
{
if (!MediaPortal.Player.g_Player.ForcePlay)
{
playResult = g_Player.Play(item.FileName, MediaPortal.Player.g_Player.MediaType.Video);
}
else
{
playResult = g_Player.Play(item.FileName, MediaPortal.Player.g_Player.MediaType.Video, MediaPortal.Player.g_Player.SetResumeBDTitleState, true);
}
}
break;
case PlayListType.PLAYLIST_VIDEO:
case PlayListType.PLAYLIST_VIDEO_TEMP:
if (!MediaPortal.Player.g_Player.ForcePlay)
{
playResult = g_Player.Play(item.FileName, MediaPortal.Player.g_Player.MediaType.Video);
}
else
{
playResult = g_Player.Play(item.FileName, MediaPortal.Player.g_Player.MediaType.Video,
MediaPortal.Player.g_Player.SetResumeBDTitleState, true);
}
break;
default:
playResult = g_Player.Play(item.FileName);
@@ -211,10 +211,6 @@ public override void Stop()
}
}
public override void StopMadVr()
{
Stop();
}
public override int Speed
{
@@ -450,10 +450,6 @@ public override void Stop()
}
}
public override void StopMadVr()
{
Stop();
}
public override int Volume
{
Oops, something went wrong.

0 comments on commit 19671da

Please sign in to comment.