From: Benjamin O. <co...@pd...> - 2004-06-06 19:36:21
|
CVS Root: /home/cvs/gstreamer Module: gst-plugins Changes by: company Date: Mon Jun 07 2004 05:36:20 EST Log message: * ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init): use explicit caps on the srcpad * ext/vorbis/vorbisdec.c: (vorbis_dec_chain): properly error out if caps couldn't be set (fixes #142764) Modified files: . : ChangeLog ext/vorbis : vorbisdec.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.734&r2=1.735 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/vorbis/vorbisdec.c.diff?r1=1.40&r2=1.41 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.734 retrieving revision 1.735 diff -u -d -r1.734 -r1.735 --- a/ChangeLog 6 Jun 2004 17:26:54 -0000 1.734 +++ b/ChangeLog 6 Jun 2004 19:36:08 -0000 1.735 @@ -1,5 +1,12 @@ 2004-06-06 Benjamin Otte <ot...@gn...> + * ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init): + use explicit caps on the srcpad + * ext/vorbis/vorbisdec.c: (vorbis_dec_chain): + properly error out if caps couldn't be set (fixes #142764) + +2004-06-06 Benjamin Otte <ot...@gn...> * ext/alsa/gstalsa.c: (gst_alsa_probe_hw_params), (gst_alsa_set_hw_params), (gst_alsa_set_sw_params), (gst_alsa_start_audio): Index: vorbisdec.c RCS file: /home/cvs/gstreamer/gst-plugins/ext/vorbis/vorbisdec.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- a/vorbisdec.c 2 Jun 2004 11:47:10 -0000 1.40 +++ b/vorbisdec.c 6 Jun 2004 19:36:08 -0000 1.41 @@ -118,35 +118,6 @@ return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats); } -static GstPadLinkReturn -vorbis_dec_link (GstPad * pad, const GstCaps * caps) -{ - GstVorbisDec *dec = GST_VORBIS_DEC (gst_pad_get_parent (pad)); - - if (dec->packetno < 3) - return GST_PAD_LINK_DELAYED; - return GST_PAD_LINK_OK; -} -static GstCaps * -vorbis_dec_getcaps (GstPad * pad) - return gst_caps_copy (gst_pad_get_pad_template_caps (pad)); - return gst_caps_new_simple ("audio/x-raw-float", - "rate", G_TYPE_INT, dec->vi.rate, - "channels", G_TYPE_INT, dec->vi.channels, - "endianness", G_TYPE_INT, G_BYTE_ORDER, "width", G_TYPE_INT, 32, -#ifdef GST_VORBIS_DEC_SEQUENTIAL - "layout", G_TYPE_STRING, "sequential", -#endif - "buffer-frames", G_TYPE_INT, 0, NULL); static void gst_vorbis_dec_init (GstVorbisDec * dec) { @@ -160,8 +131,7 @@ dec->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&vorbis_dec_src_factory), "src"); - gst_pad_set_link_function (dec->srcpad, vorbis_dec_link); - gst_pad_set_getcaps_function (dec->srcpad, vorbis_dec_getcaps); + gst_pad_use_explicit_caps (dec->srcpad); gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event); gst_pad_set_query_function (dec->srcpad, vorbis_dec_src_query); gst_pad_set_formats_function (dec->srcpad, vorbis_dec_get_formats); @@ -395,11 +365,21 @@ GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL); gst_element_found_tags_for_pad (GST_ELEMENT (vd), vd->srcpad, 0, list); } else if (packet.packetno == 2) { + GstCaps *caps; /* done */ vorbis_synthesis_init (&vd->vd, &vd->vi); vorbis_block_init (&vd->vd, &vd->vb); - if (gst_pad_is_linked (vd->srcpad)) - gst_pad_renegotiate (vd->srcpad); + caps = gst_caps_new_simple ("audio/x-raw-float", + "rate", G_TYPE_INT, vd->vi.rate, + "channels", G_TYPE_INT, vd->vi.channels, + "endianness", G_TYPE_INT, G_BYTE_ORDER, + "width", G_TYPE_INT, 32, "buffer-frames", G_TYPE_INT, 0, NULL); + if (!gst_pad_set_explicit_caps (vd->srcpad, caps)) { + gst_caps_free (caps); + return; + } + gst_caps_free (caps); } } else { float **pcm; |