[398] | 1 | //libroarpulse.c: |
---|
| 2 | |
---|
[706] | 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008 |
---|
| 5 | * The code (may) include prototypes and comments (and maybe |
---|
| 6 | * other code fragements) from libpulse*. They are mostly copyrighted by: |
---|
| 7 | * Lennart Poettering <poettering@users.sourceforge.net> and |
---|
| 8 | * Pierre Ossman <drzeus@drzeus.cx> |
---|
| 9 | * |
---|
| 10 | * This file is part of libroarpulse a part of RoarAudio, |
---|
| 11 | * a cross-platform sound system for both, home and professional use. |
---|
| 12 | * See README for details. |
---|
| 13 | * |
---|
| 14 | * This file is free software; you can redistribute it and/or modify |
---|
| 15 | * it under the terms of the GNU General Public License version 3 |
---|
| 16 | * as published by the Free Software Foundation. |
---|
| 17 | * |
---|
| 18 | * RoarAudio is distributed in the hope that it will be useful, |
---|
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 21 | * GNU General Public License for more details. |
---|
| 22 | * |
---|
| 23 | * You should have received a copy of the GNU General Public License |
---|
| 24 | * along with this software; see the file COPYING. If not, write to |
---|
| 25 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 26 | * |
---|
| 27 | * NOTE for everyone want's to change something and send patches: |
---|
| 28 | * read README and HACKING! There a addition information on |
---|
| 29 | * the license of this document you need to read before you send |
---|
| 30 | * any patches. |
---|
| 31 | * |
---|
| 32 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 33 | * or libpulse*: |
---|
| 34 | * The libs libroaresd, libroararts and libroarpulse link this libroar |
---|
| 35 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 36 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 37 | */ |
---|
| 38 | |
---|
[398] | 39 | #include <libroarpulse/libroarpulse.h> |
---|
| 40 | |
---|
[409] | 41 | int roar_codec_pulse2roar (int codec) { |
---|
| 42 | return ROAR_CODEC_DEFAULT; |
---|
| 43 | } |
---|
| 44 | |
---|
[3383] | 45 | int roar_pa_sspec2auinfo (struct roar_audio_info * info, const pa_sample_spec * ss) { |
---|
[3382] | 46 | if ( ss == NULL || info == NULL ) |
---|
| 47 | return -1; |
---|
| 48 | |
---|
| 49 | info->rate = ss->rate; |
---|
| 50 | info->channels = ss->channels; |
---|
| 51 | |
---|
| 52 | switch (ss->format) { |
---|
| 53 | case PA_SAMPLE_U8: |
---|
| 54 | info->bits = 8; |
---|
| 55 | info->codec = ROAR_CODEC_PCM_U_LE; |
---|
| 56 | break; |
---|
| 57 | case PA_SAMPLE_ALAW: |
---|
| 58 | info->bits = 8; |
---|
| 59 | info->codec = ROAR_CODEC_ALAW; |
---|
| 60 | break; |
---|
| 61 | case PA_SAMPLE_ULAW: |
---|
| 62 | info->bits = 8; |
---|
| 63 | info->codec = ROAR_CODEC_MULAW; |
---|
| 64 | break; |
---|
| 65 | case PA_SAMPLE_S16LE: |
---|
| 66 | info->bits = 16; |
---|
| 67 | info->codec = ROAR_CODEC_PCM_S_LE; |
---|
| 68 | break; |
---|
| 69 | case PA_SAMPLE_S16BE: |
---|
| 70 | info->bits = 16; |
---|
| 71 | info->codec = ROAR_CODEC_PCM_S_BE; |
---|
| 72 | break; |
---|
| 73 | // invalid and not supported ones follow: |
---|
| 74 | case PA_SAMPLE_INVALID: |
---|
| 75 | case PA_SAMPLE_MAX: |
---|
| 76 | case PA_SAMPLE_FLOAT32LE: |
---|
| 77 | case PA_SAMPLE_FLOAT32BE: |
---|
| 78 | return -1; |
---|
| 79 | break; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | return 0; |
---|
| 83 | } |
---|
| 84 | |
---|
[3388] | 85 | char * roar_pa_find_server (char * server) { |
---|
| 86 | struct roar_x11_connection * x11con; |
---|
| 87 | |
---|
| 88 | if ( server == NULL ) |
---|
| 89 | server = getenv("PULSE_SERVER"); |
---|
| 90 | |
---|
| 91 | if ( server == NULL ) { |
---|
| 92 | if ( (x11con = roar_x11_connect(NULL)) != NULL ) { |
---|
| 93 | server = roar_x11_get_prop(x11con, "PULSE_SERVER"); |
---|
| 94 | roar_x11_disconnect(x11con); |
---|
| 95 | } |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | return server; |
---|
| 99 | } |
---|
| 100 | |
---|
[398] | 101 | //ll |
---|