summaryrefslogtreecommitdiffstats
path: root/ext/mimic
diff options
context:
space:
mode:
authorOlivier Crête <olivier.crete@collabora.co.uk>2009-03-03 14:20:37 -0500
committerOlivier Crête <olivier.crete@collabora.co.uk>2009-03-03 14:34:07 -0500
commitbc4ef4ab6230a8b8f35fcfb3101252482946f6e1 (patch)
treea897bce987d1813466217f3aed1e9e71e1d48cfa /ext/mimic
parent2451f95e0f450ea6f91d9fedd4f3dd4a1f622c3e (diff)
downloadgst-plugins-bad-bc4ef4ab6230a8b8f35fcfb3101252482946f6e1.tar.gz
gst-plugins-bad-bc4ef4ab6230a8b8f35fcfb3101252482946f6e1.tar.bz2
gst-plugins-bad-bc4ef4ab6230a8b8f35fcfb3101252482946f6e1.zip
Re-indent to GST style
Diffstat (limited to 'ext/mimic')
-rw-r--r--ext/mimic/gstmimdec.c144
-rw-r--r--ext/mimic/gstmimdec.h5
-rw-r--r--ext/mimic/gstmimenc.c189
-rw-r--r--ext/mimic/gstmimenc.h5
-rw-r--r--ext/mimic/gstmimic.c25
5 files changed, 170 insertions, 198 deletions
diff --git a/ext/mimic/gstmimdec.c b/ext/mimic/gstmimdec.c
index cd1e78b1..37bafc22 100644
--- a/ext/mimic/gstmimdec.c
+++ b/ext/mimic/gstmimdec.c
@@ -33,17 +33,13 @@
GST_DEBUG_CATEGORY (mimdec_debug);
#define GST_CAT_DEFAULT (mimdec_debug)
-static GstStaticPadTemplate sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-mimic")
-);
-
-static GstStaticPadTemplate src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-mimic")
+ );
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("video/x-raw-rgb, "
@@ -54,20 +50,16 @@ GST_STATIC_PAD_TEMPLATE (
"red_mask = (int) 16711680, "
"green_mask = (int) 65280, "
"blue_mask = (int) 255, "
- "height = (int) [16, 4096], "
- "width = (int) [16, 4096]"
- )
-);
+ "height = (int) [16, 4096], " "width = (int) [16, 4096]")
+ );
-static void gst_mimdec_finalize (GObject *object);
+static void gst_mimdec_finalize (GObject * object);
-static GstFlowReturn gst_mimdec_chain (GstPad *pad,
- GstBuffer *in);
+static GstFlowReturn gst_mimdec_chain (GstPad * pad, GstBuffer * in);
static GstStateChangeReturn
- gst_mimdec_change_state (GstElement *element,
- GstStateChange transition);
+gst_mimdec_change_state (GstElement * element, GstStateChange transition);
-static gboolean gst_mimdec_sink_event (GstPad *pad, GstEvent *event);
+static gboolean gst_mimdec_sink_event (GstPad * pad, GstEvent * event);
GST_BOILERPLATE (GstMimDec, gst_mimdec, GstElement, GST_TYPE_ELEMENT);
@@ -80,9 +72,9 @@ gst_mimdec_base_init (gpointer klass)
"Codec/Decoder/Video",
"Mimic decoder",
"Andre Moreira Magalhaes <andre.magalhaes@indt.org.br>, "
- "Rob Taylor <robtaylor@fastmail.fm>, "
- "Philippe Khalaf <burger@speedy.org>, "
- "Ole André Vadla Ravnås <oleavr@gmail.com>"
+ "Rob Taylor <robtaylor@fastmail.fm>, "
+ "Philippe Khalaf <burger@speedy.org>, "
+ "Ole André Vadla Ravnås <oleavr@gmail.com>"
};
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -95,13 +87,13 @@ gst_mimdec_base_init (gpointer klass)
}
static void
-gst_mimdec_class_init (GstMimDecClass *klass)
+gst_mimdec_class_init (GstMimDecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*) klass;
- gstelement_class = (GstElementClass*) klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
gstelement_class->change_state = gst_mimdec_change_state;
gobject_class->finalize = gst_mimdec_finalize;
@@ -110,16 +102,18 @@ gst_mimdec_class_init (GstMimDecClass *klass)
}
static void
-gst_mimdec_init (GstMimDec *mimdec, GstMimDecClass *klass)
+gst_mimdec_init (GstMimDec * mimdec, GstMimDecClass * klass)
{
- mimdec->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_factory), "sink");
+ mimdec->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sink_factory),
+ "sink");
gst_element_add_pad (GST_ELEMENT (mimdec), mimdec->sinkpad);
gst_pad_set_chain_function (mimdec->sinkpad, gst_mimdec_chain);
gst_pad_set_event_function (mimdec->sinkpad, gst_mimdec_sink_event);
- mimdec->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_factory), "src");
+ mimdec->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&src_factory),
+ "src");
gst_element_add_pad (GST_ELEMENT (mimdec), mimdec->srcpad);
mimdec->adapter = gst_adapter_new ();
@@ -132,7 +126,7 @@ gst_mimdec_init (GstMimDec *mimdec, GstMimDecClass *klass)
}
static void
-gst_mimdec_finalize (GObject *object)
+gst_mimdec_finalize (GObject * object)
{
GstMimDec *mimdec = GST_MIMDEC (object);
@@ -141,7 +135,7 @@ gst_mimdec_finalize (GObject *object)
}
static GstFlowReturn
-gst_mimdec_chain (GstPad *pad, GstBuffer *in)
+gst_mimdec_chain (GstPad * pad, GstBuffer * in)
{
GstMimDec *mimdec;
GstBuffer *out_buf, *buf;
@@ -149,7 +143,7 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
guint32 fourcc;
guint16 header_size;
gint width, height;
- GstCaps * caps;
+ GstCaps *caps;
GstFlowReturn res = GST_FLOW_OK;
GST_DEBUG ("in gst_mimdec_chain");
@@ -165,7 +159,8 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
GST_OBJECT_LOCK (mimdec);
// do we have enough bytes to read a header
- while (gst_adapter_available (mimdec->adapter) >= (mimdec->have_header ? mimdec->payload_size : 24)) {
+ while (gst_adapter_available (mimdec->adapter) >=
+ (mimdec->have_header ? mimdec->payload_size : 24)) {
if (!mimdec->have_header) {
header = (guchar *) gst_adapter_peek (mimdec->adapter, 24);
header_size = GUINT16_FROM_LE (*(guint16 *) (header + 0));
@@ -179,7 +174,8 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
fourcc = GST_MAKE_FOURCC ('M', 'L', '2', '0');
if (GUINT32_FROM_LE (*((guint32 *) (header + 12))) != fourcc) {
- GST_WARNING_OBJECT (mimdec, "invalid frame: unknown FOURCC code %d", fourcc);
+ GST_WARNING_OBJECT (mimdec, "invalid frame: unknown FOURCC code %d",
+ fourcc);
gst_adapter_flush (mimdec->adapter, 24);
res = GST_FLOW_ERROR;
goto out;
@@ -196,19 +192,19 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
mimdec->have_header = TRUE;
}
- if (gst_adapter_available (mimdec->adapter) < mimdec->payload_size)
- {
+ if (gst_adapter_available (mimdec->adapter) < mimdec->payload_size) {
goto out;
}
- frame_body = (guchar *) gst_adapter_peek (mimdec->adapter, mimdec->payload_size);
+ frame_body =
+ (guchar *) gst_adapter_peek (mimdec->adapter, mimdec->payload_size);
if (mimdec->dec == NULL) {
- GstEvent * event = NULL;
+ GstEvent *event = NULL;
gboolean result = TRUE;
/* Check if its a keyframe, otherwise skip it */
- if (GUINT32_FROM_LE(*((guint32 *) (frame_body + 12))) != 0) {
+ if (GUINT32_FROM_LE (*((guint32 *) (frame_body + 12))) != 0) {
gst_adapter_flush (mimdec->adapter, mimdec->payload_size);
mimdec->have_header = FALSE;
res = GST_FLOW_OK;
@@ -236,7 +232,8 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
goto out;
}
- if (!mimic_get_property (mimdec->dec, "buffer_size", &mimdec->buffer_size)) {
+ if (!mimic_get_property (mimdec->dec, "buffer_size",
+ &mimdec->buffer_size)) {
GST_WARNING_OBJECT (mimdec,
"mimic_get_property('buffer_size') error\n");
mimic_close (mimdec->dec);
@@ -256,8 +253,7 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
if (event)
result = gst_pad_push_event (mimdec->srcpad, event);
GST_OBJECT_LOCK (mimdec);
- if (!result)
- {
+ if (!result) {
GST_WARNING_OBJECT (mimdec, "gst_pad_push_event failed");
res = GST_FLOW_ERROR;
goto out;
@@ -266,7 +262,8 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
out_buf = gst_buffer_new_and_alloc (mimdec->buffer_size);
- if (!mimic_decode_frame (mimdec->dec, frame_body, GST_BUFFER_DATA (out_buf))) {
+ if (!mimic_decode_frame (mimdec->dec, frame_body,
+ GST_BUFFER_DATA (out_buf))) {
GST_WARNING_OBJECT (mimdec, "mimic_decode_frame error\n");
gst_adapter_flush (mimdec->adapter, mimdec->payload_size);
@@ -277,10 +274,10 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
goto out;
}
- GST_BUFFER_TIMESTAMP(out_buf) = mimdec->current_ts * GST_MSECOND;
+ GST_BUFFER_TIMESTAMP (out_buf) = mimdec->current_ts * GST_MSECOND;
- mimic_get_property(mimdec->dec, "width", &width);
- mimic_get_property(mimdec->dec, "height", &height);
+ mimic_get_property (mimdec->dec, "width", &width);
+ mimic_get_property (mimdec->dec, "height", &height);
GST_DEBUG_OBJECT (mimdec,
"got WxH %d x %d payload size %d buffer_size %d",
width, height, mimdec->payload_size, mimdec->buffer_size);
@@ -292,8 +289,7 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
"red_mask", G_TYPE_INT, 16711680,
"green_mask", G_TYPE_INT, 65280,
"blue_mask", G_TYPE_INT, 255,
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height, NULL);
+ "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
gst_buffer_set_caps (out_buf, caps);
gst_caps_unref (caps);
GST_OBJECT_UNLOCK (mimdec);
@@ -304,7 +300,7 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
mimdec->have_header = FALSE;
}
- out:
+out:
GST_OBJECT_UNLOCK (mimdec);
gst_object_unref (mimdec);
@@ -312,7 +308,7 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in)
}
static GstStateChangeReturn
-gst_mimdec_change_state (GstElement *element, GstStateChange transition)
+gst_mimdec_change_state (GstElement * element, GstStateChange transition)
{
GstMimDec *mimdec;
@@ -343,7 +339,7 @@ gst_mimdec_change_state (GstElement *element, GstStateChange transition)
}
static gboolean
-gst_mimdec_sink_event (GstPad *pad, GstEvent *event)
+gst_mimdec_sink_event (GstPad * pad, GstEvent * event)
{
gboolean res = TRUE;
GstMimDec *mimdec = GST_MIMDEC (gst_pad_get_parent (pad));
@@ -354,28 +350,28 @@ gst_mimdec_sink_event (GstPad *pad, GstEvent *event)
*/
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
- {
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
+ {
+ gboolean update;
+ GstFormat format;
+ gdouble rate, arate;
+ gint64 start, stop, time;
- gst_event_parse_new_segment_full (event, &update, &rate, &arate,
- &format, &start, &stop, &time);
+ gst_event_parse_new_segment_full (event, &update, &rate, &arate,
+ &format, &start, &stop, &time);
- /* we need TIME and a positive rate */
- if (format != GST_FORMAT_TIME)
- goto newseg_wrong_format;
+ /* we need TIME and a positive rate */
+ if (format != GST_FORMAT_TIME)
+ goto newseg_wrong_format;
- if (rate <= 0.0)
- goto newseg_wrong_rate;
+ if (rate <= 0.0)
+ goto newseg_wrong_rate;
- GST_OBJECT_LOCK (mimdec);
- mimdec->need_newsegment = FALSE;
- GST_OBJECT_UNLOCK (mimdec);
+ GST_OBJECT_LOCK (mimdec);
+ mimdec->need_newsegment = FALSE;
+ GST_OBJECT_UNLOCK (mimdec);
- res = gst_pad_push_event (mimdec->srcpad, event);
- }
+ res = gst_pad_push_event (mimdec->srcpad, event);
+ }
break;
case GST_EVENT_FLUSH_STOP:
GST_OBJECT_LOCK (mimdec);
@@ -389,19 +385,19 @@ gst_mimdec_sink_event (GstPad *pad, GstEvent *event)
break;
}
- done:
+done:
gst_object_unref (mimdec);
return res;
- newseg_wrong_format:
+newseg_wrong_format:
{
GST_DEBUG_OBJECT (mimdec, "received non TIME newsegment");
gst_event_unref (event);
goto done;
}
- newseg_wrong_rate:
+newseg_wrong_rate:
{
GST_DEBUG_OBJECT (mimdec, "negative rates not supported yet");
gst_event_unref (event);
diff --git a/ext/mimic/gstmimdec.h b/ext/mimic/gstmimdec.h
index dbcd69f7..e1db38d1 100644
--- a/ext/mimic/gstmimdec.h
+++ b/ext/mimic/gstmimdec.h
@@ -28,7 +28,6 @@
#include <mimic.h>
G_BEGIN_DECLS
-
#define GST_TYPE_MIMDEC \
(gst_mimdec_get_type())
#define GST_MIMDEC(obj) \
@@ -39,8 +38,7 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MIMDEC))
#define GST_IS_MIMDEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MIMDEC))
-
-typedef struct _GstMimDec GstMimDec;
+typedef struct _GstMimDec GstMimDec;
typedef struct _GstMimDecClass GstMimDecClass;
struct _GstMimDec
@@ -71,5 +69,4 @@ struct _GstMimDecClass
GType gst_mimdec_get_type (void);
G_END_DECLS
-
#endif /* __GST_MIMDEC_H__ */
diff --git a/ext/mimic/gstmimenc.c b/ext/mimic/gstmimenc.c
index 91f4939a..3f3210cc 100644
--- a/ext/mimic/gstmimenc.c
+++ b/ext/mimic/gstmimenc.c
@@ -1,24 +1,24 @@
/*
- * GStreamer
- * Copyright (c) 2005 INdT.
- * @author Andre Moreira Magalhaes <andre.magalhaes@indt.org.br>
- * @author Philippe Khalaf <burger@speedy.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
+ * GStreamer
+ * Copyright (c) 2005 INdT.
+ * @author Andre Moreira Magalhaes <andre.magalhaes@indt.org.br>
+ * @author Philippe Khalaf <burger@speedy.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -33,13 +33,10 @@ GST_DEBUG_CATEGORY (mimenc_debug);
#define MAX_INTERFRAMES 15
-static GstStaticPadTemplate sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- "video/x-raw-rgb, "
+ GST_STATIC_CAPS ("video/x-raw-rgb, "
"bpp = (int) 24, "
"depth = (int) 24, "
"endianness = (int) 4321, "
@@ -49,39 +46,30 @@ GST_STATIC_PAD_TEMPLATE (
"blue_mask = (int) 255, "
"width = (int) 320, "
"height = (int) 240"
- ";video/x-raw-rgb, "
+ ";video/x-raw-rgb, "
"bpp = (int) 24, "
"depth = (int) 24, "
"endianness = (int) 4321, "
"framerate = (fraction) [1/1, 30/1], "
"red_mask = (int) 16711680, "
"green_mask = (int) 65280, "
- "blue_mask = (int) 255, "
- "width = (int) 160, "
- "height = (int) 120"
- )
-);
-
-static GstStaticPadTemplate src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-mimic")
-);
-
-
-static gboolean gst_mimenc_setcaps (GstPad *pad,
- GstCaps *caps);
-static GstFlowReturn gst_mimenc_chain (GstPad *pad,
- GstBuffer *in);
-static GstBuffer* gst_mimenc_create_tcp_header (GstMimEnc *mimenc,
- guint32 payload_size,
- guint32 timestamp);
+ "blue_mask = (int) 255, " "width = (int) 160, " "height = (int) 120")
+ );
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-mimic")
+ );
+
+
+static gboolean gst_mimenc_setcaps (GstPad * pad, GstCaps * caps);
+static GstFlowReturn gst_mimenc_chain (GstPad * pad, GstBuffer * in);
+static GstBuffer *gst_mimenc_create_tcp_header (GstMimEnc * mimenc,
+ guint32 payload_size, guint32 timestamp);
static GstStateChangeReturn
- gst_mimenc_change_state (GstElement *element,
- GstStateChange transition);
+gst_mimenc_change_state (GstElement * element, GstStateChange transition);
GST_BOILERPLATE (GstMimEnc, gst_mimenc, GstElement, GST_TYPE_ELEMENT);
@@ -98,36 +86,38 @@ gst_mimenc_base_init (gpointer klass)
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
+ gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &plugin_details);
}
static void
-gst_mimenc_class_init (GstMimEncClass *klass)
+gst_mimenc_class_init (GstMimEncClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*) klass;
- gstelement_class = (GstElementClass*) klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
gstelement_class->change_state = gst_mimenc_change_state;
GST_DEBUG_CATEGORY_INIT (mimenc_debug, "mimenc", 0, "Mimic encoder plugin");
}
static void
-gst_mimenc_init (GstMimEnc *mimenc, GstMimEncClass *klass)
+gst_mimenc_init (GstMimEnc * mimenc, GstMimEncClass * klass)
{
- mimenc->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_factory), "sink");
+ mimenc->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sink_factory),
+ "sink");
gst_element_add_pad (GST_ELEMENT (mimenc), mimenc->sinkpad);
gst_pad_set_setcaps_function (mimenc->sinkpad, gst_mimenc_setcaps);
gst_pad_set_chain_function (mimenc->sinkpad, gst_mimenc_chain);
- mimenc->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_factory), "src");
+ mimenc->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&src_factory),
+ "src");
gst_element_add_pad (GST_ELEMENT (mimenc), mimenc->srcpad);
mimenc->enc = NULL;
@@ -141,7 +131,7 @@ gst_mimenc_init (GstMimEnc *mimenc, GstMimEncClass *klass)
}
static gboolean
-gst_mimenc_setcaps (GstPad *pad, GstCaps *caps)
+gst_mimenc_setcaps (GstPad * pad, GstCaps * caps)
{
GstMimEnc *filter;
GstStructure *structure;
@@ -151,13 +141,13 @@ gst_mimenc_setcaps (GstPad *pad, GstCaps *caps)
g_return_val_if_fail (filter != NULL, FALSE);
g_return_val_if_fail (GST_IS_MIMENC (filter), FALSE);
- structure = gst_caps_get_structure( caps, 0 );
- ret = gst_structure_get_int( structure, "width", &width );
+ structure = gst_caps_get_structure (caps, 0);
+ ret = gst_structure_get_int (structure, "width", &width);
if (!ret) {
GST_DEBUG_OBJECT (filter, "No width set");
goto out;
}
- ret = gst_structure_get_int( structure, "height", &height );
+ ret = gst_structure_get_int (structure, "height", &height);
if (!ret) {
GST_DEBUG_OBJECT (filter, "No height set");
goto out;
@@ -176,26 +166,26 @@ gst_mimenc_setcaps (GstPad *pad, GstCaps *caps)
goto out;
}
- filter->width = (guint16)width;
- filter->height = (guint16)height;
+ filter->width = (guint16) width;
+ filter->height = (guint16) height;
- GST_DEBUG_OBJECT (filter,"Got info from caps w : %d, h : %d",
+ GST_DEBUG_OBJECT (filter, "Got info from caps w : %d, h : %d",
filter->width, filter->height);
GST_OBJECT_UNLOCK (filter);
- out:
- gst_object_unref(filter);
+out:
+ gst_object_unref (filter);
return ret;
}
static GstFlowReturn
-gst_mimenc_chain (GstPad *pad, GstBuffer *in)
+gst_mimenc_chain (GstPad * pad, GstBuffer * in)
{
GstMimEnc *mimenc;
GstBuffer *out_buf = NULL, *buf = NULL;
guchar *data;
gint buffer_size;
- GstBuffer * header = NULL;
+ GstBuffer *header = NULL;
GstFlowReturn res = GST_FLOW_OK;
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
@@ -234,10 +224,11 @@ gst_mimenc_chain (GstPad *pad, GstBuffer *in)
data = GST_BUFFER_DATA (buf);
out_buf = gst_buffer_new_and_alloc (mimenc->buffer_size);
- GST_BUFFER_TIMESTAMP(out_buf) = GST_BUFFER_TIMESTAMP(buf);
+ GST_BUFFER_TIMESTAMP (out_buf) = GST_BUFFER_TIMESTAMP (buf);
buffer_size = mimenc->buffer_size;
if (!mimic_encode_frame (mimenc->enc, data, GST_BUFFER_DATA (out_buf),
- &buffer_size, ((mimenc->frames % MAX_INTERFRAMES) == 0 ? TRUE : FALSE))) {
+ &buffer_size,
+ ((mimenc->frames % MAX_INTERFRAMES) == 0 ? TRUE : FALSE))) {
GST_WARNING_OBJECT (mimenc, "mimic_encode_frame error\n");
gst_buffer_unref (out_buf);
gst_buffer_unref (buf);
@@ -247,7 +238,7 @@ gst_mimenc_chain (GstPad *pad, GstBuffer *in)
GST_BUFFER_SIZE (out_buf) = buffer_size;
GST_DEBUG_OBJECT (mimenc, "incoming buf size %d, encoded size %d",
- GST_BUFFER_SIZE(buf), GST_BUFFER_SIZE(out_buf));
+ GST_BUFFER_SIZE (buf), GST_BUFFER_SIZE (out_buf));
++mimenc->frames;
// now let's create that tcp header
@@ -256,8 +247,7 @@ gst_mimenc_chain (GstPad *pad, GstBuffer *in)
GST_OBJECT_UNLOCK (mimenc);
- if (header)
- {
+ if (header) {
res = gst_pad_push (mimenc->srcpad, header);
if (res != GST_FLOW_OK) {
gst_buffer_unref (out_buf);
@@ -265,45 +255,44 @@ gst_mimenc_chain (GstPad *pad, GstBuffer *in)
}
res = gst_pad_push (mimenc->srcpad, out_buf);
- }
- else
- {
- GST_DEBUG_OBJECT(mimenc, "header not created succesfully");
- res = GST_FLOW_ERROR;
+ } else {
+ GST_DEBUG_OBJECT (mimenc, "header not created succesfully");
+ res = GST_FLOW_ERROR;
}
- out:
+out:
if (buf)
gst_buffer_unref (buf);
gst_object_unref (mimenc);
return res;
- out_unlock:
+out_unlock:
GST_OBJECT_UNLOCK (mimenc);
goto out;
}
-static GstBuffer*
-gst_mimenc_create_tcp_header (GstMimEnc *mimenc, guint32 payload_size,
+static GstBuffer *
+gst_mimenc_create_tcp_header (GstMimEnc * mimenc, guint32 payload_size,
guint32 timestamp)
{
- // 24 bytes
- GstBuffer *buf_header = gst_buffer_new_and_alloc (24);
- guchar *p = (guchar *) GST_BUFFER_DATA(buf_header);
-
- p[0] = 24;
- *((guchar *) (p + 1)) = 0;
- *((guint16 *) (p + 2)) = GUINT16_TO_LE(mimenc->width);
- *((guint16 *) (p + 4)) = GUINT16_TO_LE(mimenc->height);
- *((guint16 *) (p + 6)) = 0;
- *((guint32 *) (p + 8)) = GUINT32_TO_LE(payload_size);
- *((guint32 *) (p + 12)) = GUINT32_TO_LE(GST_MAKE_FOURCC ('M', 'L', '2', '0'));
- *((guint32 *) (p + 16)) = 0;
- *((guint32 *) (p + 20)) = timestamp;
-
- return buf_header;
+ // 24 bytes
+ GstBuffer *buf_header = gst_buffer_new_and_alloc (24);
+ guchar *p = (guchar *) GST_BUFFER_DATA (buf_header);
+
+ p[0] = 24;
+ *((guchar *) (p + 1)) = 0;
+ *((guint16 *) (p + 2)) = GUINT16_TO_LE (mimenc->width);
+ *((guint16 *) (p + 4)) = GUINT16_TO_LE (mimenc->height);
+ *((guint16 *) (p + 6)) = 0;
+ *((guint32 *) (p + 8)) = GUINT32_TO_LE (payload_size);
+ *((guint32 *) (p + 12)) =
+ GUINT32_TO_LE (GST_MAKE_FOURCC ('M', 'L', '2', '0'));
+ *((guint32 *) (p + 16)) = 0;
+ *((guint32 *) (p + 20)) = timestamp;
+
+ return buf_header;
}
static GstStateChangeReturn
diff --git a/ext/mimic/gstmimenc.h b/ext/mimic/gstmimenc.h
index 77b0a783..c21d714f 100644
--- a/ext/mimic/gstmimenc.h
+++ b/ext/mimic/gstmimenc.h
@@ -28,7 +28,6 @@
#include <mimic.h>
G_BEGIN_DECLS
-
#define GST_TYPE_MIMENC \
(gst_mimenc_get_type())
#define GST_MIMENC(obj) \
@@ -39,8 +38,7 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MIMENC))
#define GST_IS_MIMENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MIMENC))
-
-typedef struct _GstMimEnc GstMimEnc;
+typedef struct _GstMimEnc GstMimEnc;
typedef struct _GstMimEncClass GstMimEncClass;
struct _GstMimEnc
@@ -66,5 +64,4 @@ struct _GstMimEncClass
GType gst_mimenc_get_type (void);
G_END_DECLS
-
#endif /* __GST_MIMENC_H__ */
diff --git a/ext/mimic/gstmimic.c b/ext/mimic/gstmimic.c
index 2208371c..7ed63bb0 100644
--- a/ext/mimic/gstmimic.c
+++ b/ext/mimic/gstmimic.c
@@ -30,24 +30,17 @@
static gboolean
plugin_init (GstPlugin * plugin)
{
- if (
- !gst_element_register (plugin, "mimenc",
- GST_RANK_NONE, GST_TYPE_MIMENC) ||
- !gst_element_register (plugin, "mimdec",
- GST_RANK_NONE, GST_TYPE_MIMDEC)
- )
+ if (!gst_element_register (plugin, "mimenc",
+ GST_RANK_NONE, GST_TYPE_MIMENC) ||
+ !gst_element_register (plugin, "mimdec", GST_RANK_NONE, GST_TYPE_MIMDEC)
+ )
return FALSE;
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "mimic",
- "Mimic codec",
- plugin_init,
- VERSION,
- "GPL",
- "Farsight",
- "http://farsight.sf.net/")
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "mimic",
+ "Mimic codec",
+ plugin_init, VERSION, "GPL", "Farsight", "http://farsight.sf.net/")