+ NSSize encoded_size = [[camera_format attributeForKey:QTFormatDescriptionVideoEncodedPixelsSizeAttribute] sizeValue];
+ NSSize display_size = [[camera_format attributeForKey:QTFormatDescriptionVideoCleanApertureDisplaySizeAttribute] sizeValue];
+ NSSize par_size = [[camera_format attributeForKey:QTFormatDescriptionVideoProductionApertureDisplaySizeAttribute] sizeValue];
+
+ fmt.video.i_width = p_sys->width = encoded_size.width;
+ fmt.video.i_height = p_sys->height = encoded_size.height;
+ if( par_size.width != encoded_size.width )
+ {
+ fmt.video.i_sar_num = (int64_t)encoded_size.height * par_size.width / encoded_size.width;
+ fmt.video.i_sar_den = encoded_size.width;
+ }
+
+ NSLog( @"encoded_size %d %d", (int)encoded_size.width, (int)encoded_size.height );
+ NSLog( @"display_size %d %d", (int)display_size.width, (int)display_size.height );
+ NSLog( @"PAR size %d %d", (int)par_size.width, (int)par_size.height );
+
+ [p_sys->output setPixelBufferAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt: p_sys->height], kCVPixelBufferHeightKey,
+ [NSNumber numberWithInt: p_sys->width], kCVPixelBufferWidthKey,
+ [NSNumber numberWithBool:YES], (id)kCVPixelBufferOpenGLCompatibilityKey,
+ nil]];
+
+ p_sys->session = [[QTCaptureSession alloc] init];
+
+ bool ret = [p_sys->session addInput:input error: &o_returnedError];
+ if( !ret )
+ {
+ msg_Err( p_demux, "default video capture device could not be added to capture session (%ld)", [o_returnedError code] );
+ goto error;
+ }
+
+ ret = [p_sys->session addOutput:p_sys->output error: &o_returnedError];
+ if( !ret )
+ {
+ msg_Err( p_demux, "output could not be added to capture session (%ld)", [o_returnedError code] );
+ goto error;
+ }
+
+ [p_sys->session startRunning];