diff options
Diffstat (limited to 'pjmedia/src')
-rw-r--r-- | pjmedia/src/pjmedia-codec/gsm.c | 10 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/pjmedia-codec-lib.c | 86 | ||||
-rw-r--r-- | pjmedia/src/pjmedia-codec/speex_codec.c | 9 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/g711.c | 6 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/nullsound.c | 49 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/pasound.c | 4 |
6 files changed, 66 insertions, 98 deletions
diff --git a/pjmedia/src/pjmedia-codec/gsm.c b/pjmedia/src/pjmedia-codec/gsm.c index 46c49f08..55d207aa 100644 --- a/pjmedia/src/pjmedia-codec/gsm.c +++ b/pjmedia/src/pjmedia-codec/gsm.c @@ -27,6 +27,12 @@ #include <pj/os.h> #include "gsm/gsm.h" +/* + * Only build this file if PJMEDIA_HAS_GSM_CODEC != 0 + */ +#if defined(PJMEDIA_HAS_GSM_CODEC) && PJMEDIA_HAS_GSM_CODEC != 0 + + /* Prototypes for GSM factory */ static pj_status_t gsm_test_alloc( pjmedia_codec_factory *factory, const pjmedia_codec_info *id ); @@ -473,3 +479,7 @@ static pj_status_t gsm_codec_decode( pjmedia_codec *codec, return PJ_SUCCESS; } + + +#endif /* PJMEDIA_HAS_GSM_CODEC */ + diff --git a/pjmedia/src/pjmedia-codec/pjmedia-codec-lib.c b/pjmedia/src/pjmedia-codec/pjmedia-codec-lib.c deleted file mode 100644 index 8a201031..00000000 --- a/pjmedia/src/pjmedia-codec/pjmedia-codec-lib.c +++ /dev/null @@ -1,86 +0,0 @@ -/* $Id$ */ -/* - * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org> - * - * This program 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. - * - * This program 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 this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <pjmedia-codec.h> - -/* Include factories: */ -#include <pjmedia-codec/config.h> -#include <pjmedia-codec/gsm.h> -#include <pjmedia-codec/speex.h> - - -static pjmedia_endpt *the_endpt; -static struct codec_list -{ - pj_status_t (*init)(pjmedia_endpt*); - pj_status_t (*deinit)(void); -} codec_list[] = -{ - -#if PJMEDIA_CODEC_HAS_GSM - { &pjmedia_codec_gsm_init, &pjmedia_codec_gsm_deinit}, -#endif - -#if PJMEDIA_CODEC_HAS_SPEEX - { &pjmedia_codec_speex_init_default, &pjmedia_codec_speex_deinit}, -#endif - - { NULL, NULL } -}; - -/* - * Initialize pjmedia-codec library, and register all codec factories - * in this library. - */ -PJ_DEF(pj_status_t) pjmedia_codec_init(pjmedia_endpt *endpt) -{ - pj_status_t status; - unsigned i; - - the_endpt = endpt; - - for (i=0; codec_list[i].init; ++i) { - status = (*codec_list[i].init)(the_endpt); - if (status != PJ_SUCCESS) - return status; - } - return PJ_SUCCESS; -} - - -/* - * Deinitialize pjmedia-codec library, and unregister all codec factories - * in this library. - */ -PJ_DEF(pj_status_t) pjmedia_codec_deinit(void) -{ - pj_status_t status; - unsigned i; - - for (i=0; codec_list[i].init; ++i) { - status = (*codec_list[i].deinit)(); - if (status != PJ_SUCCESS) - return status; - } - - return PJ_SUCCESS; -} - - - - diff --git a/pjmedia/src/pjmedia-codec/speex_codec.c b/pjmedia/src/pjmedia-codec/speex_codec.c index e8b9d0a4..840737ee 100644 --- a/pjmedia/src/pjmedia-codec/speex_codec.c +++ b/pjmedia/src/pjmedia-codec/speex_codec.c @@ -29,6 +29,12 @@ #include <pj/string.h> #include <pj/os.h> +/* + * Only build this file if PJMEDIA_HAS_SPEEX_CODEC != 0 + */ +#if defined(PJMEDIA_HAS_SPEEX_CODEC) && PJMEDIA_HAS_SPEEX_CODEC!=0 + + #define THIS_FILE "speex_codec.c" #define DEFAULT_QUALITY 4 @@ -777,3 +783,6 @@ static pj_status_t spx_codec_decode( pjmedia_codec *codec, return PJ_SUCCESS; } + + +#endif /* PJMEDIA_HAS_SPEEX_CODEC */ diff --git a/pjmedia/src/pjmedia/g711.c b/pjmedia/src/pjmedia/g711.c index ad8bb7ee..d921bddf 100644 --- a/pjmedia/src/pjmedia/g711.c +++ b/pjmedia/src/pjmedia/g711.c @@ -27,6 +27,8 @@ #include <pj/string.h> #include <pj/assert.h> +#if defined(PJMEDIA_HAS_G711_CODEC) && PJMEDIA_HAS_G711_CODEC!=0 + #define G711_BPS 64000 #define G711_CODEC_CNT 0 /* number of codec to preallocate in memory */ @@ -472,6 +474,9 @@ static pj_status_t g711_decode( pjmedia_codec *codec, const struct pjmedia_fram } +#endif /* PJMEDIA_HAS_G711_CODEC */ + + /* * This source code is a product of Sun Microsystems, Inc. and is provided * for unrestricted use. Users may copy or modify this source code without @@ -764,3 +769,4 @@ ulaw2alaw( + diff --git a/pjmedia/src/pjmedia/nullsound.c b/pjmedia/src/pjmedia/nullsound.c index fcda5780..ff4e92e7 100644 --- a/pjmedia/src/pjmedia/nullsound.c +++ b/pjmedia/src/pjmedia/nullsound.c @@ -19,6 +19,8 @@ #include <pjmedia/sound.h> #include <pj/assert.h> +#if defined(PJMEDIA_HAS_NULL_SOUND) && PJMEDIA_HAS_NULL_SOUND!=0 + static pj_snd_dev_info null_info = { "Null Device", @@ -45,28 +47,48 @@ PJ_DEF(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index) return &null_info; } -PJ_DEF(pj_snd_stream*) pj_snd_open_recorder( int index, - const pj_snd_stream_info *param, - pj_snd_rec_cb rec_cb, - void *user_data) +PJ_DEF(pj_status_t) pj_snd_open_recorder( int index, + unsigned clock_rate, + unsigned channel_count, + unsigned samples_per_frame, + unsigned bits_per_sample, + pj_snd_rec_cb rec_cb, + void *user_data, + pj_snd_stream **p_snd_strm) { PJ_UNUSED_ARG(index); - PJ_UNUSED_ARG(param); + PJ_UNUSED_ARG(clock_rate); + PJ_UNUSED_ARG(channel_count); + PJ_UNUSED_ARG(samples_per_frame); + PJ_UNUSED_ARG(bits_per_sample); PJ_UNUSED_ARG(rec_cb); PJ_UNUSED_ARG(user_data); - return (void*)1; + + *p_snd_strm = (void*)1; + + return PJ_SUCCESS; } -PJ_DEF(pj_snd_stream*) pj_snd_open_player( int index, - const pj_snd_stream_info *param, - pj_snd_play_cb play_cb, - void *user_data) +PJ_DEF(pj_status_t) pj_snd_open_player( int index, + unsigned clock_rate, + unsigned channel_count, + unsigned samples_per_frame, + unsigned bits_per_sample, + pj_snd_play_cb play_cb, + void *user_data, + pj_snd_stream **p_snd_strm ) { PJ_UNUSED_ARG(index); - PJ_UNUSED_ARG(param); + PJ_UNUSED_ARG(clock_rate); + PJ_UNUSED_ARG(channel_count); + PJ_UNUSED_ARG(samples_per_frame); + PJ_UNUSED_ARG(bits_per_sample); PJ_UNUSED_ARG(play_cb); PJ_UNUSED_ARG(user_data); - return (void*)1; + + *p_snd_strm = (void*)1; + + return PJ_SUCCESS; } PJ_DEF(pj_status_t) pj_snd_stream_start(pj_snd_stream *stream) @@ -91,3 +113,6 @@ PJ_DEF(pj_status_t) pj_snd_deinit(void) { return PJ_SUCCESS; } + + +#endif /* PJMEDIA_HAS_NULL_SOUND */ diff --git a/pjmedia/src/pjmedia/pasound.c b/pjmedia/src/pjmedia/pasound.c index 176f98ed..76b8d1bc 100644 --- a/pjmedia/src/pjmedia/pasound.c +++ b/pjmedia/src/pjmedia/pasound.c @@ -23,6 +23,8 @@ #include <pj/string.h> #include <portaudio.h> +#if defined(PJMEDIA_HAS_PORTAUDIO_SOUND) && PJMEDIA_HAS_PORTAUDIO_SOUND!=0 + #define THIS_FILE "pasound.c" static struct snd_mgr @@ -434,3 +436,5 @@ PJ_DEF(pj_status_t) pj_snd_deinit(void) return Pa_Terminate(); } + +#endif /* PJMEDIA_HAS_PORTAUDIO_SOUND */ |