+ the last of the float caps changes ... these are a bit more pervasive
Original commit message from CVS: + the last of the float caps changes ... these are a bit more pervasive
This commit is contained in:
parent
f6830d4ad1
commit
6d6150c052
@ -22,78 +22,97 @@
|
|||||||
|
|
||||||
#include <gst/audio/audioclock.h>
|
#include <gst/audio/audioclock.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
/* For people that are looking at this source: the purpose of these defines is
|
/* For people that are looking at this source: the purpose of these defines is
|
||||||
* to make GstCaps a bit easier, in that you don't have to know all of the
|
* to make GstCaps a bit easier, in that you don't have to know all of the
|
||||||
* properties that need to be defined. you can just use these macros. currently
|
* properties that need to be defined. you can just use these macros. currently
|
||||||
* (8/01) the only plugins that use these are the passthrough, speed, volume,
|
* (8/01) the only plugins that use these are the passthrough, speed, volume,
|
||||||
* adder, and [de]interleave plugins.
|
* adder, and [de]interleave plugins. These are for convenience only, and do not
|
||||||
* These are for convenience only, and do not specify the 'limits' of
|
* specify the 'limits' of GStreamer. you might also use these definitions as a
|
||||||
* GStreamer. you might also use these definitions as a
|
|
||||||
* base for making your own caps, if need be.
|
* base for making your own caps, if need be.
|
||||||
*
|
*
|
||||||
* For example, to make a source pad that can output mono streams of either
|
* For example, to make a source pad that can output streams of either mono
|
||||||
* float or int:
|
* float or any channel int:
|
||||||
|
*
|
||||||
template = gst_pad_template_new
|
* template = gst_pad_template_new
|
||||||
("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
|
* ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
|
||||||
gst_caps_append(gst_caps_new ("sink_int", "audio/raw",
|
* gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int",
|
||||||
GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
|
* GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
|
||||||
gst_caps_new ("sink_float", "audio/raw",
|
* gst_caps_new ("sink_float", "audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS)),
|
* GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS)),
|
||||||
NULL);
|
* NULL);
|
||||||
|
*
|
||||||
srcpad = gst_pad_new_from_template(template,"src");
|
* sinkpad = gst_pad_new_from_template(template, "sink");
|
||||||
|
*
|
||||||
* Andy Wingo, 18 August 2001
|
* Andy Wingo, 18 August 2001
|
||||||
* Thomas, 6 September 2002 */
|
* Thomas, 6 September 2002 */
|
||||||
|
|
||||||
/* a few useful defines for arbitrary limits */
|
#define GST_AUDIO_DEF_RATE 44100
|
||||||
#define GST_AUDIO_MIN_RATE 4000
|
|
||||||
#define GST_AUDIO_MAX_RATE 96000
|
|
||||||
#define GST_AUDIO_DEF_RATE 44100
|
|
||||||
|
|
||||||
#define GST_AUDIO_INT_PAD_TEMPLATE_PROPS \
|
#define GST_AUDIO_INT_PAD_TEMPLATE_PROPS \
|
||||||
gst_props_new (\
|
gst_props_new (\
|
||||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),\
|
"rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
"signed", GST_PROPS_LIST (\
|
"channels", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
GST_PROPS_BOOLEAN (TRUE),\
|
"endianness", GST_PROPS_LIST (\
|
||||||
GST_PROPS_BOOLEAN (FALSE)\
|
GST_PROPS_INT (G_LITTLE_ENDIAN),\
|
||||||
),\
|
GST_PROPS_INT (G_BIG_ENDIAN)\
|
||||||
"width", GST_PROPS_LIST (GST_PROPS_INT (8), \
|
),\
|
||||||
GST_PROPS_INT (16)), \
|
"width", GST_PROPS_LIST (\
|
||||||
"depth", GST_PROPS_LIST (GST_PROPS_INT (8), \
|
GST_PROPS_INT (8),\
|
||||||
GST_PROPS_INT (16)),\
|
GST_PROPS_INT (16),\
|
||||||
"rate", GST_PROPS_INT_RANGE (GST_AUDIO_MIN_RATE, \
|
GST_PROPS_INT (32)\
|
||||||
GST_AUDIO_MAX_RATE),\
|
),\
|
||||||
"channels", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
"depth", GST_PROPS_INT_RANGE (1, 32),\
|
||||||
NULL)
|
"signed", GST_PROPS_LIST (\
|
||||||
|
GST_PROPS_BOOLEAN (TRUE),\
|
||||||
|
GST_PROPS_BOOLEAN (FALSE)\
|
||||||
|
),\
|
||||||
|
NULL)
|
||||||
|
|
||||||
#define GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS \
|
#define GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS \
|
||||||
gst_props_new (\
|
gst_props_new (\
|
||||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),\
|
"rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
"signed", GST_PROPS_LIST (\
|
"channels", GST_PROPS_INT (1),\
|
||||||
GST_PROPS_BOOLEAN (TRUE),\
|
"endianness", GST_PROPS_LIST (\
|
||||||
GST_PROPS_BOOLEAN (FALSE)\
|
GST_PROPS_INT (G_LITTLE_ENDIAN),\
|
||||||
),\
|
GST_PROPS_INT (G_BIG_ENDIAN)\
|
||||||
"width", GST_PROPS_LIST (GST_PROPS_INT (8), \
|
),\
|
||||||
GST_PROPS_INT (16)),\
|
"width", GST_PROPS_LIST (\
|
||||||
"depth", GST_PROPS_LIST (GST_PROPS_INT (8), \
|
GST_PROPS_INT (8),\
|
||||||
GST_PROPS_INT (16)),\
|
GST_PROPS_INT (16),\
|
||||||
"rate", GST_PROPS_INT_RANGE (GST_AUDIO_MIN_RATE, \
|
GST_PROPS_INT (32)\
|
||||||
GST_AUDIO_MAX_RATE),\
|
),\
|
||||||
"channels", GST_PROPS_INT (1),\
|
"depth", GST_PROPS_INT_RANGE (1, 32),\
|
||||||
NULL)
|
"signed", GST_PROPS_LIST (\
|
||||||
|
GST_PROPS_BOOLEAN (TRUE),\
|
||||||
|
GST_PROPS_BOOLEAN (FALSE)\
|
||||||
|
),\
|
||||||
|
NULL)
|
||||||
|
|
||||||
#define GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS \
|
#define GST_AUDIO_FLOAT_PAD_TEMPLATE_PROPS \
|
||||||
gst_props_new (\
|
gst_props_new (\
|
||||||
"depth", GST_PROPS_INT (32),\
|
"rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
"endianness", GST_PROPS_INT (G_BYTE_ORDER),\
|
"channels", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
"intercept", GST_PROPS_FLOAT (0.0),\
|
"endianness", GST_PROPS_LIST (\
|
||||||
"slope", GST_PROPS_FLOAT (1.0),\
|
GST_PROPS_INT (G_LITTLE_ENDIAN),\
|
||||||
"rate", GST_PROPS_INT_RANGE (GST_AUDIO_MIN_RATE, \
|
GST_PROPS_INT (G_BIG_ENDIAN)\
|
||||||
GST_AUDIO_MAX_RATE),\
|
),\
|
||||||
"channels", GST_PROPS_INT (1),\
|
"width", GST_PROPS_LIST (\
|
||||||
NULL)
|
GST_PROPS_INT (32),\
|
||||||
|
GST_PROPS_INT (64)\
|
||||||
|
),\
|
||||||
|
"buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
|
NULL)
|
||||||
|
|
||||||
|
#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS \
|
||||||
|
gst_props_new (\
|
||||||
|
"rate", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
|
"channels", GST_PROPS_INT (1),\
|
||||||
|
"endianness", GST_PROPS_INT (G_BYTE_ORDER),\
|
||||||
|
"width", GST_PROPS_INT (32),\
|
||||||
|
"buffer-frames", GST_PROPS_INT_RANGE (1, G_MAXINT),\
|
||||||
|
NULL)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this library defines and implements some helper functions for audio
|
* this library defines and implements some helper functions for audio
|
||||||
@ -101,21 +120,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* get byte size of audio frame (based on caps of pad */
|
/* get byte size of audio frame (based on caps of pad */
|
||||||
int gst_audio_frame_byte_size (GstPad* pad);
|
int gst_audio_frame_byte_size (GstPad* pad);
|
||||||
|
|
||||||
/* get length in frames of buffer */
|
/* get length in frames of buffer */
|
||||||
long gst_audio_frame_length (GstPad* pad, GstBuffer* buf);
|
long gst_audio_frame_length (GstPad* pad, GstBuffer* buf);
|
||||||
|
|
||||||
/* get frame rate based on caps */
|
/* get frame rate based on caps */
|
||||||
long gst_audio_frame_rate (GstPad *pad);
|
long gst_audio_frame_rate (GstPad *pad);
|
||||||
|
|
||||||
/* calculate length in seconds of audio buffer buf based on caps of pad */
|
/* calculate length in seconds of audio buffer buf based on caps of pad */
|
||||||
double gst_audio_length (GstPad* pad, GstBuffer* buf);
|
double gst_audio_length (GstPad* pad, GstBuffer* buf);
|
||||||
|
|
||||||
/* calculate highest possible sample value based on capabilities of pad */
|
/* calculate highest possible sample value based on capabilities of pad */
|
||||||
long gst_audio_highest_sample_value (GstPad* pad);
|
long gst_audio_highest_sample_value (GstPad* pad);
|
||||||
|
|
||||||
/* check if the buffer size is a whole multiple of the frame size */
|
/* check if the buffer size is a whole multiple of the frame size */
|
||||||
gboolean gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf);
|
gboolean gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -38,38 +38,38 @@ static struct _elements_entry _elements[] = {
|
|||||||
{ NULL, 0 },
|
{ NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
GstPadTemplate*
|
GstPadTemplate*
|
||||||
gst_filter_src_factory (void)
|
gst_filter_src_factory (void)
|
||||||
{
|
{
|
||||||
static GstPadTemplate *templ = NULL;
|
static GstPadTemplate *templ = NULL;
|
||||||
if (!templ) {
|
if (!templ) {
|
||||||
templ = GST_PAD_TEMPLATE_NEW (
|
templ = GST_PAD_TEMPLATE_NEW (
|
||||||
"src",
|
"src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
gst_caps_new (
|
gst_caps_new (
|
||||||
"filter_src",
|
"filter_src",
|
||||||
"audio/x-raw-float",
|
"audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return templ;
|
return templ;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPadTemplate*
|
GstPadTemplate*
|
||||||
gst_filter_sink_factory (void)
|
gst_filter_sink_factory (void)
|
||||||
{
|
{
|
||||||
static GstPadTemplate *templ = NULL;
|
static GstPadTemplate *templ = NULL;
|
||||||
if (!templ) {
|
if (!templ) {
|
||||||
templ = GST_PAD_TEMPLATE_NEW (
|
templ = GST_PAD_TEMPLATE_NEW (
|
||||||
"sink",
|
"sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
gst_caps_new (
|
gst_caps_new (
|
||||||
"filter_src",
|
"filter_src",
|
||||||
"audio/x-raw-float",
|
"audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ struct _GstMixMatrixClass {
|
|||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
static GstElementDetails mixmatrix_details = {
|
static GstElementDetails mixmatrix_details = {
|
||||||
"Mixing Matrix",
|
"Mixing Matrix",
|
||||||
"Filter/Audio/Mixing",
|
"Filter/Audio",
|
||||||
"LGPL",
|
"LGPL",
|
||||||
"Mix N audio channels together into M channels",
|
"Mix N audio channels together into M channels",
|
||||||
VERSION,
|
VERSION,
|
||||||
@ -79,7 +79,7 @@ GST_PAD_TEMPLATE_FACTORY (mixmatrix_sink_factory,
|
|||||||
gst_caps_new (
|
gst_caps_new (
|
||||||
"float_src",
|
"float_src",
|
||||||
"audio/x-raw-float",
|
"audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ GST_PAD_TEMPLATE_FACTORY (mixmatrix_src_factory,
|
|||||||
gst_caps_new (
|
gst_caps_new (
|
||||||
"float_sink",
|
"float_sink",
|
||||||
"audio/x-raw-float",
|
"audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -53,21 +53,21 @@ enum {
|
|||||||
ARG_SILENT
|
ARG_SILENT
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstPadTemplate*
|
static GstPadTemplate*
|
||||||
passthrough_sink_factory (void)
|
passthrough_sink_factory (void)
|
||||||
{
|
{
|
||||||
static GstPadTemplate *template = NULL;
|
static GstPadTemplate *template = NULL;
|
||||||
|
|
||||||
if (! template) {
|
if (! template) {
|
||||||
template = gst_pad_template_new
|
template = gst_pad_template_new
|
||||||
("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
|
("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
|
||||||
gst_caps_append (gst_caps_new ("sink_int", "audio/x-raw-int",
|
gst_caps_append (gst_caps_new ("sink_int", "audio/x-raw-int",
|
||||||
GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
|
GST_AUDIO_INT_PAD_TEMPLATE_PROPS),
|
||||||
gst_caps_new ("sink_float", "audio/x-raw-float",
|
gst_caps_new ("sink_float", "audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS)),
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS)),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPadTemplate*
|
static GstPadTemplate*
|
||||||
@ -79,7 +79,7 @@ passthrough_src_factory (void)
|
|||||||
template = gst_pad_template_new
|
template = gst_pad_template_new
|
||||||
("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
||||||
gst_caps_append (gst_caps_new ("src_float", "audio/x-raw-float",
|
gst_caps_append (gst_caps_new ("src_float", "audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS),
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS),
|
||||||
gst_caps_new ("src_int", "audio/x-raw-float",
|
gst_caps_new ("src_int", "audio/x-raw-float",
|
||||||
GST_AUDIO_INT_PAD_TEMPLATE_PROPS)),
|
GST_AUDIO_INT_PAD_TEMPLATE_PROPS)),
|
||||||
NULL);
|
NULL);
|
||||||
@ -126,35 +126,29 @@ passthrough_connect_sink (GstPad *pad, GstCaps *caps)
|
|||||||
g_return_val_if_fail (GST_IS_PASSTHROUGH (filter), GST_PAD_LINK_REFUSED);
|
g_return_val_if_fail (GST_IS_PASSTHROUGH (filter), GST_PAD_LINK_REFUSED);
|
||||||
|
|
||||||
mimetype = gst_caps_get_mime(caps);
|
mimetype = gst_caps_get_mime(caps);
|
||||||
|
|
||||||
gst_caps_get_int (caps, "rate", &filter->rate);
|
gst_caps_get_int (caps, "rate", &filter->rate);
|
||||||
gst_caps_get_int (caps, "channels", &filter->channels);
|
gst_caps_get_int (caps, "channels", &filter->channels);
|
||||||
|
gst_caps_get_int (caps, "width", &filter->width);
|
||||||
|
gst_caps_get_int (caps, "endianness", &filter->endianness);
|
||||||
|
|
||||||
if (strcmp (mimetype, "audio/x-raw-int") == 0) {
|
if (strcmp (mimetype, "audio/x-raw-int") == 0) {
|
||||||
filter->format = GST_PASSTHROUGH_FORMAT_INT;
|
filter->format = GST_PASSTHROUGH_FORMAT_INT;
|
||||||
gst_caps_get_int (caps, "width", &filter->width);
|
|
||||||
gst_caps_get_int (caps, "depth", &filter->depth);
|
gst_caps_get_int (caps, "depth", &filter->depth);
|
||||||
gst_caps_get_int (caps, "law", &filter->law);
|
|
||||||
gst_caps_get_int (caps, "endianness", &filter->endianness);
|
|
||||||
gst_caps_get_boolean (caps, "signed", &filter->is_signed);
|
gst_caps_get_boolean (caps, "signed", &filter->is_signed);
|
||||||
|
|
||||||
if (! filter->silent) {
|
if (! filter->silent) {
|
||||||
g_print ("Passthrough : channels %d, rate %d\n",
|
g_print ("Passthrough : channels %d, rate %d\n", filter->channels, filter->rate);
|
||||||
filter->channels, filter->rate);
|
|
||||||
g_print ("Passthrough : format int, bit width %d, endianness %d, signed %s\n",
|
g_print ("Passthrough : format int, bit width %d, endianness %d, signed %s\n",
|
||||||
filter->width, filter->endianness, filter->is_signed ? "yes" : "no");
|
filter->width, filter->endianness, filter->is_signed ? "yes" : "no");
|
||||||
}
|
}
|
||||||
} else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
|
} else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
|
||||||
filter->format = GST_PASSTHROUGH_FORMAT_FLOAT;
|
filter->format = GST_PASSTHROUGH_FORMAT_FLOAT;
|
||||||
gst_caps_get_string (caps, "layout", &filter->layout);
|
|
||||||
gst_caps_get_float (caps, "intercept", &filter->intercept);
|
|
||||||
gst_caps_get_float (caps, "slope", &filter->slope);
|
|
||||||
|
|
||||||
if (! filter->silent) {
|
if (! filter->silent) {
|
||||||
g_print ("Passthrough : channels %d, rate %d\n",
|
g_print ("Passthrough : channels %d, rate %d\n", filter->channels, filter->rate);
|
||||||
filter->channels, filter->rate);
|
g_print ("Passthrough : format float, width %d\n", filter->width);
|
||||||
g_print ("Passthrough : format float, layout %s, intercept %f, slope %f\n",
|
|
||||||
filter->layout, filter->intercept, filter->slope);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,26 +59,18 @@ struct _GstPassthrough {
|
|||||||
GstBufferPool *bufpool;
|
GstBufferPool *bufpool;
|
||||||
|
|
||||||
gboolean silent;
|
gboolean silent;
|
||||||
|
|
||||||
/* the next three are valid for both int and float */
|
/* the next are valid for both int and float */
|
||||||
|
|
||||||
GstPassthroughFormat format;
|
GstPassthroughFormat format;
|
||||||
guint rate;
|
guint rate;
|
||||||
guint channels;
|
guint channels;
|
||||||
|
|
||||||
/* the next five are valid only for format==GST_PASSTHROUGH_FORMAT_INT */
|
|
||||||
|
|
||||||
guint width;
|
guint width;
|
||||||
guint depth;
|
|
||||||
guint endianness;
|
guint endianness;
|
||||||
guint law;
|
|
||||||
|
/* the next are valid only for format==GST_PASSTHROUGH_FORMAT_INT */
|
||||||
|
guint depth;
|
||||||
gboolean is_signed;
|
gboolean is_signed;
|
||||||
|
|
||||||
/* the next three are valid only for format==GST_PASSTHROUGH_FORMAT_FLOAT */
|
|
||||||
|
|
||||||
const gchar *layout;
|
|
||||||
gfloat slope;
|
|
||||||
gfloat intercept;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstPassthroughClass {
|
struct _GstPassthroughClass {
|
||||||
|
@ -1673,18 +1673,14 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
|
|||||||
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
|
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
|
||||||
case GST_MAKE_FOURCC('f','l','6','4'):
|
case GST_MAKE_FOURCC('f','l','6','4'):
|
||||||
return GST_CAPS_NEW("fl64_caps","audio/x-raw-float",
|
return GST_CAPS_NEW("fl64_caps","audio/x-raw-float",
|
||||||
"depth",GST_PROPS_INT (64),
|
"width",GST_PROPS_INT (64),
|
||||||
"endianness",GST_PROPS_INT (G_BIG_ENDIAN),
|
"endianness",GST_PROPS_INT (G_BIG_ENDIAN),
|
||||||
"intercept",GST_PROPS_FLOAT (0.0),
|
|
||||||
"slope",GST_PROPS_FLOAT (1.0),
|
|
||||||
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
|
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
|
||||||
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
|
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
|
||||||
case GST_MAKE_FOURCC('f','l','3','2'):
|
case GST_MAKE_FOURCC('f','l','3','2'):
|
||||||
return GST_CAPS_NEW("fl32_caps","audio/x-raw-float",
|
return GST_CAPS_NEW("fl32_caps","audio/x-raw-float",
|
||||||
"depth",GST_PROPS_INT (32),
|
"width",GST_PROPS_INT (32),
|
||||||
"endianness",GST_PROPS_INT (G_BIG_ENDIAN),
|
"endianness",GST_PROPS_INT (G_BIG_ENDIAN),
|
||||||
"intercept",GST_PROPS_FLOAT (0.0),
|
|
||||||
"slope",GST_PROPS_FLOAT (1.0),
|
|
||||||
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
|
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
|
||||||
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
|
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
|
||||||
case GST_MAKE_FOURCC('i','n','2','4'):
|
case GST_MAKE_FOURCC('i','n','2','4'):
|
||||||
|
@ -68,7 +68,7 @@ speed_sink_factory (void)
|
|||||||
gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int",
|
gst_caps_append(gst_caps_new ("sink_int", "audio/x-raw-int",
|
||||||
GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS),
|
GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS),
|
||||||
gst_caps_new ("sink_float", "audio/x-raw-float",
|
gst_caps_new ("sink_float", "audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS)),
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS)),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
return template;
|
return template;
|
||||||
@ -83,7 +83,7 @@ speed_src_factory (void)
|
|||||||
template = gst_pad_template_new
|
template = gst_pad_template_new
|
||||||
("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
||||||
gst_caps_append (gst_caps_new ("src_float", "audio/x-raw-float",
|
gst_caps_append (gst_caps_new ("src_float", "audio/x-raw-float",
|
||||||
GST_AUDIO_FLOAT_MONO_PAD_TEMPLATE_PROPS),
|
GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS),
|
||||||
gst_caps_new ("src_int", "audio/x-raw-int",
|
gst_caps_new ("src_int", "audio/x-raw-int",
|
||||||
GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS)),
|
GST_AUDIO_INT_MONO_PAD_TEMPLATE_PROPS)),
|
||||||
NULL);
|
NULL);
|
||||||
@ -142,36 +142,32 @@ speed_parse_caps (GstSpeed *filter, GstCaps *caps)
|
|||||||
|
|
||||||
g_return_val_if_fail(filter!=NULL,-1);
|
g_return_val_if_fail(filter!=NULL,-1);
|
||||||
g_return_val_if_fail(caps!=NULL,-1);
|
g_return_val_if_fail(caps!=NULL,-1);
|
||||||
|
|
||||||
mimetype = gst_caps_get_mime (caps);
|
mimetype = gst_caps_get_mime (caps);
|
||||||
|
|
||||||
gst_caps_get_int (caps, "rate", &filter->rate);
|
gst_caps_get_int (caps, "rate", &filter->rate);
|
||||||
gst_caps_get_int (caps, "channels", &filter->channels);
|
gst_caps_get_int (caps, "channels", &filter->channels);
|
||||||
|
gst_caps_get_int (caps, "width", &filter->width);
|
||||||
|
gst_caps_get_int (caps, "endianness", &filter->endianness);
|
||||||
|
|
||||||
if (strcmp(mimetype, "audio/x-raw-int")==0) {
|
if (strcmp(mimetype, "audio/x-raw-int")==0) {
|
||||||
filter->format = GST_SPEED_FORMAT_INT;
|
filter->format = GST_SPEED_FORMAT_INT;
|
||||||
gst_caps_get_int (caps, "width", &filter->width);
|
|
||||||
gst_caps_get_int (caps, "depth", &filter->depth);
|
gst_caps_get_int (caps, "depth", &filter->depth);
|
||||||
gst_caps_get_int (caps, "law", &filter->law);
|
|
||||||
gst_caps_get_int (caps, "endianness", &filter->endianness);
|
|
||||||
gst_caps_get_boolean (caps, "signed", &filter->is_signed);
|
gst_caps_get_boolean (caps, "signed", &filter->is_signed);
|
||||||
|
|
||||||
if (!filter->silent) {
|
if (!filter->silent) {
|
||||||
g_print ("Speed : channels %d, rate %d\n",
|
g_print ("Speed : channels %d, rate %d\n",
|
||||||
filter->channels, filter->rate);
|
filter->channels, filter->rate);
|
||||||
g_print ("Speed : format int, bit width %d, endianness %d, signed %s\n",
|
g_print ("Speed : format int, bit width %d, endianness %d, signed %s\n",
|
||||||
filter->width, filter->endianness, filter->is_signed ? "yes" : "no");
|
filter->width, filter->endianness, filter->is_signed ? "yes" : "no");
|
||||||
}
|
}
|
||||||
} else if (strcmp(mimetype, "audio/x-raw-float")==0) {
|
} else if (strcmp(mimetype, "audio/x-raw-float")==0) {
|
||||||
filter->format = GST_SPEED_FORMAT_FLOAT;
|
filter->format = GST_SPEED_FORMAT_FLOAT;
|
||||||
gst_caps_get_float (caps, "intercept", &filter->intercept);
|
|
||||||
gst_caps_get_float (caps, "slope", &filter->slope);
|
|
||||||
|
|
||||||
if (!filter->silent) {
|
if (!filter->silent) {
|
||||||
g_print ("Speed : channels %d, rate %d\n",
|
g_print ("Speed : channels %d, rate %d\n",
|
||||||
filter->channels, filter->rate);
|
filter->channels, filter->rate);
|
||||||
g_print ("Speed : format float, intercept %f, slope %f\n",
|
g_print ("Speed : format float, width %d\n", filter->width);
|
||||||
filter->intercept, filter->slope);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -58,35 +58,23 @@ struct _GstSpeed {
|
|||||||
|
|
||||||
GstPad *sinkpad, *srcpad;
|
GstPad *sinkpad, *srcpad;
|
||||||
GstBufferPool *sinkpool, *srcpool;
|
GstBufferPool *sinkpool, *srcpool;
|
||||||
|
|
||||||
gboolean silent;
|
|
||||||
|
|
||||||
gfloat speed;
|
|
||||||
|
|
||||||
/* the next three are valid for both int and float */
|
|
||||||
|
|
||||||
GstSpeedFormat format;
|
|
||||||
|
|
||||||
guint rate;
|
|
||||||
|
|
||||||
guint channels;
|
|
||||||
|
|
||||||
/* the next five are valid only for format==GST_SPEED_FORMAT_INT */
|
|
||||||
|
|
||||||
guint width;
|
|
||||||
|
|
||||||
guint depth;
|
|
||||||
|
|
||||||
|
gboolean silent;
|
||||||
|
gfloat speed;
|
||||||
|
|
||||||
|
/* the next are valid for both int and float */
|
||||||
|
GstSpeedFormat format;
|
||||||
|
guint rate;
|
||||||
|
guint channels;
|
||||||
|
guint width;
|
||||||
guint endianness;
|
guint endianness;
|
||||||
|
|
||||||
guint law;
|
/* the next are valid only for format==GST_SPEED_FORMAT_INT */
|
||||||
|
guint depth;
|
||||||
gboolean is_signed;
|
gboolean is_signed;
|
||||||
|
|
||||||
/* the next three are valid only for format==GST_SPEED_FORMAT_FLOAT */
|
/* the next three are valid only for format==GST_SPEED_FORMAT_FLOAT */
|
||||||
|
|
||||||
gfloat slope;
|
gfloat slope;
|
||||||
|
|
||||||
gfloat intercept;
|
gfloat intercept;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user