mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-06 14:32:31 +00:00
deinterleave: Code style fixes
This commit is contained in:
parent
f28ab45f3e
commit
c94fbf6206
1 changed files with 1 additions and 26 deletions
|
@ -219,7 +219,6 @@ static void
|
||||||
gst_deinterleave_add_new_pads (GstDeinterleave * self, GstCaps * caps)
|
gst_deinterleave_add_new_pads (GstDeinterleave * self, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
for (i = 0; i < GST_AUDIO_INFO_CHANNELS (&self->audio_info); i++) {
|
for (i = 0; i < GST_AUDIO_INFO_CHANNELS (&self->audio_info); i++) {
|
||||||
|
@ -430,7 +429,6 @@ static void
|
||||||
__remove_channels (GstCaps * caps)
|
__remove_channels (GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
|
|
||||||
gint i, size;
|
gint i, size;
|
||||||
|
|
||||||
size = gst_caps_get_size (caps);
|
size = gst_caps_get_size (caps);
|
||||||
|
@ -445,7 +443,6 @@ static void
|
||||||
__set_channels (GstCaps * caps, gint channels)
|
__set_channels (GstCaps * caps, gint channels)
|
||||||
{
|
{
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
|
|
||||||
gint i, size;
|
gint i, size;
|
||||||
|
|
||||||
size = gst_caps_get_size (caps);
|
size = gst_caps_get_size (caps);
|
||||||
|
@ -463,9 +460,7 @@ gst_deinterleave_sink_getcaps (GstPad * pad, GstObject * parent,
|
||||||
GstCaps * filter)
|
GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
||||||
|
|
||||||
GstCaps *ret;
|
GstCaps *ret;
|
||||||
|
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (self);
|
GST_OBJECT_LOCK (self);
|
||||||
|
@ -479,7 +474,6 @@ gst_deinterleave_sink_getcaps (GstPad * pad, GstObject * parent,
|
||||||
ret = gst_caps_new_any ();
|
ret = gst_caps_new_any ();
|
||||||
for (l = GST_ELEMENT (self)->pads; l != NULL; l = l->next) {
|
for (l = GST_ELEMENT (self)->pads; l != NULL; l = l->next) {
|
||||||
GstPad *ourpad = GST_PAD (l->data);
|
GstPad *ourpad = GST_PAD (l->data);
|
||||||
|
|
||||||
GstCaps *peercaps = NULL, *ourcaps;
|
GstCaps *peercaps = NULL, *ourcaps;
|
||||||
|
|
||||||
ourcaps = gst_caps_copy (gst_pad_get_pad_template_caps (ourpad));
|
ourcaps = gst_caps_copy (gst_pad_get_pad_template_caps (ourpad));
|
||||||
|
@ -503,7 +497,6 @@ gst_deinterleave_sink_getcaps (GstPad * pad, GstObject * parent,
|
||||||
* otherwise assume that the peer accepts everything */
|
* otherwise assume that the peer accepts everything */
|
||||||
if (peercaps) {
|
if (peercaps) {
|
||||||
GstCaps *intersection;
|
GstCaps *intersection;
|
||||||
|
|
||||||
GstCaps *oldret = ret;
|
GstCaps *oldret = ret;
|
||||||
|
|
||||||
__remove_channels (peercaps);
|
__remove_channels (peercaps);
|
||||||
|
@ -533,7 +526,6 @@ static gboolean
|
||||||
gst_deinterleave_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
gst_deinterleave_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
||||||
|
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
|
GST_DEBUG ("Got %s event on pad %s:%s", GST_EVENT_TYPE_NAME (event),
|
||||||
|
@ -578,14 +570,12 @@ static gboolean
|
||||||
gst_deinterleave_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
gst_deinterleave_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
||||||
|
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
res = gst_pad_query_default (pad, parent, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
|
|
||||||
if (res && GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
|
if (res && GST_QUERY_TYPE (query) == GST_QUERY_DURATION) {
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
|
|
||||||
gint64 dur;
|
gint64 dur;
|
||||||
|
|
||||||
gst_query_parse_duration (query, &format, &dur);
|
gst_query_parse_duration (query, &format, &dur);
|
||||||
|
@ -598,7 +588,6 @@ gst_deinterleave_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
dur / GST_AUDIO_INFO_CHANNELS (&self->audio_info));
|
dur / GST_AUDIO_INFO_CHANNELS (&self->audio_info));
|
||||||
} else if (res && GST_QUERY_TYPE (query) == GST_QUERY_POSITION) {
|
} else if (res && GST_QUERY_TYPE (query) == GST_QUERY_POSITION) {
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
|
|
||||||
gint64 pos;
|
gint64 pos;
|
||||||
|
|
||||||
gst_query_parse_position (query, &format, &pos);
|
gst_query_parse_position (query, &format, &pos);
|
||||||
|
@ -657,33 +646,24 @@ static GstFlowReturn
|
||||||
gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
|
gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
guint channels = GST_AUDIO_INFO_CHANNELS (&self->audio_info);
|
guint channels = GST_AUDIO_INFO_CHANNELS (&self->audio_info);
|
||||||
|
|
||||||
guint pads_pushed = 0, buffers_allocated = 0;
|
guint pads_pushed = 0, buffers_allocated = 0;
|
||||||
|
|
||||||
guint nframes =
|
guint nframes =
|
||||||
gst_buffer_get_size (buf) / channels /
|
gst_buffer_get_size (buf) / channels /
|
||||||
(GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
|
(GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
|
||||||
|
|
||||||
guint bufsize = nframes * (GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
|
guint bufsize = nframes * (GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
|
||||||
|
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
GList *srcs;
|
GList *srcs;
|
||||||
|
|
||||||
GstBuffer **buffers_out = g_new0 (GstBuffer *, channels);
|
GstBuffer **buffers_out = g_new0 (GstBuffer *, channels);
|
||||||
|
|
||||||
guint8 *in, *out;
|
guint8 *in, *out;
|
||||||
|
|
||||||
GstMapInfo read_info;
|
GstMapInfo read_info;
|
||||||
|
|
||||||
gst_buffer_map (buf, &read_info, GST_MAP_READ);
|
gst_buffer_map (buf, &read_info, GST_MAP_READ);
|
||||||
|
|
||||||
/* Send any pending events to all src pads */
|
/* Send any pending events to all src pads */
|
||||||
GST_OBJECT_LOCK (self);
|
GST_OBJECT_LOCK (self);
|
||||||
if (self->pending_events) {
|
if (self->pending_events) {
|
||||||
GList *events;
|
GList *events;
|
||||||
|
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Sending pending events to all src pads");
|
GST_DEBUG_OBJECT (self, "Sending pending events to all src pads");
|
||||||
|
@ -732,16 +712,12 @@ gst_deinterleave_process (GstDeinterleave * self, GstBuffer * buf)
|
||||||
GstPad *pad = (GstPad *) srcs->data;
|
GstPad *pad = (GstPad *) srcs->data;
|
||||||
GstMapInfo write_info;
|
GstMapInfo write_info;
|
||||||
|
|
||||||
|
|
||||||
in = (guint8 *) read_info.data;
|
in = (guint8 *) read_info.data;
|
||||||
in += i * (GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
|
in += i * (GST_AUDIO_INFO_WIDTH (&self->audio_info) / 8);
|
||||||
if (buffers_out[i]) {
|
if (buffers_out[i]) {
|
||||||
gst_buffer_map (buffers_out[i], &write_info, GST_MAP_WRITE);
|
gst_buffer_map (buffers_out[i], &write_info, GST_MAP_WRITE);
|
||||||
|
|
||||||
out = (guint8 *) write_info.data;
|
out = (guint8 *) write_info.data;
|
||||||
|
|
||||||
self->func (out, in, channels, nframes);
|
self->func (out, in, channels, nframes);
|
||||||
|
|
||||||
gst_buffer_unmap (buffers_out[i], &write_info);
|
gst_buffer_unmap (buffers_out[i], &write_info);
|
||||||
|
|
||||||
ret = gst_pad_push (pad, buffers_out[i]);
|
ret = gst_pad_push (pad, buffers_out[i]);
|
||||||
|
@ -801,7 +777,6 @@ static GstFlowReturn
|
||||||
gst_deinterleave_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
gst_deinterleave_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
GstDeinterleave *self = GST_DEINTERLEAVE (parent);
|
||||||
|
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED);
|
g_return_val_if_fail (self->func != NULL, GST_FLOW_NOT_NEGOTIATED);
|
||||||
|
|
Loading…
Reference in a new issue