summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-27 18:34:27 +0300
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-29 12:05:03 +0200
commit0ef393c6aff7c4dab6409e9680a84e875d63213a (patch)
treeeb56b880314b6d58e3d82f454342ed0f2fd18455
parente36fb69ef907333fce851ff6bb644ea3b5b0b165 (diff)
vaapisink: automatically detect overlay rendering mode.
Retain the VA surface until another surface is to be displayed only if VA display rendering mode is determined to be "overlay" mode.
-rw-r--r--gst/vaapi/gstvaapisink.c10
-rw-r--r--gst/vaapi/gstvaapisink.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c
index cacf087..45d8155 100644
--- a/gst/vaapi/gstvaapisink.c
+++ b/gst/vaapi/gstvaapisink.c
@@ -298,6 +298,7 @@ static inline gboolean
gst_vaapisink_ensure_display(GstVaapiSink *sink)
{
GstVaapiDisplayType display_type;
+ GstVaapiRenderMode render_mode;
if (!gst_vaapi_ensure_display(sink, sink->display_type, &sink->display))
return FALSE;
@@ -307,6 +308,11 @@ gst_vaapisink_ensure_display(GstVaapiSink *sink)
GST_INFO("created %s %p", get_display_type_name(display_type),
sink->display);
sink->display_type = display_type;
+
+ sink->use_overlay =
+ gst_vaapi_display_get_render_mode(sink->display, &render_mode) &&
+ render_mode == GST_VAAPI_RENDER_MODE_OVERLAY;
+ GST_DEBUG("use %s rendering mode", sink->use_overlay ? "overlay" : "texture");
}
return TRUE;
}
@@ -778,7 +784,8 @@ gst_vaapisink_show_frame(GstBaseSink *base_sink, GstBuffer *buffer)
return GST_FLOW_UNEXPECTED;
/* Retain VA surface until the next one is displayed */
- gst_buffer_replace(&sink->video_buffer, buffer);
+ if (sink->use_overlay)
+ gst_buffer_replace(&sink->video_buffer, buffer);
return GST_FLOW_OK;
}
@@ -955,4 +962,5 @@ gst_vaapisink_init(GstVaapiSink *sink)
sink->synchronous = FALSE;
sink->display_type = DEFAULT_DISPLAY_TYPE;
sink->use_reflection = FALSE;
+ sink->use_overlay = FALSE;
}
diff --git a/gst/vaapi/gstvaapisink.h b/gst/vaapi/gstvaapisink.h
index 0e8709f..eae1665 100644
--- a/gst/vaapi/gstvaapisink.h
+++ b/gst/vaapi/gstvaapisink.h
@@ -84,6 +84,7 @@ struct _GstVaapiSink {
guint fullscreen : 1;
guint synchronous : 1;
guint use_reflection : 1;
+ guint use_overlay : 1;
};
struct _GstVaapiSinkClass {