[FFmpeg-devel] iSight camera support

Lukasz M lukasz.m.luki at gmail.com
Wed Oct 30 00:26:24 CET 2013

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

+- (id)initWithContext:(CaptureContext*)context
+    [super init];
+    _context = context;
+    return self;

if should be
- (id)initWithContext:(CaptureContext*)context
    if (self = [super init]) {
        _context = context;
    return self;

inside isight_read_header you print several errors, but you don't return
and flow continue.

NSError* error;
It seems to be unsed inside isight_read_header, you can pass just nils
(unless framework insist)

+    // Take stream info from the first frame.
+    while( ctx->frames_captured < 1 )
+    {
+        CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, YES);
+        usleep(100);
+    }
You can add time intercal instead of usleep.

instead of do {} while and usleep(1000000/60); when there is not new frame
captured, you can add pthread_cond_wait and wait. signal from delegate.

In general you should fix formatting and styles. It is messy.

As I said im iOS developer, not Mac, I'm also not sure about memory
management. This dev will be compiled into C library. Which may be linked
with C program (like ffmpeg) which is not objectiveC program.
It has no Autorelease pool and all objects that are released with
autorelease method (inside QTKit) will probably leak.  I never used objC
lib in C program so I'm not quite sure about that.
Did you profile it for mem leaks?

It would be easier to review when you squash patches. Last one adds new
line only. :)

More information about the ffmpeg-devel mailing list