mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
bugfixing:
Original commit message from CVS: bugfixing: - Fix for bug 93479 - Fix for bug 103659 - Did not set interleaved/non-interleaved correctly - Changed g_print to DEBUG to disable unwanted output Alsa is still not really useful. Missing is for example: - Support for Relinking in paused state (when going to next song in gst-player) - A bug when using gst-launch filesrc ! spider ! alsasink - Support for events - Padtemplates exporting proper caps - general cleanliness K, back to work ;)
This commit is contained in:
parent
1c0cabe1ff
commit
3d78da5dc2
1 changed files with 40 additions and 24 deletions
|
@ -961,7 +961,7 @@ static gboolean
|
||||||
gst_alsa_sink_process (GstAlsa *this, snd_pcm_uframes_t frames)
|
gst_alsa_sink_process (GstAlsa *this, snd_pcm_uframes_t frames)
|
||||||
{
|
{
|
||||||
guint8 *peeked;
|
guint8 *peeked;
|
||||||
guint32 len, avail, num_peeked;
|
guint32 len, avail, num_peeked = 0;
|
||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
GstAlsaPad *alsa_pad;
|
GstAlsaPad *alsa_pad;
|
||||||
GList *l;
|
GList *l;
|
||||||
|
@ -976,14 +976,34 @@ gst_alsa_sink_process (GstAlsa *this, snd_pcm_uframes_t frames)
|
||||||
if (! alsa_pad->bs)
|
if (! alsa_pad->bs)
|
||||||
alsa_pad->bs = gst_bytestream_new(alsa_pad->pad);
|
alsa_pad->bs = gst_bytestream_new(alsa_pad->pad);
|
||||||
|
|
||||||
num_peeked = gst_bytestream_peek_bytes (alsa_pad->bs, &peeked, frames);
|
while (num_peeked == 0) {
|
||||||
if (num_peeked < frames) {
|
num_peeked = gst_bytestream_peek_bytes (alsa_pad->bs, &peeked, frames);
|
||||||
g_warning("could not make initial pull of %d bytes on pad %s:%s",
|
if (num_peeked == 0) {
|
||||||
(int)frames,
|
gst_bytestream_get_status(alsa_pad->bs, &avail, &event);
|
||||||
GST_DEBUG_PAD_NAME(alsa_pad->pad));
|
if (event) {
|
||||||
gst_element_set_eos (GST_ELEMENT(this));
|
if (GST_EVENT_TYPE(event) == GST_EVENT_EOS) {
|
||||||
return FALSE;
|
/* really, we should just cut this pad out of the graph. let
|
||||||
}
|
me know when this is needed ;) */
|
||||||
|
|
||||||
|
gst_element_set_eos(GST_ELEMENT(this));
|
||||||
|
gst_event_unref(event);
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
g_warning("GstAlsaSink: got an unknown event (Type: %d)", GST_EVENT_TYPE(event));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* the element at the top of the chain did not emit an eos
|
||||||
|
* event. this is a Bug(tm) */
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
} else if (num_peeked < frames) {
|
||||||
|
g_warning("could not make initial pull of %d bytes on pad %s:%s",
|
||||||
|
(int)frames,
|
||||||
|
GST_DEBUG_PAD_NAME(alsa_pad->pad));
|
||||||
|
gst_element_set_eos (GST_ELEMENT(this));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!this->sample_bytes) {
|
if (!this->sample_bytes) {
|
||||||
g_critical ("alsa plugin requires a pipeline that can adequately set caps.");
|
g_critical ("alsa plugin requires a pipeline that can adequately set caps.");
|
||||||
|
@ -1004,27 +1024,22 @@ gst_alsa_sink_process (GstAlsa *this, snd_pcm_uframes_t frames)
|
||||||
if (num_peeked == 0) {
|
if (num_peeked == 0) {
|
||||||
gst_bytestream_get_status(alsa_pad->bs, &avail, &event);
|
gst_bytestream_get_status(alsa_pad->bs, &avail, &event);
|
||||||
if (event) {
|
if (event) {
|
||||||
g_warning("got an event on alsasink");
|
|
||||||
if (GST_EVENT_TYPE(event) == GST_EVENT_EOS) {
|
if (GST_EVENT_TYPE(event) == GST_EVENT_EOS) {
|
||||||
/* really, we should just cut this pad out of the graph. let
|
/* really, we should just cut this pad out of the graph. let
|
||||||
me know when this is needed ;) */
|
me know when this is needed ;) */
|
||||||
|
|
||||||
num_peeked = gst_bytestream_peek_bytes(alsa_pad->bs, &peeked, avail);
|
|
||||||
if (num_peeked && peeked)
|
|
||||||
memcpy(alsa_pad->access_addr, peeked, avail);
|
|
||||||
|
|
||||||
gst_element_set_eos(GST_ELEMENT(this));
|
gst_element_set_eos(GST_ELEMENT(this));
|
||||||
gst_event_unref(event);
|
gst_event_unref(event);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
} else {
|
||||||
|
g_warning("GstAlsaSink: got an unknown event (Type: %d)", GST_EVENT_TYPE(event));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* the element at the top of the chain did not emit an eos
|
/* the element at the top of the chain did not emit an eos
|
||||||
* event. this is a Bug(tm) */
|
* event. this is a Bug(tm) */
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
}
|
}
|
||||||
}
|
} else if (peeked && alsa_pad->access_addr) {
|
||||||
|
|
||||||
if (num_peeked && peeked && alsa_pad->access_addr) {
|
|
||||||
memcpy(alsa_pad->access_addr, peeked, num_peeked);
|
memcpy(alsa_pad->access_addr, peeked, num_peeked);
|
||||||
gst_bytestream_flush(alsa_pad->bs, num_peeked);
|
gst_bytestream_flush(alsa_pad->bs, num_peeked);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1074,7 +1089,7 @@ gst_alsa_set_params (GstAlsa *this)
|
||||||
g_return_val_if_fail(this != NULL, FALSE);
|
g_return_val_if_fail(this != NULL, FALSE);
|
||||||
g_return_val_if_fail(this->handle != NULL, FALSE);
|
g_return_val_if_fail(this->handle != NULL, FALSE);
|
||||||
|
|
||||||
g_print("Preparing channel: %s %dHz, %d channels\n",
|
DEBUG("Preparing channel: %s %dHz, %d channels\n",
|
||||||
snd_pcm_format_name(this->format),
|
snd_pcm_format_name(this->format),
|
||||||
this->rate, this->channels);
|
this->rate, this->channels);
|
||||||
|
|
||||||
|
@ -1095,10 +1110,11 @@ gst_alsa_set_params (GstAlsa *this)
|
||||||
mask = alloca(snd_pcm_access_mask_sizeof());
|
mask = alloca(snd_pcm_access_mask_sizeof());
|
||||||
snd_pcm_access_mask_none(mask);
|
snd_pcm_access_mask_none(mask);
|
||||||
|
|
||||||
if (this->data_interleaved)
|
if (this->data_interleaved) {
|
||||||
snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
|
snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
|
||||||
|
} else {
|
||||||
snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
|
snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
|
||||||
|
}
|
||||||
ret = snd_pcm_hw_params_set_access_mask(this->handle, hw_param, mask);
|
ret = snd_pcm_hw_params_set_access_mask(this->handle, hw_param, mask);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
g_warning("the gstreamer alsa plugin does not support your hardware.");
|
g_warning("the gstreamer alsa plugin does not support your hardware.");
|
||||||
|
@ -1241,7 +1257,7 @@ gst_alsa_open_audio(GstAlsa *this)
|
||||||
if (this->handle)
|
if (this->handle)
|
||||||
gst_alsa_close_audio(this);
|
gst_alsa_close_audio(this);
|
||||||
|
|
||||||
g_print("Opening alsa device \"%s\" for %s...\n", this->device,
|
DEBUG("Opening alsa device \"%s\" for %s...\n", this->device,
|
||||||
this->stream==SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
|
this->stream==SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
|
||||||
|
|
||||||
ret = snd_output_stdio_attach(&this->out, stdout, 0);
|
ret = snd_output_stdio_attach(&this->out, stdout, 0);
|
||||||
|
|
Loading…
Reference in a new issue