audioencoder: Add gst_audio_encoder_set_output_format() function for consistency

This commit is contained in:
Sebastian Dröge 2012-02-01 16:00:37 +01:00
parent dbd43c7dd3
commit 0370b0dc12
2 changed files with 36 additions and 0 deletions

View file

@ -2169,3 +2169,36 @@ gst_audio_encoder_merge_tags (GstAudioEncoder * enc,
gst_tag_list_free (otags);
GST_OBJECT_UNLOCK (enc);
}
/*
* gst_audio_encoder_set_output_format:
* @enc: a #GstAudioEncoder
* @caps: #GstCaps
*
* Configure output caps on the srcpad of @enc.
*
* Returns: %TRUE on success.
**/
gboolean
gst_audio_encoder_set_output_format (GstAudioEncoder * enc, GstCaps * caps)
{
gboolean res = FALSE;
GST_DEBUG_OBJECT (enc, "Setting srcpad caps %" GST_PTR_FORMAT, caps);
if (!gst_caps_is_fixed (caps))
goto refuse_caps;
res = gst_pad_set_caps (enc->srcpad, caps);
done:
return res;
/* ERRORS */
refuse_caps:
{
GST_WARNING_OBJECT (enc, "refused caps %" GST_PTR_FORMAT, caps);
res = FALSE;
goto done;
}
}

View file

@ -197,6 +197,9 @@ GstFlowReturn gst_audio_encoder_finish_frame (GstAudioEncoder * enc,
GstCaps * gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc,
GstCaps * caps);
gboolean gst_audio_encoder_set_output_format (GstAudioEncoder * enc,
GstCaps * caps);
/* context parameters */
GstAudioInfo * gst_audio_encoder_get_audio_info (GstAudioEncoder * enc);