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

Roger Pack rogerdpack2 at gmail.com
Thu Apr 3 19:22:04 CEST 2014


On 4/2/14, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Wed, Apr 02, 2014 at 03:35:40PM -0600, Roger Pack wrote:
>> On 4/2/14, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Wed, Apr 02, 2014 at 02:25:30PM -0400, Calvin Walton wrote:
>> >> 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.
>> >
>> > ok, anyone else interrested in maintaining it ?
>> > roger ?
>>
>> Sure put me in (add a CC rogerdpack at gmail.com to the MAINTAINERS
>> file--also for dshow the CC...)
>
> done

OK the new gdigrab does configure and compile right.
I sometimes get this message when using it:

*** dropping frame 690 from stream 0 at ts 687

(hint/feature request: it might be nice if messages like that and
other like it said which *module* was generating the message, similar
to how other messages are formatted:
here's a normal message [note it says source]
[libx264 @ 02698900] 8x8 transform intra:30.6% inter:15.0%)
Thanks for your efforts here.


More information about the ffmpeg-devel mailing list