video: parse number of views
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 22 Aug 2011 13:57:30 +0000 (15:57 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 22 Aug 2011 13:57:30 +0000 (15:57 +0200)
Parse the number of views in multiview video buffers.

docs/design/draft-media-types.txt
gst-libs/gst/video/gstmetavideo.h
gst-libs/gst/video/video.c
gst-libs/gst/video/video.h

index b4f3e43..4b7c891 100644 (file)
@@ -3,19 +3,23 @@ Media Types
 
  video/x-raw
 
-  width, G_TYPE_INT
+  width, G_TYPE_INT, mandatory
     The width of the image in pixels.
 
-  height, G_TYPE_INT
+  height, G_TYPE_INT, mandatory
     The height of the image in pixels
 
-  framerate, GST_TYPE_FRACTION
+  framerate, GST_TYPE_FRACTION, default 0/1
     The framerate of the video 0/1 for variable framerate
 
-  pixel-aspect-ratio, GST_TYPE_FRACTION
+  pixel-aspect-ratio, GST_TYPE_FRACTION, default 1/1
     The pixel aspect ration of the video
 
-  format, G_TYPE_STRING
+  views, G_TYPE_INT, default 1
+    The number of views for multiview video. Each buffer contains
+    multiple GstMetaVideo buffers that describe each view.
+
+  format, G_TYPE_STRING, mandatory
     The format of the video
 
   *  "I420" planar 4:2:0 YUV
index e88b0b5..858d048 100644 (file)
@@ -37,7 +37,11 @@ typedef struct _GstMetaVideoCrop GstMetaVideoCrop;
 /**
  * GstMetaVideo:
  * @meta: parent #GstMeta
+ * @buffer: the buffer this metadata belongs to
  * @flags: additional video flags
+ * @format: the video format
+ * @width: the video width
+ * @height: the video height
  * @n_planes: the number of planes in the image
  * @offset: array of offsets for the planes
  * @stride: array of strides for the planes
index d860340..e714843 100644 (file)
@@ -572,6 +572,7 @@ gst_video_info_init (GstVideoInfo * info)
   g_return_if_fail (info != NULL);
 
   memset (info, 0, sizeof (GstVideoInfo));
+  info->views = 1;
   /* arrange for sensible defaults, e.g. if turned into caps */
   info->fps_n = 0;
   info->fps_d = 1;
@@ -622,7 +623,7 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
   GstStructure *structure;
   const gchar *s;
   GstVideoFormat format;
-  gint width, height;
+  gint width, height, views;
   gint fps_n, fps_d;
   gboolean interlaced;
   gint par_n, par_d;
@@ -667,6 +668,11 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
   else
     info->flags &= ~GST_VIDEO_FLAG_INTERLACED;
 
+  if (gst_structure_get_int (structure, "views", &views))
+    info->views = views;
+  else
+    info->views = 1;
+
   s = gst_structure_get_string (structure, "color-matrix");
   if (s)
     info->color_matrix = s;
@@ -752,6 +758,8 @@ gst_video_info_to_caps (GstVideoInfo * info)
   if (info->chroma_site)
     gst_caps_set_simple (caps, "chroma-site", G_TYPE_STRING, info->chroma_site,
         NULL);
+  if (info->views > 1)
+    gst_caps_set_simple (caps, "views", G_TYPE_INT, info->views, NULL);
 
   return caps;
 }
index 290da71..59e68fc 100644 (file)
@@ -329,6 +329,7 @@ typedef enum {
  * @flags: additional video flags
  * @width: the width of the video
  * @height: the height of the video
+ * @views: the number of views for multiview video
  * @size: the default size of one frame
  * @color_matrix: the color matrix.  Possible values are
  *   "sdtv" for the standard definition color matrix (as specified in
@@ -360,6 +361,7 @@ struct _GstVideoInfo {
   gint                      width;
   gint                      height;
   gsize                     size;
+  gint                      views;
 
   const gchar              *color_matrix;
   const gchar              *chroma_site;
@@ -386,6 +388,7 @@ struct _GstVideoInfo {
 #define GST_VIDEO_INFO_WIDTH(i)          ((i)->width)
 #define GST_VIDEO_INFO_HEIGHT(i)         ((i)->height)
 #define GST_VIDEO_INFO_SIZE(i)           ((i)->size)
+#define GST_VIDEO_INFO_VIEWS(i)          ((i)->views)
 #define GST_VIDEO_INFO_PAR_N(i)          ((i)->par_n)
 #define GST_VIDEO_INFO_PAR_D(i)          ((i)->par_d)
 #define GST_VIDEO_INFO_FPS_N(i)          ((i)->fps_n)