Commit 67d3ebd3 authored by Arwed von Merkatz Merkatz's avatar Arwed von Merkatz Merkatz
Browse files

tta plugin ported to 0.9

Original commit message from CVS:
tta plugin ported to 0.9
parent 4b6bcfb3
2005-09-22 Arwed v. Merkatz <v.merkatz@gmx.net>
* configure.ac:
* gst/tta/gstttadec.c: (gst_tta_dec_setcaps), (gst_tta_dec_init),
(gst_tta_dec_chain):
* gst/tta/gstttaparse.c: (gst_tta_parse_dispose),
(gst_tta_parse_class_init), (gst_tta_parse_reset),
(gst_tta_parse_init), (gst_tta_parse_src_event),
(gst_tta_parse_get_query_types), (gst_tta_parse_query),
(gst_tta_parse_activate), (gst_tta_parse_activate_pull),
(gst_tta_parse_parse_header), (gst_tta_parse_stream_data),
(gst_tta_parse_loop), (gst_tta_parse_change_state):
* gst/tta/gstttaparse.h:
Ported tta plugin to 0.9.
2005-09-20 Flavio Oliveira <flavio.oliveira@indt.org.br> 2005-09-20 Flavio Oliveira <flavio.oliveira@indt.org.br>
......
...@@ -287,6 +287,7 @@ AC_SUBST(GST_PLUGIN_LDFLAGS) ...@@ -287,6 +287,7 @@ AC_SUBST(GST_PLUGIN_LDFLAGS)
dnl these are all the gst plug-ins, compilable without additional libs dnl these are all the gst plug-ins, compilable without additional libs
GST_PLUGINS_ALL="\ GST_PLUGINS_ALL="\
qtdemux \ qtdemux \
tta \
" "
dnl see if we can build C++ plug-ins dnl see if we can build C++ plug-ins
...@@ -466,6 +467,7 @@ gst-plugins-bad.spec ...@@ -466,6 +467,7 @@ gst-plugins-bad.spec
gst/Makefile gst/Makefile
gst/qtdemux/Makefile gst/qtdemux/Makefile
gst/speed/Makefile gst/speed/Makefile
gst/tta/Makefile
sys/Makefile sys/Makefile
ext/Makefile ext/Makefile
ext/faac/Makefile ext/faac/Makefile
......
...@@ -96,24 +96,27 @@ static void gst_tta_dec_class_init (GstTtaDecClass * klass); ...@@ -96,24 +96,27 @@ static void gst_tta_dec_class_init (GstTtaDecClass * klass);
static void gst_tta_dec_base_init (GstTtaDecClass * klass); static void gst_tta_dec_base_init (GstTtaDecClass * klass);
static void gst_tta_dec_init (GstTtaDec * ttadec); static void gst_tta_dec_init (GstTtaDec * ttadec);
static void gst_tta_dec_chain (GstPad * pad, GstData * in); static GstFlowReturn gst_tta_dec_chain (GstPad * pad, GstBuffer * in);
static GstElementClass *parent = NULL; static GstElementClass *parent = NULL;
static GstPadLinkReturn static gboolean
gst_tta_dec_link (GstPad * pad, const GstCaps * caps) gst_tta_dec_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstTtaDec *ttadec = GST_TTA_DEC (gst_pad_get_parent (pad)); GstTtaDec *ttadec = GST_TTA_DEC (gst_pad_get_parent (pad));
GstStructure *structure = gst_caps_get_structure (caps, 0); GstStructure *structure = gst_caps_get_structure (caps, 0);
GstCaps *srccaps; GstCaps *srccaps;
guint64 outsize; guint64 outsize;
guint bits; gint bits, channels;
gint32 samplerate;
if (!gst_caps_is_fixed (caps)) // if (!gst_caps_is_fixed (caps))
return GST_PAD_LINK_DELAYED; // return GST_PAD_LINK_DELAYED;
gst_structure_get_int (structure, "rate", &ttadec->samplerate); gst_structure_get_int (structure, "rate", &samplerate);
gst_structure_get_int (structure, "channels", &ttadec->channels); ttadec->samplerate = (guint32) samplerate;
gst_structure_get_int (structure, "channels", &channels);
ttadec->channels = (guint) channels;
gst_structure_get_int (structure, "width", &bits); gst_structure_get_int (structure, "width", &bits);
ttadec->bytes = bits / 8; ttadec->bytes = bits / 8;
...@@ -125,7 +128,8 @@ gst_tta_dec_link (GstPad * pad, const GstCaps * caps) ...@@ -125,7 +128,8 @@ gst_tta_dec_link (GstPad * pad, const GstCaps * caps)
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
"signed", G_TYPE_BOOLEAN, TRUE, NULL); "signed", G_TYPE_BOOLEAN, TRUE, NULL);
gst_pad_set_explicit_caps (ttadec->srcpad, srccaps); if (!gst_pad_set_caps (ttadec->srcpad, srccaps))
return FALSE;
ttadec->frame_length = FRAME_TIME * ttadec->samplerate; ttadec->frame_length = FRAME_TIME * ttadec->samplerate;
...@@ -138,7 +142,7 @@ gst_tta_dec_link (GstPad * pad, const GstCaps * caps) ...@@ -138,7 +142,7 @@ gst_tta_dec_link (GstPad * pad, const GstCaps * caps)
(guchar *) g_malloc (ttadec->channels * ttadec->frame_length * (guchar *) g_malloc (ttadec->channels * ttadec->frame_length *
ttadec->bytes * sizeof (guchar)); ttadec->bytes * sizeof (guchar));
return GST_PAD_LINK_OK; return TRUE;
} }
GType GType
...@@ -216,19 +220,18 @@ gst_tta_dec_init (GstTtaDec * ttadec) ...@@ -216,19 +220,18 @@ gst_tta_dec_init (GstTtaDec * ttadec)
ttadec->sinkpad = ttadec->sinkpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass, gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"sink"), "sink"); "sink"), "sink");
gst_pad_set_link_function (ttadec->sinkpad, gst_tta_dec_link); gst_pad_set_setcaps_function (ttadec->sinkpad, gst_tta_dec_setcaps);
ttadec->srcpad = ttadec->srcpad =
gst_pad_new_from_template (gst_element_class_get_pad_template (klass, gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
"src"), "src"); "src"), "src");
gst_pad_use_explicit_caps (ttadec->srcpad); gst_pad_use_fixed_caps (ttadec->srcpad);
gst_element_add_pad (GST_ELEMENT (ttadec), ttadec->sinkpad); gst_element_add_pad (GST_ELEMENT (ttadec), ttadec->sinkpad);
gst_element_add_pad (GST_ELEMENT (ttadec), ttadec->srcpad); gst_element_add_pad (GST_ELEMENT (ttadec), ttadec->srcpad);
gst_pad_set_chain_function (ttadec->sinkpad, gst_tta_dec_chain); gst_pad_set_chain_function (ttadec->sinkpad, gst_tta_dec_chain);
ttadec->tta_buf.buffer = (guchar *) g_malloc (TTA_BUFFER_SIZE + 4); ttadec->tta_buf.buffer = (guchar *) g_malloc (TTA_BUFFER_SIZE + 4);
ttadec->tta_buf.buffer_end = ttadec->tta_buf.buffer + TTA_BUFFER_SIZE; ttadec->tta_buf.buffer_end = ttadec->tta_buf.buffer + TTA_BUFFER_SIZE;
GST_FLAG_SET (ttadec, GST_ELEMENT_EVENT_AWARE);
} }
void void
...@@ -311,8 +314,8 @@ get_unary (tta_buffer * tta_buf, guchar * buffer, unsigned long buffersize, ...@@ -311,8 +314,8 @@ get_unary (tta_buffer * tta_buf, guchar * buffer, unsigned long buffersize,
tta_buf->bit_count--; tta_buf->bit_count--;
} }
static void static GstFlowReturn
gst_tta_dec_chain (GstPad * pad, GstData * in) gst_tta_dec_chain (GstPad * pad, GstBuffer * in)
{ {
GstTtaDec *ttadec; GstTtaDec *ttadec;
GstBuffer *outbuf, *buf = GST_BUFFER (in); GstBuffer *outbuf, *buf = GST_BUFFER (in);
...@@ -324,16 +327,8 @@ gst_tta_dec_chain (GstPad * pad, GstData * in) ...@@ -324,16 +327,8 @@ gst_tta_dec_chain (GstPad * pad, GstData * in)
long res; long res;
long *prev; long *prev;
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
ttadec = GST_TTA_DEC (GST_OBJECT_PARENT (pad)); ttadec = GST_TTA_DEC (GST_OBJECT_PARENT (pad));
g_return_if_fail (GST_IS_TTA_DEC (ttadec));
if (GST_IS_EVENT (buf)) {
gst_pad_event_default (pad, GST_EVENT (buf));
return;
}
data = GST_BUFFER_DATA (buf); data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf); size = GST_BUFFER_SIZE (buf);
...@@ -447,7 +442,8 @@ gst_tta_dec_chain (GstPad * pad, GstData * in) ...@@ -447,7 +442,8 @@ gst_tta_dec_chain (GstPad * pad, GstData * in)
memcpy (GST_BUFFER_DATA (outbuf), ttadec->decdata, outsize); memcpy (GST_BUFFER_DATA (outbuf), ttadec->decdata, outsize);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf); GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf); GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
gst_pad_push (ttadec->srcpad, GST_DATA (outbuf)); gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ttadec->srcpad));
return gst_pad_push (ttadec->srcpad, outbuf);
} }
gboolean gboolean
......
This diff is collapsed.
...@@ -42,7 +42,6 @@ typedef struct _GstTtaParse GstTtaParse; ...@@ -42,7 +42,6 @@ typedef struct _GstTtaParse GstTtaParse;
typedef struct _GstTtaParseClass GstTtaParseClass; typedef struct _GstTtaParseClass GstTtaParseClass;
typedef struct _GstTtaIndex { typedef struct _GstTtaIndex {
guint32 frameno;
guint32 size; /* size of frame frameno */ guint32 size; /* size of frame frameno */
guint64 pos; /* start of the frame */ guint64 pos; /* start of the frame */
guint64 time; /* in nanoseconds */ guint64 time; /* in nanoseconds */
...@@ -54,16 +53,14 @@ struct _GstTtaParse ...@@ -54,16 +53,14 @@ struct _GstTtaParse
GstPad *sinkpad, *srcpad; GstPad *sinkpad, *srcpad;
gboolean silent;
gboolean header_parsed; gboolean header_parsed;
GstBuffer *partialbuf;
guint32 samplerate; guint32 samplerate;
guint16 channels; guint16 channels;
guint16 bits; guint16 bits;
guint32 data_length; guint32 data_length;
GstTtaIndex *index;
guint num_frames; guint num_frames;
gboolean seek_ok;
GstTtaIndex *index;
guint32 current_frame; guint32 current_frame;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment