"Fossies" - the Fresh Open Source Software Archive

Member "pulseaudio-13.0/src/modules/raop/module-raop-sink.c" (20 Nov 2018, 2593 Bytes) of package /linux/misc/pulseaudio-13.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "module-raop-sink.c" see the Fossies "Dox" file reference documentation.

    1 /***
    2   This file is part of PulseAudio.
    3 
    4   Copyright 2004-2006 Lennart Poettering
    5   Copyright 2008 Colin Guthrie
    6 
    7   PulseAudio is free software; you can redistribute it and/or modify
    8   it under the terms of the GNU Lesser General Public License as published
    9   by the Free Software Foundation; either version 2.1 of the License,
   10   or (at your option) any later version.
   11 
   12   PulseAudio is distributed in the hope that it will be useful, but
   13   WITHOUT ANY WARRANTY; without even the implied warranty of
   14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   15   General Public License for more details.
   16 
   17   You should have received a copy of the GNU Lesser General Public License
   18   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
   19 ***/
   20 
   21 #ifdef HAVE_CONFIG_H
   22 #include <config.h>
   23 #endif
   24 
   25 #include <pulsecore/module.h>
   26 #include <pulsecore/sink.h>
   27 #include <pulsecore/modargs.h>
   28 
   29 #include "raop-sink.h"
   30 
   31 PA_MODULE_AUTHOR("Colin Guthrie");
   32 PA_MODULE_DESCRIPTION("RAOP Sink");
   33 PA_MODULE_VERSION(PACKAGE_VERSION);
   34 PA_MODULE_LOAD_ONCE(false);
   35 PA_MODULE_USAGE(
   36         "name=<name of the sink, to be prefixed> "
   37         "sink_name=<name for the sink> "
   38         "sink_properties=<properties for the sink> "
   39         "server=<address> "
   40         "protocol=<transport protocol> "
   41         "encryption=<encryption type> "
   42         "codec=<audio codec> "
   43         "format=<sample format> "
   44         "rate=<sample rate> "
   45         "channels=<number of channels> "
   46         "username=<authentication user name, default: \"iTunes\"> "
   47         "password=<authentication password> "
   48         "latency_msec=<audio latency>");
   49 
   50 static const char* const valid_modargs[] = {
   51     "name",
   52     "sink_name",
   53     "sink_properties",
   54     "server",
   55     "protocol",
   56     "encryption",
   57     "codec",
   58     "format",
   59     "rate",
   60     "channels",
   61     "username",
   62     "password",
   63     "latency_msec",
   64     NULL
   65 };
   66 
   67 int pa__init(pa_module *m) {
   68     pa_modargs *ma = NULL;
   69 
   70     pa_assert(m);
   71 
   72     if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
   73         pa_log("Failed to parse module arguments");
   74         goto fail;
   75     }
   76 
   77     if (!(m->userdata = pa_raop_sink_new(m, ma, __FILE__)))
   78         goto fail;
   79 
   80     pa_modargs_free(ma);
   81 
   82     return 0;
   83 
   84 fail:
   85 
   86     if (ma)
   87         pa_modargs_free(ma);
   88 
   89     pa__done(m);
   90 
   91     return -1;
   92 }
   93 
   94 int pa__get_n_used(pa_module *m) {
   95     pa_sink *sink;
   96 
   97     pa_assert(m);
   98     pa_assert_se(sink = m->userdata);
   99 
  100     return pa_sink_linked_by(sink);
  101 }
  102 
  103 void pa__done(pa_module *m) {
  104     pa_sink *sink;
  105 
  106     pa_assert(m);
  107 
  108     if ((sink = m->userdata))
  109         pa_raop_sink_free(sink);
  110 }