[FFmpeg-devel] A patch for gdigrab function

hlszl1983 at 163.com hlszl1983 at 163.com
Fri Aug 8 11:08:46 CEST 2014


hi, all

I'm using gdigrab feature on windows, and found that the count of gdi objects owned by ffmpeg.exe increasing endlessly...
 
Here is the patch, can someone commit it?
----------------------------------------------
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c 
index bccfef2..e2bed14 100644 
--- a/libavdevice/gdigrab.c 
+++ b/libavdevice/gdigrab.c 
@@ -451,6 +451,10 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab) 
icon = CopyCursor(LoadCursor(NULL, IDC_ARROW)); 
} 

+ /*Remarks 
+ *GetIconInfo creates bitmaps for the hbmMask and hbmColor members of ICONINFO. 
+ *The calling application must manage these bitmaps and delete them when they are no longer necessary. 
+ */ 
if (!GetIconInfo(icon, &info)) { 
CURSOR_ERROR("Could not get icon info"); 
goto icon_error; 
@@ -481,6 +485,10 @@ static void paint_mouse_pointer(AVFormatContext *s1, struct gdigrab *gdigrab) 
} 

icon_error: 
+ if (info.hbmMask) 
+ DeleteObject(info.hbmMask); 
+ if(info.hbmColor) 
+ DeleteObject(info.hbmColor); 
if (icon) 
DestroyCursor(icon); 
} else {




hlszl1983 at 163.com


More information about the ffmpeg-devel mailing list