diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2009-08-06 18:38:20 +0100 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2009-08-06 18:38:20 +0100 |
commit | b53787165685f6e87e4628038ad32ebd7658e3cc (patch) | |
tree | 7f56d6c47deebd91f5ae46e6cbe5297d4b67942f | |
parent | a0d402d92523112a1d436d4f1e2002d1e9bbdb8e (diff) | |
download | clutter-gst-b53787165685f6e87e4628038ad32ebd7658e3cc.tar.gz |
[debug] Add a CLUTTER_GST_MEDIA debug category
And a few annotations to the ClutteMedia interface implementation.
-rw-r--r-- | clutter-gst/clutter-gst-debug.c | 3 | ||||
-rw-r--r-- | clutter-gst/clutter-gst-debug.h | 1 | ||||
-rw-r--r-- | clutter-gst/clutter-gst-video-texture.c | 44 |
3 files changed, 40 insertions, 8 deletions
diff --git a/clutter-gst/clutter-gst-debug.c b/clutter-gst/clutter-gst-debug.c index 4179f70..bf7c2dd 100644 --- a/clutter-gst/clutter-gst-debug.c +++ b/clutter-gst/clutter-gst-debug.c @@ -36,7 +36,8 @@ guint clutter_gst_debug_flags = 0; /* global clutter-gst debug flag */ static GTimer *clutter_gst_timer; static const GDebugKey clutter_gst_debug_keys[] = { - { "misc", CLUTTER_GST_DEBUG_MISC }, + { "misc", CLUTTER_GST_DEBUG_MISC }, + { "media", CLUTTER_GST_DEBUG_MEDIA }, }; /** diff --git a/clutter-gst/clutter-gst-debug.h b/clutter-gst/clutter-gst-debug.h index d818906..2ce884e 100644 --- a/clutter-gst/clutter-gst-debug.h +++ b/clutter-gst/clutter-gst-debug.h @@ -36,6 +36,7 @@ G_BEGIN_DECLS typedef enum { CLUTTER_GST_DEBUG_MISC = 1 << 0, + CLUTTER_GST_DEBUG_MEDIA = 1 << 1, } ClutterDebugFlag; #ifdef __GNUC__ diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c index 54e0b6f..20c5110 100644 --- a/clutter-gst/clutter-gst-video-texture.c +++ b/clutter-gst/clutter-gst-video-texture.c @@ -37,11 +37,12 @@ #include "config.h" #endif -#include "clutter-gst-video-texture.h" -#include "clutter-gst-video-sink.h" - -#include <gst/gst.h> #include <glib.h> +#include <gst/gst.h> + +#include "clutter-gst-debug.h" +#include "clutter-gst-video-sink.h" +#include "clutter-gst-video-texture.h" struct _ClutterGstVideoTexturePrivate { @@ -142,6 +143,8 @@ set_uri (ClutterGstVideoTexture *video_texture, gst_element_set_state (priv->playbin, GST_STATE_NULL); + CLUTTER_GST_NOTE (MEDIA, "setting URI: %s", uri); + g_object_set (priv->playbin, "uri", uri, NULL); /* @@ -169,6 +172,8 @@ set_playing (ClutterGstVideoTexture *video_texture, if (!priv->playbin) return; + CLUTTER_GST_NOTE (MEDIA, "set playing: %d", playing); + if (priv->uri) { GstState state = GST_STATE_PAUSED; @@ -193,6 +198,7 @@ get_playing (ClutterGstVideoTexture *video_texture) { ClutterGstVideoTexturePrivate *priv = video_texture->priv; GstState state, pending; + gboolean playing; if (!priv->playbin) return FALSE; @@ -200,9 +206,13 @@ get_playing (ClutterGstVideoTexture *video_texture) gst_element_get_state (priv->playbin, &state, &pending, 0); if (pending) - return (pending == GST_STATE_PLAYING); + playing = (pending == GST_STATE_PLAYING); else - return (state == GST_STATE_PLAYING); + playing = (state == GST_STATE_PLAYING); + + CLUTTER_GST_NOTE (MEDIA, "get playing: %d", playing); + + return playing; } static void @@ -217,6 +227,8 @@ set_progress (ClutterGstVideoTexture *video_texture, if (!priv->playbin) return; + CLUTTER_GST_NOTE (MEDIA, "set progress: %.02f", progress); + gst_element_get_state (priv->playbin, &state, &pending, 0); if (pending) @@ -283,6 +295,8 @@ get_progress (ClutterGstVideoTexture *video_texture) gst_query_unref (position_q); gst_query_unref (duration_q); + CLUTTER_GST_NOTE (MEDIA, "get progress: %.02f", progress); + return progress; } @@ -295,6 +309,8 @@ set_audio_volume (ClutterGstVideoTexture *video_texture, if (!priv->playbin) return; + CLUTTER_GST_NOTE (MEDIA, "set volume: %.02f", volume); + /* the :volume property is in the [0, 10] interval */ g_object_set (G_OBJECT (priv->playbin), "volume", volume * 10.0, NULL); g_object_notify (G_OBJECT (video_texture), "audio-volume"); @@ -312,7 +328,11 @@ get_audio_volume (ClutterGstVideoTexture *video_texture) /* the :volume property is in the [0, 10] interval */ g_object_get (priv->playbin, "volume", &volume, NULL); - return CLAMP (volume / 10.0, 0.0, 1.0); + volume = CLAMP (volume / 10.0, 0.0, 1.0); + + CLUTTER_GST_NOTE (MEDIA, "get volume: %.02f", volume); + + return volume; } static void @@ -491,6 +511,8 @@ bus_message_eos_cb (GstBus *bus, { g_object_notify (G_OBJECT (video_texture), "progress"); + CLUTTER_GST_NOTE (MEDIA, "EOS"); + g_signal_emit_by_name (video_texture, "eos"); } @@ -515,6 +537,8 @@ bus_message_buffering_cb (GstBus *bus, 0.0, 1.0); + CLUTTER_GST_NOTE (MEDIA, "buffer-fill: %.02f", priv->buffer_fill); + g_object_notify (G_OBJECT (video_texture), "buffer-fill"); } } @@ -534,6 +558,8 @@ bus_message_duration_cb (GstBus *bus, priv->duration = (gdouble) duration / GST_SECOND; + CLUTTER_GST_NOTE (MEDIA, "duration: %.02f", priv->duration); + g_object_notify (G_OBJECT (video_texture), "duration"); } @@ -583,6 +609,8 @@ bus_message_state_change_cb (GstBus *bus, gst_query_unref (query); + CLUTTER_GST_NOTE (MEDIA, "can-seek: %d", priv->can_seek); + g_object_notify (G_OBJECT (video_texture), "can-seek"); /* Determine the duration */ @@ -595,6 +623,8 @@ bus_message_state_change_cb (GstBus *bus, gst_query_parse_duration (query, NULL, &duration); priv->duration = (gdouble) duration / GST_SECOND; + CLUTTER_GST_NOTE (MEDIA, "duration: %.02f", priv->duration); + g_object_notify (G_OBJECT (video_texture), "duration"); } |