sbc: Force LITTLE_ENDIAN instead of BYTE_ORDER for now

This commit is contained in:
Marcel Holtmann 2007-08-27 14:10:00 +00:00 committed by Tim-Philipp Müller
parent 85874338ff
commit e590dc56dc
3 changed files with 115 additions and 112 deletions

View file

@ -49,7 +49,7 @@ GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, " GST_STATIC_CAPS ("audio/x-raw-int, "
"rate = (int) { 16000, 32000, 44100, 48000 }, " "rate = (int) { 16000, 32000, 44100, 48000 }, "
"channels = (int) [ 1, 2 ], " "channels = (int) [ 1, 2 ], "
"endianness = (int) BYTE_ORDER, " "endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) true, " "width = (int) 16, " "depth = (int) 16")); "signed = (boolean) true, " "width = (int) 16, " "depth = (int) 16"));
static GstFlowReturn static GstFlowReturn

View file

@ -72,7 +72,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-raw-int, " GST_STATIC_CAPS ("audio/x-raw-int, "
"rate = (int) { 16000, 32000, 44100, 48000 }, " "rate = (int) { 16000, 32000, 44100, 48000 }, "
"channels = (int) [ 1, 2 ], " "channels = (int) [ 1, 2 ], "
"endianness = (int) BYTE_ORDER, " "endianness = (int) LITTLE_ENDIAN, "
"signed = (boolean) true, " "width = (int) 16, " "depth = (int) 16")); "signed = (boolean) true, " "width = (int) 16, " "depth = (int) 16"));
static GstStaticPadTemplate sbc_enc_src_factory = static GstStaticPadTemplate sbc_enc_src_factory =

View file

@ -54,7 +54,8 @@ static GstStaticPadTemplate sbc_parse_src_factory =
"subbands = (int) { 4, 8 }, " "subbands = (int) { 4, 8 }, "
"allocation = (string) { snr, loudness }")); "allocation = (string) { snr, loudness }"));
static GstFlowReturn sbc_parse_chain(GstPad *pad, GstBuffer *buffer) static GstFlowReturn
sbc_parse_chain (GstPad * pad, GstBuffer * buffer)
{ {
GstSbcParse *parse = GST_SBC_PARSE (gst_pad_get_parent (pad)); GstSbcParse *parse = GST_SBC_PARSE (gst_pad_get_parent (pad));
GstFlowReturn res = GST_FLOW_OK; GstFlowReturn res = GST_FLOW_OK;
@ -88,19 +89,16 @@ static GstFlowReturn sbc_parse_chain(GstPad *pad, GstBuffer *buffer)
caps = gst_caps_new_simple ("audio/x-sbc", caps = gst_caps_new_simple ("audio/x-sbc",
"rate", G_TYPE_INT, parse->sbc.rate, "rate", G_TYPE_INT, parse->sbc.rate,
"channels", G_TYPE_INT, parse->sbc.channels, "channels", G_TYPE_INT, parse->sbc.channels, NULL);
NULL);
template = gst_static_pad_template_get (&sbc_parse_src_factory); template = gst_static_pad_template_get (&sbc_parse_src_factory);
temp = gst_caps_intersect(caps, temp = gst_caps_intersect (caps, gst_pad_template_get_caps (template));
gst_pad_template_get_caps(template));
gst_caps_unref (caps); gst_caps_unref (caps);
res = gst_pad_alloc_buffer_and_set_caps (parse->srcpad, res = gst_pad_alloc_buffer_and_set_caps (parse->srcpad,
GST_BUFFER_OFFSET_NONE, GST_BUFFER_OFFSET_NONE, consumed, temp, &output);
consumed, temp, &output);
gst_caps_unref (temp); gst_caps_unref (temp);
@ -117,8 +115,7 @@ static GstFlowReturn sbc_parse_chain(GstPad *pad, GstBuffer *buffer)
} }
if (offset < size) if (offset < size)
parse->buffer = gst_buffer_create_sub(buffer, parse->buffer = gst_buffer_create_sub (buffer, offset, size - offset);
offset, size - offset);
done: done:
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
@ -127,8 +124,8 @@ done:
return res; return res;
} }
static GstStateChangeReturn sbc_parse_change_state(GstElement *element, static GstStateChangeReturn
GstStateChange transition) sbc_parse_change_state (GstElement * element, GstStateChange transition)
{ {
GstSbcParse *parse = GST_SBC_PARSE (element); GstSbcParse *parse = GST_SBC_PARSE (element);
@ -158,7 +155,8 @@ static GstStateChangeReturn sbc_parse_change_state(GstElement *element,
return parent_class->change_state (element, transition); return parent_class->change_state (element, transition);
} }
static void gst_sbc_parse_base_init(gpointer g_class) static void
gst_sbc_parse_base_init (gpointer g_class)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
@ -171,7 +169,8 @@ static void gst_sbc_parse_base_init(gpointer g_class)
gst_element_class_set_details (element_class, &sbc_parse_details); gst_element_class_set_details (element_class, &sbc_parse_details);
} }
static void gst_sbc_parse_class_init(GstSbcParseClass *klass) static void
gst_sbc_parse_class_init (GstSbcParseClass * klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@ -183,12 +182,16 @@ static void gst_sbc_parse_class_init(GstSbcParseClass *klass)
"SBC parsing element"); "SBC parsing element");
} }
static void gst_sbc_parse_init(GstSbcParse *self, GstSbcParseClass *klass) static void
gst_sbc_parse_init (GstSbcParse * self, GstSbcParseClass * klass)
{ {
self->sinkpad = gst_pad_new_from_static_template(&sbc_parse_sink_factory, "sink"); self->sinkpad =
gst_pad_set_chain_function(self->sinkpad, GST_DEBUG_FUNCPTR(sbc_parse_chain)); gst_pad_new_from_static_template (&sbc_parse_sink_factory, "sink");
gst_pad_set_chain_function (self->sinkpad,
GST_DEBUG_FUNCPTR (sbc_parse_chain));
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad); gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
self->srcpad = gst_pad_new_from_static_template(&sbc_parse_src_factory, "src"); self->srcpad =
gst_pad_new_from_static_template (&sbc_parse_src_factory, "src");
gst_element_add_pad (GST_ELEMENT (self), self->srcpad); gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
} }