Re-indent the siren stuff to be gst style

This commit is contained in:
Olivier Crête 2009-02-10 19:20:19 +00:00 committed by Edward Hervey
parent b1efc2f9aa
commit 11328ad67f
5 changed files with 41 additions and 68 deletions

View file

@ -27,7 +27,6 @@
#include <gst/base/gstbasetransform.h> #include <gst/base/gstbasetransform.h>
G_BEGIN_DECLS G_BEGIN_DECLS
/* #define's don't like whitespacey bits */ /* #define's don't like whitespacey bits */
#define GST_TYPE_SIREN \ #define GST_TYPE_SIREN \
(gst_siren_get_type()) (gst_siren_get_type())
@ -41,7 +40,6 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN))
#define GST_IS_SIREN_CLASS(obj) \ #define GST_IS_SIREN_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN))
typedef struct _GstSiren GstSiren; typedef struct _GstSiren GstSiren;
typedef struct _GstSirenClass GstSirenClass; typedef struct _GstSirenClass GstSirenClass;
typedef struct _GstSirenPrivate GstSirenPrivate; typedef struct _GstSirenPrivate GstSirenPrivate;
@ -65,5 +63,4 @@ struct _GstSirenClass
GType gst_siren_get_type (void); GType gst_siren_get_type (void);
G_END_DECLS G_END_DECLS
#endif /* __GST_SIREN_H__ */ #endif /* __GST_SIREN_H__ */

View file

