mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
Re-indent the siren stuff to be gst style
This commit is contained in:
parent
b1efc2f9aa
commit
11328ad67f
5 changed files with 41 additions and 68 deletions
|
@ -27,7 +27,6 @@
|
|||
#include <gst/base/gstbasetransform.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* #define's don't like whitespacey bits */
|
||||
#define GST_TYPE_SIREN \
|
||||
(gst_siren_get_type())
|
||||
|
@ -41,7 +40,6 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN))
|
||||
#define GST_IS_SIREN_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN))
|
||||
|
||||
typedef struct _GstSiren GstSiren;
|
||||
typedef struct _GstSirenClass GstSirenClass;
|
||||
typedef struct _GstSirenPrivate GstSirenPrivate;
|
||||
|
@ -65,5 +63,4 @@ struct _GstSirenClass
|
|||
GType gst_siren_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_SIREN_H__ */
|
||||
|
|
|
@ -33,8 +33,7 @@ GST_DEBUG_CATEGORY (sirendec_debug);
|
|||
|
||||
/* elementfactory information */
|
||||
static const GstElementDetails gst_siren_dec_details =
|
||||
GST_ELEMENT_DETAILS (
|
||||
"Siren Decoder element",
|
||||
GST_ELEMENT_DETAILS ("Siren Decoder element",
|
||||
"Codec/Decoder/Audio ",
|
||||
"Decode streams encoded with the Siren7 codec into 16bit PCM",
|
||||
"Youness Alaoui <kakaroto@kakaroto.homelinux.net>");
|
||||
|
@ -43,8 +42,7 @@ GST_ELEMENT_DETAILS (
|
|||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-siren, "
|
||||
"dct-length = (int) 320"));
|
||||
GST_STATIC_CAPS ("audio/x-siren, " "dct-length = (int) 320"));
|
||||
|
||||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
|
@ -54,8 +52,7 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|||
"depth = (int) 16, "
|
||||
"endianness = (int) 1234, "
|
||||
"signed = (boolean) true, "
|
||||
"rate = (int) 16000, "
|
||||
"channels = (int) 1"));
|
||||
"rate = (int) 16000, " "channels = (int) 1"));
|
||||
|
||||
/* signals and args */
|
||||
enum
|
||||
|
@ -70,16 +67,14 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static GstFlowReturn
|
||||
gst_siren_dec_chain (GstPad *pad, GstBuffer *buf);
|
||||
static GstFlowReturn gst_siren_dec_chain (GstPad * pad, GstBuffer * buf);
|
||||
|
||||
static void gst_siren_dec_dispose (GObject * object);
|
||||
|
||||
static void
|
||||
_do_init (GType type)
|
||||
{
|
||||
GST_DEBUG_CATEGORY_INIT
|
||||
(sirendec_debug, "sirendec", 0, "sirendec");
|
||||
GST_DEBUG_CATEGORY_INIT (sirendec_debug, "sirendec", 0, "sirendec");
|
||||
}
|
||||
|
||||
GST_BOILERPLATE_FULL (GstSirenDec, gst_siren_dec, GstElement,
|
||||
|
@ -147,8 +142,7 @@ gst_siren_dec_dispose (GObject *object)
|
|||
dec->decoder = NULL;
|
||||
}
|
||||
|
||||
if (dec->srccaps)
|
||||
{
|
||||
if (dec->srccaps) {
|
||||
gst_caps_unref (dec->srccaps);
|
||||
dec->srccaps = NULL;
|
||||
}
|
||||
|
@ -172,8 +166,7 @@ gst_siren_dec_chain (GstPad *pad, GstBuffer *buf)
|
|||
size = GST_BUFFER_SIZE (buf) * 16;
|
||||
size -= size % 640;
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
if (size == 0) {
|
||||
GST_LOG_OBJECT (dec, "Got buffer smaller than framesize: %u < 40",
|
||||
GST_BUFFER_SIZE (buf));
|
||||
return GST_FLOW_OK;
|
||||
|
@ -190,8 +183,7 @@ gst_siren_dec_chain (GstPad *pad, GstBuffer *buf)
|
|||
|
||||
GST_BUFFER_TIMESTAMP (decoded) = GST_BUFFER_TIMESTAMP (buf);
|
||||
|
||||
while((in_offset + 40 <= GST_BUFFER_SIZE (buf)) &&
|
||||
ret == GST_FLOW_OK) {
|
||||
while ((in_offset + 40 <= GST_BUFFER_SIZE (buf)) && ret == GST_FLOW_OK) {
|
||||
|
||||
GST_LOG_OBJECT (dec, "Decoding frame");
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "siren7.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* #define's don't like whitespacey bits */
|
||||
#define GST_TYPE_SIREN_DEC \
|
||||
(gst_siren_dec_get_type())
|
||||
|
@ -43,7 +42,6 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_DEC))
|
||||
#define GST_IS_SIREN_DEC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_DEC))
|
||||
|
||||
typedef struct _GstSirenDec GstSirenDec;
|
||||
typedef struct _GstSirenDecClass GstSirenDecClass;
|
||||
typedef struct _GstSirenDecPrivate GstSirenDecPrivate;
|
||||
|
@ -68,9 +66,7 @@ struct _GstSirenDecClass
|
|||
|
||||
GType gst_siren_dec_get_type (void);
|
||||
|
||||
gboolean
|
||||
gst_siren_dec_plugin_init (GstPlugin *plugin);
|
||||
gboolean gst_siren_dec_plugin_init (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_SIREN_DEC_H__ */
|
||||
|
|
|
@ -33,8 +33,7 @@ GST_DEBUG_CATEGORY (sirenenc_debug);
|
|||
|
||||
/* elementfactory information */
|
||||
static const GstElementDetails gst_siren_enc_details =
|
||||
GST_ELEMENT_DETAILS (
|
||||
"Siren Encoder element",
|
||||
GST_ELEMENT_DETAILS ("Siren Encoder element",
|
||||
"Codec/Encoder/Audio ",
|
||||
"Encode 16bit PCM streams into the Siren7 codec",
|
||||
"Youness Alaoui <kakaroto@kakaroto.homelinux.net>");
|
||||
|
@ -43,8 +42,7 @@ GST_ELEMENT_DETAILS (
|
|||
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-siren, "
|
||||
"dct-length = (int) 320"));
|
||||
GST_STATIC_CAPS ("audio/x-siren, " "dct-length = (int) 320"));
|
||||
|
||||
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
|
@ -54,8 +52,7 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|||
"depth = (int) 16, "
|
||||
"endianness = (int) 1234, "
|
||||
"signed = (boolean) true, "
|
||||
"rate = (int) 16000, "
|
||||
"channels = (int) 1"));
|
||||
"rate = (int) 16000, " "channels = (int) 1"));
|
||||
|
||||
/* signals and args */
|
||||
enum
|
||||
|
@ -73,8 +70,7 @@ enum
|
|||
|
||||
static void gst_siren_enc_dispose (GObject * object);
|
||||
|
||||
static GstFlowReturn
|
||||
gst_siren_enc_chain (GstPad *pad, GstBuffer *buf);
|
||||
static GstFlowReturn gst_siren_enc_chain (GstPad * pad, GstBuffer * buf);
|
||||
static GstStateChangeReturn
|
||||
gst_siren_change_state (GstElement * element, GstStateChange transition);
|
||||
|
||||
|
@ -82,8 +78,7 @@ gst_siren_change_state (GstElement *element, GstStateChange transition);
|
|||
static void
|
||||
_do_init (GType type)
|
||||
{
|
||||
GST_DEBUG_CATEGORY_INIT
|
||||
(sirenenc_debug, "sirenenc", 0, "sirenenc");
|
||||
GST_DEBUG_CATEGORY_INIT (sirenenc_debug, "sirenenc", 0, "sirenenc");
|
||||
}
|
||||
|
||||
GST_BOILERPLATE_FULL (GstSirenEnc, gst_siren_enc, GstElement,
|
||||
|
@ -159,8 +154,7 @@ gst_siren_enc_dispose (GObject *object)
|
|||
enc->adapter = NULL;
|
||||
}
|
||||
|
||||
if (enc->srccaps)
|
||||
{
|
||||
if (enc->srccaps) {
|
||||
gst_caps_unref (enc->srccaps);
|
||||
enc->srccaps = NULL;
|
||||
}
|
||||
|
@ -210,8 +204,7 @@ gst_siren_enc_chain (GstPad *pad, GstBuffer *buf)
|
|||
GST_LOG_OBJECT (enc, "Encoding frame");
|
||||
|
||||
encode_ret = Siren7_EncodeFrame (enc->encoder,
|
||||
data + in_offset,
|
||||
GST_BUFFER_DATA (encoded) + out_offset);
|
||||
data + in_offset, GST_BUFFER_DATA (encoded) + out_offset);
|
||||
if (encode_ret != 0) {
|
||||
GST_ERROR_OBJECT (enc, "Siren7_EncodeFrame returned %d", encode_ret);
|
||||
ret = GST_FLOW_ERROR;
|
||||
|
@ -246,8 +239,7 @@ gst_siren_change_state (GstElement *element, GstStateChange transition)
|
|||
if (ret == GST_STATE_CHANGE_FAILURE)
|
||||
return ret;
|
||||
|
||||
switch (transition)
|
||||
{
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
GST_OBJECT_LOCK (element);
|
||||
gst_adapter_clear (enc->adapter);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "siren7.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* #define's don't like whitespacey bits */
|
||||
#define GST_TYPE_SIREN_ENC \
|
||||
(gst_siren_enc_get_type())
|
||||
|
@ -43,7 +42,6 @@ G_BEGIN_DECLS
|
|||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SIREN_ENC))
|
||||
#define GST_IS_SIREN_ENC_CLASS(obj) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SIREN_ENC))
|
||||
|
||||
typedef struct _GstSirenEnc GstSirenEnc;
|
||||
typedef struct _GstSirenEncClass GstSirenEncClass;
|
||||
typedef struct _GstSirenEncPrivate GstSirenEncPrivate;
|
||||
|
@ -70,9 +68,7 @@ struct _GstSirenEncClass
|
|||
|
||||
GType gst_siren_enc_get_type (void);
|
||||
|
||||
gboolean
|
||||
gst_siren_enc_plugin_init (GstPlugin *plugin);
|
||||
gboolean gst_siren_enc_plugin_init (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_SIREN_ENC_H__ */
|
||||
|
|
Loading…
Reference in a new issue