From 00a30b5cfdca2fb890c93f3c29ca000be70766fa Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 22 Aug 2011 15:57:30 +0200 Subject: [PATCH] video: parse number of views Parse the number of views in multiview video buffers. --- docs/design/draft-media-types.txt | 14 +++++++++----- gst-libs/gst/video/gstmetavideo.h | 4 ++++ gst-libs/gst/video/video.c | 10 +++++++++- gst-libs/gst/video/video.h | 3 +++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/design/draft-media-types.txt b/docs/design/draft-media-types.txt index b4f3e4332b..4b7c891849 100644 --- a/docs/design/draft-media-types.txt +++ b/docs/design/draft-media-types.txt @@ -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 diff --git a/gst-libs/gst/video/gstmetavideo.h b/gst-libs/gst/video/gstmetavideo.h index e88b0b5874..858d048c87 100644 --- a/gst-libs/gst/video/gstmetavideo.h +++ b/gst-libs/gst/video/gstmetavideo.h @@ -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 diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index d860340d75..e714843a98 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -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; } diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h index 290da71192..59e68fc0dd 100644 --- a/gst-libs/gst/video/video.h +++ b/gst-libs/gst/video/video.h @@ -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)