flacenc: only set complete output caps once

... so as to avoid downstream complaints about missing streamheaders.
This commit is contained in:
Mark Nauwelaerts 2012-07-25 16:02:34 +02:00
parent a9b4ceefaf
commit 0f18a9aaaa

View file

@ -706,7 +706,6 @@ gst_flac_enc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
GstFlacEnc *flacenc; GstFlacEnc *flacenc;
guint64 total_samples = GST_CLOCK_TIME_NONE; guint64 total_samples = GST_CLOCK_TIME_NONE;
FLAC__StreamEncoderInitStatus init_status; FLAC__StreamEncoderInitStatus init_status;
GstCaps *caps;
flacenc = GST_FLAC_ENC (enc); flacenc = GST_FLAC_ENC (enc);
@ -715,14 +714,7 @@ gst_flac_enc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
FLAC__STREAM_ENCODER_UNINITIALIZED) FLAC__STREAM_ENCODER_UNINITIALIZED)
goto encoder_already_initialized; goto encoder_already_initialized;
caps = gst_caps_new_simple ("audio/x-flac", /* delay setting output caps/format until we have all headers */
"channels", G_TYPE_INT, GST_AUDIO_INFO_CHANNELS (info),
"rate", G_TYPE_INT, GST_AUDIO_INFO_RATE (info), NULL);
if (!gst_audio_encoder_set_output_format (enc, caps))
goto setting_src_caps_failed;
gst_caps_unref (caps);
gst_audio_get_channel_reorder_map (GST_AUDIO_INFO_CHANNELS (info), gst_audio_get_channel_reorder_map (GST_AUDIO_INFO_CHANNELS (info),
channel_positions[GST_AUDIO_INFO_CHANNELS (info) - 1], info->position, channel_positions[GST_AUDIO_INFO_CHANNELS (info) - 1], info->position,
@ -763,13 +755,6 @@ encoder_already_initialized:
g_warning ("flac already initialized -- fixme allow this"); g_warning ("flac already initialized -- fixme allow this");
return FALSE; return FALSE;
} }
setting_src_caps_failed:
{
GST_DEBUG_OBJECT (flacenc,
"Couldn't set caps on source pad: %" GST_PTR_FORMAT, caps);
gst_caps_unref (caps);
return FALSE;
}
failed_to_initialize: failed_to_initialize:
{ {
GST_ELEMENT_ERROR (flacenc, LIBRARY, INIT, (NULL), GST_ELEMENT_ERROR (flacenc, LIBRARY, INIT, (NULL),