diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index 330697a098..1603838ad0 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -2068,21 +2068,21 @@ gst_pulse_format_info_to_caps (pa_format_info * format) if (pa_format_info_get_prop_string (format, PA_PROP_FORMAT_SAMPLE_FORMAT, &tmp)) { /* No specific sample format means any sample format */ - ret = gst_caps_from_string (_PULSE_SINK_CAPS_PCM); + ret = gst_caps_from_string (_PULSE_CAPS_PCM); goto out; } else if (ss.format == PA_SAMPLE_ALAW) { - ret = gst_caps_from_string (_PULSE_SINK_CAPS_ALAW); + ret = gst_caps_from_string (_PULSE_CAPS_ALAW); } else if (ss.format == PA_SAMPLE_ULAW) { - ret = gst_caps_from_string (_PULSE_SINK_CAPS_MP3); + ret = gst_caps_from_string (_PULSE_CAPS_MP3); } else { /* Linear PCM format */ const char *sformat = gst_pulse_sample_format_to_caps_format (ss.format); - ret = gst_caps_from_string (_PULSE_SINK_CAPS_LINEAR); + ret = gst_caps_from_string (_PULSE_CAPS_LINEAR); if (sformat) gst_caps_set_simple (ret, "format", G_TYPE_STRING, NULL); @@ -2093,19 +2093,19 @@ gst_pulse_format_info_to_caps (pa_format_info * format) } case PA_ENCODING_AC3_IEC61937: - ret = gst_caps_from_string (_PULSE_SINK_CAPS_AC3); + ret = gst_caps_from_string (_PULSE_CAPS_AC3); break; case PA_ENCODING_EAC3_IEC61937: - ret = gst_caps_from_string (_PULSE_SINK_CAPS_EAC3); + ret = gst_caps_from_string (_PULSE_CAPS_EAC3); break; case PA_ENCODING_DTS_IEC61937: - ret = gst_caps_from_string (_PULSE_SINK_CAPS_DTS); + ret = gst_caps_from_string (_PULSE_CAPS_DTS); break; case PA_ENCODING_MPEG_IEC61937: - ret = gst_caps_from_string (_PULSE_SINK_CAPS_MP3); + ret = gst_caps_from_string (_PULSE_CAPS_MP3); break; default: diff --git a/ext/pulse/pulsesink.h b/ext/pulse/pulsesink.h index 85f5f7f5f1..09872a70cc 100644 --- a/ext/pulse/pulsesink.h +++ b/ext/pulse/pulsesink.h @@ -92,47 +92,12 @@ struct _GstPulseSinkClass GType gst_pulsesink_get_type (void); -#if (G_BYTE_ORDER == G_LITTLE_ENDIAN) -# define FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, " \ - "S24LE, S24BE, S24_32LE, S24_32BE, U8 }" -#else -# define FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, " \ - "S24BE, S24LE, S24_32BE, S24_32LE, U8 }" -#endif - -#define _PULSE_SINK_CAPS_LINEAR \ - "audio/x-raw, " \ - "format = (string) " FORMATS ", " \ - "layout = (string) interleaved, " \ - "rate = (int) [ 1, MAX ], " \ - "channels = (int) [ 1, 32 ]; " -#define _PULSE_SINK_CAPS_ALAW \ - "audio/x-alaw, " \ - "rate = (int) [ 1, MAX], " \ - "channels = (int) [ 1, 32 ]; " -#define _PULSE_SINK_CAPS_MULAW \ - "audio/x-mulaw, " \ - "rate = (int) [ 1, MAX], " \ - "channels = (int) [ 1, 32 ]; " - -#define _PULSE_SINK_CAPS_AC3 "audio/x-ac3, framed = (boolean) true; " -#define _PULSE_SINK_CAPS_EAC3 "audio/x-eac3, framed = (boolean) true; " -#define _PULSE_SINK_CAPS_DTS "audio/x-dts, framed = (boolean) true, " \ - "block-size = (int) { 512, 1024, 2048 }; " -#define _PULSE_SINK_CAPS_MP3 "audio/mpeg, mpegversion = (int) 1, " \ - "mpegaudioversion = (int) [ 1, 2 ], parsed = (boolean) true;" - -#define _PULSE_SINK_CAPS_PCM \ - _PULSE_SINK_CAPS_LINEAR \ - _PULSE_SINK_CAPS_ALAW \ - _PULSE_SINK_CAPS_MULAW - #define PULSE_SINK_TEMPLATE_CAPS \ - _PULSE_SINK_CAPS_PCM \ - _PULSE_SINK_CAPS_AC3 \ - _PULSE_SINK_CAPS_EAC3 \ - _PULSE_SINK_CAPS_DTS \ - _PULSE_SINK_CAPS_MP3 + _PULSE_CAPS_PCM \ + _PULSE_CAPS_AC3 \ + _PULSE_CAPS_EAC3 \ + _PULSE_CAPS_DTS \ + _PULSE_CAPS_MP3 G_END_DECLS diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c index 495f0c052c..0f0764b4bf 100644 --- a/ext/pulse/pulsesrc.c +++ b/ext/pulse/pulsesrc.c @@ -107,28 +107,12 @@ static GstStateChangeReturn gst_pulsesrc_change_state (GstElement * static GstClockTime gst_pulsesrc_get_time (GstClock * clock, GstPulseSrc * src); -#if (G_BYTE_ORDER == G_LITTLE_ENDIAN) -# define FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, U8 }" -#else -# define FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, U8 }" -#endif - static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw, " - "format = (string) " FORMATS ", " - "layout = (string) interleaved, " - "rate = (int) [ 1, MAX ], " - "channels = (int) [ 1, 32 ];" - "audio/x-alaw, " - "rate = (int) [ 1, MAX], " - "channels = (int) [ 1, 32 ];" - "audio/x-mulaw, " - "rate = (int) [ 1, MAX], " "channels = (int) [ 1, 32 ]") + GST_STATIC_CAPS (_PULSE_CAPS_PCM) ); - #define gst_pulsesrc_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstPulseSrc, gst_pulsesrc, GST_TYPE_AUDIO_SRC, G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL)); diff --git a/ext/pulse/pulseutil.h b/ext/pulse/pulseutil.h index ecf06c9e3c..9356d37b3e 100644 --- a/ext/pulse/pulseutil.h +++ b/ext/pulse/pulseutil.h @@ -31,6 +31,43 @@ #include #include + +#if (G_BYTE_ORDER == G_LITTLE_ENDIAN) +# define _PULSE_FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, " \ + "S24LE, S24BE, S24_32LE, S24_32BE, U8 }" +#else +# define _PULSE_FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, " \ + "S24BE, S24LE, S24_32BE, S24_32LE, U8 }" +#endif + +#define _PULSE_CAPS_LINEAR \ + "audio/x-raw, " \ + "format = (string) " _PULSE_FORMATS ", " \ + "layout = (string) interleaved, " \ + "rate = (int) [ 1, MAX ], " \ + "channels = (int) [ 1, 32 ]; " +#define _PULSE_CAPS_ALAW \ + "audio/x-alaw, " \ + "rate = (int) [ 1, MAX], " \ + "channels = (int) [ 1, 32 ]; " +#define _PULSE_CAPS_MULAW \ + "audio/x-mulaw, " \ + "rate = (int) [ 1, MAX], " \ + "channels = (int) [ 1, 32 ]; " + +#define _PULSE_CAPS_AC3 "audio/x-ac3, framed = (boolean) true; " +#define _PULSE_CAPS_EAC3 "audio/x-eac3, framed = (boolean) true; " +#define _PULSE_CAPS_DTS "audio/x-dts, framed = (boolean) true, " \ + "block-size = (int) { 512, 1024, 2048 }; " +#define _PULSE_CAPS_MP3 "audio/mpeg, mpegversion = (int) 1, " \ + "mpegaudioversion = (int) [ 1, 2 ], parsed = (boolean) true;" + +#define _PULSE_CAPS_PCM \ + _PULSE_CAPS_LINEAR \ + _PULSE_CAPS_ALAW \ + _PULSE_CAPS_MULAW + + gboolean gst_pulse_fill_sample_spec (GstAudioRingBufferSpec * spec, pa_sample_spec * ss); gboolean gst_pulse_fill_format_info (GstAudioRingBufferSpec * spec,