summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-07-13 12:03:36 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-07-13 12:44:36 +0200
commit3063cd33a456ed8c2d6326c1724d2ec2f2dfba32 (patch)
tree087cc989ab3d28a86bc974cdb125f625fd1091f3
parent3d49202078406baf8526730af3b8999bd62d258d (diff)
dvbsuboverlay: adaptively blend or attach video overlay composition
-rw-r--r--gst/dvbsuboverlay/gstdvbsuboverlay.c22
-rw-r--r--gst/dvbsuboverlay/gstdvbsuboverlay.h2
2 files changed, 21 insertions, 3 deletions
diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c
index cae8b1efe..bfdde5d33 100644
--- a/gst/dvbsuboverlay/gstdvbsuboverlay.c
+++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c
@@ -67,14 +67,14 @@ enum
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420") "; video/x-surface")
);
static GstStaticPadTemplate video_sink_factory =
GST_STATIC_PAD_TEMPLATE ("video_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420") "; video/x-surface")
);
static GstStaticPadTemplate text_sink_factory =
@@ -461,6 +461,7 @@ gst_dvbsub_overlay_setcaps_video (GstPad * pad, GstCaps * caps)
{
GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (gst_pad_get_parent (pad));
gboolean ret = FALSE;
+ GstStructure *structure;
render->width = 0;
render->height = 0;
@@ -480,6 +481,15 @@ gst_dvbsub_overlay_setcaps_video (GstPad * pad, GstCaps * caps)
if (!ret)
goto out;
+ /* FIXME Use the query to the sink to do that when implemented */
+ /* Update wether to attach composition to buffer or do the composition
+ * ourselves */
+ structure = gst_caps_get_structure (caps, 0);
+ if (gst_structure_has_name (structure, "video/x-surface"))
+ render->attach_compo_to_buffer = TRUE;
+ else
+ render->attach_compo_to_buffer = FALSE;
+
GST_DEBUG_OBJECT (render, "ass renderer setup complete");
out:
@@ -870,7 +880,13 @@ gst_dvbsub_overlay_chain_video (GstPad * pad, GstBuffer * buffer)
if (g_atomic_int_get (&overlay->enable) && overlay->current_subtitle) {
g_assert (overlay->current_comp);
buffer = gst_buffer_make_writable (buffer);
- gst_video_overlay_composition_blend (overlay->current_comp, buffer);
+ if (overlay->attach_compo_to_buffer) {
+ GST_DEBUG_OBJECT (overlay, "Attaching overlay image to video buffer");
+ gst_video_buffer_set_overlay_composition (buffer, overlay->current_comp);
+ } else {
+ GST_DEBUG_OBJECT (overlay, "Blending overlay image to video buffer");
+ gst_video_overlay_composition_blend (overlay->current_comp, buffer);
+ }
}
g_mutex_unlock (overlay->dvbsub_mutex);
diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.h b/gst/dvbsuboverlay/gstdvbsuboverlay.h
index 29d4085f5..8f9f22bba 100644
--- a/gst/dvbsuboverlay/gstdvbsuboverlay.h
+++ b/gst/dvbsuboverlay/gstdvbsuboverlay.h
@@ -69,6 +69,8 @@ struct _GstDVBSubOverlay
gboolean pending_sub;
/* last text pts */
GstClockTime last_text_pts;
+
+ gboolean attach_compo_to_buffer;
};
struct _GstDVBSubOverlayClass