diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-12-19 18:03:45 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-12-19 18:03:45 +0100 |
commit | 6241ff63f8b7e3b1aeceb461dc13ee22d152a0c2 (patch) | |
tree | fdd34e4adbf61a26dc4766c3dc212763ab9f096b /gst-libs/gst/video/video.c | |
parent | 81d351b5f0f508c7000e0ec8ee11d79461c9b7a6 (diff) |
video: update interlace caps and docs
Remove interlaced boolean from caps and replace with an interlace-mode enum.
document this new property in the video caps document. With the enum we can
put fields into separate video meta.
Add enum for this interlace-mode in the VideoInfo.
Update the buffer flags.
Diffstat (limited to 'gst-libs/gst/video/video.c')
-rw-r--r-- | gst-libs/gst/video/video.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index 48be215d0..f00ebd6ba 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -647,6 +647,33 @@ gst_video_info_set_format (GstVideoInfo * info, GstVideoFormat format, fill_planes (info); } +static const gchar *interlace_mode[] = { + "progressive", + "interleaved", + "mixed", + "fields" +}; + +static const gchar * +gst_interlace_mode_to_string (GstVideoInterlaceMode mode) +{ + if (mode < 0 || mode >= G_N_ELEMENTS (interlace_mode)) + return NULL; + + return interlace_mode[mode]; +} + +static GstVideoInterlaceMode +gst_interlace_mode_from_string (const gchar * mode) +{ + gint i; + for (i = 0; i < G_N_ELEMENTS (interlace_mode); i++) { + if (g_str_equal (interlace_mode[i], mode)) + return i; + } + return GST_VIDEO_INTERLACE_MODE_PROGRESSIVE; +} + typedef struct { const gchar *name; @@ -797,7 +824,6 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps) GstVideoFormat format; gint width, height, views; gint fps_n, fps_d; - gboolean interlaced; gint par_n, par_d; g_return_val_if_fail (info != NULL, FALSE); @@ -840,12 +866,10 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps) info->fps_d = 1; } - if (!gst_structure_get_boolean (structure, "interlaced", &interlaced)) - interlaced = FALSE; - if (interlaced) - info->flags |= GST_VIDEO_FLAG_INTERLACED; + if ((s = gst_structure_get_string (structure, "interlace-mode"))) + info->interlace_mode = gst_interlace_mode_from_string (s); else - info->flags &= ~GST_VIDEO_FLAG_INTERLACED; + info->interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE; if (gst_structure_get_int (structure, "views", &views)) info->views = views; @@ -928,8 +952,8 @@ gst_video_info_to_caps (GstVideoInfo * info) "height", G_TYPE_INT, info->height, "pixel-aspect-ratio", GST_TYPE_FRACTION, info->par_n, info->par_d, NULL); - if (info->flags & GST_VIDEO_FLAG_INTERLACED) - gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL); + gst_caps_set_simple (caps, "interlace-mode", G_TYPE_STRING, + gst_interlace_mode_to_string (info->interlace_mode), NULL); if (info->chroma_site != GST_VIDEO_CHROMA_SITE_UNKNOWN) gst_caps_set_simple (caps, "chroma-site", G_TYPE_STRING, |