mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
Auparse ported to 0.9. Tested with filesrc ! auparse ! osssink and alsasink
Original commit message from CVS: Auparse ported to 0.9. Tested with filesrc ! auparse ! osssink and alsasink
This commit is contained in:
parent
7067b806e0
commit
50bdf8c462
5 changed files with 56 additions and 57 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
|
||||||
|
2005-09-22 Edgard Lima (edgard.lima@indt.org.br)
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
* PORTED_09:
|
||||||
|
* gst/auparse/gstauparse.c:
|
||||||
|
* gst/auparse/gstauparse.h:
|
||||||
|
Auparse ported to 0.9.
|
||||||
|
|
||||||
2005-09-22 Wim Taymans <wim@fluendo.com>
|
2005-09-22 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/rtp/TODO:
|
* gst/rtp/TODO:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
When porting a plugin start with 0.8 CVS head, not the old code in this module. There are many bugfixes which have gone into 0.8 which you want to keep.
|
When porting a plugin start with 0.8 CVS head, not the old code in this module. There are many bugfixes which have gone into 0.8 which you want to keep.
|
||||||
|
|
||||||
List of ported plugins (update when you commit a ported plugin):
|
List of ported plugins (update when you commit a ported plugin):
|
||||||
|
auparse (alima)
|
||||||
effectv (wim)
|
effectv (wim)
|
||||||
mad (wim)
|
mad (wim)
|
||||||
videofilter (wim)
|
videofilter (wim)
|
||||||
|
|
|
@ -267,6 +267,7 @@ dnl videofilter is at the top because others depend on it
|
||||||
GST_PLUGINS_ALL="\
|
GST_PLUGINS_ALL="\
|
||||||
videofilter \
|
videofilter \
|
||||||
alpha \
|
alpha \
|
||||||
|
auparse \
|
||||||
autodetect \
|
autodetect \
|
||||||
avi \
|
avi \
|
||||||
debug \
|
debug \
|
||||||
|
@ -564,6 +565,7 @@ AC_CONFIG_FILES(
|
||||||
Makefile
|
Makefile
|
||||||
gst/Makefile
|
gst/Makefile
|
||||||
gst/alpha/Makefile
|
gst/alpha/Makefile
|
||||||
|
gst/auparse/Makefile
|
||||||
gst/autodetect/Makefile
|
gst/autodetect/Makefile
|
||||||
gst/avi/Makefile
|
gst/avi/Makefile
|
||||||
gst/debug/Makefile
|
gst/debug/Makefile
|
||||||
|
|
|
@ -67,13 +67,6 @@ static GstStaticPadTemplate gst_auparse_src_template =
|
||||||
"audio/x-adpcm, " "layout = (string) { g721, g722, g723_3, g723_5 }")
|
"audio/x-adpcm, " "layout = (string) { g721, g722, g723_3, g723_5 }")
|
||||||
);
|
);
|
||||||
|
|
||||||
/* AuParse signals and args */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/* FILL ME */
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARG_0
|
ARG_0
|
||||||
|
@ -84,13 +77,14 @@ static void gst_auparse_base_init (gpointer g_class);
|
||||||
static void gst_auparse_class_init (GstAuParseClass * klass);
|
static void gst_auparse_class_init (GstAuParseClass * klass);
|
||||||
static void gst_auparse_init (GstAuParse * auparse);
|
static void gst_auparse_init (GstAuParse * auparse);
|
||||||
|
|
||||||
static void gst_auparse_chain (GstPad * pad, GstData * _data);
|
static GstFlowReturn gst_auparse_chain (GstPad * pad, GstBuffer * buf);
|
||||||
|
|
||||||
static GstStateChangeReturn gst_auparse_change_state (GstElement * element,
|
static GstStateChangeReturn gst_auparse_change_state (GstElement * element,
|
||||||
GstStateChange transition);
|
GstStateChange transition);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
|
|
||||||
/*static guint gst_auparse_signals[LAST_SIGNAL] = { 0 }; */
|
/*static guint gst_auparse_signals[LAST_SIGNAL] = { 0 }; */
|
||||||
|
|
||||||
GType
|
GType
|
||||||
|
@ -157,7 +151,7 @@ gst_auparse_init (GstAuParse * auparse)
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
(&gst_auparse_src_template), "src");
|
(&gst_auparse_src_template), "src");
|
||||||
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
|
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
|
||||||
gst_pad_use_explicit_caps (auparse->srcpad);
|
gst_pad_use_fixed_caps (auparse->srcpad);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auparse->offset = 0;
|
auparse->offset = 0;
|
||||||
|
@ -167,10 +161,10 @@ gst_auparse_init (GstAuParse * auparse)
|
||||||
auparse->channels = 0;
|
auparse->channels = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_auparse_chain (GstPad * pad, GstData * _data)
|
gst_auparse_chain (GstPad * pad, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstBuffer *buf = GST_BUFFER (_data);
|
GstFlowReturn ret;
|
||||||
GstAuParse *auparse;
|
GstAuParse *auparse;
|
||||||
gchar *data;
|
gchar *data;
|
||||||
glong size;
|
glong size;
|
||||||
|
@ -180,9 +174,9 @@ gst_auparse_chain (GstPad * pad, GstData * _data)
|
||||||
|
|
||||||
layout[0] = 0;
|
layout[0] = 0;
|
||||||
|
|
||||||
g_return_if_fail (pad != NULL);
|
g_return_val_if_fail (pad != NULL, GST_FLOW_ERROR);
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
|
||||||
g_return_if_fail (buf != NULL);
|
g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
|
||||||
|
|
||||||
auparse = GST_AUPARSE (gst_pad_get_parent (pad));
|
auparse = GST_AUPARSE (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
@ -232,12 +226,11 @@ gst_auparse_chain (GstPad * pad, GstData * _data)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE, (NULL), (NULL));
|
GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE, (NULL), (NULL));
|
||||||
gst_buffer_unref (buf);
|
return GST_FLOW_ERROR;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG
|
GST_DEBUG
|
||||||
("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld",
|
("offset %ld, size %ld, encoding %ld, frequency %ld, channels %ld\n",
|
||||||
auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
|
auparse->offset, auparse->size, auparse->encoding, auparse->frequency,
|
||||||
auparse->channels);
|
auparse->channels);
|
||||||
|
|
||||||
|
@ -318,14 +311,17 @@ Samples :
|
||||||
|
|
||||||
default:
|
default:
|
||||||
GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), (NULL));
|
GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), (NULL));
|
||||||
gst_buffer_unref (buf);
|
return GST_FLOW_ERROR;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auparse->srcpad =
|
auparse->srcpad =
|
||||||
gst_pad_new_from_template (gst_static_pad_template_get
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
(&gst_auparse_src_template), "src");
|
(&gst_auparse_src_template), "src");
|
||||||
gst_pad_use_explicit_caps (auparse->srcpad);
|
|
||||||
|
g_return_val_if_fail (auparse->srcpad != NULL, GST_FLOW_ERROR);
|
||||||
|
|
||||||
|
|
||||||
|
gst_pad_use_fixed_caps (auparse->srcpad);
|
||||||
|
|
||||||
if (law) {
|
if (law) {
|
||||||
tempcaps =
|
tempcaps =
|
||||||
|
@ -352,47 +348,45 @@ Samples :
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_pad_set_explicit_caps (auparse->srcpad, tempcaps)) {
|
gst_pad_use_fixed_caps (auparse->srcpad);
|
||||||
GST_ELEMENT_ERROR (auparse, CORE, NEGOTIATION, (NULL), (NULL));
|
gst_pad_set_active (auparse->srcpad, TRUE);
|
||||||
gst_buffer_unref (buf);
|
gst_pad_set_caps (auparse->srcpad, tempcaps);
|
||||||
gst_object_unref (GST_OBJECT (auparse->srcpad));
|
|
||||||
auparse->srcpad = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
|
gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad);
|
||||||
|
|
||||||
newbuf = gst_buffer_new ();
|
if ((ret = gst_pad_alloc_buffer (auparse->srcpad, GST_BUFFER_OFFSET_NONE,
|
||||||
GST_BUFFER_DATA (newbuf) = (gpointer) malloc (size - (auparse->offset));
|
size - (auparse->offset),
|
||||||
|
GST_PAD_CAPS (auparse->srcpad), &newbuf)) != GST_FLOW_OK) {
|
||||||
|
printf ("failed gst_pad_alloc_buffer\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
ret = GST_FLOW_OK;
|
||||||
|
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (newbuf), data + (auparse->offset),
|
memcpy (GST_BUFFER_DATA (newbuf), data + (auparse->offset),
|
||||||
size - (auparse->offset));
|
size - (auparse->offset));
|
||||||
GST_BUFFER_SIZE (newbuf) = size - (auparse->offset);
|
GST_BUFFER_SIZE (newbuf) = size - (auparse->offset);
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
GstEvent *event;
|
||||||
|
|
||||||
|
event = NULL;
|
||||||
|
|
||||||
|
event = gst_event_new_newsegment (1.0, GST_FORMAT_DEFAULT,
|
||||||
|
0, GST_CLOCK_TIME_NONE, 0);
|
||||||
|
|
||||||
|
|
||||||
|
gst_pad_push_event (auparse->srcpad, event);
|
||||||
|
|
||||||
|
return gst_pad_push (auparse->srcpad, newbuf);
|
||||||
|
|
||||||
gst_pad_push (auparse->srcpad, GST_DATA (newbuf));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_pad_push (auparse->srcpad, GST_DATA (buf));
|
return gst_pad_push (auparse->srcpad, buf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
gst_auparse_change_state (GstElement * element, GstStateChange transition)
|
gst_auparse_change_state (GstElement * element, GstStateChange transition)
|
||||||
{
|
{
|
||||||
GstAuParse *auparse = GST_AUPARSE (element);
|
|
||||||
|
|
||||||
switch (transition) {
|
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
||||||
if (auparse->srcpad) {
|
|
||||||
gst_element_remove_pad (element, auparse->srcpad);
|
|
||||||
auparse->srcpad = NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parent_class->change_state)
|
if (parent_class->change_state)
|
||||||
return parent_class->change_state (element, transition);
|
return parent_class->change_state (element, transition);
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,7 @@
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
G_BEGIN_DECLS
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#define GST_TYPE_AUPARSE \
|
#define GST_TYPE_AUPARSE \
|
||||||
(gst_auparse_get_type())
|
(gst_auparse_get_type())
|
||||||
|
@ -64,10 +61,6 @@ struct _GstAuParseClass {
|
||||||
|
|
||||||
GType gst_auparse_get_type (void);
|
GType gst_auparse_get_type (void);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GST_AUPARSE_H__ */
|
#endif /* __GST_AUPARSE_H__ */
|
||||||
|
|
Loading…
Reference in a new issue