@ -33,8 +33,7 @@ GST_DEBUG_CATEGORY (sirendec_debug);
/* elementfactory information */ /* elementfactory information */
static const GstElementDetails gst_siren_dec_details = static const GstElementDetails gst_siren_dec_details =
GST_ELEMENT_DETAILS ( GST_ELEMENT_DETAILS ("Siren Decoder element",
"Siren Decoder element",
"Codec/Decoder/Audio ", "Codec/Decoder/Audio ",
"Decode streams encoded with the Siren7 codec into 16bit PCM", "Decode streams encoded with the Siren7 codec into 16bit PCM",
"Youness Alaoui <kakaroto@kakaroto.homelinux.net>"); "Youness Alaoui <kakaroto@kakaroto.homelinux.net>");
@ -43,8 +42,7 @@ GST_ELEMENT_DETAILS (
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-siren, " GST_STATIC_CAPS ("audio/x-siren, " "dct-length = (int) 320"));
"dct-length = (int) 320"));
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
@ -54,8 +52,7 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
"depth = (int) 16, " "depth = (int) 16, "
"endianness = (int) 1234, " "endianness = (int) 1234, "
"signed = (boolean) true, " "signed = (boolean) true, "
"rate = (int) 16000, " "rate = (int) 16000, " "channels = (int) 1"));
"channels = (int) 1"));
/* signals and args */ /* signals and args */
enum enum
@ -70,16 +67,14 @@ enum
}; };
static GstFlowReturn static GstFlowReturn gst_siren_dec_chain (GstPad * pad, GstBuffer * buf);
gst_siren_dec_chain (GstPad *pad, GstBuffer *buf);
static void gst_siren_dec_dispose (GObject * object); static void gst_siren_dec_dispose (GObject * object);
static void static void
_do_init (GType type) _do_init (GType type)
{ {
GST_DEBUG_CATEGORY_INIT GST_DEBUG_CATEGORY_INIT (sirendec_debug, "sirendec", 0, "sirendec");
(sirendec_debug, "sirendec", 0, "sirendec");
} }
GST_BOILERPLATE_FULL (GstSirenDec, gst_siren_dec, GstElement, GST_BOILERPLATE_FULL (GstSirenDec, gst_siren_dec, GstElement,
@ -147,8 +142,7 @@ gst_siren_dec_dispose (GObject *object)
dec->decoder = NULL; dec->decoder = NULL;
} }
if (dec->srccaps) if (dec->srccaps) {
{
gst_caps_unref (dec->srccaps); gst_caps_unref (dec->srccaps);
dec->srccaps = NULL; dec->srccaps = NULL;
} }
@ -172,8 +166,7 @@ gst_siren_dec_chain (GstPad *pad, GstBuffer *buf)
size = GST_BUFFER_SIZE (buf) * 16; size = GST_BUFFER_SIZE (buf) * 16;
size -= size % 640; size -= size % 640;
if (size == 0) if (size == 0) {
{
GST_LOG_OBJECT (dec, "Got buffer smaller than framesize: %u < 40", GST_LOG_OBJECT (dec, "Got buffer smaller than framesize: %u < 40",
GST_BUFFER_SIZE (buf)); GST_BUFFER_SIZE (buf));
return GST_FLOW_OK; return GST_FLOW_OK;
@ -190,8 +183,7 @@ gst_siren_dec_chain (GstPad *pad, GstBuffer *buf)
GST_BUFFER_TIMESTAMP (decoded) = GST_BUFFER_TIMESTAMP (buf); GST_BUFFER_TIMESTAMP (decoded) = GST_BUFFER_TIMESTAMP (buf);
while((in_offset + 40 <= GST_BUFFER_SIZE (buf)) && while ((in_offset + 40 <= GST_BUFFER_SIZE (buf)) && ret == GST_FLOW_OK) {
ret == GST_FLOW_OK) {
GST_LOG_OBJECT (dec, "Decoding frame"); GST_LOG_OBJECT (dec, "Decoding frame");

View file

@ -29,7 +29,6 @@
#include "siren7.h" #include "siren7.h"
G_BEGIN_DECLS G_BEGIN_DECLS
/* #define's don't like whitespacey bits */ /* #define's don't like whitespacey bits */
#define GST_TYPE_SIREN_DEC \ #define GST_TYPE_SIREN_DEC \
(gst_siren_dec_get_type()) (gst_siren_dec_get_type())
@ -43,7 +42,6 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_DEC)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_DEC))
#define GST_IS_SIREN_DEC_CLASS(obj) \ #define GST_IS_SIREN_DEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_DEC)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_DEC))
typedef struct _GstSirenDec GstSirenDec; typedef struct _GstSirenDec GstSirenDec;
typedef struct _GstSirenDecClass GstSirenDecClass; typedef struct _GstSirenDecClass GstSirenDecClass;
typedef struct _GstSirenDecPrivate GstSirenDecPrivate; typedef struct _GstSirenDecPrivate GstSirenDecPrivate;
@ -68,9 +66,7 @@ struct _GstSirenDecClass
GType gst_siren_dec_get_type (void); GType gst_siren_dec_get_type (void);
gboolean gboolean gst_siren_dec_plugin_init (GstPlugin * plugin);
gst_siren_dec_plugin_init (GstPlugin *plugin);
G_END_DECLS G_END_DECLS
#endif /* __GST_SIREN_DEC_H__ */ #endif /* __GST_SIREN_DEC_H__ */

View file

@ -33,8 +33,7 @@ GST_DEBUG_CATEGORY (sirenenc_debug);
/* elementfactory information */ /* elementfactory information */
static const GstElementDetails gst_siren_enc_details = static const GstElementDetails gst_siren_enc_details =
GST_ELEMENT_DETAILS ( GST_ELEMENT_DETAILS ("Siren Encoder element",
"Siren Encoder element",
"Codec/Encoder/Audio ", "Codec/Encoder/Audio ",
"Encode 16bit PCM streams into the Siren7 codec", "Encode 16bit PCM streams into the Siren7 codec",
"Youness Alaoui <kakaroto@kakaroto.homelinux.net>"); "Youness Alaoui <kakaroto@kakaroto.homelinux.net>");
@ -43,8 +42,7 @@ GST_ELEMENT_DETAILS (
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/x-siren, " GST_STATIC_CAPS ("audio/x-siren, " "dct-length = (int) 320"));
"dct-length = (int) 320"));
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
@ -54,8 +52,7 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
"depth = (int) 16, " "depth = (int) 16, "
"endianness = (int) 1234, " "endianness = (int) 1234, "
"signed = (boolean) true, " "signed = (boolean) true, "
"rate = (int) 16000, " "rate = (int) 16000, " "channels = (int) 1"));
"channels = (int) 1"));
/* signals and args */ /* signals and args */
enum enum
@ -73,8 +70,7 @@ enum
static void gst_siren_enc_dispose (GObject * object); static void gst_siren_enc_dispose (GObject * object);
static GstFlowReturn static GstFlowReturn gst_siren_enc_chain (GstPad * pad, GstBuffer * buf);
gst_siren_enc_chain (GstPad *pad, GstBuffer *buf);
static GstStateChangeReturn static GstStateChangeReturn
gst_siren_change_state (GstElement * element, GstStateChange transition); gst_siren_change_state (GstElement * element, GstStateChange transition);
@ -82,8 +78,7 @@ gst_siren_change_state (GstElement *element, GstStateChange transition);
static void static void
_do_init (GType type) _do_init (GType type)
{ {
GST_DEBUG_CATEGORY_INIT GST_DEBUG_CATEGORY_INIT (sirenenc_debug, "sirenenc", 0, "sirenenc");
(sirenenc_debug, "sirenenc", 0, "sirenenc");
} }
GST_BOILERPLATE_FULL (GstSirenEnc, gst_siren_enc, GstElement, GST_BOILERPLATE_FULL (GstSirenEnc, gst_siren_enc, GstElement,
@ -159,8 +154,7 @@ gst_siren_enc_dispose (GObject *object)
enc->adapter = NULL; enc->adapter = NULL;
} }
if (enc->srccaps) if (enc->srccaps) {
{
gst_caps_unref (enc->srccaps); gst_caps_unref (enc->srccaps);
enc->srccaps = NULL; enc->srccaps = NULL;
} }
@ -210,8 +204,7 @@ gst_siren_enc_chain (GstPad *pad, GstBuffer *buf)
GST_LOG_OBJECT (enc, "Encoding frame"); GST_LOG_OBJECT (enc, "Encoding frame");
encode_ret = Siren7_EncodeFrame (enc->encoder, encode_ret = Siren7_EncodeFrame (enc->encoder,
data + in_offset, data + in_offset, GST_BUFFER_DATA (encoded) + out_offset);
GST_BUFFER_DATA (encoded) + out_offset);
if (encode_ret != 0) { if (encode_ret != 0) {
GST_ERROR_OBJECT (enc, "Siren7_EncodeFrame returned %d", encode_ret); GST_ERROR_OBJECT (enc, "Siren7_EncodeFrame returned %d", encode_ret);
ret = GST_FLOW_ERROR; ret = GST_FLOW_ERROR;
@ -246,8 +239,7 @@ gst_siren_change_state (GstElement *element, GstStateChange transition)
if (ret == GST_STATE_CHANGE_FAILURE) if (ret == GST_STATE_CHANGE_FAILURE)
return ret; return ret;
switch (transition) switch (transition) {
{
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_OBJECT_LOCK (element); GST_OBJECT_LOCK (element);
gst_adapter_clear (enc->adapter); gst_adapter_clear (enc->adapter);

View file

@ -29,7 +29,6 @@
#include "siren7.h" #include "siren7.h"
G_BEGIN_DECLS G_BEGIN_DECLS
/* #define's don't like whitespacey bits */ /* #define's don't like whitespacey bits */
#define GST_TYPE_SIREN_ENC \ #define GST_TYPE_SIREN_ENC \
(gst_siren_enc_get_type()) (gst_siren_enc_get_type())
@ -43,7 +42,6 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_ENC)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_ENC))
#define GST_IS_SIREN_ENC_CLASS(obj) \ #define GST_IS_SIREN_ENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_ENC)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_ENC))
typedef struct _GstSirenEnc GstSirenEnc; typedef struct _GstSirenEnc GstSirenEnc;
typedef struct _GstSirenEncClass GstSirenEncClass; typedef struct _GstSirenEncClass GstSirenEncClass;
typedef struct _GstSirenEncPrivate GstSirenEncPrivate; typedef struct _GstSirenEncPrivate GstSirenEncPrivate;
@ -70,9 +68,7 @@ struct _GstSirenEncClass
GType gst_siren_enc_get_type (void); GType gst_siren_enc_get_type (void);
gboolean gboolean gst_siren_enc_plugin_init (GstPlugin * plugin);
gst_siren_enc_plugin_init (GstPlugin *plugin);
G_END_DECLS G_END_DECLS
#endif /* __GST_SIREN_ENC_H__ */ #endif /* __GST_SIREN_ENC_H__ */