mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
sys/sunaudio/: Implement reset functions to unblock the src/sink more quickly on state change requests.
Original commit message from CVS: * sys/sunaudio/gstsunaudiosink.c: (gst_sunaudiosink_reset): * sys/sunaudio/gstsunaudiosrc.c: (gst_sunaudiosrc_open), (gst_sunaudiosrc_reset): Implement reset functions to unblock the src/sink more quickly on state change requests. Patch by: Padraig O'Briain <padraig dot obriain at sun dot com>
This commit is contained in:
parent
f3df7a85e4
commit
a3b5d523d8
3 changed files with 93 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2006-12-08 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
|
* sys/sunaudio/gstsunaudiosink.c: (gst_sunaudiosink_reset):
|
||||||
|
* sys/sunaudio/gstsunaudiosrc.c: (gst_sunaudiosrc_open),
|
||||||
|
(gst_sunaudiosrc_reset):
|
||||||
|
|
||||||
|
Implement reset functions to unblock the src/sink more quickly on
|
||||||
|
state change requests.
|
||||||
|
Patch by: Padraig O'Briain <padraig dot obriain at sun dot com>
|
||||||
|
|
||||||
2006-12-08 Jan Schmidt <thaytan@mad.scientist.com>
|
2006-12-08 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
* sys/sunaudio/gstsunaudiomixer.c:
|
* sys/sunaudio/gstsunaudiomixer.c:
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stropts.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
@ -390,4 +391,45 @@ gst_sunaudiosink_delay (GstAudioSink * asink)
|
||||||
static void
|
static void
|
||||||
gst_sunaudiosink_reset (GstAudioSink * asink)
|
gst_sunaudiosink_reset (GstAudioSink * asink)
|
||||||
{
|
{
|
||||||
|
/* Get current values */
|
||||||
|
GstSunAudioSink *sunaudiosink = GST_SUNAUDIO_SINK (asink);
|
||||||
|
audio_info_t ainfo;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ioctl (sunaudiosink->fd, AUDIO_GETINFO, &ainfo);
|
||||||
|
if (ret == -1) {
|
||||||
|
/*
|
||||||
|
* Should never happen, but if we couldn't getinfo, then no point
|
||||||
|
* trying to setinfo
|
||||||
|
*/
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pause the audio - so audio stops playing immediately rather than
|
||||||
|
* waiting for the ringbuffer to empty.
|
||||||
|
*/
|
||||||
|
ainfo.play.pause = !NULL;
|
||||||
|
ret = ioctl (sunaudiosink->fd, AUDIO_SETINFO, &ainfo);
|
||||||
|
if (ret == -1) {
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flush the audio */
|
||||||
|
ret = ioctl (sunaudiosink->fd, I_FLUSH, FLUSHW);
|
||||||
|
if (ret == -1) {
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* unpause the audio */
|
||||||
|
ainfo.play.pause = NULL;
|
||||||
|
ret = ioctl (sunaudiosink->fd, AUDIO_SETINFO, &ainfo);
|
||||||
|
if (ret == -1) {
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosink, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -398,5 +398,45 @@ gst_sunaudiosrc_delay (GstAudioSrc * asrc)
|
||||||
static void
|
static void
|
||||||
gst_sunaudiosrc_reset (GstAudioSrc * asrc)
|
gst_sunaudiosrc_reset (GstAudioSrc * asrc)
|
||||||
{
|
{
|
||||||
|
/* Get current values */
|
||||||
|
GstSunAudioSrc *sunaudiosrc = GST_SUNAUDIO_SRC (asrc);
|
||||||
|
audio_info_t ainfo;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ioctl (sunaudiosrc->fd, AUDIO_GETINFO, &ainfo);
|
||||||
|
if (ret == -1) {
|
||||||
|
/*
|
||||||
|
* Should never happen, but if we couldn't getinfo, then no point
|
||||||
|
* trying to setinfo
|
||||||
|
*/
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pause the audio - so audio stops playing immediately rather than
|
||||||
|
* waiting for the ringbuffer to empty.
|
||||||
|
*/
|
||||||
|
ainfo.record.pause = !NULL;
|
||||||
|
ret = ioctl (sunaudiosrc->fd, AUDIO_SETINFO, &ainfo);
|
||||||
|
if (ret == -1) {
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flush the audio */
|
||||||
|
ret = ioctl (sunaudiosrc->fd, I_FLUSH, FLUSHR);
|
||||||
|
if (ret == -1) {
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* unpause the audio */
|
||||||
|
ainfo.record.pause = NULL;
|
||||||
|
ret = ioctl (sunaudiosrc->fd, AUDIO_SETINFO, &ainfo);
|
||||||
|
if (ret == -1) {
|
||||||
|
GST_ELEMENT_ERROR (sunaudiosrc, RESOURCE, SETTINGS, (NULL), ("%s",
|
||||||
|
strerror (errno)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue