diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-10-18 22:46:12 +0000 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2007-10-18 22:46:12 +0000 |
commit | 2dda76438063672e2bdccf1709db3615d453ad5b (patch) | |
tree | d356158dfc6ec7a42fc3e1ab596e5f4e46391696 /audio | |
parent | 942422b8c90ba6e30339ab066cdc7fd2fc31cb7c (diff) |
Fix coding style issues.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/gsta2dpsink.c | 49 | ||||
-rw-r--r-- | audio/gstsbcenc.c | 30 | ||||
-rw-r--r-- | audio/gstsbcparse.c | 2 |
3 files changed, 36 insertions, 45 deletions
diff --git a/audio/gsta2dpsink.c b/audio/gsta2dpsink.c index 0e8c8e02..1bb88b36 100644 --- a/audio/gsta2dpsink.c +++ b/audio/gsta2dpsink.c @@ -141,8 +141,8 @@ struct rtp_payload { #error "Unknown byte order" #endif -#define IS_SBC(n) (strcmp(n, "audio/x-sbc") == 0) -#define IS_MPEG(n) (strcmp(n, "audio/mpeg") == 0) +#define IS_SBC(n) (strcmp((n), "audio/x-sbc") == 0) +#define IS_MPEG(n) (strcmp((n), "audio/mpeg") == 0) enum { PROP_0, @@ -218,7 +218,7 @@ static void gst_a2dp_sink_finalize(GObject *object) GstA2dpSink *self = GST_A2DP_SINK(object); if (self->data) - gst_a2dp_sink_stop (GST_BASE_SINK (self)); + gst_a2dp_sink_stop(GST_BASE_SINK(self)); if (self->device) g_free(self->device); @@ -285,7 +285,7 @@ static gint gst_a2dp_sink_bluetooth_recvmsg_fd(GstA2dpSink *sink) ret = recvmsg(g_io_channel_unix_get_fd(sink->server), &msgh, 0); if (ret < 0) { err = errno; - GST_ERROR_OBJECT(sink, "Unable to receive fd: %s (%d)", + GST_ERROR_OBJECT(sink, "Unable to receive fd: %s (%d)", strerror(err), err); return -err; } @@ -305,7 +305,7 @@ static gint gst_a2dp_sink_bluetooth_recvmsg_fd(GstA2dpSink *sink) return -EINVAL; } -static int gst_a2dp_sink_bluetooth_a2dp_init(GstA2dpSink *sink, +static int gst_a2dp_sink_bluetooth_a2dp_init(GstA2dpSink *sink, struct ipc_codec_sbc *sbc) { struct bluetooth_a2dp *a2dp = &sink->data->a2dp; @@ -403,21 +403,6 @@ static gboolean gst_a2dp_sink_init_pkt_conf(GstA2dpSink *sink, value = gst_structure_get_value(structure, "blocks"); sbc->blocks = g_value_get_int(value); -/* FIXME how can I obtain the bitpool ? - if (strcmp(id, "bitpool") == 0) { - if (snd_config_get_string(n, &bitpool) < 0) { - SNDERR("Invalid type for %s", id); - return -EINVAL; - } - - sbc->bitpool = atoi(bitpool); - continue; - } - - SNDERR("Unknown field %s", id); - return -EINVAL; - } -*/ sbc->bitpool = 32; pkt->length = sizeof(*cfg) + sizeof(*sbc); @@ -438,7 +423,7 @@ static gboolean gst_a2dp_sink_conf_resp(GstA2dpSink *sink) memset(buf, 0, sizeof(buf)); - io_error = g_io_channel_read(sink->server, (gchar*)buf, + io_error = g_io_channel_read(sink->server, (gchar *) buf, sizeof(*pkt) + sizeof(*cfg), &ret); if (io_error != G_IO_ERROR_NONE && ret > 0) { GST_ERROR_OBJECT(sink, "Error ocurred while receiving \ @@ -476,14 +461,14 @@ static gboolean gst_a2dp_sink_conf_recv_dev_conf(GstA2dpSink *sink) struct ipc_data_cfg *cfg = (void *) pkt->data; struct ipc_codec_sbc *sbc = (void *) cfg->data; - io_error = g_io_channel_read(sink->server, (gchar*) sbc, + io_error = g_io_channel_read(sink->server, (gchar *) sbc, sizeof(*sbc), &ret); if (io_error != G_IO_ERROR_NONE) { GST_ERROR_OBJECT(sink, "Error while reading data from socket \ - %s (%d)", strerror(errno), errno); + %s (%d)", strerror(errno), errno); return FALSE; } else if (ret == 0) { - GST_ERROR_OBJECT(sink, "Read 0 bytes from socket"); + GST_ERROR_OBJECT(sink, "Read 0 bytes from socket"); return FALSE; } @@ -491,8 +476,8 @@ static gboolean gst_a2dp_sink_conf_recv_dev_conf(GstA2dpSink *sink) GST_DEBUG_OBJECT(sink, "OK - %d bytes received", sink->total); if (pkt->length != (sink->total - sizeof(struct ipc_packet))) { - GST_ERROR_OBJECT(sink, "Error while configuring device: \ - packet size doesn't match"); + GST_ERROR_OBJECT(sink, "Error while configuring device: " + "packet size doesn't match"); return FALSE; } @@ -524,14 +509,14 @@ static gboolean gst_a2dp_sink_conf_recv_stream_fd(GstA2dpSink *sink) return FALSE; if (!sink->stream) { - GST_ERROR_OBJECT(sink, "Error while configuring device: \ - could not acquire audio socket"); + GST_ERROR_OBJECT(sink, "Error while configuring device: " + "could not acquire audio socket"); return FALSE; } /* It is possible there is some outstanding data in the pipe - we have to empty it */ - while (TRUE) { + while (1) { err = g_io_channel_read(sink->stream, (gchar *) sink->data->buffer, (gsize) sink->data->cfg.pkt_len, @@ -589,7 +574,7 @@ static gboolean server_callback(GIOChannel *chan, gst_a2dp_sink_conf_recv_data(sink); else GST_WARNING_OBJECT(sink, "Unexpected data received"); - break; + break; case G_IO_HUP: return FALSE; break; @@ -661,7 +646,7 @@ static gboolean gst_a2dp_sink_send_conf_pkt(GstA2dpSink *sink, GstCaps *caps) sink->con_state = CONFIGURING_INIT; - io_error = g_io_channel_write(sink->server, (gchar*)pkt, + io_error = g_io_channel_write(sink->server, (gchar *) pkt, sizeof(*pkt) + pkt->length, &bytes_sent); if (io_error != G_IO_ERROR_NONE) { GST_ERROR_OBJECT(sink, "Error ocurred while sending \ @@ -735,7 +720,7 @@ static int gst_a2dp_sink_avdtp_write(GstA2dpSink *sink) header->timestamp = htonl(a2dp->nsamples); header->ssrc = htonl(1); - while (TRUE) { + while (1) { err = g_io_channel_write(sink->stream, (const char *) a2dp->buffer, (gsize) a2dp->count, (gsize *) &ret); diff --git a/audio/gstsbcenc.c b/audio/gstsbcenc.c index ea97563e..628d15c9 100644 --- a/audio/gstsbcenc.c +++ b/audio/gstsbcenc.c @@ -30,7 +30,6 @@ #include "gstsbcenc.h" #include "gstsbcutil.h" - #define SBC_ENC_DEFAULT_MODE CFG_MODE_AUTO #define SBC_ENC_DEFAULT_BLOCKS 16 #define SBC_ENC_DEFAULT_SUB_BANDS 8 @@ -83,7 +82,7 @@ enum { PROP_MODE, PROP_ALLOCATION, PROP_BLOCKS, - PROP_SUB_BANDS + PROP_SUBBANDS }; GST_BOILERPLATE(GstSbcEnc, gst_sbc_enc, GstElement, GST_TYPE_ELEMENT); @@ -121,6 +120,8 @@ static GstCaps* sbc_enc_generate_srcpad_caps(GstSbcEnc *enc, GstCaps *caps) gint channels; GstCaps* src_caps; GstStructure *structure; + const gchar *mode; + const gchar *allocation; structure = gst_caps_get_structure(caps, 0); @@ -144,14 +145,17 @@ static GstCaps* sbc_enc_generate_srcpad_caps(GstSbcEnc *enc, GstCaps *caps) else enc->sbc.allocation = enc->allocation; - src_caps = gst_caps_new_simple("audio/x-sbc", "rate", G_TYPE_INT, - enc->sbc.rate, "channels", G_TYPE_INT, - enc->sbc.channels, "mode", G_TYPE_STRING, - gst_sbc_get_mode_string(enc->sbc.joint), "subbands", - G_TYPE_INT, enc->sbc.subbands, "blocks", G_TYPE_INT, - enc->sbc.blocks, "allocation", G_TYPE_STRING, - gst_sbc_get_allocation_string(enc->sbc.allocation), - NULL); + mode = gst_sbc_get_mode_string(enc->sbc.joint); + allocation = gst_sbc_get_allocation_string(enc->sbc.allocation); + + src_caps = gst_caps_new_simple("audio/x-sbc", + "rate", G_TYPE_INT, enc->sbc.rate, + "channels", G_TYPE_INT, enc->sbc.channels, + "mode", G_TYPE_STRING, mode, + "subbands", G_TYPE_INT, enc->sbc.subbands, + "blocks", G_TYPE_INT, enc->sbc.blocks, + "allocation", G_TYPE_STRING, allocation, + NULL); return src_caps; } @@ -280,7 +284,7 @@ static void gst_sbc_enc_set_property(GObject *object, guint prop_id, /* TODO - verify consistency */ enc->blocks = g_value_get_int(value); break; - case PROP_SUB_BANDS: + case PROP_SUBBANDS: /* TODO - verify consistency */ enc->subbands = g_value_get_int(value); break; @@ -305,7 +309,7 @@ static void gst_sbc_enc_get_property(GObject *object, guint prop_id, case PROP_BLOCKS: g_value_set_int(value, enc->blocks); break; - case PROP_SUB_BANDS: + case PROP_SUBBANDS: g_value_set_int(value, enc->subbands); break; default: @@ -341,7 +345,7 @@ static void gst_sbc_enc_class_init(GstSbcEncClass *klass) "Blocks", 0, G_MAXINT, SBC_ENC_DEFAULT_BLOCKS, G_PARAM_READWRITE)); - g_object_class_install_property(object_class, PROP_SUB_BANDS, + g_object_class_install_property(object_class, PROP_SUBBANDS, g_param_spec_int("subbands", "Sub Bands", "Sub Bands", 0, G_MAXINT, SBC_ENC_DEFAULT_SUB_BANDS, G_PARAM_READWRITE)); diff --git a/audio/gstsbcparse.c b/audio/gstsbcparse.c index e204870b..9f0c4d81 100644 --- a/audio/gstsbcparse.c +++ b/audio/gstsbcparse.c @@ -295,6 +295,7 @@ static GstStateChangeReturn sbc_parse_change_state(GstElement *element, } sbc_init(&parse->sbc, 0); break; + case GST_STATE_CHANGE_PAUSED_TO_READY: GST_DEBUG("Finish subband codec"); if (parse->buffer) { @@ -303,6 +304,7 @@ static GstStateChangeReturn sbc_parse_change_state(GstElement *element, } sbc_finish(&parse->sbc); break; + default: break; } |