[Xfce4-commits] <parole:0.2.2> Fix the query of a video capability for playbin2, since the previous commit parole uses playbin2, which has a cleaner API.
Ali Abdallah
noreply at xfce.org
Wed Dec 15 16:56:01 CET 2010
Updating branch refs/heads/0.2.2
to 294293148da04d171f5798b6b7b982fe7db78e8f (commit)
from 07e68468448bcd8c19c5b00655c86c13c44c3450 (commit)
commit 294293148da04d171f5798b6b7b982fe7db78e8f
Author: Ali Abdallah <aliov at xfce.org>
Date: Wed Dec 15 16:56:08 2010 +0100
Fix the query of a video capability for playbin2, since the previous commit
parole uses playbin2, which has a cleaner API.
gst/parole-gst.c | 78 ++++++++++++++++++-----------------------------------
1 files changed, 27 insertions(+), 51 deletions(-)
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index b20cc6c..9c39233 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -757,68 +757,44 @@ parole_gst_get_pad_capabilities (GObject *object, GParamSpec *pspec, ParoleGst *
static void
parole_gst_query_info (ParoleGst *gst)
{
- const GList *info = NULL;
- GObject *obj;
- GParamSpec *pspec;
- GEnumValue *val;
- gint type;
- gboolean has_video = FALSE;
+ GstPad *videopad = NULL;
+
+ gint n_audio, n_video, i;
g_object_get (G_OBJECT (gst->priv->playbin),
- "stream-info", &info,
+ "n-audio", &n_audio,
+ "n-video", &n_video,
NULL);
- for ( ; info != NULL; info = info->next )
+
+ g_object_set (G_OBJECT (gst->priv->stream),
+ "has-video", (n_video > 0),
+ "has-audio", (n_audio > 0),
+ NULL);
+
+ if (n_video > 0)
{
- obj = info->data;
-
- g_object_get (obj,
- "type", &type,
- NULL);
-
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (obj), "type");
- val = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
-
- if ( g_ascii_strcasecmp (val->value_name, "video") == 0 ||
- g_ascii_strcasecmp (val->value_nick, "video") == 0)
- {
- GstPad *pad = NULL;
+ for (i = 0; i < n_video && videopad == NULL; i++)
+ g_signal_emit_by_name (gst->priv->playbin, "get-video-pad", i, &videopad);
- g_object_get (G_OBJECT (obj),
- "object", &pad,
- NULL);
+ if (videopad)
+ {
+ GstCaps *caps;
- if ( pad )
+ if ((caps = gst_pad_get_negotiated_caps (videopad)))
{
- if ( GST_IS_PAD (pad) && GST_PAD_CAPS (pad) )
- {
- parole_gst_get_pad_capabilities (G_OBJECT (pad), NULL, gst);
- }
- else
- {
- g_signal_connect (pad, "notify::caps",
- G_CALLBACK (parole_gst_get_pad_capabilities),
- gst);
- }
- g_object_unref (pad);
+ parole_gst_get_pad_capabilities (G_OBJECT (videopad), NULL, gst);
+ g_object_unref (caps);
}
- TRACE ("Stream has video");
- g_object_set (G_OBJECT (gst->priv->stream),
- "has-video", TRUE,
- NULL);
- has_video = TRUE;
- }
- if ( g_ascii_strcasecmp (val->value_name, "audio") == 0 ||
- g_ascii_strcasecmp (val->value_nick, "audio") == 0)
- {
- TRACE ("Stream has audio");
- g_object_set (G_OBJECT (gst->priv->stream),
- "has-audio", TRUE,
- NULL);
+
+ g_signal_connect (videopad, "notify::caps",
+ G_CALLBACK (parole_gst_get_pad_capabilities),
+ gst);
+ g_object_unref (videopad);
}
}
-
- if ( !has_video )
+
+ if ( n_video == 0 )
gtk_widget_queue_draw (GTK_WIDGET (gst));
}
More information about the Xfce4-commits
mailing list