Permalink
Browse files

MP1-4781V8 : madVR V340 (Handle the grabbing frame by new madVR method)

  • Loading branch information...
Sebastiii committed Oct 5, 2017
1 parent 7716720 commit 1945ffd855ef4c8b5cd1e85f1250dfc8864ca75f
Showing with 46 additions and 12 deletions.
  1. +42 −11 mediaportal/Core/Player/FrameGrabber.cs
  2. +4 −1 mediaportal/Core/Player/PlaneScene.cs
@@ -22,8 +22,10 @@
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using DirectShowLib;
using MediaPortal.ExtensionMethods;
using MediaPortal.GUI.Library;
using MediaPortal.Player;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
@@ -93,16 +95,9 @@ public Bitmap GetCurrentImage()
{
lock (grabNotifier)
{
grabSucceeded = false;
grabSample = true;
if (!Monitor.Wait(grabNotifier, 500))
{
Log.Debug("FrameGrabber: Timed-out waiting for grabbed frame!");
return null;
}
if (grabSucceeded)
if (VMR9Util.g_vmr9 != null)
{
VMR9Util.g_vmr9.MadVrGrabCurrentFrame();
try
{
if (FrameResult != null)
@@ -111,9 +106,9 @@ public Bitmap GetCurrentImage()
FrameResult = null;
}
if (GUIGraphicsContext.madVRFrameBitmap != null)
if (GUIGraphicsContext.madVRCurrentFrameBitmap != null)
{
FrameResult = new Bitmap(GUIGraphicsContext.madVRFrameBitmap);
FrameResult = new Bitmap(GUIGraphicsContext.madVRCurrentFrameBitmap);
return FrameResult;
}
}
@@ -124,6 +119,42 @@ public Bitmap GetCurrentImage()
// When Bitmap is not yet ready
}
}
//////// Part of code used for D3D9 setting in madVR
//////lock (grabNotifier)
//////{
////// grabSucceeded = false;
////// grabSample = true;
////// if (!Monitor.Wait(grabNotifier, 500))
////// {
////// Log.Debug("FrameGrabber: Timed-out waiting for grabbed frame!");
////// return null;
////// }
////// if (grabSucceeded)
////// {
////// try
////// {
////// if (FrameResult != null)
////// {
////// FrameResult.SafeDispose();
////// FrameResult = null;
////// }
////// if (GUIGraphicsContext.madVRFrameBitmap != null)
////// {
////// FrameResult = new Bitmap(GUIGraphicsContext.madVRFrameBitmap);
////// return FrameResult;
////// }
////// }
////// catch
////// {
////// Log.Debug("FrameGrabber: Frame grab catch failed for madVR");
////// return null;
////// // When Bitmap is not yet ready
////// }
////// }
//////}
}
// Bitmap not ready return null
Log.Debug("FrameGrabber: Frame grab failed for madVR");
@@ -810,7 +810,7 @@ public void GrabMadVrFrame(IntPtr pTargetmadVrDib)
public void GrabMadVrCurrentFrame(IntPtr pTargetmadVrDib)
{
lock (GUIGraphicsContext.RenderModeSwitch)
{
{
if (GUIGraphicsContext.madVRCurrentFrameBitmap != null)
{
GUIGraphicsContext.madVRCurrentFrameBitmap.Dispose();
@@ -1253,6 +1253,9 @@ private int RenderLayers(GUILayers layers, Int16 width, Int16 height, Int16 arWi
if (VMR9Util.g_vmr9 != null)
{
VMR9Util.g_vmr9.ProcessMadVrOsd();
// Enable the GetCurrentImage new madVR
if (grabber != null) grabber.FrameGrabberD3D9Enable = false;
}
}
return _visible ? 0 : 1; // S_OK, S_FALSE

0 comments on commit 1945ffd

Please sign in to comment.