diff options
author | Thilo Borgmann <thilo.borgmann@mail.de> | 2019-07-08 19:39:35 +0200 |
---|---|---|
committer | Thilo Borgmann <thilo.borgmann@mail.de> | 2019-07-08 20:02:41 +0200 |
commit | 5c2e0e417ac8ff6ae34c98bb982974d65cc35deb (patch) | |
tree | 956b79b26462539dc029125fddb90292d0f6405c | |
parent | 02f65678ba9b5958cf53d1e5bc29939d941ad95f (diff) | |
download | ffmpeg-5c2e0e417ac8ff6ae34c98bb982974d65cc35deb.tar.gz |
lavd/avfoundation: Reindent after last commit.
-rw-r--r-- | libavdevice/avfoundation.m | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index a28dca7448..9ef6c3cc13 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -297,59 +297,59 @@ static int configure_video_device(AVFormatContext *s, AVCaptureDevice *video_dev // might raise an exception if no format list is given // (then fallback to default, no configuration) @try { - for (format in [video_device valueForKey:@"formats"]) { - CMFormatDescriptionRef formatDescription; - CMVideoDimensions dimensions; + for (format in [video_device valueForKey:@"formats"]) { + CMFormatDescriptionRef formatDescription; + CMVideoDimensions dimensions; - formatDescription = (CMFormatDescriptionRef) [format performSelector:@selector(formatDescription)]; - dimensions = CMVideoFormatDescriptionGetDimensions(formatDescription); + formatDescription = (CMFormatDescriptionRef) [format performSelector:@selector(formatDescription)]; + dimensions = CMVideoFormatDescriptionGetDimensions(formatDescription); - if ((ctx->width == 0 && ctx->height == 0) || - (dimensions.width == ctx->width && dimensions.height == ctx->height)) { + if ((ctx->width == 0 && ctx->height == 0) || + (dimensions.width == ctx->width && dimensions.height == ctx->height)) { - selected_format = format; + selected_format = format; - for (range in [format valueForKey:@"videoSupportedFrameRateRanges"]) { - double max_framerate; + for (range in [format valueForKey:@"videoSupportedFrameRateRanges"]) { + double max_framerate; - [[range valueForKey:@"maxFrameRate"] getValue:&max_framerate]; - if (fabs (framerate - max_framerate) < 0.01) { - selected_range = range; - break; + [[range valueForKey:@"maxFrameRate"] getValue:&max_framerate]; + if (fabs (framerate - max_framerate) < 0.01) { + selected_range = range; + break; + } } } } - } - - if (!selected_format) { - av_log(s, AV_LOG_ERROR, "Selected video size (%dx%d) is not supported by the device.\n", - ctx->width, ctx->height); - goto unsupported_format; - } - if (!selected_range) { - av_log(s, AV_LOG_ERROR, "Selected framerate (%f) is not supported by the device.\n", - framerate); - if (ctx->video_is_muxed) { - av_log(s, AV_LOG_ERROR, "Falling back to default.\n"); - } else { - goto unsupported_format; + if (!selected_format) { + av_log(s, AV_LOG_ERROR, "Selected video size (%dx%d) is not supported by the device.\n", + ctx->width, ctx->height); + goto unsupported_format; } - } - if ([video_device lockForConfiguration:NULL] == YES) { - if (selected_format) { - [video_device setValue:selected_format forKey:@"activeFormat"]; + if (!selected_range) { + av_log(s, AV_LOG_ERROR, "Selected framerate (%f) is not supported by the device.\n", + framerate); + if (ctx->video_is_muxed) { + av_log(s, AV_LOG_ERROR, "Falling back to default.\n"); + } else { + goto unsupported_format; + } } - if (selected_range) { - NSValue *min_frame_duration = [selected_range valueForKey:@"minFrameDuration"]; - [video_device setValue:min_frame_duration forKey:@"activeVideoMinFrameDuration"]; - [video_device setValue:min_frame_duration forKey:@"activeVideoMaxFrameDuration"]; + + if ([video_device lockForConfiguration:NULL] == YES) { + if (selected_format) { + [video_device setValue:selected_format forKey:@"activeFormat"]; + } + if (selected_range) { + NSValue *min_frame_duration = [selected_range valueForKey:@"minFrameDuration"]; + [video_device setValue:min_frame_duration forKey:@"activeVideoMinFrameDuration"]; + [video_device setValue:min_frame_duration forKey:@"activeVideoMaxFrameDuration"]; + } + } else { + av_log(s, AV_LOG_ERROR, "Could not lock device for configuration.\n"); + return AVERROR(EINVAL); } - } else { - av_log(s, AV_LOG_ERROR, "Could not lock device for configuration.\n"); - return AVERROR(EINVAL); - } } @catch(NSException *e) { av_log(ctx, AV_LOG_WARNING, "Configuration of video device failed, falling back to default.\n"); } @@ -486,15 +486,15 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device) // set videoSettings to an empty dict for receiving raw data of muxed devices if (ctx->capture_raw_data) { - ctx->pixel_format = pxl_fmt_spec.ff_id; - ctx->video_output.videoSettings = @{ }; + ctx->pixel_format = pxl_fmt_spec.ff_id; + ctx->video_output.videoSettings = @{ }; } else { - ctx->pixel_format = pxl_fmt_spec.ff_id; - pixel_format = [NSNumber numberWithUnsignedInt:pxl_fmt_spec.avf_id]; - capture_dict = [NSDictionary dictionaryWithObject:pixel_format - forKey:(id)kCVPixelBufferPixelFormatTypeKey]; + ctx->pixel_format = pxl_fmt_spec.ff_id; + pixel_format = [NSNumber numberWithUnsignedInt:pxl_fmt_spec.avf_id]; + capture_dict = [NSDictionary dictionaryWithObject:pixel_format + forKey:(id)kCVPixelBufferPixelFormatTypeKey]; - [ctx->video_output setVideoSettings:capture_dict]; + [ctx->video_output setVideoSettings:capture_dict]; } [ctx->video_output setAlwaysDiscardsLateVideoFrames:YES]; @@ -587,11 +587,11 @@ static int get_video_config(AVFormatContext *s) if (image_buffer) { image_buffer_size = CVImageBufferGetEncodedSize(image_buffer); - stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; - stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; - stream->codecpar->width = (int)image_buffer_size.width; - stream->codecpar->height = (int)image_buffer_size.height; - stream->codecpar->format = ctx->pixel_format; + stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; + stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + stream->codecpar->width = (int)image_buffer_size.width; + stream->codecpar->height = (int)image_buffer_size.height; + stream->codecpar->format = ctx->pixel_format; } else { stream->codecpar->codec_id = AV_CODEC_ID_DVVIDEO; stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -762,7 +762,7 @@ static int avf_read_header(AVFormatContext *s) if (ctx->video_device_index >= 0) { if (ctx->video_device_index < ctx->num_video_devices) { if (ctx->video_device_index < [devices count]) { - video_device = [devices objectAtIndex:ctx->video_device_index]; + video_device = [devices objectAtIndex:ctx->video_device_index]; } else { video_device = [devices_muxed objectAtIndex:(ctx->video_device_index - [devices count])]; ctx->video_is_muxed = 1; @@ -1025,7 +1025,7 @@ static int avf_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags |= AV_PKT_FLAG_KEY; if (image_buffer) { - status = copy_cvpixelbuffer(s, image_buffer, pkt); + status = copy_cvpixelbuffer(s, image_buffer, pkt); } else { status = 0; OSStatus ret = CMBlockBufferCopyDataBytes(block_buffer, 0, pkt->size, pkt->data); |