iphone - writeImageToSavedPhotosAlbum save only a few images -


i've been following apples example, qa1702, on how capture images using avfoundation. won't cite code here because of space concern. brief description of i'm trying achieve: use iphone camera pass "video" (actually sequence of images) web server, , know possible. in order able pass image using http post in this example, have save image. not in photos album wan't able view pictures there in debug purposes.

the apple qa1702 contains 3 methods:

- (void)setupcapturesession   - (void)captureoutput:(avcaptureoutput *)captureoutput      didoutputsamplebuffer:(cmsamplebufferref)samplebuffer      fromconnection:(avcaptureconnection *)connection  //this modified void might see, - (void) imagefromsamplebuffer:(cmsamplebufferref) samplebuffer 

in setupcapturesession start session in example. captureoutput running imagefromsamplebuffer, , that's i've added changes:

// create quartz image pixel data in bitmap graphics context cgimageref quartzimage = cgbitmapcontextcreateimage(context);  // unlock pixel buffer cvpixelbufferunlockbaseaddress(imagebuffer,0);  // free context , color space cgcontextrelease(context);  cgcolorspacerelease(colorspace);  //library declared in .h , alassetslibrary [library writeimagetosavedphotosalbum:quartzimage orientation:alassetorientationdown completionblock:nil];  // release quartz image cgimagerelease(quartzimage);  

i've removed creation of uiimage , changed void typ since writeimagetosavedphotosalbum: cgimageref here instead.

the problem see during 10sec capture images ~150 calls captureoutput made, , therefor same amount writeimagetosavedphotos ~5-10 pictures saved. i'm aware of memory abuse since i'm not getting warnings can't figure out why not more images created. , can it? because, , i'm guessing now, writeimagetosavedphotos starts new threads , iphone can't handle more amount of threads. i've read nsoperationqueue, should it?

on side note, use nstimer in setupcapturesession:

    [nstimer scheduledtimerwithtimeinterval: 10.0 target:self selector:@selector(timerfiremethod:) userinfo:nil repeats: no]; 

however want start in first call captureoutput in order avoid time elapsing during startup of video camera. if move code line captureoutput timerfiremethod: never called? ideas?

this solvable nsoperationqueue, no longer interesting me since writing file way ineffective applications.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -