From 70420b066171d5ce89ad9bf33b6b5b7ac7349d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Thu, 27 Oct 2011 19:39:20 +0200 Subject: [PATCH] wavenc: port to 0.11 raw audio caps --- gst/wavenc/Makefile.am | 1 + gst/wavenc/gstwavenc.c | 62 +++++++++++------------------------------- 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/gst/wavenc/Makefile.am b/gst/wavenc/Makefile.am index a213b0075e..53ef62d2c0 100644 --- a/gst/wavenc/Makefile.am +++ b/gst/wavenc/Makefile.am @@ -6,6 +6,7 @@ libgstwavenc_la_CFLAGS = \ $(GST_CFLAGS) libgstwavenc_la_LIBADD = \ $(GST_PLUGINS_BASE_LIBS) \ + -lgstaudio-@GST_MAJORMINOR@ \ -lgstriff-@GST_MAJORMINOR@ \ $(GST_LIBS) libgstwavenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) diff --git a/gst/wavenc/gstwavenc.c b/gst/wavenc/gstwavenc.c index 0608e0642a..a186082112 100644 --- a/gst/wavenc/gstwavenc.c +++ b/gst/wavenc/gstwavenc.c @@ -32,6 +32,7 @@ #include #include "gstwavenc.h" +#include #include GST_DEBUG_CATEGORY_STATIC (wavenc_debug); @@ -72,42 +73,11 @@ struct wave_header /* Max. of two channels, more channels need WAVFORMATEX with * channel layout, which we do not support yet */ #define SINK_CAPS \ - "audio/x-raw-int, " \ + "audio/x-raw, " \ "rate = (int) [ 1, MAX ], " \ "channels = (int) [ 1, 2 ], " \ - "endianness = (int) LITTLE_ENDIAN, " \ - "width = (int) 32, " \ - "depth = (int) 32, " \ - "signed = (boolean) true" \ + "format = (string) { S32LE, S24LE, S16LE, U8, F32LE, F64LE } " \ "; " \ - "audio/x-raw-int, " \ - "rate = (int) [ 1, MAX ], " \ - "channels = (int) [ 1, 2 ], " \ - "endianness = (int) LITTLE_ENDIAN, " \ - "width = (int) 24, " \ - "depth = (int) 24, " \ - "signed = (boolean) true" \ - "; " \ - "audio/x-raw-int, " \ - "rate = (int) [ 1, MAX ], " \ - "channels = (int) [ 1, 2 ], " \ - "endianness = (int) LITTLE_ENDIAN, " \ - "width = (int) 16, " \ - "depth = (int) 16, " \ - "signed = (boolean) true" \ - "; " \ - "audio/x-raw-int, " \ - "rate = (int) [ 1, MAX ], " \ - "channels = (int) [ 1, 2 ], " \ - "width = (int) 8, " \ - "depth = (int) 8, " \ - "signed = (boolean) false" \ - "; " \ - "audio/x-raw-float, " \ - "rate = (int) [ 1, MAX ], " \ - "channels = (int) [ 1, 2 ], " \ - "endianness = (int) LITTLE_ENDIAN, " \ - "width = (int) { 32, 64 }; " \ "audio/x-alaw, " \ "rate = (int) [ 8000, 192000 ], " \ "channels = (int) [ 1, 2 ], " \ @@ -266,7 +236,7 @@ gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps) GstWavEnc *wavenc; GstStructure *structure; const gchar *name; - gint chans, rate, width; + gint chans, rate; GstCaps *ccaps; wavenc = GST_WAVENC (gst_pad_get_parent (pad)); @@ -291,20 +261,20 @@ gst_wavenc_sink_setcaps (GstPad * pad, GstCaps * caps) goto fail; } - if (strcmp (name, "audio/x-raw-int") == 0) { - if (!gst_structure_get_int (structure, "width", &width)) { - GST_WARNING_OBJECT (wavenc, "caps incomplete"); + if (strcmp (name, "audio/x-raw") == 0) { + GstAudioInfo info; + + if (!gst_audio_info_from_caps (&info, caps)) goto fail; - } - wavenc->format = GST_RIFF_WAVE_FORMAT_PCM; - wavenc->width = width; - } else if (strcmp (name, "audio/x-raw-float") == 0) { - if (!gst_structure_get_int (structure, "width", &width)) { - GST_WARNING_OBJECT (wavenc, "caps incomplete"); + + if (GST_AUDIO_INFO_IS_INTEGER (&info)) + wavenc->format = GST_RIFF_WAVE_FORMAT_PCM; + else if (GST_AUDIO_INFO_IS_FLOAT (&info)) + wavenc->format = GST_RIFF_WAVE_FORMAT_IEEE_FLOAT; + else goto fail; - } - wavenc->format = GST_RIFF_WAVE_FORMAT_IEEE_FLOAT; - wavenc->width = width; + + wavenc->width = GST_AUDIO_INFO_WIDTH (&info); } else if (strcmp (name, "audio/x-alaw") == 0) { wavenc->format = GST_RIFF_WAVE_FORMAT_ALAW; wavenc->width = 8;