fix negotiation error handling

Original commit message from CVS:
fix negotiation error handling
This commit is contained in:
Wim Taymans 2003-06-01 08:34:23 +00:00
parent 2c32dd6f5a
commit cd3f2fa760

View file

@ -454,6 +454,8 @@ static gboolean
gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link) gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link)
{ {
vorbis_info *vi = ov_info (&vorbisfile->vf, link); vorbis_info *vi = ov_info (&vorbisfile->vf, link);
GstCaps *caps;
gboolean res = TRUE;
/* new logical bitstream */ /* new logical bitstream */
vorbisfile->current_link = link; vorbisfile->current_link = link;
@ -461,23 +463,26 @@ gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link)
gst_vorbisfile_update_metadata (vorbisfile, link); gst_vorbisfile_update_metadata (vorbisfile, link);
gst_vorbisfile_update_streaminfo (vorbisfile, link); gst_vorbisfile_update_streaminfo (vorbisfile, link);
if (gst_pad_try_set_caps (vorbisfile->srcpad, caps = GST_CAPS_NEW ("vorbisdec_src",
GST_CAPS_NEW ("vorbisdec_src", "audio/raw",
"audio/raw", "format", GST_PROPS_STRING ("int"),
"format", GST_PROPS_STRING ("int"), "law", GST_PROPS_INT (0),
"law", GST_PROPS_INT (0), "endianness", GST_PROPS_INT (G_BYTE_ORDER),
"endianness", GST_PROPS_INT (G_BYTE_ORDER), "signed", GST_PROPS_BOOLEAN (TRUE),
"signed", GST_PROPS_BOOLEAN (TRUE), "width", GST_PROPS_INT (16),
"width", GST_PROPS_INT (16), "depth", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16), "rate", GST_PROPS_INT (vi->rate),
"rate", GST_PROPS_INT (vi->rate), "channels", GST_PROPS_INT (vi->channels));
"channels", GST_PROPS_INT (vi->channels) gst_caps_ref (caps);
)) <= 0)
{ if (gst_pad_try_set_caps (vorbisfile->srcpad, caps) <= 0) {
return FALSE; if (!gst_pad_recover_caps_error (vorbisfile->srcpad, caps))
res = FALSE;
} }
return TRUE; gst_caps_unref (caps);
return res;
} }
static void static void
@ -565,7 +570,7 @@ gst_vorbisfile_loop (GstElement *element)
/* we update the caps for each logical stream */ /* we update the caps for each logical stream */
if (vorbisfile->vf.current_link != vorbisfile->current_link) { if (vorbisfile->vf.current_link != vorbisfile->current_link) {
if (!gst_vorbisfile_new_link (vorbisfile, vorbisfile->vf.current_link)) { if (!gst_vorbisfile_new_link (vorbisfile, vorbisfile->vf.current_link)) {
gst_element_error (GST_ELEMENT (vorbisfile), "could not negotiate format"); return;
} }
return; return;
} }