mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
pulse: Share static caps definition between src and sink
The src was also missing 24-bit sample formats
This commit is contained in:
parent
89b9019e3e
commit
db84b928a3
4 changed files with 51 additions and 65 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -31,6 +31,43 @@
|
|||
#include <gst/audio/gstaudioringbuffer.h>
|
||||
#include <gst/audio/gstaudiosink.h>
|
||||
|
||||
|
||||
#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,
|
||||
|
|
Loading…
Reference in a new issue