From: Padraig O'Briain Date: Fri, 8 Dec 2006 15:12:01 +0000 (+0000) Subject: sys/sunaudio/: Implement reset functions to unblock the src/sink more quickly on... X-Git-Tag: RELEASE-0_10_5~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3b5d523d8edd62920bb4f75f67abdd574e24fb5;p=platform%2Fupstream%2Fgst-plugins-good.git 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 --- diff --git a/ChangeLog b/ChangeLog index 8203634c8..05de0d5be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-12-08 Jan Schmidt + + * 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 + 2006-12-08 Jan Schmidt * sys/sunaudio/gstsunaudiomixer.c: diff --git a/sys/sunaudio/gstsunaudiosink.c b/sys/sunaudio/gstsunaudiosink.c index 5c6e48f76..ab7f4e3ca 100644 --- a/sys/sunaudio/gstsunaudiosink.c +++ b/sys/sunaudio/gstsunaudiosink.c @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -390,4 +391,45 @@ gst_sunaudiosink_delay (GstAudioSink * asink) static void 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))); + } } diff --git a/sys/sunaudio/gstsunaudiosrc.c b/sys/sunaudio/gstsunaudiosrc.c index 0993ed979..1a6ff9699 100644 --- a/sys/sunaudio/gstsunaudiosrc.c +++ b/sys/sunaudio/gstsunaudiosrc.c @@ -398,5 +398,45 @@ gst_sunaudiosrc_delay (GstAudioSrc * asrc) static void gst_sunaudiosrc_reset (GstAudioSrc * asrc) { - return; + /* 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; + } + + /* + * 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))); + } }