Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / sys / ximage / ximagepool.c
index 06a5c72..7ad88e9 100644 (file)
@@ -29,7 +29,7 @@
 
 /* Helper functions */
 #include <gst/video/video.h>
-#include <gst/video/gstmetavideo.h>
+#include <gst/video/gstvideometa.h>
 #include <gst/video/gstvideopool.h>
 
 GST_DEBUG_CATEGORY_EXTERN (gst_debug_ximagepool);
@@ -46,22 +46,22 @@ struct _GstXImageBufferPoolPrivate
   gboolean need_alignment;
 };
 
-static void gst_meta_ximage_free (GstMetaXImage * meta, GstBuffer * buffer);
+static void gst_ximage_meta_free (GstXImageMeta * meta, GstBuffer * buffer);
 
 /* ximage metadata */
 const GstMetaInfo *
-gst_meta_ximage_get_info (void)
+gst_ximage_meta_get_info (void)
 {
-  static const GstMetaInfo *meta_ximage_info = NULL;
+  static const GstMetaInfo *ximage_meta_info = NULL;
 
-  if (meta_ximage_info == NULL) {
-    meta_ximage_info = gst_meta_register ("GstMetaXImage", "GstMetaXImage",
-        sizeof (GstMetaXImage),
+  if (ximage_meta_info == NULL) {
+    ximage_meta_info = gst_meta_register ("GstXImageMeta", "GstXImageMeta",
+        sizeof (GstXImageMeta),
         (GstMetaInitFunction) NULL,
-        (GstMetaFreeFunction) gst_meta_ximage_free,
+        (GstMetaFreeFunction) gst_ximage_meta_free,
         (GstMetaCopyFunction) NULL, (GstMetaTransformFunction) NULL);
   }
-  return meta_ximage_info;
+  return ximage_meta_info;
 }
 
 /* X11 stuff */
@@ -78,14 +78,14 @@ gst_ximagesink_handle_xerror (Display * display, XErrorEvent * xevent)
   return 0;
 }
 
-static GstMetaXImage *
-gst_buffer_add_meta_ximage (GstBuffer * buffer, GstXImageBufferPool * xpool)
+static GstXImageMeta *
+gst_buffer_add_ximage_meta (GstBuffer * buffer, GstXImageBufferPool * xpool)
 {
   GstXImageSink *ximagesink;
   int (*handler) (Display *, XErrorEvent *);
   gboolean success = FALSE;
   GstXContext *xcontext;
-  GstMetaXImage *meta;
+  GstXImageMeta *meta;
   gint width, height;
   GstXImageBufferPoolPrivate *priv;
 
@@ -97,7 +97,7 @@ gst_buffer_add_meta_ximage (GstBuffer * buffer, GstXImageBufferPool * xpool)
   height = priv->padded_height;
 
   meta =
-      (GstMetaXImage *) gst_buffer_add_meta (buffer, GST_META_INFO_XIMAGE,
+      (GstXImageMeta *) gst_buffer_add_meta (buffer, GST_XIMAGE_META_INFO,
       NULL);
 #ifdef HAVE_XSHM
   meta->SHMInfo.shmaddr = ((void *) -1);
@@ -279,7 +279,7 @@ xattach_failed:
 }
 
 static void
-gst_meta_ximage_free (GstMetaXImage * meta, GstBuffer * buffer)
+gst_ximage_meta_free (GstXImageMeta * meta, GstBuffer * buffer)
 {
   GstXImageSink *ximagesink;
 
@@ -454,7 +454,7 @@ G_DEFINE_TYPE (GstXImageBufferPool, gst_ximage_buffer_pool,
 static const gchar **
 ximage_buffer_pool_get_options (GstBufferPool * pool)
 {
-  static const gchar *options[] = { GST_BUFFER_POOL_OPTION_META_VIDEO,
+  static const gchar *options[] = { GST_BUFFER_POOL_OPTION_VIDEO_META,
     GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT, NULL
   };
 
@@ -492,7 +492,7 @@ ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
   /* check for the configured metadata */
   priv->add_metavideo =
       gst_buffer_pool_config_has_option (config,
-      GST_BUFFER_POOL_OPTION_META_VIDEO);
+      GST_BUFFER_POOL_OPTION_VIDEO_META);
 
   /* parse extra alignment info */
   priv->need_alignment = gst_buffer_pool_config_has_option (config,
@@ -507,6 +507,8 @@ ximage_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config)
 
     /* we need the video metadata too now */
     priv->add_metavideo = TRUE;
+  } else {
+    gst_video_alignment_reset (&priv->align);
   }
 
   /* add the padding */
@@ -547,22 +549,22 @@ ximage_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
   GstXImageBufferPoolPrivate *priv = xpool->priv;
   GstVideoInfo *info;
   GstBuffer *ximage;
-  GstMetaXImage *meta;
+  GstXImageMeta *meta;
 
   info = &priv->info;
 
   ximage = gst_buffer_new ();
-  meta = gst_buffer_add_meta_ximage (ximage, xpool);
+  meta = gst_buffer_add_ximage_meta (ximage, xpool);
   if (meta == NULL) {
     gst_buffer_unref (ximage);
     goto no_buffer;
   }
   if (priv->add_metavideo) {
-    GstMetaVideo *meta;
+    GstVideoMeta *meta;
 
-    GST_DEBUG_OBJECT (pool, "adding GstMetaVideo");
+    GST_DEBUG_OBJECT (pool, "adding GstVideoMeta");
     /* these are just the defaults for now */
-    meta = gst_buffer_add_meta_video (ximage, 0, GST_VIDEO_INFO_FORMAT (info),
+    meta = gst_buffer_add_video_meta (ximage, 0, GST_VIDEO_INFO_FORMAT (info),
         priv->padded_width, priv->padded_height);
 
     if (priv->need_alignment) {
@@ -590,12 +592,6 @@ no_buffer:
   }
 }
 
-static void
-ximage_buffer_pool_free (GstBufferPool * pool, GstBuffer * buffer)
-{
-  gst_buffer_unref (buffer);
-}
-
 GstBufferPool *
 gst_ximage_buffer_pool_new (GstXImageSink * ximagesink)
 {
@@ -624,7 +620,6 @@ gst_ximage_buffer_pool_class_init (GstXImageBufferPoolClass * klass)
   gstbufferpool_class->get_options = ximage_buffer_pool_get_options;
   gstbufferpool_class->set_config = ximage_buffer_pool_set_config;
   gstbufferpool_class->alloc_buffer = ximage_buffer_pool_alloc;
-  gstbufferpool_class->free_buffer = ximage_buffer_pool_free;
 }
 
 static void