home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Development
General Development (no feature request here!)
[Poll] Expose present surface object as in Framegrabber as event?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="gemx" data-source="post: 560699" data-attributes="member: 26324"><p>Hi,</p><p></p><p>while working on the Atmolight plugin (see here <a href="https://forum.team-mediaportal.com/mediaportal-plugins-47/new-plugin-atmolight-process-plugin-update-13-01-2010-v1-1-a-75840/#post557386" target="_blank">https://forum.team-mediaportal.com/mediaportal-plugins-47/new-plugin-atmolight-process-plugin-update-13-01-2010-v1-1-a-75840/#post557386</a>) i noticed that the current method in the framebuffer always copies the whole image from the GPU which is a big CPU eater.</p><p>Even more when you think about 1080i/p video content.</p><p>In most cases it is enough to get only a small portion of the screen (e.g. for black bar detection) or get a smaller, resized image like e.g. in my case.</p><p></p><p>I tried many different ways to capture the current screen content but the framegrabber was the only solution since it gets feeded directly by PlaneSurface.PresentImage(...).</p><p></p><p>To give Plugin developers the freedom of choice how they would like the current image i made the attached small patch.</p><p>It just exposes an OnNewFrameEvent from the framegrabber, where the current image is handed over before it's processed by the framegrabber itself.</p><p></p><p>It's just a very small patch and until this event is not hooked to any code it won't be used anyway but maybe of great help to take CPU load from the framegrabber.</p><p></p><p>Ok, I know, we have a feature freeze but this is not really a feature - it helps to reduce CPU load in MP if used by a plugin and if not it doesn't have any effect or side effect at all.</p><p></p><p>This is a bit like begging - but please vote for "yes" because otherwise my (and probably that of many other) Atmolight Hardware will never run smooth with MP <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" /></p><p></p><p>So, what do you think?</p><p></p><p>Please vote <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p><p></p><p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /></p><p></p><p>The patch is here </p><p>[CODE]</p><p>Index: Core/Player/FrameGrabber.cs</p><p>===================================================================</p><p>--- Core/Player/FrameGrabber.cs (revision 24717)</p><p>+++ Core/Player/FrameGrabber.cs (working copy)</p><p>@@ -45,6 +45,9 @@</p><p> </p><p> private FrameGrabber() {}</p><p> </p><p>+ public delegate void NewFrameHandler(Int16 width, Int16 height, Int16 arWidth, Int16 arHeight, uint pSurface);</p><p>+ public event NewFrameHandler OnNewFrame;</p><p>+</p><p> public static FrameGrabber GetInstance()</p><p> {</p><p> if (instance == null)</p><p>@@ -120,6 +123,16 @@</p><p> /// <param name="pSurface"></param></p><p> public void OnFrame(Int16 width, Int16 height, Int16 arWidth, Int16 arHeight, uint pSurface)</p><p> {</p><p>+ if (OnNewFrame != null)</p><p>+ {</p><p>+ try</p><p>+ {</p><p>+ OnNewFrame(width, height, arWidth, arHeight, pSurface);</p><p>+ }</p><p>+ catch(Exception)</p><p>+ {</p><p>+ }</p><p>+ }</p><p> // Is GetCurrentImage() requesting a frame grab?</p><p> if (!grabSample)</p><p> {</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="gemx, post: 560699, member: 26324"] Hi, while working on the Atmolight plugin (see here [url]https://forum.team-mediaportal.com/mediaportal-plugins-47/new-plugin-atmolight-process-plugin-update-13-01-2010-v1-1-a-75840/#post557386[/url]) i noticed that the current method in the framebuffer always copies the whole image from the GPU which is a big CPU eater. Even more when you think about 1080i/p video content. In most cases it is enough to get only a small portion of the screen (e.g. for black bar detection) or get a smaller, resized image like e.g. in my case. I tried many different ways to capture the current screen content but the framegrabber was the only solution since it gets feeded directly by PlaneSurface.PresentImage(...). To give Plugin developers the freedom of choice how they would like the current image i made the attached small patch. It just exposes an OnNewFrameEvent from the framegrabber, where the current image is handed over before it's processed by the framegrabber itself. It's just a very small patch and until this event is not hooked to any code it won't be used anyway but maybe of great help to take CPU load from the framegrabber. Ok, I know, we have a feature freeze but this is not really a feature - it helps to reduce CPU load in MP if used by a plugin and if not it doesn't have any effect or side effect at all. This is a bit like begging - but please vote for "yes" because otherwise my (and probably that of many other) Atmolight Hardware will never run smooth with MP :P So, what do you think? Please vote :) :thx: The patch is here [CODE] Index: Core/Player/FrameGrabber.cs =================================================================== --- Core/Player/FrameGrabber.cs (revision 24717) +++ Core/Player/FrameGrabber.cs (working copy) @@ -45,6 +45,9 @@ private FrameGrabber() {} + public delegate void NewFrameHandler(Int16 width, Int16 height, Int16 arWidth, Int16 arHeight, uint pSurface); + public event NewFrameHandler OnNewFrame; + public static FrameGrabber GetInstance() { if (instance == null) @@ -120,6 +123,16 @@ /// <param name="pSurface"></param> public void OnFrame(Int16 width, Int16 height, Int16 arWidth, Int16 arHeight, uint pSurface) { + if (OnNewFrame != null) + { + try + { + OnNewFrame(width, height, arWidth, arHeight, pSurface); + } + catch(Exception) + { + } + } // Is GetCurrentImage() requesting a frame grab? if (!grabSample) { [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
[Poll] Expose present surface object as in Framegrabber as event?
Contact us
RSS
Top
Bottom