summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst/play
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2004-03-06 00:42:20 +0000
committerDavid Schleef <ds@schleef.org>2004-03-06 00:42:20 +0000
commit86db595f563c3b5da4427055f4afc439c12036b5 (patch)
tree917f010e633963aa567f4c9dd5ba0a6c856a6455 /gst-libs/gst/play
parent42547f3e85c3b208dd1ca7e06445e6e61c6d4b86 (diff)
downloadgst-plugins-bad-86db595f563c3b5da4427055f4afc439c12036b5.tar.gz
gst-plugins-bad-86db595f563c3b5da4427055f4afc439c12036b5.tar.bz2
gst-plugins-bad-86db595f563c3b5da4427055f4afc439c12036b5.zip
ext/faad/gstfaad.c: Fix negotiation.
Original commit message from CVS: * ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_srcgetcaps), (gst_faad_chain): Fix negotiation. * ext/librfb/gstrfbsrc.c: (gst_rfbsrc_handle_src_event): Add key and button events. * gst-libs/gst/floatcast/floatcast.h: Fix a minor bug in this dung heap of code. * gst-libs/gst/gconf/gstreamer-gconf-uninstalled.pc.in: gstgconf depends on gconf * gst-libs/gst/gconf/gstreamer-gconf.pc.in: same * gst-libs/gst/play/play.c: (gst_play_pipeline_setup), (gst_play_video_fixate), (gst_play_audio_fixate): Add a fixate function to encourage better negotiation, particularly between audioconvert and osssink. * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain): * gst/qtdemux/qtdemux.c: (qtdemux_parse_trak): Make some debugging more important. * gst/typefind/gsttypefindfunctions.c: Fix mistake in flash typefinding. * gst/vbidec/vbiscreen.c: Add glib header * pkgconfig/gstreamer-play.pc.in: Depends on gst-interfaces.
Diffstat (limited to 'gst-libs/gst/play')
-rw-r--r--gst-libs/gst/play/play.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/gst-libs/gst/play/play.c b/gst-libs/gst/play/play.c
index 081af994..f46fbabc 100644
--- a/gst-libs/gst/play/play.c
+++ b/gst-libs/gst/play/play.c
@@ -67,6 +67,9 @@ static GstPipelineClass *parent_class = NULL;
/* */
/* ======================================================= */
+static GstCaps * gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data);
+static GstCaps * gst_play_audio_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data);
+
static GQuark
gst_play_error_quark (void)
{
@@ -275,6 +278,8 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
/* Software scaling of video stream */
GST_PLAY_MAKE_OR_ERROR (video_scaler, "videoscale", "video_scaler", error);
g_hash_table_insert (play->priv->elements, "video_scaler", video_scaler);
+ g_signal_connect (gst_element_get_pad(video_scaler, "src"), "fixate",
+ G_CALLBACK (gst_play_video_fixate), play);
/* Placeholder for future video sink bin */
GST_PLAY_MAKE_OR_ERROR (video_sink, "fakesink", "video_sink", error);
@@ -315,6 +320,8 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
/* Volume control */
GST_PLAY_MAKE_OR_ERROR (volume, "volume", "volume", error);
g_hash_table_insert (play->priv->elements, "volume", volume);
+ g_signal_connect (gst_element_get_pad(volume, "src"), "fixate",
+ G_CALLBACK (gst_play_audio_fixate), play);
/* Placeholder for future audio sink bin */
GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error);
@@ -434,6 +441,65 @@ gst_play_get_length_callback (GstPlay *play)
return TRUE;
}
+static GstCaps *
+gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
+{
+ GstStructure *structure;
+ GstCaps *newcaps;
+
+ GST_DEBUG ("video fixate %p %" GST_PTR_FORMAT, pad, caps);
+
+ if (gst_caps_get_size (caps) > 1) return NULL;
+
+ newcaps = gst_caps_copy (caps);
+ structure = gst_caps_get_structure (newcaps, 0);
+
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 320)) {
+ return newcaps;
+ }
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "height", 240)) {
+ return newcaps;
+ }
+ if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
+ 30.0)) {
+ return newcaps;
+ }
+
+ /* failed to fixate */
+ gst_caps_free (newcaps);
+ return NULL;
+}
+
+static GstCaps *
+gst_play_audio_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
+{
+ GstCaps *newcaps;
+ GstStructure *structure;
+
+ GST_DEBUG ("audio fixate %p %" GST_PTR_FORMAT, pad, caps);
+
+ newcaps = gst_caps_new_full (gst_structure_copy (
+ gst_caps_get_structure (caps, 0)), NULL);
+ structure = gst_caps_get_structure (newcaps, 0);
+
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) {
+ return newcaps;
+ }
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "depth", 16)) {
+ return newcaps;
+ }
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "width", 16)) {
+ return newcaps;
+ }
+ if (gst_caps_structure_fixate_field_nearest_int (structure, "channels", 2)) {
+ return newcaps;
+ }
+
+ gst_caps_free (newcaps);
+
+ return NULL;
+}
+
static void
gst_play_state_change (GstElement *element, GstElementState old,
GstElementState state)