[FFmpeg-devel] iSight camera support

Lukasz M lukasz.m.luki at gmail.com
Wed Oct 30 11:39:16 CET 2013


On 30 October 2013 03:53, Vadim Kalinsky <vadim at kalinsky.ru> wrote:

>
> On 2013-10-29, at 7:26 PM, Lukasz M <lukasz.m.luki at gmail.com> wrote:
>
> Thanks for your comments, Lukasz
>
> > On 28 October 2013 21:21, Vadim Kalinsky <vadim at kalinsky.ru> wrote:
> >
> > I'm not Mac developer, but iOS and also don't know QTKit, but have few
> > remarsk after quick look
> >
> > In general you should fix formatting and styles. It is messy.
>
> I tried to keep Objective-C "camel case" style in Objective-C code.
>
> > It would be easier to review when you squash patches. Last one adds new
> > line only. :)
>
>
> I created the patch from github pull request, seems like this feature
> doesn't work well there.
>
> New patch attached.
>

I was thinking about this:

static int isight_read_packet(AVFormatContext *s, AVPacket *pkt)
{
    CaptureContext* ctx = (CaptureContext*)s->priv_data;
    lock_frames(ctx);

    if( ctx->current_frame == nil )
        pthread_cond_wait(&ctx->frame_wait_cond, &ctx->frame_lock);

    CVPixelBufferLockBaseAddress(ctx->current_frame, 0);
[...]
    ctx->current_frame = nil;

    unlock_frames(ctx);
    return 0
}

It is a bit easier.

Also, I think Autorelease pool should be moved to CaptureContext.
call [pool drain] at the end of isight_read_header and isight_read_packet
and [pool release] in destroy_context.
Otherwise autoreleased objects during capture will leak if no pool from
"outside" is provided.


More information about the ffmpeg-devel mailing list