2011-11-04 20:50:15 +00:00
|
|
|
/*
|
|
|
|
* gstvaapipluginutil.h - VA-API plugin helpers
|
|
|
|
*
|
2013-11-22 05:37:12 +00:00
|
|
|
* Copyright (C) 2011-2013 Intel Corporation
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
2011-11-04 20:50:15 +00:00
|
|
|
* Copyright (C) 2011 Collabora
|
|
|
|
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.co.uk>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2.1
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2013-03-20 10:57:03 +00:00
|
|
|
#include "gst/vaapi/sysdeps.h"
|
2013-05-22 16:07:52 +00:00
|
|
|
#include "gstvaapivideocontext.h"
|
2012-08-01 13:46:19 +00:00
|
|
|
#if USE_DRM
|
|
|
|
# include <gst/vaapi/gstvaapidisplay_drm.h>
|
|
|
|
#endif
|
2012-07-23 14:15:38 +00:00
|
|
|
#if USE_X11
|
|
|
|
# include <gst/vaapi/gstvaapidisplay_x11.h>
|
|
|
|
#endif
|
|
|
|
#if USE_GLX
|
|
|
|
# include <gst/vaapi/gstvaapidisplay_glx.h>
|
2011-11-04 20:50:15 +00:00
|
|
|
#endif
|
2012-07-24 07:45:25 +00:00
|
|
|
#if USE_WAYLAND
|
|
|
|
# include <gst/vaapi/gstvaapidisplay_wayland.h>
|
|
|
|
#endif
|
2011-11-04 20:50:15 +00:00
|
|
|
#include "gstvaapipluginutil.h"
|
|
|
|
|
|
|
|
/* Preferred first */
|
|
|
|
static const char *display_types[] = {
|
2012-07-23 16:01:26 +00:00
|
|
|
"gst-vaapi-display",
|
|
|
|
"vaapi-display",
|
2012-07-24 07:45:25 +00:00
|
|
|
#if USE_WAYLAND
|
|
|
|
"wl-display",
|
|
|
|
"wl-display-name",
|
|
|
|
#endif
|
2012-07-24 13:07:48 +00:00
|
|
|
#if USE_X11
|
2012-07-23 16:01:26 +00:00
|
|
|
"x11-display",
|
|
|
|
"x11-display-name",
|
2012-08-01 13:46:19 +00:00
|
|
|
#endif
|
|
|
|
#if USE_DRM
|
|
|
|
"drm-device",
|
|
|
|
"drm-device-path",
|
2012-07-24 13:07:48 +00:00
|
|
|
#endif
|
2012-07-23 16:01:26 +00:00
|
|
|
NULL
|
2011-11-04 20:50:15 +00:00
|
|
|
};
|
|
|
|
|
2012-07-23 16:37:38 +00:00
|
|
|
typedef struct {
|
|
|
|
const gchar *type_str;
|
|
|
|
GstVaapiDisplayType type;
|
|
|
|
GstVaapiDisplay * (*create_display)(const gchar *);
|
|
|
|
} DisplayMap;
|
|
|
|
|
|
|
|
static const DisplayMap g_display_map[] = {
|
2012-07-24 07:45:25 +00:00
|
|
|
#if USE_WAYLAND
|
|
|
|
{ "wayland",
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_WAYLAND,
|
|
|
|
gst_vaapi_display_wayland_new },
|
|
|
|
#endif
|
2012-07-27 08:45:41 +00:00
|
|
|
#if USE_GLX
|
|
|
|
{ "glx",
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_GLX,
|
|
|
|
gst_vaapi_display_glx_new },
|
2012-08-01 13:46:19 +00:00
|
|
|
#endif
|
2013-06-06 09:36:03 +00:00
|
|
|
#if USE_X11
|
|
|
|
{ "x11",
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_X11,
|
|
|
|
gst_vaapi_display_x11_new },
|
|
|
|
#endif
|
2012-08-01 13:46:19 +00:00
|
|
|
#if USE_DRM
|
|
|
|
{ "drm",
|
|
|
|
GST_VAAPI_DISPLAY_TYPE_DRM,
|
|
|
|
gst_vaapi_display_drm_new },
|
2012-07-23 16:37:38 +00:00
|
|
|
#endif
|
|
|
|
{ NULL, }
|
|
|
|
};
|
|
|
|
|
2013-05-24 09:04:01 +00:00
|
|
|
static GstVaapiDisplay *
|
|
|
|
gst_vaapi_create_display(GstVaapiDisplayType *display_type)
|
|
|
|
{
|
|
|
|
GstVaapiDisplay *display = NULL;
|
|
|
|
const DisplayMap *m;
|
|
|
|
|
|
|
|
for (m = g_display_map; m->type_str != NULL; m++) {
|
|
|
|
if (*display_type != GST_VAAPI_DISPLAY_TYPE_ANY &&
|
|
|
|
*display_type != m->type)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
display = m->create_display(NULL);
|
|
|
|
if (display) {
|
2013-07-15 09:58:31 +00:00
|
|
|
*display_type = m->type;
|
|
|
|
break;
|
2013-05-24 09:04:01 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 05:54:54 +00:00
|
|
|
if (*display_type != GST_VAAPI_DISPLAY_TYPE_ANY)
|
2013-05-24 09:04:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2011-11-04 20:50:15 +00:00
|
|
|
gboolean
|
2012-07-23 16:37:38 +00:00
|
|
|
gst_vaapi_ensure_display(
|
|
|
|
gpointer element,
|
2012-07-25 08:02:29 +00:00
|
|
|
GstVaapiDisplayType display_type,
|
|
|
|
GstVaapiDisplay **display_ptr
|
2012-07-23 16:37:38 +00:00
|
|
|
)
|
2011-11-04 20:50:15 +00:00
|
|
|
{
|
2012-07-23 16:37:38 +00:00
|
|
|
GstVaapiDisplay *display;
|
2012-07-23 16:01:26 +00:00
|
|
|
GstVideoContext *context;
|
2011-11-04 20:50:15 +00:00
|
|
|
|
2012-07-23 16:01:26 +00:00
|
|
|
g_return_val_if_fail(GST_IS_VIDEO_CONTEXT(element), FALSE);
|
2012-07-23 16:37:38 +00:00
|
|
|
g_return_val_if_fail(display_ptr != NULL, FALSE);
|
2011-11-04 20:50:15 +00:00
|
|
|
|
2012-07-23 16:01:26 +00:00
|
|
|
/* Already exist ? */
|
2012-07-23 16:37:38 +00:00
|
|
|
display = *display_ptr;
|
|
|
|
if (display)
|
2012-07-23 16:01:26 +00:00
|
|
|
return TRUE;
|
2011-11-04 20:50:15 +00:00
|
|
|
|
2012-07-23 16:01:26 +00:00
|
|
|
context = GST_VIDEO_CONTEXT(element);
|
2012-07-25 08:02:29 +00:00
|
|
|
g_return_val_if_fail(context != NULL, FALSE);
|
|
|
|
|
2013-05-22 16:07:52 +00:00
|
|
|
gst_vaapi_video_context_prepare(context, display_types);
|
2011-11-04 20:50:15 +00:00
|
|
|
|
2012-07-25 08:02:29 +00:00
|
|
|
/* Neighbour found and it updated the display */
|
|
|
|
if (*display_ptr)
|
|
|
|
return TRUE;
|
|
|
|
|
2012-07-23 16:01:26 +00:00
|
|
|
/* If no neighboor, or application not interested, use system default */
|
2013-05-24 09:04:01 +00:00
|
|
|
display = gst_vaapi_create_display(&display_type);
|
2013-11-29 12:56:12 +00:00
|
|
|
if (!display)
|
|
|
|
return FALSE;
|
2013-05-22 16:07:52 +00:00
|
|
|
|
|
|
|
gst_vaapi_video_context_propagate(context, display);
|
2013-11-29 12:56:12 +00:00
|
|
|
*display_ptr = display;
|
|
|
|
return TRUE;
|
2011-11-04 20:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-07-23 16:01:26 +00:00
|
|
|
gst_vaapi_set_display(
|
|
|
|
const gchar *type,
|
|
|
|
const GValue *value,
|
|
|
|
GstVaapiDisplay **display
|
|
|
|
)
|
2011-11-04 20:50:15 +00:00
|
|
|
{
|
2012-07-23 16:01:26 +00:00
|
|
|
GstVaapiDisplay *dpy = NULL;
|
2011-11-04 20:50:15 +00:00
|
|
|
|
2012-07-24 07:45:25 +00:00
|
|
|
if (!strcmp(type, "vaapi-display")) {
|
|
|
|
g_return_if_fail(G_VALUE_HOLDS_POINTER(value));
|
|
|
|
dpy = gst_vaapi_display_new_with_display(g_value_get_pointer(value));
|
|
|
|
}
|
|
|
|
else if (!strcmp(type, "gst-vaapi-display")) {
|
2013-05-06 12:43:38 +00:00
|
|
|
g_return_if_fail(G_VALUE_HOLDS_POINTER(value));
|
|
|
|
dpy = gst_vaapi_display_ref(g_value_get_pointer(value));
|
2012-07-24 07:45:25 +00:00
|
|
|
}
|
2012-08-01 13:46:19 +00:00
|
|
|
#if USE_DRM
|
|
|
|
else if (!strcmp(type, "drm-device")) {
|
|
|
|
gint device;
|
|
|
|
g_return_if_fail(G_VALUE_HOLDS_INT(value));
|
|
|
|
device = g_value_get_int(value);
|
|
|
|
dpy = gst_vaapi_display_drm_new_with_device(device);
|
|
|
|
}
|
|
|
|
else if (!strcmp(type, "drm-device-path")) {
|
|
|
|
const gchar *device_path;
|
|
|
|
g_return_if_fail(G_VALUE_HOLDS_STRING(value));
|
|
|
|
device_path = g_value_get_string(value);
|
|
|
|
dpy = gst_vaapi_display_drm_new(device_path);
|
|
|
|
}
|
|
|
|
#endif
|
2012-07-24 13:07:48 +00:00
|
|
|
#if USE_X11
|
2012-07-24 07:45:25 +00:00
|
|
|
else if (!strcmp(type, "x11-display-name")) {
|
2012-07-23 16:01:26 +00:00
|
|
|
g_return_if_fail(G_VALUE_HOLDS_STRING(value));
|
2012-07-23 14:15:38 +00:00
|
|
|
#if USE_GLX
|
2012-07-23 16:01:26 +00:00
|
|
|
dpy = gst_vaapi_display_glx_new(g_value_get_string(value));
|
2011-11-04 20:50:15 +00:00
|
|
|
#endif
|
2012-07-23 16:01:26 +00:00
|
|
|
if (!dpy)
|
|
|
|
dpy = gst_vaapi_display_x11_new(g_value_get_string(value));
|
|
|
|
}
|
|
|
|
else if (!strcmp(type, "x11-display")) {
|
|
|
|
g_return_if_fail(G_VALUE_HOLDS_POINTER(value));
|
2012-07-23 14:15:38 +00:00
|
|
|
#if USE_GLX
|
2012-07-23 16:01:26 +00:00
|
|
|
dpy = gst_vaapi_display_glx_new_with_display(g_value_get_pointer(value));
|
2011-11-04 20:50:15 +00:00
|
|
|
#endif
|
2012-07-23 16:01:26 +00:00
|
|
|
if (!dpy)
|
|
|
|
dpy = gst_vaapi_display_x11_new_with_display(g_value_get_pointer(value));
|
|
|
|
}
|
2012-07-24 13:07:48 +00:00
|
|
|
#endif
|
2012-07-24 07:45:25 +00:00
|
|
|
#if USE_WAYLAND
|
|
|
|
else if (!strcmp(type, "wl-display")) {
|
|
|
|
struct wl_display *wl_display;
|
2012-07-23 16:01:26 +00:00
|
|
|
g_return_if_fail(G_VALUE_HOLDS_POINTER(value));
|
2012-07-24 07:45:25 +00:00
|
|
|
wl_display = g_value_get_pointer(value);
|
|
|
|
dpy = gst_vaapi_display_wayland_new_with_display(wl_display);
|
2012-07-23 16:01:26 +00:00
|
|
|
}
|
2012-07-24 07:45:25 +00:00
|
|
|
else if (!strcmp(type, "wl-display-name")) {
|
|
|
|
const gchar *display_name;
|
|
|
|
g_return_if_fail(G_VALUE_HOLDS_STRING(value));
|
|
|
|
display_name = g_value_get_string(value);
|
|
|
|
dpy = gst_vaapi_display_wayland_new(display_name);
|
2012-07-23 16:01:26 +00:00
|
|
|
}
|
2012-07-24 07:45:25 +00:00
|
|
|
#endif
|
2012-07-23 16:01:26 +00:00
|
|
|
|
|
|
|
if (dpy) {
|
2013-05-06 12:43:38 +00:00
|
|
|
gst_vaapi_display_replace(display, dpy);
|
|
|
|
gst_vaapi_display_unref(dpy);
|
2012-07-23 16:01:26 +00:00
|
|
|
}
|
2011-11-04 20:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2012-07-23 16:01:26 +00:00
|
|
|
gst_vaapi_reply_to_query(GstQuery *query, GstVaapiDisplay *display)
|
2011-11-04 20:50:15 +00:00
|
|
|
{
|
2013-05-21 16:42:39 +00:00
|
|
|
#if GST_CHECK_VERSION(1,1,0)
|
2013-10-01 15:57:11 +00:00
|
|
|
const gchar *type = NULL;
|
|
|
|
GstContext *context;
|
|
|
|
|
|
|
|
if (GST_QUERY_TYPE(query) != GST_QUERY_CONTEXT)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!display)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!gst_query_parse_context_type(query, &type))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (g_strcmp0(type, GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
context = gst_vaapi_video_context_new_with_display(display, FALSE);
|
|
|
|
gst_query_set_context(query, context);
|
|
|
|
gst_context_unref(context);
|
|
|
|
|
|
|
|
return TRUE;
|
2013-05-21 16:42:39 +00:00
|
|
|
#else
|
2012-07-25 12:51:28 +00:00
|
|
|
GstVaapiDisplayType display_type;
|
2012-07-23 16:01:26 +00:00
|
|
|
const gchar **types;
|
|
|
|
const gchar *type;
|
|
|
|
gint i;
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
2013-03-26 17:57:00 +00:00
|
|
|
if (GST_QUERY_TYPE(query) != GST_QUERY_CUSTOM)
|
|
|
|
return FALSE;
|
|
|
|
|
2012-07-23 16:01:26 +00:00
|
|
|
if (!display)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
types = gst_video_context_query_get_supported_types(query);
|
|
|
|
|
|
|
|
if (!types)
|
|
|
|
return FALSE;
|
|
|
|
|
2012-07-25 12:51:28 +00:00
|
|
|
display_type = gst_vaapi_display_get_display_type(display);
|
|
|
|
for (i = 0; types[i] && !res; i++) {
|
2012-07-23 16:01:26 +00:00
|
|
|
type = types[i];
|
|
|
|
|
2012-07-25 12:51:28 +00:00
|
|
|
res = TRUE;
|
2012-07-23 16:01:26 +00:00
|
|
|
if (!strcmp(type, "gst-vaapi-display")) {
|
2013-05-06 12:43:38 +00:00
|
|
|
gst_video_context_query_set_pointer(query, type, display);
|
2012-07-23 16:01:26 +00:00
|
|
|
}
|
|
|
|
else if (!strcmp(type, "vaapi-display")) {
|
|
|
|
VADisplay vadpy = gst_vaapi_display_get_display(display);
|
|
|
|
gst_video_context_query_set_pointer(query, type, vadpy);
|
|
|
|
}
|
|
|
|
else {
|
2012-07-25 12:51:28 +00:00
|
|
|
switch (display_type) {
|
2012-08-01 13:46:19 +00:00
|
|
|
#if USE_DRM
|
|
|
|
case GST_VAAPI_DISPLAY_TYPE_DRM: {
|
|
|
|
GstVaapiDisplayDRM * const drm_dpy =
|
|
|
|
GST_VAAPI_DISPLAY_DRM(display);
|
|
|
|
if (!strcmp(type, "drm-device-path"))
|
|
|
|
gst_video_context_query_set_string(query, type,
|
|
|
|
gst_vaapi_display_drm_get_device_path(drm_dpy));
|
|
|
|
#if 0
|
|
|
|
/* XXX: gst_video_context_query_set_int() does not exist yet */
|
|
|
|
else if (!strcmp(type, "drm-device"))
|
|
|
|
gst_video_context_query_set_int(query, type,
|
|
|
|
gst_vaapi_display_drm_get_device(drm_dpy));
|
|
|
|
#endif
|
|
|
|
else
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2012-07-24 13:07:48 +00:00
|
|
|
#if USE_X11
|
2012-07-25 12:51:28 +00:00
|
|
|
#if USE_GLX
|
|
|
|
case GST_VAAPI_DISPLAY_TYPE_GLX:
|
|
|
|
#endif
|
|
|
|
case GST_VAAPI_DISPLAY_TYPE_X11: {
|
|
|
|
GstVaapiDisplayX11 * const xvadpy =
|
|
|
|
GST_VAAPI_DISPLAY_X11(display);
|
|
|
|
Display * const x11dpy =
|
|
|
|
gst_vaapi_display_x11_get_display(xvadpy);
|
|
|
|
if (!strcmp(type, "x11-display"))
|
|
|
|
gst_video_context_query_set_pointer(query, type, x11dpy);
|
|
|
|
else if (!strcmp(type, "x11-display-name"))
|
|
|
|
gst_video_context_query_set_string(query, type,
|
|
|
|
DisplayString(x11dpy));
|
|
|
|
else
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2012-07-24 13:07:48 +00:00
|
|
|
#endif
|
2012-07-24 07:45:25 +00:00
|
|
|
#if USE_WAYLAND
|
|
|
|
case GST_VAAPI_DISPLAY_TYPE_WAYLAND: {
|
|
|
|
GstVaapiDisplayWayland * const wlvadpy =
|
|
|
|
GST_VAAPI_DISPLAY_WAYLAND(display);
|
|
|
|
struct wl_display * const wldpy =
|
|
|
|
gst_vaapi_display_wayland_get_display(wlvadpy);
|
|
|
|
if (!strcmp(type, "wl-display"))
|
|
|
|
gst_video_context_query_set_pointer(query, type, wldpy);
|
|
|
|
else
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2012-07-25 12:51:28 +00:00
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2012-07-23 16:01:26 +00:00
|
|
|
}
|
2011-11-04 20:50:15 +00:00
|
|
|
}
|
2012-07-23 16:01:26 +00:00
|
|
|
return res;
|
2013-05-21 16:42:39 +00:00
|
|
|
#endif /* !GST_CHECK_VERSION(1,1,0) */
|
2011-11-04 20:50:15 +00:00
|
|
|
}
|
2012-01-05 10:00:39 +00:00
|
|
|
|
|
|
|
gboolean
|
2012-07-23 16:01:26 +00:00
|
|
|
gst_vaapi_append_surface_caps(GstCaps *out_caps, GstCaps *in_caps)
|
2012-01-05 10:00:39 +00:00
|
|
|
{
|
2012-07-23 16:01:26 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
const GValue *v_width, *v_height, *v_framerate, *v_par;
|
|
|
|
guint i, n_structures;
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure(in_caps, 0);
|
|
|
|
v_width = gst_structure_get_value(structure, "width");
|
|
|
|
v_height = gst_structure_get_value(structure, "height");
|
|
|
|
v_framerate = gst_structure_get_value(structure, "framerate");
|
|
|
|
v_par = gst_structure_get_value(structure, "pixel-aspect-ratio");
|
|
|
|
if (!v_width || !v_height)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
n_structures = gst_caps_get_size(out_caps);
|
|
|
|
for (i = 0; i < n_structures; i++) {
|
|
|
|
structure = gst_caps_get_structure(out_caps, i);
|
|
|
|
gst_structure_set_value(structure, "width", v_width);
|
|
|
|
gst_structure_set_value(structure, "height", v_height);
|
|
|
|
if (v_framerate)
|
|
|
|
gst_structure_set_value(structure, "framerate", v_framerate);
|
|
|
|
if (v_par)
|
|
|
|
gst_structure_set_value(structure, "pixel-aspect-ratio", v_par);
|
|
|
|
}
|
|
|
|
return TRUE;
|
2012-01-05 10:00:39 +00:00
|
|
|
}
|
2013-03-21 15:32:43 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_vaapi_apply_composition(GstVaapiSurface *surface, GstBuffer *buffer)
|
|
|
|
{
|
2012-09-03 11:00:25 +00:00
|
|
|
#if GST_CHECK_VERSION(1,0,0)
|
|
|
|
GstVideoOverlayCompositionMeta * const cmeta =
|
|
|
|
gst_buffer_get_video_overlay_composition_meta(buffer);
|
|
|
|
GstVideoOverlayComposition *composition;
|
|
|
|
|
|
|
|
if (!cmeta)
|
|
|
|
return TRUE;
|
|
|
|
composition = cmeta->overlay;
|
|
|
|
#else
|
2013-03-21 15:32:43 +00:00
|
|
|
GstVideoOverlayComposition * const composition =
|
|
|
|
gst_video_buffer_get_overlay_composition(buffer);
|
2012-09-03 11:00:25 +00:00
|
|
|
#endif
|
2013-03-21 15:32:43 +00:00
|
|
|
if (!composition)
|
2013-04-03 13:06:46 +00:00
|
|
|
return TRUE;
|
2013-03-21 15:32:43 +00:00
|
|
|
return gst_vaapi_surface_set_subpictures_from_composition(surface,
|
|
|
|
composition, TRUE);
|
|
|
|
}
|
2013-10-04 17:30:36 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_caps_set_interlaced(GstCaps *caps, GstVideoInfo *vip)
|
|
|
|
{
|
|
|
|
#if GST_CHECK_VERSION(1,0,0)
|
|
|
|
GstVideoInterlaceMode mode;
|
|
|
|
const gchar *mode_str;
|
|
|
|
|
|
|
|
mode = vip ? GST_VIDEO_INFO_INTERLACE_MODE(vip) :
|
|
|
|
GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
|
|
|
|
switch (mode) {
|
|
|
|
case GST_VIDEO_INTERLACE_MODE_PROGRESSIVE:
|
|
|
|
mode_str = "progressive";
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_INTERLACE_MODE_INTERLEAVED:
|
|
|
|
mode_str = "interleaved";
|
|
|
|
break;
|
2013-10-04 14:00:56 +00:00
|
|
|
case GST_VIDEO_INTERLACE_MODE_MIXED:
|
|
|
|
mode_str = "mixed";
|
|
|
|
break;
|
2013-10-04 17:30:36 +00:00
|
|
|
default:
|
|
|
|
GST_ERROR("unsupported `interlace-mode' %d", mode);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_set_simple(caps, "interlace-mode", G_TYPE_STRING, mode_str, NULL);
|
|
|
|
#else
|
|
|
|
gst_caps_set_simple(caps, "interlaced", G_TYPE_BOOLEAN,
|
|
|
|
vip ? GST_VIDEO_INFO_IS_INTERLACED(vip) : FALSE, NULL);
|
|
|
|
#endif
|
|
|
|
return TRUE;
|
|
|
|
}
|