amrnb: Use new audio encoder/decoder base class API for srcpad caps
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 1 Feb 2012 15:14:08 +0000 (16:14 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 1 Feb 2012 15:27:49 +0000 (16:27 +0100)
ext/amrnb/amrnbdec.c
ext/amrnb/amrnbenc.c

index 53c9bf714c278fac1dd0543319f4c1aee4f39849..40d8a668e4ad1fea7a28eb14da3b69146b44f7e9 100644 (file)
@@ -210,7 +210,7 @@ gst_amrnbdec_set_format (GstAudioDecoder * dec, GstCaps * caps)
 {
   GstStructure *structure;
   GstAmrnbDec *amrnbdec;
-  GstCaps *copy;
+  GstAudioInfo info;
 
   amrnbdec = GST_AMRNBDEC (dec);
 
@@ -221,16 +221,11 @@ gst_amrnbdec_set_format (GstAudioDecoder * dec, GstCaps * caps)
   gst_structure_get_int (structure, "rate", &amrnbdec->rate);
 
   /* create reverse caps */
-  copy = gst_caps_new_simple ("audio/x-raw",
-      "format", G_TYPE_STRING, GST_AUDIO_NE (S16),
-      "layout", G_TYPE_STRING, "interleaved",
-      "channels", G_TYPE_INT, amrnbdec->channels,
-      "rate", G_TYPE_INT, amrnbdec->rate, NULL);
+  gst_audio_info_init (&info);
+  gst_audio_info_set_format (&info,
+      GST_AUDIO_FORMAT_S16, amrnbdec->rate, amrnbdec->channels, NULL);
 
-  gst_audio_decoder_set_outcaps (dec, copy);
-  gst_caps_unref (copy);
-
-  return TRUE;
+  return gst_audio_decoder_set_output_format (dec, &info);
 }
 
 static GstFlowReturn
index 55f0c9363da53a051d5ec67b40f9f06153e394fa..09ff0e15f219233a4bbfe90577c27d55f8fa66f1 100644 (file)
@@ -224,7 +224,7 @@ gst_amrnbenc_set_format (GstAudioEncoder * enc, GstAudioInfo * info)
       "channels", G_TYPE_INT, amrnbenc->channels,
       "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);
 
   /* report needs to base class: hand one frame at a time */