[Cogl] [PATCH 2/9] Fix some trailing whitespace issues

Neil Roberts neil at linux.intel.com
Fri Mar 1 05:31:53 PST 2013


---
 cogl-gst/cogl-gst-video-sink.c     | 139 ++++++++++++++++++-------------------
 examples/cogl-basic-video-player.c |  46 ++++++------
 2 files changed, 92 insertions(+), 93 deletions(-)

diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index c929f3b..c4ef968 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -306,21 +306,21 @@ cogl_gst_rgb24_upload (CoglGstVideoSink *sink,
     format = COGL_PIXEL_FORMAT_BGR_888;
   else
     format = COGL_PIXEL_FORMAT_RGB_888;
-  
+
   if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ))
     goto map_fail;
-  
-  tex = cogl_texture_new_from_data (priv->ctx, priv->info.width, 
-                                    priv->info.height, COGL_GST_TEXTURE_FLAGS, 
-                                    format, format, priv->info.stride[0], 
+
+  tex = cogl_texture_new_from_data (priv->ctx, priv->info.width,
+                                    priv->info.height, COGL_GST_TEXTURE_FLAGS,
+                                    format, format, priv->info.stride[0],
                                     frame.data[0], NULL);
-                                    
+
   gst_video_frame_unmap (&frame);
 
   create_paint_pipeline (sink, tex, NULL, NULL);
-  
+
   return TRUE;
-  
+
 map_fail:
   {
     GST_ERROR_OBJECT (sink, "Could not map incoming video frame");
@@ -353,21 +353,21 @@ cogl_gst_rgb32_upload (CoglGstVideoSink *sink,
     format = COGL_PIXEL_FORMAT_BGRA_8888;
   else
     format = COGL_PIXEL_FORMAT_RGBA_8888;
-    
+
   if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ))
     goto map_fail;
 
-  tex = cogl_texture_new_from_data (priv->ctx, priv->info.width, 
-                                    priv->info.height, COGL_GST_TEXTURE_FLAGS, 
-                                    format, format, priv->info.stride[0], 
+  tex = cogl_texture_new_from_data (priv->ctx, priv->info.width,
+                                    priv->info.height, COGL_GST_TEXTURE_FLAGS,
+                                    format, format, priv->info.stride[0],
                                     frame.data[0], NULL);
-                                    
+
   gst_video_frame_unmap (&frame);
 
   create_paint_pipeline (sink, tex, NULL, NULL);
-  
+
   return TRUE;
-  
+
 map_fail:
   {
     GST_ERROR_OBJECT (sink, "Could not map incoming video frame");
@@ -394,37 +394,37 @@ cogl_gst_yv12_upload (CoglGstVideoSink *sink,
   CoglTexture *y_tex, *u_tex, *v_tex;
   GstVideoFrame frame;
   CoglPixelFormat format = COGL_PIXEL_FORMAT_G_8;
-  
+
   if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ))
     goto map_fail;
 
-  y_tex = 
-     cogl_texture_new_from_data (priv->ctx, 
-                                 GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 0), 
+  y_tex =
+     cogl_texture_new_from_data (priv->ctx,
+                                 GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 0),
                                  GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 0),
                                  COGL_GST_TEXTURE_FLAGS, format, format,
                                  priv->info.stride[0], frame.data[0], NULL);
 
-  u_tex = 
-     cogl_texture_new_from_data (priv->ctx, 
-                                 GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 1), 
+  u_tex =
+     cogl_texture_new_from_data (priv->ctx,
+                                 GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 1),
                                  GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 1),
                                  COGL_GST_TEXTURE_FLAGS, format, format,
                                  priv->info.stride[1], frame.data[1], NULL);
 
-  v_tex = 
-     cogl_texture_new_from_data (priv->ctx, 
-                                 GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 2), 
+  v_tex =
+     cogl_texture_new_from_data (priv->ctx,
+                                 GST_VIDEO_INFO_COMP_WIDTH (&priv->info, 2),
                                  GST_VIDEO_INFO_COMP_HEIGHT (&priv->info, 2),
                                  COGL_GST_TEXTURE_FLAGS, format, format,
                                  priv->info.stride[2], frame.data[2], NULL);
-                                 
+
   gst_video_frame_unmap (&frame);
 
   create_paint_pipeline (sink, y_tex, u_tex, v_tex);
-  
+
   return TRUE;
-  
+
 map_fail:
   {
     GST_ERROR_OBJECT (sink, "Could not map incoming video frame");
@@ -486,21 +486,21 @@ cogl_gst_ayuv_upload (CoglGstVideoSink *sink,
   CoglPixelFormat format = COGL_PIXEL_FORMAT_RGBA_8888;
   CoglTexture *tex;
   GstVideoFrame frame;
-  
+
   if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ))
     goto map_fail;
 
