mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
audiodecoder: Rename set_outcaps() to set_output_format() and take a GstAudioInfo as parameter
This commit is contained in:
parent
29cc1d2ce1
commit
dbd43c7dd3
2 changed files with 19 additions and 15 deletions
|
@ -488,28 +488,30 @@ gst_audio_decoder_finalize (GObject * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_audio_decoder_set_outcaps:
|
* gst_audio_decoder_set_output_format:
|
||||||
* @dec: a #GstAudioDecoder
|
* @dec: a #GstAudioDecoder
|
||||||
* @caps: #GstCaps
|
* @info: #GstAudioInfo
|
||||||
*
|
*
|
||||||
* Configure output @caps on the srcpad of @dec. Also perform
|
* Configure output info on the srcpad of @dec.
|
||||||
* sanity checking of @caps and extracts output data format
|
|
||||||
*
|
*
|
||||||
* Returns: %TRUE on success.
|
* Returns: %TRUE on success.
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gst_audio_decoder_set_outcaps (GstAudioDecoder * dec, GstCaps * caps)
|
gst_audio_decoder_set_output_format (GstAudioDecoder * dec,
|
||||||
|
const GstAudioInfo * info)
|
||||||
{
|
{
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
guint old_rate;
|
guint old_rate;
|
||||||
|
GstCaps *caps;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dec, "setting src caps %" GST_PTR_FORMAT, caps);
|
GST_DEBUG_OBJECT (dec, "Setting output format");
|
||||||
|
|
||||||
GST_AUDIO_DECODER_STREAM_LOCK (dec);
|
GST_AUDIO_DECODER_STREAM_LOCK (dec);
|
||||||
|
|
||||||
/* parse caps here to check subclass;
|
/* If the audio info can't be converted to caps,
|
||||||
* also makes us aware of output format */
|
* it was invalid */
|
||||||
if (!gst_caps_is_fixed (caps))
|
caps = gst_audio_info_to_caps (info);
|
||||||
|
if (!caps)
|
||||||
goto refuse_caps;
|
goto refuse_caps;
|
||||||
|
|
||||||
/* adjust ts tracking to new sample rate */
|
/* adjust ts tracking to new sample rate */
|
||||||
|
@ -520,20 +522,22 @@ gst_audio_decoder_set_outcaps (GstAudioDecoder * dec, GstCaps * caps)
|
||||||
dec->priv->samples = 0;
|
dec->priv->samples = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_audio_info_from_caps (&dec->priv->ctx.info, caps))
|
/* copy the GstAudioInfo */
|
||||||
goto refuse_caps;
|
dec->priv->ctx.info = *info;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (dec, "setting src caps %" GST_PTR_FORMAT, caps);
|
||||||
|
|
||||||
done:
|
|
||||||
GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
|
GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
|
||||||
|
|
||||||
res = gst_pad_set_caps (dec->srcpad, caps);
|
res = gst_pad_set_caps (dec->srcpad, caps);
|
||||||
|
|
||||||
|
done:
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
refuse_caps:
|
refuse_caps:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (dec, "rejected caps %" GST_PTR_FORMAT, caps);
|
GST_WARNING_OBJECT (dec, "invalid output format");
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,8 +242,8 @@ struct _GstAudioDecoderClass
|
||||||
|
|
||||||
GType gst_audio_decoder_get_type (void);
|
GType gst_audio_decoder_get_type (void);
|
||||||
|
|
||||||
gboolean gst_audio_decoder_set_outcaps (GstAudioDecoder * dec,
|
gboolean gst_audio_decoder_set_output_format (GstAudioDecoder * dec,
|
||||||
GstCaps * caps);
|
const GstAudioInfo * info);
|
||||||
|
|
||||||
GstFlowReturn gst_audio_decoder_finish_frame (GstAudioDecoder * dec,
|
GstFlowReturn gst_audio_decoder_finish_frame (GstAudioDecoder * dec,
|
||||||
GstBuffer * buf, gint frames);
|
GstBuffer * buf, gint frames);
|
||||||
|
|
Loading…
Reference in a new issue