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

This commit is contained in:
Sebastian Dröge 2012-02-01 16:14:08 +01:00
parent 2f49fd9f39
commit 20b889a588
2 changed files with 6 additions and 11 deletions

View File

@ -210,7 +210,7 @@ gst_amrnbdec_set_format (GstAudioDecoder * dec, GstCaps * caps)
{ {
GstStructure *structure; GstStructure *structure;
GstAmrnbDec *amrnbdec; GstAmrnbDec *amrnbdec;
GstCaps *copy; GstAudioInfo info;
amrnbdec = GST_AMRNBDEC (dec); amrnbdec = GST_AMRNBDEC (dec);
@ -221,16 +221,11 @@ gst_amrnbdec_set_format (GstAudioDecoder * dec, GstCaps * caps)
gst_structure_get_int (structure, "rate", &amrnbdec->rate); gst_structure_get_int (structure, "rate", &amrnbdec->rate);
/* create reverse caps */ /* create reverse caps */
copy = gst_caps_new_simple ("audio/x-raw", gst_audio_info_init (&info);
"format", G_TYPE_STRING, GST_AUDIO_NE (S16), gst_audio_info_set_format (&info,
"layout", G_TYPE_STRING, "interleaved", GST_AUDIO_FORMAT_S16, amrnbdec->rate, amrnbdec->channels, NULL);
"channels", G_TYPE_INT, amrnbdec->channels,
"rate", G_TYPE_INT, amrnbdec->rate, NULL);
gst_audio_decoder_set_outcaps (dec, copy); return gst_audio_decoder_set_output_format (dec, &info);
gst_caps_unref (copy);
return TRUE;
} }
static GstFlowReturn static GstFlowReturn

View File

@ -224,7 +224,7 @@ gst_amrnbenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
"channels", G_TYPE_INT, amrnbenc->channels, "channels", G_TYPE_INT, amrnbenc->channels,
"rate", G_TYPE_INT, amrnbenc->rate, NULL); "rate", G_TYPE_INT, amrnbenc->rate, NULL);
gst_pad_set_caps (GST_AUDIO_ENCODER_SRC_PAD (amrnbenc), copy); gst_audio_encoder_set_output_format (GST_AUDIO_ENCODER (amrnbenc), copy);
gst_caps_unref (copy); gst_caps_unref (copy);
/* report needs to base class: hand one frame at a time */ /* report needs to base class: hand one frame at a time */