[FFmpeg-devel] [PATCH 3/3] lavd/avfoundation: Reindentions and comment improvements.

Thilo Borgmann thilo.borgmann at mail.de
Tue Nov 24 19:32:22 CET 2015


-------------- next part --------------
From bcf7a6b966469902a080c4f52c4c091fa19c286c Mon Sep 17 00:00:00 2001
From: Thilo Borgmann <thilo.borgmann at mail.de>
Date: Tue, 24 Nov 2015 19:08:39 +0100
Subject: [PATCH 3/3] lavd/avfoundation: Reindentions and comment improvements.

---
 libavdevice/avfoundation.m | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 20341ef..8119820 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -206,9 +206,9 @@ static int configure_video_device(AVFormatContext *s, AVCaptureDevice *video_dev
     AVFContext *ctx = (AVFContext*)s->priv_data;
 
     double framerate = av_q2d(ctx->framerate);
-    NSObject *range = nil;
+    NSObject *range  = nil;
     NSObject *format = nil;
-    NSObject *selected_range = nil;
+    NSObject *selected_range  = nil;
     NSObject *selected_format = nil;
 
     for (format in [video_device valueForKey:@"formats"]) {
@@ -304,7 +304,7 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device)
 
     if (!capture_input) {
         av_log(s, AV_LOG_ERROR, "Failed to create AV capture input device: %s\n",
-               [[error localizedDescription] UTF8String]);
+            [[error localizedDescription] UTF8String]);
         return 1;
     }
 
@@ -364,14 +364,14 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device)
     // check if selected pixel format is supported by AVFoundation
     if (pxl_fmt_spec.ff_id == AV_PIX_FMT_NONE) {
         av_log(s, AV_LOG_ERROR, "Selected pixel format (%s) is not supported by AVFoundation.\n",
-               av_get_pix_fmt_name(pxl_fmt_spec.ff_id));
+            av_get_pix_fmt_name(pxl_fmt_spec.ff_id));
         return 1;
     }
 
     // check if the pixel format is available for this device
     if ([[ctx->video_output availableVideoCVPixelFormatTypes] indexOfObject:[NSNumber numberWithInt:pxl_fmt_spec.avf_id]] == NSNotFound) {
         av_log(s, AV_LOG_ERROR, "Selected pixel format (%s) is not supported by the input device.\n",
-               av_get_pix_fmt_name(pxl_fmt_spec.ff_id));
+            av_get_pix_fmt_name(pxl_fmt_spec.ff_id));
 
         pxl_fmt_spec.ff_id = AV_PIX_FMT_NONE;
 
@@ -405,10 +405,10 @@ static int add_video_device(AVFormatContext *s, AVCaptureDevice *video_device)
         }
     }
 
-    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 setAlwaysDiscardsLateVideoFrames:YES];
@@ -432,7 +432,7 @@ static int add_audio_device(AVFormatContext *s, AVCaptureDevice *audio_device)
 
     if (!audio_dev_input) {
         av_log(s, AV_LOG_ERROR, "Failed to create AV capture input device: %s\n",
-               [[error localizedDescription] UTF8String]);
+            [[error localizedDescription] UTF8String]);
         return 1;
     }
 
@@ -644,6 +644,7 @@ static int avf_read_header(AVFormatContext *s)
         sscanf(ctx->audio_filename, "%d", &ctx->audio_device_index);
     }
 
+    // select video device by index
     if (ctx->video_device_index >= 0) {
         if (ctx->video_device_index < ctx->num_video_devices) {
             video_device = [devices objectAtIndex:ctx->video_device_index];
@@ -729,7 +730,7 @@ static int avf_read_header(AVFormatContext *s)
         }
     }
 
-    // get audio device
+    // select audio device by index
     if (ctx->audio_device_index >= 0) {
         NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeAudio];
 
-- 
2.3.2 (Apple Git-55)



More information about the ffmpeg-devel mailing list