gsm: Use new audio encoder/decoder base class API for srcpad caps

This commit is contained in:
Sebastian Dröge 2012-02-01 16:23:31 +01:00
parent cf0f205cca
commit 18a21051a2
2 changed files with 5 additions and 8 deletions

View file

@ -134,10 +134,10 @@ static gboolean
gst_gsmdec_set_format (GstAudioDecoder * dec, GstCaps * caps)
{
GstGSMDec *gsmdec;
GstCaps *srccaps;
GstStructure *s;
gboolean ret = FALSE;
gint rate;
GstAudioInfo info;
gsmdec = GST_GSMDEC (dec);
@ -164,13 +164,10 @@ gst_gsmdec_set_format (GstAudioDecoder * dec, GstCaps * caps)
gsm_option (gsmdec->state, GSM_OPT_WAV49, &gsmdec->use_wav49);
/* Setting up src caps based on the input sample rate. */
srccaps = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
"layout", G_TYPE_STRING, "interleaved",
"rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL);
gst_audio_info_init (&info);
gst_audio_info_set_format (&info, GST_AUDIO_FORMAT_S16, rate, 1, NULL);
ret = gst_audio_decoder_set_outcaps (dec, srccaps);
gst_caps_unref (srccaps);
ret = gst_audio_decoder_set_output_format (dec, &info);
return ret;

View file

@ -133,7 +133,7 @@ gst_gsmenc_set_format (GstAudioEncoder * benc, GstAudioInfo * info)
GstCaps *srccaps;
srccaps = gst_static_pad_template_get_caps (&gsmenc_src_template);
gst_pad_set_caps (GST_AUDIO_ENCODER_SRC_PAD (benc), srccaps);
gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (benc), srccaps);
/* report needs to base class */
gst_audio_encoder_set_frame_samples_min (benc, 160);