mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
minor cleanups
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1704 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
0ff2afd8a6
commit
1bfa1802d4
1 changed files with 14 additions and 29 deletions
|
|
@ -28,12 +28,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_POLL_H
|
|
||||||
#include <sys/poll.h>
|
|
||||||
#else
|
|
||||||
#include "poll.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <asoundlib.h>
|
#include <asoundlib.h>
|
||||||
|
|
||||||
#include <pulse/xmalloc.h>
|
#include <pulse/xmalloc.h>
|
||||||
|
|
@ -343,7 +337,8 @@ static int suspend(struct userdata *u) {
|
||||||
pa_assert(u);
|
pa_assert(u);
|
||||||
pa_assert(u->pcm_handle);
|
pa_assert(u->pcm_handle);
|
||||||
|
|
||||||
snd_pcm_drain(u->pcm_handle); /* Let's suspend */
|
/* Let's suspend */
|
||||||
|
snd_pcm_drain(u->pcm_handle);
|
||||||
snd_pcm_close(u->pcm_handle);
|
snd_pcm_close(u->pcm_handle);
|
||||||
u->pcm_handle = NULL;
|
u->pcm_handle = NULL;
|
||||||
|
|
||||||
|
|
@ -624,8 +619,6 @@ static void thread_func(void *userdata) {
|
||||||
if (PA_SINK_OPENED(u->sink->thread_info.state)) {
|
if (PA_SINK_OPENED(u->sink->thread_info.state)) {
|
||||||
int work_done = 0;
|
int work_done = 0;
|
||||||
|
|
||||||
pa_assert(u->pcm_handle);
|
|
||||||
|
|
||||||
if (u->use_mmap) {
|
if (u->use_mmap) {
|
||||||
if ((work_done = mmap_write(u)) < 0)
|
if ((work_done = mmap_write(u)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -648,8 +641,6 @@ static void thread_func(void *userdata) {
|
||||||
if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &offset, &chunk, 0) == 0) {
|
if (pa_asyncmsgq_get(u->thread_mq.inq, &object, &code, &data, &offset, &chunk, 0) == 0) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* pa_log("processing msg"); */
|
|
||||||
|
|
||||||
if (!object && code == PA_MESSAGE_SHUTDOWN) {
|
if (!object && code == PA_MESSAGE_SHUTDOWN) {
|
||||||
pa_asyncmsgq_done(u->thread_mq.inq, 0);
|
pa_asyncmsgq_done(u->thread_mq.inq, 0);
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
@ -707,7 +698,6 @@ finish:
|
||||||
int pa__init(pa_module*m) {
|
int pa__init(pa_module*m) {
|
||||||
|
|
||||||
pa_modargs *ma = NULL;
|
pa_modargs *ma = NULL;
|
||||||
int ret = -1;
|
|
||||||
struct userdata *u = NULL;
|
struct userdata *u = NULL;
|
||||||
const char *dev;
|
const char *dev;
|
||||||
pa_sample_spec ss;
|
pa_sample_spec ss;
|
||||||
|
|
@ -723,6 +713,8 @@ int pa__init(pa_module*m) {
|
||||||
int namereg_fail;
|
int namereg_fail;
|
||||||
int use_mmap = 1, b;
|
int use_mmap = 1, b;
|
||||||
|
|
||||||
|
snd_pcm_info_alloca(&pcm_info);
|
||||||
|
|
||||||
pa_assert(m);
|
pa_assert(m);
|
||||||
|
|
||||||
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
|
||||||
|
|
@ -773,8 +765,7 @@ int pa__init(pa_module*m) {
|
||||||
|
|
||||||
u->device_name = pa_xstrdup(dev);
|
u->device_name = pa_xstrdup(dev);
|
||||||
|
|
||||||
if ((err = snd_pcm_info_malloc(&pcm_info)) < 0 ||
|
if ((err = snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
|
||||||
(err = snd_pcm_info(u->pcm_handle, pcm_info)) < 0) {
|
|
||||||
pa_log("Error fetching PCM info: %s", snd_strerror(err));
|
pa_log("Error fetching PCM info: %s", snd_strerror(err));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
@ -903,24 +894,18 @@ int pa__init(pa_module*m) {
|
||||||
if (u->sink->get_mute)
|
if (u->sink->get_mute)
|
||||||
u->sink->get_mute(u->sink);
|
u->sink->get_mute(u->sink);
|
||||||
|
|
||||||
ret = 0;
|
pa_modargs_free(ma);
|
||||||
|
|
||||||
finish:
|
return 0;
|
||||||
|
|
||||||
if (ma)
|
|
||||||
pa_modargs_free(ma);
|
|
||||||
|
|
||||||
if (pcm_info)
|
|
||||||
snd_pcm_info_free(pcm_info);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
||||||
if (u)
|
if (ma)
|
||||||
pa__done(m);
|
pa_modargs_free(ma);
|
||||||
|
|
||||||
goto finish;
|
pa__done(m);
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pa__done(pa_module*m) {
|
void pa__done(pa_module*m) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue