简体   繁体   中英

How can I know whether camera supports a resolution or not in mac os x

I am working on a project and recently switch to objective c for a small period of time. I am facing some problem in mac osx while capturing video from camera using qtkit. I am currently using "setPixelBufferAttributes" to set different properties of captured video. The problem is :

  1. If camera does not support 640 X 360 resolution and i am setting it using "setPixelBufferAttributes" then also video is captured and internally converted to 640 X 360 Which I dont need. So I don't want automatic conversion of resolutions.

  2. I want all supported resolutions supported by camera hardware directly.

Please guide me if any other API is also present...

This code will enumerate the size of the video source from the QTCaptureDevice :

    [captureDevice.formatDescriptions enumerateObjectsUsingBlock:^(QTFormatDescription* formatDescription, NSUInteger idx, BOOL* stop) {
        NSDictionary* attributes = [formatDescription formatDescriptionAttributes];
        NSValue* videoEncodedPixelsSize = [attributes objectForKey:@"videoEncodedPixelsSize"];
        NSSize videoSize = [videoEncodedPixelsSize sizeValue];
        NSLog(@"%@", NSStringFromSize(videoSize));
    }];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM