Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / debian / patches / 0019-xvimagesink-add-disable-colorkey-property-Maemo-spec.patch
diff --git a/gst-plugins-base-subtitles0.10/debian/patches/0019-xvimagesink-add-disable-colorkey-property-Maemo-spec.patch b/gst-plugins-base-subtitles0.10/debian/patches/0019-xvimagesink-add-disable-colorkey-property-Maemo-spec.patch
new file mode 100644 (file)
index 0000000..ef9998d
--- /dev/null
@@ -0,0 +1,167 @@
+From 048db61bc6cf06b2554867f6dfb8e088eb3bf951 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ren=C3=A9=20Stadler?= <rene.stadler@nokia.com>
+Date: Mon, 21 Dec 2009 17:34:26 +0200
+Subject: [PATCH] xvimagesink: add disable-colorkey property (Maemo specific)
+
+---
+ sys/xvimage/xvimagesink.c |   57 +++++++++++++++++++++++++++++++++++++++++++-
+ sys/xvimage/xvimagesink.h |    4 +++
+ 2 files changed, 59 insertions(+), 2 deletions(-)
+
+diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
+index 30368d5..63f7e77 100644
+--- a/sys/xvimage/xvimagesink.c
++++ b/sys/xvimage/xvimagesink.c
+@@ -188,7 +188,8 @@ enum
+   PROP_COLORKEY,
+   PROP_DRAW_BORDERS,
+   PROP_WINDOW_WIDTH,
+-  PROP_WINDOW_HEIGHT
++  PROP_WINDOW_HEIGHT,
++  PROP_DISABLE_COLORKEY
+ };
+ static GstVideoSinkClass *parent_class = NULL;
+@@ -774,6 +775,7 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
+ {
+   GstVideoRectangle result;
+   gboolean draw_border = FALSE;
++  gboolean disable_colorkey;
+   /* We take the flow_lock. If expose is in there we don't want to run
+      concurrently from the data flow thread */
+@@ -831,6 +833,16 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
+   g_mutex_lock (xvimagesink->x_lock);
++  disable_colorkey = g_atomic_int_get (&xvimagesink->disable_colorkey);
++  if (G_UNLIKELY (disable_colorkey != xvimagesink->disable_colorkey_set)) {
++    GST_LOG_OBJECT (xvimagesink, "Setting disable-colorkey to %d",
++        (disable_colorkey ? 1 : 0));
++    XvSetPortAttribute (xvimagesink->xcontext->disp,
++        xvimagesink->xcontext->xv_port_id, xvimagesink->disable_colorkey_atom,
++        disable_colorkey ? 1 : 0);
++    xvimagesink->disable_colorkey_set = disable_colorkey;
++  }
++
+   if (draw_border && xvimagesink->draw_borders) {
+     gst_xvimagesink_xwindow_draw_borders (xvimagesink, xvimagesink->xwindow,
+         result);
+@@ -1431,18 +1443,20 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
+   /* Set XV_AUTOPAINT_COLORKEY and XV_DOUBLE_BUFFER and XV_COLORKEY */
+   {
+-    int count, todo = 3;
++    int count, todo = 4;
+     XvAttribute *const attr = XvQueryPortAttributes (xcontext->disp,
+         xcontext->xv_port_id, &count);
+     static const char autopaint[] = "XV_AUTOPAINT_COLORKEY";
+     static const char dbl_buffer[] = "XV_DOUBLE_BUFFER";
+     static const char colorkey[] = "XV_COLORKEY";
++    static const char disable_colorkey[] = "XV_DISABLE_COLORKEY";
+     GST_DEBUG_OBJECT (xvimagesink, "Checking %d Xv port attributes", count);
+     xvimagesink->have_autopaint_colorkey = FALSE;
+     xvimagesink->have_double_buffer = FALSE;
+     xvimagesink->have_colorkey = FALSE;
++    xvimagesink->have_disable_colorkey = FALSE;
+     for (i = 0; ((i < count) && todo); i++)
+       if (!strcmp (attr[i].name, autopaint)) {
+@@ -1508,6 +1522,22 @@ gst_xvimagesink_get_xv_support (GstXvImageSink * xvimagesink,
+         }
+         todo--;
+         xvimagesink->have_colorkey = TRUE;
++      } else if (!strcmp (attr[i].name, disable_colorkey)) {
++        const Atom atom = XInternAtom (xcontext->disp, disable_colorkey, False);
++        gboolean disable_colorkey;
++
++        GST_LOG_OBJECT (xvimagesink, "Setting disable-colorkey to %d",
++            (xvimagesink->disable_colorkey ? 1 : 0));
++
++        disable_colorkey = g_atomic_int_get (&xvimagesink->disable_colorkey);
++        XvSetPortAttribute (xcontext->disp, xcontext->xv_port_id, atom,
++            (disable_colorkey ? 1 : 0));
++        xvimagesink->disable_colorkey_set = disable_colorkey;
++
++        todo--;
++        xvimagesink->have_disable_colorkey = TRUE;
++
++        xvimagesink->disable_colorkey_atom = atom;
+       }
+     XFree (attr);
+@@ -3291,6 +3321,10 @@ gst_xvimagesink_set_property (GObject * object, guint prop_id,
+     case PROP_DRAW_BORDERS:
+       xvimagesink->draw_borders = g_value_get_boolean (value);
+       break;
++    case PROP_DISABLE_COLORKEY:
++      g_atomic_int_set (&xvimagesink->disable_colorkey,
++          g_value_get_boolean (value));
++      break;
+     default:
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+       break;
+@@ -3379,6 +3413,9 @@ gst_xvimagesink_get_property (GObject * object, guint prop_id,
+       else
+         g_value_set_uint64 (value, 0);
+       break;
++    case PROP_DISABLE_COLORKEY:
++      g_value_set_boolean (value, xvimagesink->disable_colorkey);
++      break;
+     default:
+       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+       break;
+@@ -3503,6 +3540,9 @@ gst_xvimagesink_init (GstXvImageSink * xvimagesink)
+   xvimagesink->par = NULL;
+   xvimagesink->handle_expose = TRUE;
+   xvimagesink->autopaint_colorkey = TRUE;
++  xvimagesink->disable_colorkey = FALSE;
++  xvimagesink->disable_colorkey_set = FALSE;
++  xvimagesink->disable_colorkey_atom = None;
+   /* on 16bit displays this becomes r,g,b = 1,2,3
+    * on 24bit displays this becomes r,g,b = 8,8,16
+@@ -3670,6 +3710,19 @@ gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
+           "Height of the window", 0, G_MAXUINT64, 0,
+           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
++  /*
++   * GstXvImageSink:disable-colorkey
++   *
++   * Whether to disable colorkeying (disabling has the same effect as painting
++   * the color key everywhere).
++   *
++   * This is a Maemo-specific property.
++   */
++  g_object_class_install_property (gobject_class, PROP_DISABLE_COLORKEY,
++      g_param_spec_boolean ("disable-colorkey", "Disable colorkeying",
++          "Whether to disable colorkey", FALSE,
++          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
++
+   gobject_class->finalize = gst_xvimagesink_finalize;
+   gstelement_class->change_state =
+diff --git a/sys/xvimage/xvimagesink.h b/sys/xvimage/xvimagesink.h
+index 0181018..ddc0e06 100644
+--- a/sys/xvimage/xvimagesink.h
++++ b/sys/xvimage/xvimagesink.h
+@@ -276,6 +276,9 @@ struct _GstXvImageSink {
+   /* port attributes */
+   gboolean autopaint_colorkey;
+   gint colorkey;
++  gboolean disable_colorkey;
++  gboolean disable_colorkey_set;
++  Atom disable_colorkey_atom;
+   
+   gboolean draw_borders;
+   
+@@ -283,6 +286,7 @@ struct _GstXvImageSink {
+   gboolean have_autopaint_colorkey;
+   gboolean have_colorkey;
+   gboolean have_double_buffer;
++  gboolean have_disable_colorkey;
+   
+   /* stream metadata */
+   gchar *media_title;