diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2010-01-06 15:12:19 +0000 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2010-02-12 20:09:43 +0000 |
commit | 599c02fbe2da42f3c1fe133cf61ac3d4c2f0887d (patch) | |
tree | 8d7f98cfc5289dbaaa7f0a175c8d43208d0dd783 /clutter-gst/clutter-gst-video-texture.c | |
parent | 9f1a0011ba167d2f2e9c60a29201794057f37f4e (diff) | |
download | clutter-gst-599c02fbe2da42f3c1fe133cf61ac3d4c2f0887d.tar.gz |
Add support for the subtitle related properties
ClutterMedia has a new API (since 1.2) to let the user specify an URI of
a subtitle file and display them along with a video. You can also
specify the font that should be used when rendering.
Diffstat (limited to 'clutter-gst/clutter-gst-video-texture.c')
-rw-r--r-- | clutter-gst/clutter-gst-video-texture.c | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c index 5654b64..85b2160 100644 --- a/clutter-gst/clutter-gst-video-texture.c +++ b/clutter-gst/clutter-gst-video-texture.c @@ -70,6 +70,8 @@ enum { PROP_URI, PROP_PLAYING, PROP_PROGRESS, + PROP_SUBTITLE_URI, + PROP_SUBTITLE_FONT_NAME, PROP_AUDIO_VOLUME, PROP_CAN_SEEK, PROP_BUFFER_FILL, @@ -414,6 +416,34 @@ get_progress (ClutterGstVideoTexture *video_texture) } static void +set_subtitle_uri (ClutterGstVideoTexture *video_texture, + const gchar *uri) +{ + ClutterGstVideoTexturePrivate *priv = video_texture->priv; + + if (!priv->pipeline) + return; + + CLUTTER_GST_NOTE (MEDIA, "setting subtitle URI: %s", uri); + + g_object_set (priv->pipeline, "suburi", uri, NULL); +} + +static void +set_subtitle_font_name (ClutterGstVideoTexture *video_texture, + const gchar *font_name) +{ + ClutterGstVideoTexturePrivate *priv = video_texture->priv; + + if (!priv->pipeline) + return; + + CLUTTER_GST_NOTE (MEDIA, "setting subtitle font to %s", font_name); + + g_object_set (priv->pipeline, "subtitle-font-desc", font_name, NULL); +} + +static void set_audio_volume (ClutterGstVideoTexture *video_texture, gdouble volume) { @@ -501,9 +531,7 @@ clutter_gst_video_texture_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - ClutterGstVideoTexture *video_texture; - - video_texture = CLUTTER_GST_VIDEO_TEXTURE (object); + ClutterGstVideoTexture *video_texture = CLUTTER_GST_VIDEO_TEXTURE (object); switch (property_id) { @@ -519,6 +547,14 @@ clutter_gst_video_texture_set_property (GObject *object, set_progress (video_texture, g_value_get_double (value)); break; + case PROP_SUBTITLE_URI: + set_subtitle_uri (video_texture, g_value_get_string (value)); + break; + + case PROP_SUBTITLE_FONT_NAME: + set_subtitle_font_name (video_texture, g_value_get_string (value)); + break; + case PROP_AUDIO_VOLUME: set_audio_volume (video_texture, g_value_get_double (value)); break; @@ -536,6 +572,7 @@ clutter_gst_video_texture_get_property (GObject *object, { ClutterGstVideoTexture *video_texture; ClutterGstVideoTexturePrivate *priv; + char *str; video_texture = CLUTTER_GST_VIDEO_TEXTURE (object); priv = video_texture->priv; @@ -554,6 +591,16 @@ clutter_gst_video_texture_get_property (GObject *object, g_value_set_double (value, get_progress (video_texture)); break; + case PROP_SUBTITLE_URI: + g_object_get (priv->pipeline, "suburi", &str, NULL); + g_value_take_string (value, str); + break; + + case PROP_SUBTITLE_FONT_NAME: + g_object_get (priv->pipeline, "subtitle-font-desc", &str, NULL); + g_value_take_string (value, str); + break; + case PROP_AUDIO_VOLUME: g_value_set_double (value, get_audio_volume (video_texture)); break; @@ -594,6 +641,11 @@ clutter_gst_video_texture_class_init (ClutterGstVideoTextureClass *klass) g_object_class_override_property (object_class, PROP_PROGRESS, "progress"); g_object_class_override_property (object_class, + PROP_SUBTITLE_URI, "subtitle-uri"); + g_object_class_override_property (object_class, + PROP_SUBTITLE_FONT_NAME, + "subtitle-font-name"); + g_object_class_override_property (object_class, PROP_AUDIO_VOLUME, "audio-volume"); g_object_class_override_property (object_class, PROP_CAN_SEEK, "can-seek"); |