+2004-05-24 Benjamin Otte <otte@gnome.org>
+
+ * ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_sinkconnect),
+ (gst_oggvorbisenc_setup):
+ properly fail when we can't setup the vorbis encoder due to
+ unsupported settings
+ * ext/vorbis/vorbisenc.c: (gst_vorbisenc_sinkconnect),
+ (gst_vorbisenc_setup):
+ same
+ * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_link):
+ fix case where warnings occured when one pad was unlinked while the
+ other's link function was called
+
2004-05-24 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/tcp/Makefile.am:
GstStructure *structure;
vorbisenc = GST_OGGVORBISENC (gst_pad_get_parent (pad));
+ vorbisenc->setup = FALSE;
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "channels", &vorbisenc->channels);
vorbis_encode_ctl (&vorbisenc->vi, OV_ECTL_RATEMANAGE_SET, &ai);
}
} else {
- if (vorbis_encode_setup_managed (&vorbisenc->vi,
- vorbisenc->channels,
- vorbisenc->frequency,
- vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1,
- vorbisenc->bitrate,
- vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1)) {
- g_warning
- ("vorbisenc: initialisation failed: invalid parameters for bitrate\n");
+ int ret;
+
+ GST_LOG_OBJECT (vorbisenc,
+ "calling setup_managed with channels=%d, frequency=%d, bitrate=[%d,%d,%d]",
+ vorbisenc->channels, vorbisenc->frequency,
+ vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1,
+ vorbisenc->bitrate,
+ vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1);
+ ret =
+ vorbis_encode_setup_managed (&vorbisenc->vi, vorbisenc->channels,
+ vorbisenc->frequency,
+ vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1,
+ vorbisenc->bitrate,
+ vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1);
+ if (ret != 0) {
+ GST_ERROR_OBJECT (vorbisenc,
+ "vorbisenc: initialisation failed: invalid parameters for bitrate (returned: %d)",
+ ret);
vorbis_info_clear (&vorbisenc->vi);
return FALSE;
}
GstStructure *structure;
vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
+ vorbisenc->setup = FALSE;
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "channels", &vorbisenc->channels);
static gboolean
gst_vorbisenc_setup (VorbisEnc * vorbisenc)
{
+ vorbisenc->setup = FALSE;
+
if (vorbisenc->bitrate < 0 && vorbisenc->min_bitrate < 0
&& vorbisenc->max_bitrate < 0) {
vorbisenc->quality_set = TRUE;
if (vorbisenc->quality_set) {
if (vorbis_encode_setup_vbr (&vorbisenc->vi,
- vorbisenc->channels, vorbisenc->frequency, vorbisenc->quality)) {
- g_warning
- ("vorbisenc: initialisation failed: invalid parameters for quality");
+ vorbisenc->channels, vorbisenc->frequency,
+ vorbisenc->quality) != 0) {
+ GST_ERROR_OBJECT (vorbisenc,
+ "vorbisenc: initialisation failed: invalid parameters for quality");
vorbis_info_clear (&vorbisenc->vi);
return FALSE;
}
vorbisenc->max_bitrate > 0 ? vorbisenc->max_bitrate : -1,
vorbisenc->bitrate,
vorbisenc->min_bitrate > 0 ? vorbisenc->min_bitrate : -1)) {
- g_warning
- ("vorbisenc: initialisation failed: invalid parameters for bitrate\n");
+ GST_ERROR_OBJECT (vorbisenc,
+ "vorbisenc: initialisation failed: invalid parameters for bitrate");
vorbis_info_clear (&vorbisenc->vi);
return FALSE;
}
return ret;
/* woohoo, got it */
- if (!gst_audio_convert_parse_caps (gst_pad_get_negotiated_caps (otherpad),
- &other_ac_caps)) {
- g_critical ("internal negotiation error");
- return GST_PAD_LINK_REFUSED;
+ othercaps = (GstCaps *) gst_pad_get_negotiated_caps (otherpad);
+ if (othercaps) {
+ if (!gst_audio_convert_parse_caps (othercaps, &other_ac_caps)) {
+ g_critical ("internal negotiation error");
+ return GST_PAD_LINK_REFUSED;
+ }
+ } else {
+ other_ac_caps = ac_caps;
}
if (this->sink == pad) {