Commit 708fb6e6 authored by Ronald S. Bultje's avatar Ronald S. Bultje

ext/alsa/gstalsasink.c: Implement FILLER event awareness.

Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event):
Implement FILLER event awareness.
parent 0d04f83e
2005-02-08 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event):
Implement FILLER event awareness.
2005-02-08 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/cdparanoia/gstcdparanoia.c: (cdparanoia_convert):
......
......@@ -252,6 +252,37 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr)
break;
}
case GST_EVENT_FILLER:{
guint64 dur = gst_event_filler_get_duration (event);
if (GST_CLOCK_TIME_IS_VALID (dur)) {
gint samples;
GstBuffer *buf;
buf = gst_buffer_new ();
GST_BUFFER_TIMESTAMP (buf) = GST_EVENT_TIMESTAMP (event);
GST_BUFFER_DURATION (buf) = dur;
samples = gst_alsa_timestamp_to_samples (this,
GST_BUFFER_DURATION (buf));
if (GST_ELEMENT (this)->numsinkpads == 1)
samples *= this->format->channels;
GST_BUFFER_SIZE (buf) = samples *
snd_pcm_format_physical_width (this->format->format) / 8;
GST_BUFFER_DATA (buf) = g_malloc (GST_BUFFER_SIZE (buf));
if (0 != snd_pcm_format_set_silence (this->format->format,
GST_BUFFER_DATA (buf), samples)) {
GST_WARNING_OBJECT (this, "error silencing buffer, may hang");
gst_buffer_unref (buf);
} else {
GST_DEBUG_OBJECT (this, "adding %" GST_TIME_FORMAT " silence at %"
GST_TIME_FORMAT, GST_TIME_ARGS (dur),
GST_TIME_ARGS (GST_EVENT_TIMESTAMP (event)));
sink->gst_data[pad_nr] = GST_DATA (buf);
}
}
break;
}
case GST_EVENT_TAG:
break;
default:
......@@ -262,7 +293,6 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr)
GST_LOG_OBJECT (sink, "unreffing event %p of type %d with refcount %d",
event, GST_EVENT_TYPE (event), GST_DATA_REFCOUNT (event));
gst_event_unref (event);
sink->gst_data[pad_nr] = NULL;
} else {
/* the element at the top of the chain did not emit an event. */
g_assert_not_reached ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment