Index: gst/subparse/gstsubparse.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/subparse/gstsubparse.c,v
retrieving revision 1.28
diff -u -r1.28 gstsubparse.c
--- gst/subparse/gstsubparse.c	8 Apr 2006 21:02:51 -0000	1.28
+++ gst/subparse/gstsubparse.c	24 Apr 2006 03:42:36 -0000
@@ -33,6 +33,20 @@
 GST_DEBUG_CATEGORY_STATIC (sub_parse_debug);
 #define GST_CAT_DEFAULT sub_parse_debug
 
+#define DEFAULT_PROP_ENCODING	""
+
+enum
+{
+  PROP_ENCODING
+};
+
+static void
+gst_sub_parse_set_property(GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void
+gst_sub_parse_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+
 static GstElementDetails sub_parse_details =
 GST_ELEMENT_DETAILS ("Subtitle parser",
     "Codec/Parser/Subtitle",
@@ -114,6 +128,10 @@
     gst_segment_free (subparse->segment);
     subparse->segment = NULL;
   }
+  if (subparse->default_encoding) {
+    g_free(subparse->default_encoding);
+    subparse->default_encoding = NULL;
+  }
 
   GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
 }
@@ -127,8 +145,17 @@
   parent_class = g_type_class_peek_parent (klass);
 
   object_class->dispose = gst_sub_parse_dispose;
+  object_class->set_property = gst_sub_parse_set_property;
+  object_class->get_property = gst_sub_parse_get_property;
 
   element_class->change_state = gst_sub_parse_change_state;
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ENCODING,
+      g_param_spec_string ("encoding", "subtitle charset encoding",
+          "Define subtitle charset. If not defined, assume "
+	  "GST_SUBTITLE_ENCODING value.",
+          DEFAULT_PROP_ENCODING, G_PARAM_WRITABLE));
+
 }
 
 static void
@@ -157,6 +184,7 @@
     GST_WARNING_OBJECT (subparse, "segment creation failed");
     g_assert_not_reached ();
   }
+  subparse->default_encoding = NULL;
 }
 
 /*
@@ -227,6 +255,46 @@
   return ret;
 }
 
+static void
+gst_sub_parse_set_property(GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GstSubParse *subparse = GST_SUBPARSE (object);
+
+  GST_OBJECT_LOCK(subparse);
+  switch (prop_id) {
+    case PROP_ENCODING:
+      if (subparse->default_encoding)
+      g_free(subparse->default_encoding);
+      subparse->default_encoding = g_value_dup_string(value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+
+  GST_OBJECT_UNLOCK(subparse);
+}
+
+static void
+gst_sub_parse_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GstSubParse *subparse = GST_SUBPARSE (object);
+
+  GST_OBJECT_LOCK(subparse);
+  switch (prop_id) {
+    case PROP_ENCODING:
+      g_value_set_string (value, subparse->default_encoding);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+  }
+
+  GST_OBJECT_UNLOCK(subparse);
+}
+
 static gchar *
 convert_encoding (GstSubParse * self, const gchar * str, gsize len)
 {
@@ -243,7 +311,10 @@
     self->valid_utf8 = FALSE;
   }
 
-  encoding = g_getenv ("GST_SUBTITLE_ENCODING");
+  encoding = self->default_encoding;
+  if (encoding == NULL || *encoding == '\0') {
+    encoding = g_getenv ("GST_SUBTITLE_ENCODING");
+  }
   if (encoding == NULL || *encoding == '\0') {
     /* if local encoding is UTF-8 and no encoding specified
      * via the environment variable, assume ISO-8859-15 */
Index: gst/subparse/gstsubparse.h
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/gst/subparse/gstsubparse.h,v
retrieving revision 1.5
diff -u -r1.5 gstsubparse.h
--- gst/subparse/gstsubparse.h	24 Mar 2006 17:57:39 -0000	1.5
+++ gst/subparse/gstsubparse.h	24 Apr 2006 03:42:36 -0000
@@ -82,6 +82,7 @@
   
   gboolean flushing;
   gboolean valid_utf8;
+  gchar *default_encoding;
 };
 
 struct _GstSubParseClass {
