Feature request - integrate patched Core.dll (FrameGrabber) for AtmoLight (1 Viewer)

Owlsroost

Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Can someone expalin what the new code does (I'm not a C# programmer) ?

    Presumably 'OnNewFrame' only exists if something else i.e. the Atomlight plug-in creates it, so it's null by default ?

    How often does the Atmolight plug-in request a frame grab ? Is it calling it from within MP's main render thread (not good), or from a separate thread ?
     

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,948
    5,617
    France - IDF
    Home Country
    France France

    azzuro

    Test Group
  • Team MediaPortal
  • May 10, 2007
    9,948
    5,617
    France - IDF
    Home Country
    France France
    this is the code line from Atmolightplugin.cs
    Code:
     void AtmolightPlugin_OnNewFrame(short width, short height, short arWidth, short arHeight, uint pSurface)
    {
    if (currentEffect != ContentEffect.MP_Live_view)
    return;
    if (width == 0 || height == 0)
    return;
    if (rgbSurface==null)
    rgbSurface = GUIGraphicsContext.DX9Device.CreateRenderTarget(captureWidth,captureHeight, Format.A8R8G8B8,MultiSampleType.None, 0, true);
    unsafe
    {
    try
    {
    VideoSurfaceToRGBSurfaceExt(new IntPtr(pSurface), width, height, (IntPtr)rgbSurface.UnmanagedComPointer, captureWidth, captureHeight);
    Microsoft.DirectX.GraphicsStream stream = SurfaceLoader.SaveToStream(ImageFileFormat.Bmp, rgbSurface);
    BinaryReader reader = new BinaryReader(stream);
    stream.Position = 0; // ensure that what start at the beginning of the stream.
    reader.ReadBytes(14); // skip bitmap file info header
    byte[] bmiInfoHeader = reader.ReadBytes(4 + 4 + 4 + 2 + 2 + 4 + 4 + 4 + 4 + 4 + 4);
    byte[] pixelData = reader.ReadBytes((int)(stream.Length - stream.Position));
    atmoLiveViewCtrl.setPixelData(bmiInfoHeader, pixelData);
    stream.Close();
    stream.Dispose();
    }
    catch (Exception ex)
    {
    Log.Error(ex);
    rgbSurface.Dispose();
    rgbSurface = null;
    }
    }
    }
     

    Deda

    Lead Dev MP1 Videos
  • Premium Supporter
  • March 18, 2009
    2,423
    2,385
    Zagreb
    Home Country
    Croatia Croatia
    Can someone expalin what the new code does (I'm not a C# programmer) ?

    Presumably 'OnNewFrame' only exists if something else i.e. the Atomlight plug-in creates it, so it's null by default ?

    How often does the Atmolight plug-in request a frame grab ? Is it calling it from within MP's main render thread (not good), or from a separate thread ?

    In short, you're right, if there is no any subscriber (some outside class) to that event it will be null.
    If there is one, event itself will publish frame parameters width, height, arWidth, arHeight, pSurface and subscriber class will independently do with it what it likes and if that event subscriber do some nasty stuff and hogs cpu it's not our problem (actually it is :) but we are not the one to blame).
     
    Last edited:

    Users who are viewing this thread

    Top Bottom