summaryrefslogtreecommitdiffstats
path: root/src/source.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-07-17 14:12:30 +0000
committerLennart Poettering <lennart@poettering.net>2004-07-17 14:12:30 +0000
commit41f6aea8fdbc744c13bc461056a2d694a5c4d06f (patch)
tree1e23911c1f61c66df3fba272af53475508a7a7ce /src/source.c
parent563201e128d600ec1ae4a33ca81d03b776501f82 (diff)
rename src to polyp
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@90 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/source.c')
-rw-r--r--src/source.c131
1 files changed, 0 insertions, 131 deletions
diff --git a/src/source.c b/src/source.c
deleted file mode 100644
index ccde0e2f..00000000
--- a/src/source.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of polypaudio.
-
- polypaudio is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2 of the License,
- or (at your option) any later version.
-
- polypaudio is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with polypaudio; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "source.h"
-#include "source-output.h"
-#include "namereg.h"
-
-struct pa_source* pa_source_new(struct pa_core *core, const char *name, int fail, const struct pa_sample_spec *spec) {
- struct pa_source *s;
- char st[256];
- int r;
- assert(core && spec && name);
-
- s = malloc(sizeof(struct pa_source));
- assert(s);
-
- if (!(name = pa_namereg_register(core, name, PA_NAMEREG_SOURCE, s, fail))) {
- free(s);
- return NULL;
- }
-
- s->name = strdup(name);
- s->description = NULL;
-
- s->owner = NULL;
- s->core = core;
- s->sample_spec = *spec;
- s->outputs = pa_idxset_new(NULL, NULL);
- s->monitor_of = NULL;
-
- s->notify = NULL;
- s->userdata = NULL;
-
- r = pa_idxset_put(core->sources, s, &s->index);
- assert(s->index != PA_IDXSET_INVALID && r >= 0);
-
- pa_sample_snprint(st, sizeof(st), spec);
- fprintf(stderr, "source: created %u \"%s\" with sample spec \"%s\"\n", s->index, s->name, st);
-
- return s;
-}
-
-void pa_source_free(struct pa_source *s) {
- struct pa_source_output *o, *j = NULL;
- assert(s);
-
- pa_namereg_unregister(s->core, s->name);
-
- while ((o = pa_idxset_first(s->outputs, NULL))) {
- assert(o != j);
- pa_source_output_kill(o);
- j = o;
- }
- pa_idxset_free(s->outputs, NULL, NULL);
-
- pa_idxset_remove_by_data(s->core->sources, s, NULL);
-
- fprintf(stderr, "source: freed %u \"%s\"\n", s->index, s->name);
-
- free(s->name);
- free(s->description);
- free(s);
-}
-
-void pa_source_notify(struct pa_source*s) {
- assert(s);
-
- if (s->notify)
- s->notify(s);
-}
-
-static int do_post(void *p, uint32_t index, int *del, void*userdata) {
- struct pa_memchunk *chunk = userdata;
- struct pa_source_output *o = p;
- assert(o && o->push && del && chunk);
-
- pa_source_output_push(o, chunk);
- return 0;
-}
-
-void pa_source_post(struct pa_source*s, struct pa_memchunk *chunk) {
- assert(s && chunk);
-
- pa_idxset_foreach(s->outputs, do_post, chunk);
-}
-
-struct pa_source* pa_source_get_default(struct pa_core *c) {
- struct pa_source *source;
- assert(c);
-
- if ((source = pa_idxset_get_by_index(c->sources, c->default_source_index)))
- return source;
-
- if (!(source = pa_idxset_first(c->sources, &c->default_source_index)))
- return NULL;
-
- fprintf(stderr, "core: default source vanished, setting to %u.\n", source->index);
- return source;
-}
-
-void pa_source_set_owner(struct pa_source *s, struct pa_module *m) {
- assert(s);
- s->owner = m;
-}