-  tex = cogl_texture_new_from_data (priv->ctx, priv->info.width, 
-                                    priv->info.height, COGL_GST_TEXTURE_FLAGS, 
+  tex = cogl_texture_new_from_data (priv->ctx, priv->info.width,
+                                    priv->info.height, COGL_GST_TEXTURE_FLAGS,
                                     format, format, priv->info.stride[0],
                                     frame.data[0], NULL);
-                                    
+
   gst_video_frame_unmap (&frame);
 
   create_paint_pipeline (sink, tex, NULL, NULL);
-  
+
   return TRUE;
-  
+
 map_fail:
   {
     GST_ERROR_OBJECT (sink, "Could not map incoming video frame");
@@ -536,32 +536,32 @@ cogl_gst_hw_deinit (CoglGstVideoSink* sink)
 }
 
 static void
-cogl_gst_hw_upload (CoglGstVideoSink *sink, 
+cogl_gst_hw_upload (CoglGstVideoSink *sink,
                     GstBuffer *buffer)
 {
   CoglGstVideoSinkPriv *priv = sink->priv;
   GstSurfaceMeta* surface = gst_buffer_get_surface_meta (buffer);
 
   g_return_if_fail (surface != NULL);
-  
+
   if (G_UNLIKELY (priv->converter == NULL))
     {
       CoglTexture* tex;
       unsigned int gl_tex;
       unsigned int gl_tar;
       GValue value = {0};
-      
-      tex = cogl_texture_new_with_size (priv->ctx, priv->info.width, 
-                                        priv->info.height, 
-                                        COGL_GST_TEXTURE_FLAGS, 
+
+      tex = cogl_texture_new_with_size (priv->ctx, priv->info.width,
+                                        priv->info.height,
+                                        COGL_GST_TEXTURE_FLAGS,
                                         COGL_PIXEL_FORMAT_BGRA_8888, NULL);
-                                        
+
       cogl_pipeline_set_layer_texture (priv->pipeline, 0, tex);
       cogl_texture_get_gl_texture (tex, &gl_texture, &gl_target);
-      
+
       g_value_init (&value, gl_texture);
       g_value_set_uint (&value, gl_texture);
-      
+
       priv->converter = gst_surface_meta_create_converter (surface, "opengl"
                                                            &value);
       cogl_object_unref (tex);
@@ -693,7 +693,7 @@ cogl_gst_video_sink_get_caps (GstBaseSink *bsink,
 
 static CoglBool
 cogl_gst_video_sink_parse_caps (GstCaps *caps,
-                                CoglGstVideoSink *sink, 
+                                CoglGstVideoSink *sink,
                                 CoglBool save)
 {
   CoglGstVideoSinkPrivate *priv = sink->priv;
@@ -702,16 +702,16 @@ cogl_gst_video_sink_parse_caps (GstCaps *caps,
   CoglGstVideoFormat format;
   CoglBool bgr = FALSE;
   CoglGstRenderer* renderer;
-  
+
   intersection = gst_caps_intersect (priv->caps, caps);
   if (gst_caps_is_empty (intersection))
     goto no_intersection;
-    
+
   gst_caps_unref (intersection);
-  
+
   if (!gst_video_info_from_caps (&vinfo, caps))
     goto unknown_format;
-    
+
   switch (vinfo.finfo->format) {
     case GST_VIDEO_FORMAT_YV12:
       format = COGL_GST_YV12;
@@ -742,7 +742,7 @@ cogl_gst_video_sink_parse_caps (GstCaps *caps,
     default:
       goto unhandled_format;
   }
-  
+
   renderer = cogl_gst_find_renderer_by_format (sink, format);
 
   if (G_UNLIKELY (renderer == NULL))
@@ -818,7 +818,7 @@ cogl_gst_source_dispatch (GSource *source,
   GstBuffer *buffer;
 
   g_mutex_lock (&gst_source->buffer_lock);
-  
+
   if (G_UNLIKELY (gst_source->has_new_caps))
     {
       GstCaps *caps =
@@ -827,27 +827,27 @@ cogl_gst_source_dispatch (GSource *source,
 
       if (priv->renderer)
         priv->renderer->deinit (gst_source->sink);
-      
+
       if (!cogl_gst_video_sink_parse_caps (caps, gst_source->sink, TRUE))
         goto negotiation_fail;
 
       priv->renderer->init (gst_source->sink);
       gst_source->has_new_caps = FALSE;
     }
-  
+
   buffer = gst_source->buffer;
   gst_source->buffer = NULL;
 
   g_mutex_unlock (&gst_source->buffer_lock);
 
-  if (buffer) 
+  if (buffer)
     {
       if (!priv->renderer->upload (gst_source->sink, buffer))
         goto fail_upload;
 
       g_signal_emit_by_name (gst_source->sink, "cogl-gst-new-frame", NULL);
       gst_buffer_unref (buffer);
-    } 
+    }
   else
     GST_WARNING_OBJECT (gst_source->sink, "No buffers available for display");
 
@@ -920,22 +920,22 @@ _cogl_gst_video_sink_render (GstBaseSink *bsink,
   CoglGstVideoSink *sink = COGL_GST_VIDEO_SINK (bsink);
   CoglGstVideoSinkPrivate *priv = sink->priv;
   CoglGstSource *gst_source = priv->source;
-  
+
   g_mutex_lock (&gst_source->buffer_lock);
-  
+
   if (G_UNLIKELY (priv->flow_return != GST_FLOW_OK))
     goto dispatch_flow_ret;
-  
+
   if (gst_source->buffer)
     gst_buffer_unref (gst_source->buffer);
-    
+
   gst_source->buffer = gst_buffer_ref (buffer);
   g_mutex_unlock (&gst_source->buffer_lock);
 
   g_main_context_wakeup (priv->g_ctx);
 
   return GST_FLOW_OK;
-  
+
   dispatch_flow_ret:
   {
     g_mutex_unlock (&gst_source->buffer_lock);
@@ -951,8 +951,8 @@ cogl_gst_video_sink_dispose (GObject *object)
 
   self = COGL_GST_VIDEO_SINK (object);
   priv = self->priv;
-  
-  if (priv->renderer) 
+
+  if (priv->renderer)
     {
       priv->renderer->deinit (self);
       priv->renderer = NULL;
@@ -1057,21 +1057,21 @@ cogl_gst_video_sink_class_init (CoglGstVideoSinkClass *klass)
   GObjectClass *go_class = G_OBJECT_CLASS (klass);
   GstBaseSinkClass *gb_class = GST_BASE_SINK_CLASS (klass);
   GstElementClass *ge_class = GST_ELEMENT_CLASS (klass);
-  GParamSpec *pspec; 
+  GParamSpec *pspec;
 
   g_type_class_add_private (klass, sizeof (CoglGstVideoSinkPrivate));
   go_class->set_property = cogl_gst_video_sink_set_property;
   go_class->get_property = cogl_gst_video_sink_get_property;
   go_class->dispose = cogl_gst_video_sink_dispose;
   go_class->finalize = cogl_gst_video_sink_finalize;
-  
-  gst_element_class_add_pad_template (ge_class, 
+
+  gst_element_class_add_pad_template (ge_class,
                                       gst_static_pad_template_get (&sinktemplate_all));
   gst_element_class_set_metadata (ge_class, "Cogl video sink", "Sink/Video",
             "Sends video data from GStreamer to a Cogl pipeline",
             "Jonathan Matthew <jonathan at kaolin.wh9.net>, "
             "Matthew Allum <mallum at o-hand.com, "
-            "Chris Lord <chris at o-hand.com>, " 
+            "Chris Lord <chris at o-hand.com>, "
             "Plamena Manolova <plamena.n.manolova at intel.com>");
 
   gb_class->render = _cogl_gst_video_sink_render;
@@ -1093,8 +1093,8 @@ cogl_gst_video_sink_class_init (CoglGstVideoSinkClass *klass)
   g_signal_new ("cogl-pipeline-ready", COGL_GST_TYPE_VIDEO_SINK,
                 G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
                 G_TYPE_NONE, 0, G_TYPE_NONE);
-                
-  g_signal_new ("cogl-gst-new-frame", COGL_GST_TYPE_VIDEO_SINK, 
+
+  g_signal_new ("cogl-gst-new-frame", COGL_GST_TYPE_VIDEO_SINK,
                 G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
                 G_TYPE_NONE, 0, G_TYPE_NONE);
 }
@@ -1104,7 +1104,7 @@ cogl_gst_video_sink_new (CoglContext *ctx)
 {
   CoglGstVideoSink* sink = g_object_new (COGL_GST_TYPE_VIDEO_SINK, NULL);
   cogl_gst_video_sink_set_context (sink, ctx);
-  
+
   return sink;
 }
 
@@ -1127,6 +1127,5 @@ GST_PLUGIN_DEFINE (
     "CoglGst",
     "http://gstreamer.net/"
 )
-                   
-      
+
 
diff --git a/examples/cogl-basic-video-player.c b/examples/cogl-basic-video-player.c
index d2639ea..3e61a8a 100644
--- a/examples/cogl-basic-video-player.c
+++ b/examples/cogl-basic-video-player.c
@@ -62,8 +62,8 @@ _draw  (gpointer instance,
         gpointer user_data)
 {
   Data *data = (Data*) user_data;
-  
-  /* 
+
+  /*
     The cogl pipeline needs to be retrieved from the sink before every draw.
     This is due to the cogl-gst sink creating a new cogl pipeline for each frame
     by copying the previous one and attaching the new frame to it.
@@ -89,9 +89,9 @@ _draw  (gpointer instance,
   return TRUE;
 }
 
-/* 
+/*
   A callback like this should be attached to the cogl-pipeline-ready
-  signal. This way requesting the cogl pipeline before its creation 
+  signal. This way requesting the cogl pipeline before its creation
   by the sink is avoided. At this point, user textures and snippets can
   be added to the cogl pipeline.
 */
@@ -99,11 +99,11 @@ _draw  (gpointer instance,
 static void
 _set_up_pipeline (gpointer instance,
                   gpointer user_data)
-{    
+{
   Data* data = (Data*) user_data;
-  
+
   /*
-    The cogl-gst sink, depending on the video format, can use up to 3 texture 
+    The cogl-gst sink, depending on the video format, can use up to 3 texture
     layers to render a frame. To avoid overwriting frame data, the first
     free layer in the cogl pipeline needs to be queried before adding any
     additional textures.
@@ -122,10 +122,10 @@ _set_up_pipeline (gpointer instance,
 
   cogl_onscreen_add_frame_callback(COGL_ONSCREEN (data->fb), _frame_callback,
                                    &data, NULL);
-                                   
-  /* 
-     The cogl-gst-new-frame signal is emitted when the cogl-gst sink has 
-     retrieved a new frame and attached it to the cogl pipeline. This can be 
+
+  /*
+     The cogl-gst-new-frame signal is emitted when the cogl-gst sink has
+     retrieved a new frame and attached it to the cogl pipeline. This can be
      used to make sure cogl doesn't do any unnecessary drawing i.e. keeps to the
      frame-rate of the video.
   */
@@ -149,7 +149,7 @@ main (int argc,
   char *uri;
 
   /* Set the necessary cogl elements */
-  
+
   ctx = cogl_context_new (NULL, NULL);
   onscreen = cogl_onscreen_new (ctx, 640, 480);
   data.fb = COGL_FRAMEBUFFER (onscreen);
@@ -169,22 +169,22 @@ main (int argc,
   cogl_framebuffer_set_modelview_matrix (data.fb, &view);
 
   /* Intialize GStreamer */
- 
+
   gst_init (&argc, &argv);
-  
-  /* 
+
+  /*
      Create the cogl-gst video sink by calling the cogl_gst_video_sink_new
      function and passing it a CoglContext (this is used to create the
-     CoglPipeline and the texures for each frame). Alternatively you can use 
+     CoglPipeline and the texures for each frame). Alternatively you can use
      gst_element_factory_make ("coglsink", "some_name") and then set the
      context with cogl_gst_video_sink_set_context.
   */
 
-  data.sink = cogl_gst_video_sink_new (ctx); 
-  
+  data.sink = cogl_gst_video_sink_new (ctx);
+
   pipeline = gst_pipeline_new ("gst-player");
   bin = gst_element_factory_make ("playbin", "bin");
-  
+
   if (argc < 2)
     uri = "http://docs.gstreamer.com/media/sintel_trailer-480p.webm";
   else
@@ -196,12 +196,12 @@ main (int argc,
   gst_bin_add (GST_BIN (pipeline), bin);
 
   g_object_set (G_OBJECT (bin), "uri", uri, NULL);
-  
+
   gst_element_set_state (pipeline, GST_STATE_PLAYING);
   bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
   gst_bus_add_watch (bus, _bus_watch, &data);
-  
-  /* 
+
+  /*
     Retrieve the GMainLoop from the cogl-gst sink. GStreamer makes the use of a
     GMainLoop necessary .
   */
@@ -210,7 +210,7 @@ main (int argc,
 
   /*
     The cogl-pipeline-ready signal tells you when the cogl pipeline is
-    initialized i.e. when cogl-gst has figured out the video format and 
+    initialized i.e. when cogl-gst has figured out the video format and
     is prepared to retrieve and attach the first frame of the video.
   */
 
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list