ext/musepack/gstmusepackdec.cpp: There's also floating point libmusepacks.

Original commit message from CVS:
* ext/musepack/gstmusepackdec.cpp:
There's also floating point libmusepacks.
This commit is contained in:
Ronald S. Bultje 2004-12-03 18:13:43 +00:00
parent 461861f3de
commit 40e9cff5bc
3 changed files with 47 additions and 26 deletions

View file

@ -1,3 +1,8 @@
2004-12-03 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/musepack/gstmusepackdec.cpp:
There's also floating point libmusepacks.
2004-12-03 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2004-12-03 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/faad/gstfaad.c: (gst_faad_chanpos_from_gst), * ext/faad/gstfaad.c: (gst_faad_chanpos_from_gst),

View file

@ -30,14 +30,24 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS ("audio/x-musepack") GST_STATIC_CAPS ("audio/x-musepack")
); );
#ifdef MPC_FIXED_POINT
#define BASE_CAPS \
"audio/x-raw-int, " \
"signed = (bool) TRUE, " \
"width = (int) 32, " \
"depth = (int) 32"
#else
#define BASE_CAPS \
"audio/x-raw-float, " \
"width = (int) 32, " \
"buffer-frames = (int) 0"
#endif
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, " GST_STATIC_CAPS (BASE_CAPS ", "
"endianness = (int) BYTE_ORDER, " "endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) 32, "
"depth = (int) 32, "
"rate = (int) [ 8000, 96000 ], " "rate = (int) [ 8000, 96000 ], "
"channels = (int) [ 1, 2 ]") "channels = (int) [ 1, 2 ]")
); );
@ -352,6 +362,7 @@ static gboolean
gst_musepack_stream_init (GstMusepackDec * musepackdec) gst_musepack_stream_init (GstMusepackDec * musepackdec)
{ {
StreamInfo si = StreamInfo (); StreamInfo si = StreamInfo ();
GstCaps *caps;
if (musepackdec->dec) if (musepackdec->dec)
delete musepackdec->dec; delete musepackdec->dec;
@ -379,15 +390,12 @@ gst_musepack_stream_init (GstMusepackDec * musepackdec)
return FALSE; return FALSE;
} }
if (!gst_pad_set_explicit_caps (musepackdec->srcpad, caps = gst_caps_from_string (BASE_CAPS);
gst_caps_new_simple ("audio/x-raw-int", gst_caps_set_simple (caps,
"width", G_TYPE_INT, 32,
"depth", G_TYPE_INT, 32,
"endianness", G_TYPE_INT, G_BYTE_ORDER, "endianness", G_TYPE_INT, G_BYTE_ORDER,
"channels", G_TYPE_INT, si.simple.Channels, "channels", G_TYPE_INT, si.simple.Channels,
"rate", G_TYPE_INT, si.simple.SampleFreq, "rate", G_TYPE_INT, si.simple.SampleFreq, NULL);
"signed", G_TYPE_BOOLEAN, TRUE, if (!gst_pad_set_explicit_caps (musepackdec->srcpad, caps)) {
NULL))) {
GST_ELEMENT_ERROR (musepackdec, CORE, NEGOTIATION, (NULL), (NULL)); GST_ELEMENT_ERROR (musepackdec, CORE, NEGOTIATION, (NULL), (NULL));
delete musepackdec->dec; delete musepackdec->dec;
musepackdec->dec = NULL; musepackdec->dec = NULL;

View file

@ -30,14 +30,24 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS ("audio/x-musepack") GST_STATIC_CAPS ("audio/x-musepack")
); );
#ifdef MPC_FIXED_POINT
#define BASE_CAPS \
"audio/x-raw-int, " \
"signed = (bool) TRUE, " \
"width = (int) 32, " \
"depth = (int) 32"
#else
#define BASE_CAPS \
"audio/x-raw-float, " \
"width = (int) 32, " \
"buffer-frames = (int) 0"
#endif
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, " GST_STATIC_CAPS (BASE_CAPS ", "
"endianness = (int) BYTE_ORDER, " "endianness = (int) BYTE_ORDER, "
"signed = (bool) TRUE, "
"width = (int) 32, "
"depth = (int) 32, "
"rate = (int) [ 8000, 96000 ], " "rate = (int) [ 8000, 96000 ], "
"channels = (int) [ 1, 2 ]") "channels = (int) [ 1, 2 ]")
); );
@ -352,6 +362,7 @@ static gboolean
gst_musepack_stream_init (GstMusepackDec * musepackdec) gst_musepack_stream_init (GstMusepackDec * musepackdec)
{ {
StreamInfo si = StreamInfo (); StreamInfo si = StreamInfo ();
GstCaps *caps;
if (musepackdec->dec) if (musepackdec->dec)
delete musepackdec->dec; delete musepackdec->dec;
@ -379,15 +390,12 @@ gst_musepack_stream_init (GstMusepackDec * musepackdec)
return FALSE; return FALSE;
} }
if (!gst_pad_set_explicit_caps (musepackdec->srcpad, caps = gst_caps_from_string (BASE_CAPS);
gst_caps_new_simple ("audio/x-raw-int", gst_caps_set_simple (caps,
"width", G_TYPE_INT, 32,
"depth", G_TYPE_INT, 32,
"endianness", G_TYPE_INT, G_BYTE_ORDER, "endianness", G_TYPE_INT, G_BYTE_ORDER,
"channels", G_TYPE_INT, si.simple.Channels, "channels", G_TYPE_INT, si.simple.Channels,
"rate", G_TYPE_INT, si.simple.SampleFreq, "rate", G_TYPE_INT, si.simple.SampleFreq, NULL);
"signed", G_TYPE_BOOLEAN, TRUE, if (!gst_pad_set_explicit_caps (musepackdec->srcpad, caps)) {
NULL))) {
GST_ELEMENT_ERROR (musepackdec, CORE, NEGOTIATION, (NULL), (NULL)); GST_ELEMENT_ERROR (musepackdec, CORE, NEGOTIATION, (NULL), (NULL));
delete musepackdec->dec; delete musepackdec->dec;
musepackdec->dec = NULL; musepackdec->dec = NULL;