mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
audiopanorama: cleanup of transform()
Only map input if we are reading it. Cleanup the logging and the comments a bit.
This commit is contained in:
parent
1dc06932a2
commit
349a60e164
1 changed files with 10 additions and 12 deletions
|
@ -505,34 +505,32 @@ gst_audio_panorama_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
||||||
GstBuffer * outbuf)
|
GstBuffer * outbuf)
|
||||||
{
|
{
|
||||||
GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base);
|
GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base);
|
||||||
GstClockTime timestamp, stream_time;
|
GstClockTime ts;
|
||||||
GstMapInfo inmap, outmap;
|
GstMapInfo inmap, outmap;
|
||||||
|
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (inbuf);
|
ts = gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME,
|
||||||
stream_time =
|
GST_BUFFER_TIMESTAMP (inbuf));
|
||||||
gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT,
|
if (GST_CLOCK_TIME_IS_VALID (ts)) {
|
||||||
GST_TIME_ARGS (timestamp));
|
GST_DEBUG_OBJECT (filter, "sync to %" GST_TIME_FORMAT, GST_TIME_ARGS (ts));
|
||||||
|
gst_object_sync_values (GST_OBJECT (filter), ts);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
gst_buffer_map (outbuf, &outmap, GST_MAP_WRITE);
|
||||||
|
|
||||||
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP))) {
|
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP))) {
|
||||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
||||||
orc_memset (outmap.data, 0, outmap.size);
|
orc_memset (outmap.data, 0, outmap.size);
|
||||||
} else {
|
} else {
|
||||||
/* output always stereo, input mono or stereo,
|
/* output is always stereo, input is mono or stereo,
|
||||||
* and info describes input format */
|
* and info describes input format */
|
||||||
guint num_samples = outmap.size / (2 * GST_AUDIO_INFO_BPS (&filter->info));
|
guint num_samples = outmap.size / (2 * GST_AUDIO_INFO_BPS (&filter->info));
|
||||||
|
|
||||||
|
gst_buffer_map (inbuf, &inmap, GST_MAP_READ);
|
||||||
filter->process (filter->panorama, inmap.data, outmap.data, num_samples);
|
filter->process (filter->panorama, inmap.data, outmap.data, num_samples);
|
||||||
|
gst_buffer_unmap (inbuf, &inmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unmap (inbuf, &inmap);
|
|
||||||
gst_buffer_unmap (outbuf, &outmap);
|
gst_buffer_unmap (outbuf, &outmap);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
Loading…
Reference in a new issue