[FFmpeg-devel] [PATCH] Add Win32 GDI-based screen grabbing

Calvin Walton calvin.walton at kepstin.ca
Wed Apr 2 20:25:30 CEST 2014


On Wed, 2014-04-02 at 07:32 +0000, Eli Kara wrote:
> > > >  7 files changed, 719 insertions(+)  create mode 100644 
> > > > libavdevice/gdigrab.c
> > >
> > > this breaks compilation with mingw
> > >
> > > ffmpeg/libavdevice/gdigrab.c: In function 'gdigrab_region_wnd_init':
> > > ffmpeg/libavdevice/gdigrab.c:162:29: error: 'GWL_WNDPROC' undeclared
> > (first use in this function)
> > > ffmpeg/libavdevice/gdigrab.c:162:29: note: each undeclared 
> > > identifier is
> > reported only once for each function it appears in
> > > ffmpeg/libavdevice/gdigrab.c: In function 'gdigrab_read_packet':
> > 
> > That should probably be *GWLP_**WNDPROC*. See 
> > http://msdn.microsoft.com/en-us/library/windows/desktop/ms644898(v=vs.85).aspx.
> > 
> > But I'm not sure if that will fix compilation though. Are you using 
> > MinGW32
> > (i686-pc-mingw32) or mingw-w64 (*-w64-mingw32)?
> 
> > 64bit
> 
> I just have to mention this - the SetWindowLongPtr function replaces
> SetWindowLong as it was limited to 32-bit DWORD values. Supported as
> of Windows 2000.
> So, to properly build under borth 32-bit and 64-bit, only
> SetWindowLongPtr should be used. The constants change accordingly, in
> this case GWLP_WNDPROC as
> mentioned before.
> When compiling for 32-bit, SetWindowLongPtr is actually defined to be
> SetWindowLong.

My fault; I was only targeting 32-bit builds with my development
(although I was using mingw-w64 to do so). I just now tried doing a
64-bit build and I see the build error (and a few printf format warnings
in an old debug string). I am already using SetWindowLongPtr, the error
was simply that I forgot the 'P' on the constant name :)

I'll submit a new patch that fixes the build error and corrects
Cristophe's name.

As far as maintaining it going forwards - I am, quite honestly, not a
windows developer; this capture work was done as part of a project which
didn't really go anywhere in the end. I just figured that since I had
something working, I might as well share it.

-- 
Calvin Walton <calvin.walton at kepstin.ca>



More information about the ffmpeg-devel mailing list