[FFmpeg-cvslog] vda: use K&R style.

Clément Bœsch git at videolan.org
Tue Nov 15 00:52:39 CET 2011


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Tue Nov 15 00:17:31 2011 +0100| [edc26bfae59055bac90853dbc3f9fc9fc959cc1a] | committer: Sebastien Zwickert

vda: use K&R style.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=edc26bfae59055bac90853dbc3f9fc9fc959cc1a
---

 libavcodec/vda.c |   70 ++++++++++++++++++++++++------------------------------
 libavcodec/vda.h |    4 +--
 2 files changed, 32 insertions(+), 42 deletions(-)

diff --git a/libavcodec/vda.c b/libavcodec/vda.c
index ade961e..aaf5ba0 100644
--- a/libavcodec/vda.c
+++ b/libavcodec/vda.c
@@ -38,21 +38,20 @@
 /* Mutex manager callback. */
 static int vda_lock_operation(void **mtx, enum AVLockOp op)
 {
-    switch(op)
-    {
-        case AV_LOCK_CREATE:
-            *mtx = av_malloc(sizeof(pthread_mutex_t));
-            if(!*mtx)
-                return 1;
-            return !!pthread_mutex_init(*mtx, NULL);
-        case AV_LOCK_OBTAIN:
-            return !!pthread_mutex_lock(*mtx);
-        case AV_LOCK_RELEASE:
-            return !!pthread_mutex_unlock(*mtx);
-        case AV_LOCK_DESTROY:
-            pthread_mutex_destroy(*mtx);
-            av_freep(mtx);
-            return 0;
+    switch (op) {
+    case AV_LOCK_CREATE:
+        *mtx = av_malloc(sizeof(pthread_mutex_t));
+        if (!*mtx)
+            return 1;
+        return !!pthread_mutex_init(*mtx, NULL);
+    case AV_LOCK_OBTAIN:
+        return !!pthread_mutex_lock(*mtx);
+    case AV_LOCK_RELEASE:
+        return !!pthread_mutex_unlock(*mtx);
+    case AV_LOCK_DESTROY:
+        pthread_mutex_destroy(*mtx);
+        av_freep(mtx);
+        return 0;
     }
     return 1;
 }
@@ -62,12 +61,12 @@ static CFDictionaryRef vda_dictionary_with_pts(int64_t i_pts)
 {
     CFStringRef key = CFSTR("FF_VDA_DECODER_PTS_KEY");
     CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &i_pts);
-    CFDictionaryRef user_info = CFDictionaryCreate( kCFAllocatorDefault,
-                                                    (const void **)&key,
-                                                    (const void **)&value,
-                                                    1,
-                                                    &kCFTypeDictionaryKeyCallBacks,
-                                                    &kCFTypeDictionaryValueCallBacks);
+    CFDictionaryRef user_info = CFDictionaryCreate(kCFAllocatorDefault,
+                                                   (const void **)&key,
+                                                   (const void **)&value,
+                                                   1,
+                                                   &kCFTypeDictionaryKeyCallBacks,
+                                                   &kCFTypeDictionaryValueCallBacks);
     CFRelease(value);
     return user_info;
 }
@@ -96,8 +95,7 @@ static void vda_clear_queue(struct vda_context *vda_ctx)
 
     vda_lock_operation(&vda_ctx->queue_mutex, AV_LOCK_OBTAIN);
 
-    while (vda_ctx->queue)
-    {
+    while (vda_ctx->queue) {
         top_frame = vda_ctx->queue;
         vda_ctx->queue = top_frame->next_frame;
         ff_vda_release_vda_frame(top_frame);
@@ -136,23 +134,18 @@ static void vda_decoder_callback (void *vda_hw_ctx,
 
     queue_walker = vda_ctx->queue;
 
-    if (!queue_walker || (new_frame->pts < queue_walker->pts))
-    {
+    if (!queue_walker || (new_frame->pts < queue_walker->pts)) {
         /* we have an empty queue, or this frame earlier than the current queue head */
         new_frame->next_frame = queue_walker;
         vda_ctx->queue = new_frame;
-    }
-    else
-    {
+    } else {
         /* walk the queue and insert this frame where it belongs in display order */
         vda_frame *next_frame;
 
-        while (1)
-        {
+        while (1) {
             next_frame = queue_walker->next_frame;
 
-            if (!next_frame || (new_frame->pts < next_frame->pts))
-            {
+            if (!next_frame || (new_frame->pts < next_frame->pts)) {
                 new_frame->next_frame = next_frame;
                 queue_walker->next_frame = new_frame;
                 break;
@@ -219,11 +212,11 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
                          kCVPixelBufferIOSurfacePropertiesKey,
                          io_surface_properties);
 
-    status = VDADecoderCreate( config_info,
-                               buffer_attributes,
-                               (VDADecoderOutputCallback *)vda_decoder_callback,
-                               vda_ctx,
-                               &vda_ctx->decoder );
+    status = VDADecoderCreate(config_info,
+                              buffer_attributes,
+                              (VDADecoderOutputCallback *)vda_decoder_callback,
+                              vda_ctx,
+                              &vda_ctx->decoder);
 
     CFRelease(height);
     CFRelease(width);
@@ -278,8 +271,7 @@ vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx)
 
 void ff_vda_release_vda_frame(vda_frame *frame)
 {
-    if (frame)
-    {
+    if (frame) {
         CVPixelBufferRelease(frame->cv_buffer);
         av_freep(&frame);
     }
diff --git a/libavcodec/vda.h b/libavcodec/vda.h
index 9a2af2d..5ff8070 100644
--- a/libavcodec/vda.h
+++ b/libavcodec/vda.h
@@ -36,8 +36,7 @@
 /**
  *  This structure is used to store a decoded frame information and data.
  */
-typedef struct
-{
+typedef struct {
     /**
     * The PTS of the frame.
     *
@@ -71,7 +70,6 @@ typedef struct
  * The application must make it available as AVCodecContext.hwaccel_context.
  */
 struct vda_context {
-
     /**
     * VDA decoder object.
     *



More information about the ffmpeg-cvslog mailing list