/* this function does the actual processing */ static GstFlowReturn gst_audio_panorama_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf) { GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base); guint num_samples = GST_BUFFER_SIZE (outbuf) / (2 * filter->width); if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (outbuf))) gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (outbuf)); if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP))) { GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP); memset (GST_BUFFER_DATA (outbuf), 0, GST_BUFFER_SIZE (outbuf)); return GST_FLOW_OK; } filter->process (filter, GST_BUFFER_DATA (inbuf), GST_BUFFER_DATA (outbuf), num_samples); return GST_FLOW_OK; }
/* this function does the actual processing */ static GstFlowReturn gst_audio_panorama_transform (GstBaseTransform * base, GstBuffer * inbuf, GstBuffer * outbuf) { GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base); GstClockTime timestamp, stream_time; GstMapInfo inmap, outmap; timestamp = GST_BUFFER_TIMESTAMP (inbuf); stream_time = gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp); GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp)); if (GST_CLOCK_TIME_IS_VALID (stream_time)) gst_object_sync_values (GST_OBJECT (filter), stream_time); gst_buffer_map (inbuf, &inmap, GST_MAP_READ); gst_buffer_map (outbuf, &outmap, GST_MAP_WRITE); if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP))) { GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP); memset (outmap.data, 0, outmap.size); } else { /* output always stereo, input mono or stereo, * and info describes input format */ guint num_samples = outmap.size / (2 * GST_AUDIO_INFO_BPS (&filter->info)); filter->process (filter, inmap.data, outmap.data, num_samples); } gst_buffer_unmap (inbuf, &inmap); gst_buffer_unmap (outbuf, &outmap); return GST_FLOW_OK; }