[Ffmpeg-devel] Screen frame grabbing for Win32 platform

GISQUET Christophe christophe.gisquet
Fri Feb 2 00:16:30 CET 2007


Ramiro Polla a ?crit :
>>      if (has_video) {
>>          AVInputFormat *fmt1;
>> +
>>   
> Be careful. Don't send cosmetic changes in your patches.

Leftover from printf debugging that was forced onto me by gdb...

>> +        else if (video_device&&!strncmp(video_device,"gdi:",4)) {
>> +            video_grab_format="win32grab";
>> +        }
>>   
> Anyways, any change to ffmpeg.c will be dropped with the new grab 
> interface.

In the mean time, it's still needed for testing :)

>> +    int     size;          /**< Size in bytes of the grab frame */
>> +    int     width;         /**< Width of the grab frame */
>> +    int     height;        /**< Height of the grab frame */
>> +    int     bpp;           /**< Bits per pixel of the grab frame */
>>   
> I used a BITMAPINFOHEADER to keep all this. Maybe you should keep the 
> result of your GetObject.

I didn't because, although not performance-critical, it was a mostly useless
object and another indirection.

> I left this to RAWVIDEO. It doesn't return an error though. Also, 
> RAWVIDEO deals with bottom-down DIBS if you specify bits_per_sample.

Copied for x11grab.c, so I don't know what's superfluous.

>> +    av_set_pts_info(st, 64, 1, 1000000); /* 32 bits pts in ms */
>>   
> Then set it to 32 bits instead of 64, and in ms instead of us.

Not sure of the calculations, I preferred being safe than experimenting on 
this part. Work for later.

>> +    s->time_base  = ap->time_base;
>> +    s->time_frame = av_gettime() / av_q2d(ap->time_base);
> This isn't necessary to keep around in the context. We shouldn't be 
> calculating the time anyways. Let FFmpeg do that

OK, but then I don't know if it's just code removal or if I should instead
read some struct fields.

> GetTickCount, since that's what will be used internally anyways. (Hmm... 
> on second thoughs, I don't know well the developers would like this)

We are including windows.h anyway and I think GetTickCount is a requirement
(used by av_gettime, indeed).

>> Property changes on: libavformat\win32grab.c
>> ___________________________________________________________________
>> Name: svn:eol-style
>>    + native
>>   
> Be careful =) Don't change the eol-style.

That was a remark in my initial mail. I didn't know if it mattered, and as I 
knew it wouldn't be applied anyway on the first submission, I left it in case 
it was needed.

> Also, we need to capture the mouse pointer...

Result of 2H googling+API discovering+coding attached. First time ever, and 
I'm not a genius, so I smell problems, for instance animated cursors (a reason 
why I don't store the cursor). But it works.

Christophe Gisquet
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: win32grab.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070202/bd910820/attachment.asc>



More information about the ffmpeg-devel mailing list