[FFmpeg-devel] [PATCH] VFW capture support

Michael Niedermayer michaelni
Wed Mar 5 00:24:34 CET 2008


On Mon, Mar 03, 2008 at 01:59:03PM -0300, Ramiro Polla wrote:
[...]
> static LRESULT CALLBACK FrameCallbackProc( HWND hwnd, LPVIDEOHDR vdhdr )
> {
>     struct vfw_ctx *ctx;
>     AVPacket *pkt;
> 
>     ctx = (struct vfw_ctx *) SendMessage( hwnd, WM_CAP_GET_USER_DATA, 0, 0 );
>     if( !ctx )
>         return FALSE;
> 
>     pkt = ctx->pkt;
> 
>     if( av_new_packet( pkt, vdhdr->dwBytesUsed ) < 0 )
>         return FALSE;
> 
>     pkt->pts = GetTickCount( );

Doesnt vfw provide some timestamp for each frame?


[...]
>     if( s->flags & AVFMT_FLAG_NONBLOCK ) {
>         av_log( s, AV_LOG_ERROR, "Non blocking capture not yet implemented.\n" );
>         return AVERROR_PATCHWELCOME;
>     }

where is the problem with that?


[...]
> static int vfw_read_packet( AVFormatContext *s, AVPacket *pkt )
> {
>     struct vfw_ctx *ctx = s->priv_data;
>     int ret;
> 
>     ctx->pkt = pkt;
>     ctx->grabbed = 0;
> 
>     ret = SendMessage( ctx->hwnd, WM_CAP_GRAB_FRAME, 0, 0 );
>     if( !ret || !ctx->grabbed )
>         return AVERROR_IO;
> 

Hmm, cant the grabbing of the next frame be activated before returning?
If no, then i think this has to be run in a seprate thread to work
reliable.


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080305/df012ba4/attachment.pgp>



More information about the ffmpeg-devel mailing list