From 89303c580fc8a644779f208abb4c6850e67fc880 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 15 Jan 2004 21:05:17 +0000 Subject: [PATCH] ext/esd/esdsink.c: Remove property that handles osssink fallback. Original commit message from CVS: * ext/esd/esdsink.c: (gst_esdsink_class_init): Remove property that handles osssink fallback. * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init), (gst_audio_convert_getcaps): * gst/qtdemux/qtdemux.c: (qtdemux_audio_caps): Add audio/x-qdm2 for QDM2 audio. * gst/sine/gstsinesrc.c: (gst_sinesrc_get): * gst/sine/gstsinesrc.h: Add example of how to implement tags. * gst/videoscale/gstvideoscale.c: (gst_videoscale_getcaps): Decrease minimum size to 16x16. * gst/wavparse/gstwavparse.c: Convert disabled pad template caps to new caps. * sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get), (gst_xvimagesink_chain): Throw element error when display cannot be opened. Increase minimum framerate to 1.0. Check the data free function on a buffer to make sure it is the type we expect before manipulating it. --- ChangeLog | 21 +++++++++++++++++ gst/audioconvert/gstaudioconvert.c | 36 ++++++++++++++++++++++++++++++ gst/sine/gstsinesrc.c | 12 ++++++++++ gst/sine/gstsinesrc.h | 2 ++ gst/videoscale/gstvideoscale.c | 4 ++-- sys/ximage/ximagesink.c | 3 ++- sys/xvimage/xvimagesink.c | 10 ++++++--- 7 files changed, 82 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 131c75f55b..821365d685 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2004-01-15 David Schleef + + * ext/esd/esdsink.c: (gst_esdsink_class_init): Remove property + that handles osssink fallback. + * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init), + (gst_audio_convert_getcaps): + * gst/qtdemux/qtdemux.c: (qtdemux_audio_caps): + Add audio/x-qdm2 for QDM2 audio. + * gst/sine/gstsinesrc.c: (gst_sinesrc_get): + * gst/sine/gstsinesrc.h: Add example of how to implement tags. + * gst/videoscale/gstvideoscale.c: (gst_videoscale_getcaps): + Decrease minimum size to 16x16. + * gst/wavparse/gstwavparse.c: + Convert disabled pad template caps to new caps. + * sys/ximage/ximagesink.c: (gst_ximagesink_xcontext_get): + * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xcontext_get), + (gst_xvimagesink_chain): Throw element error when display cannot + be opened. Increase minimum framerate to 1.0. Check the data + free function on a buffer to make sure it is the type we expect + before manipulating it. + 2004-01-15 Julien MOUTTE * gst/videofilter/gstvideobalance.c: (gst_videobalance_init), diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index 64d5c910eb..aa0b8126e9 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -119,6 +119,7 @@ static void gst_audio_convert_get_property (GObject *object, guint prop_id, GVa /* gstreamer functions */ static void gst_audio_convert_chain (GstPad *pad, GstData *_data); static GstPadLinkReturn gst_audio_convert_link (GstPad *pad, const GstCaps *caps); +static GstCaps * gst_audio_convert_getcaps (GstPad *pad); static GstElementStateReturn gst_audio_convert_change_state (GstElement *element); /* actual work */ @@ -268,6 +269,7 @@ gst_audio_convert_init (GstAudioConvert *this) /* sinkpad */ this->sink = gst_pad_new_from_template ( gst_static_pad_template_get (&gst_audio_convert_sink_template), "sink"); + gst_pad_set_getcaps_function (this->sink, gst_audio_convert_getcaps); gst_pad_set_link_function (this->sink, gst_audio_convert_link); gst_pad_set_getcaps_function (this->sink, gst_audioconvert_getcaps); gst_element_add_pad (GST_ELEMENT(this), this->sink); @@ -275,6 +277,7 @@ gst_audio_convert_init (GstAudioConvert *this) /* srcpad */ this->src = gst_pad_new_from_template ( gst_static_pad_template_get (&gst_audio_convert_src_template), "src"); + gst_pad_set_getcaps_function (this->src, gst_audio_convert_getcaps); gst_pad_set_link_function (this->src, gst_audio_convert_link); gst_pad_set_getcaps_function (this->src, gst_audioconvert_getcaps); gst_element_add_pad (GST_ELEMENT(this), this->src); @@ -362,6 +365,39 @@ gst_audio_convert_chain (GstPad *pad, GstData *_data) gst_pad_push (this->src, GST_DATA (buf)); } +static GstCaps * +gst_audio_convert_getcaps (GstPad *pad) +{ + GstAudioConvert *this; + GstPad *otherpad; + GstCaps *othercaps; + GstCaps *caps; + int i; + + g_return_val_if_fail(GST_IS_PAD(pad), NULL); + g_return_val_if_fail(GST_IS_AUDIO_CONVERT(GST_OBJECT_PARENT (pad)), NULL); + this = GST_AUDIO_CONVERT(GST_OBJECT_PARENT (pad)); + + otherpad = (pad == this->src) ? this->sink : this->src; + + othercaps = gst_pad_get_allowed_caps (otherpad); + + for (i=0;itags_pushed) { + GstTagList *taglist; + + taglist = gst_tag_list_new (); + + gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, + GST_TAG_DESCRIPTION, "sine wave", NULL); + + gst_element_found_tags_for_pad (GST_ELEMENT (src), pad, 0, taglist); + src->tags_pushed = TRUE; + } + tdiff = src->samples_per_buffer * GST_SECOND / src->samplerate; /* note: the 2 is because of the format we use */ diff --git a/gst/sine/gstsinesrc.h b/gst/sine/gstsinesrc.h index b07e067433..fbfc455e9b 100644 --- a/gst/sine/gstsinesrc.h +++ b/gst/sine/gstsinesrc.h @@ -77,6 +77,8 @@ struct _GstSineSrc { guint64 offset; gdouble accumulator; + + gboolean tags_pushed; }; struct _GstSineSrcClass { diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 25e835db4e..b3f4ea674d 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -183,8 +183,8 @@ gst_videoscale_getcaps (GstPad *pad) GstStructure *structure = gst_caps_get_structure (caps, i); gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 100, G_MAXINT, - "height", GST_TYPE_INT_RANGE, 100, G_MAXINT, + "width", GST_TYPE_INT_RANGE, 16, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 16, G_MAXINT, NULL); } diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index bb4b392383..bebd513815 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -44,7 +44,7 @@ GST_STATIC_PAD_TEMPLATE ( GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-rgb, " - "framerate = (double) [ 0, MAX ], " + "framerate = (double) [ 1.0, 100.0 ], " "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]") ); @@ -446,6 +446,7 @@ gst_ximagesink_xcontext_get (GstXImageSink *ximagesink) { g_mutex_unlock (ximagesink->x_lock); g_free (xcontext); + gst_element_error (GST_ELEMENT (ximagesink), "Could not open display"); return NULL; } diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index e774417ee1..562a8e932f 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -29,6 +29,8 @@ /* Object header */ #include "xvimagesink.h" +static void gst_xvimagesink_buffer_free (GstBuffer *buffer); + /* ElementFactory information */ static GstElementDetails gst_xvimagesink_details = GST_ELEMENT_DETAILS ( "Video sink", @@ -46,11 +48,11 @@ GST_STATIC_PAD_TEMPLATE ( GST_PAD_ALWAYS, GST_STATIC_CAPS ( "video/x-raw-rgb, " - "framerate = (double) [ 0, MAX ], " + "framerate = (double) [ 1.0, 100.0 ], " "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]; " "video/x-raw-yuv, " - "framerate = (double) [ 0, MAX ], " + "framerate = (double) [ 1.0, 100.0 ], " "width = (int) [ 0, MAX ], " "height = (int) [ 0, MAX ]" ) @@ -557,6 +559,7 @@ gst_xvimagesink_xcontext_get (GstXvImageSink *xvimagesink) { g_mutex_unlock (xvimagesink->x_lock); g_free (xcontext); + gst_element_error (GST_ELEMENT (xvimagesink), "Could not open display"); return NULL; } @@ -938,7 +941,8 @@ gst_xvimagesink_chain (GstPad *pad, GstData *data) /* If this buffer has been allocated using our buffer management we simply put the ximage which is in the PRIVATE pointer */ - if (GST_BUFFER_PRIVATE (buf)) + /* FIXME: need to check for correct xvimagesink here? */ + if (GST_BUFFER_FREE_DATA_FUNC (buf) == gst_xvimagesink_buffer_free) { gst_xvimagesink_xvimage_put (xvimagesink, GST_BUFFER_PRIVATE (buf)); }