mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
audiofx: Sync properties to the stream time
This commit is contained in:
parent
4381b9296f
commit
79e720052a
8 changed files with 104 additions and 27 deletions
|
@ -479,11 +479,21 @@ static GstFlowReturn
|
|||
gst_audio_amplify_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
||||
{
|
||||
GstAudioAmplify *filter = GST_AUDIO_AMPLIFY (base);
|
||||
guint num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
guint num_samples;
|
||||
GstClockTime timestamp, stream_time;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
|
||||
gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (buf));
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||
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 (G_OBJECT (filter), stream_time);
|
||||
|
||||
num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
|
||||
if (gst_base_transform_is_passthrough (base) ||
|
||||
G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)))
|
||||
|
|
|
@ -695,11 +695,21 @@ static GstFlowReturn
|
|||
gst_audio_dynamic_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
||||
{
|
||||
GstAudioDynamic *filter = GST_AUDIO_DYNAMIC (base);
|
||||
guint num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
guint num_samples;
|
||||
GstClockTime timestamp, stream_time;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
|
||||
gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (buf));
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||
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 (G_OBJECT (filter), stream_time);
|
||||
|
||||
num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
|
||||
if (gst_base_transform_is_passthrough (base) ||
|
||||
G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)))
|
||||
|
|
|
@ -357,11 +357,21 @@ static GstFlowReturn
|
|||
gst_audio_echo_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
||||
{
|
||||
GstAudioEcho *self = GST_AUDIO_ECHO (base);
|
||||
guint num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (self)->format.width / 8);
|
||||
guint num_samples;
|
||||
GstClockTime timestamp, stream_time;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
|
||||
gst_object_sync_values (G_OBJECT (self), GST_BUFFER_TIMESTAMP (buf));
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||
stream_time =
|
||||
gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "sync to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (timestamp));
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||
gst_object_sync_values (G_OBJECT (self), stream_time);
|
||||
|
||||
num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (self)->format.width / 8);
|
||||
|
||||
if (self->buffer == NULL) {
|
||||
guint width, rate, channels;
|
||||
|
|
|
@ -822,15 +822,24 @@ gst_audio_fx_base_fir_filter_transform (GstBaseTransform * base,
|
|||
guint generated_samples;
|
||||
guint64 output_offset;
|
||||
gint64 diff = 0;
|
||||
GstClockTime stream_time;
|
||||
|
||||
timestamp = GST_BUFFER_TIMESTAMP (outbuf);
|
||||
|
||||
if (!GST_CLOCK_TIME_IS_VALID (timestamp)
|
||||
&& !GST_CLOCK_TIME_IS_VALID (self->start_ts)) {
|
||||
GST_ERROR_OBJECT (self, "Invalid timestamp");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
gst_object_sync_values (G_OBJECT (self), timestamp);
|
||||
stream_time =
|
||||
gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
|
||||
|
||||
GST_DEBUG_OBJECT (self, "sync to %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (timestamp));
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (stream_time))
|
||||
gst_object_sync_values (G_OBJECT (self), stream_time);
|
||||
|
||||
g_return_val_if_fail (self->kernel != NULL, GST_FLOW_ERROR);
|
||||
g_return_val_if_fail (channels != 0, GST_FLOW_ERROR);
|
||||
|
|
|
@ -355,11 +355,21 @@ gst_audio_fx_base_iir_filter_transform_ip (GstBaseTransform * base,
|
|||
GstBuffer * buf)
|
||||
{
|
||||
GstAudioFXBaseIIRFilter *filter = GST_AUDIO_FX_BASE_IIR_FILTER (base);
|
||||
guint num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
guint num_samples;
|
||||
GstClockTime timestamp, stream_time;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
|
||||
gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (buf));
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||
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 (G_OBJECT (filter), stream_time);
|
||||
|
||||
num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
|
||||
if (gst_base_transform_is_passthrough (base))
|
||||
return GST_FLOW_OK;
|
||||
|
|
|
@ -236,11 +236,21 @@ static GstFlowReturn
|
|||
gst_audio_invert_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
||||
{
|
||||
GstAudioInvert *filter = GST_AUDIO_INVERT (base);
|
||||
guint num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
guint num_samples;
|
||||
GstClockTime timestamp, stream_time;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
|
||||
gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (buf));
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||
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 (G_OBJECT (filter), stream_time);
|
||||
|
||||
num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
|
||||
if (gst_base_transform_is_passthrough (base) ||
|
||||
G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)))
|
||||
|
|
|
@ -341,11 +341,21 @@ static GstFlowReturn
|
|||
gst_audio_karaoke_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
||||
{
|
||||
GstAudioKaraoke *filter = GST_AUDIO_KARAOKE (base);
|
||||
guint num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
guint num_samples;
|
||||
GstClockTime timestamp, stream_time;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
|
||||
gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (buf));
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
||||
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 (G_OBJECT (filter), stream_time);
|
||||
|
||||
num_samples =
|
||||
GST_BUFFER_SIZE (buf) / (GST_AUDIO_FILTER (filter)->format.width / 8);
|
||||
|
||||
if (gst_base_transform_is_passthrough (base) ||
|
||||
G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP)))
|
||||
|
|
|
@ -631,9 +631,17 @@ gst_audio_panorama_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
|||
{
|
||||
GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base);
|
||||
guint num_samples = GST_BUFFER_SIZE (outbuf) / (2 * filter->width);
|
||||
GstClockTime timestamp, stream_time;
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (outbuf)))
|
||||
gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (outbuf));
|
||||
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 (G_OBJECT (filter), stream_time);
|
||||
|
||||
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP))) {
|
||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
||||
|
|
Loading…
Reference in a new issue