mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 17:18:15 +00:00
ext/vorbis/oggvorbisenc.c: properly fail when we can't setup the vorbis encoder due to unsupported settings
Original commit message from CVS: * 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
This commit is contained in:
parent
72f03b689d
commit
2e050e0378
4 changed files with 49 additions and 17 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
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:
|
||||
|
|
|
@ -224,6 +224,7 @@ gst_oggvorbisenc_sinkconnect (GstPad * pad, const GstCaps * caps)
|
|||
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);
|
||||
|
@ -655,14 +656,24 @@ gst_oggvorbisenc_setup (OggVorbisEnc * vorbisenc)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -228,6 +228,7 @@ gst_vorbisenc_sinkconnect (GstPad * pad, const GstCaps * caps)
|
|||
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);
|
||||
|
@ -622,6 +623,8 @@ update_start_message (VorbisEnc * vorbisenc)
|
|||
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;
|
||||
|
@ -635,9 +638,10 @@ gst_vorbisenc_setup (VorbisEnc * vorbisenc)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -662,8 +666,8 @@ gst_vorbisenc_setup (VorbisEnc * vorbisenc)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -400,10 +400,14 @@ gst_audio_convert_link (GstPad * pad, const GstCaps * caps)
|
|||
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) {
|
||||
|
|
Loading…
Reference in a new issue