summaryrefslogtreecommitdiff
path: root/pjmedia/src/pjmedia/nullsound.c
blob: ff4e92e7e4ffdfad738b9c3a1f1874d820c1ffea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* $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/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",
    1,
    1,
    8000
};


PJ_DEF(pj_status_t) pj_snd_init(pj_pool_factory *factory)
{
    PJ_UNUSED_ARG(factory);
    return PJ_SUCCESS;
}

PJ_DEF(int) pj_snd_get_dev_count(void)
{
    return 1;
}

PJ_DEF(const pj_snd_dev_info*) pj_snd_get_dev_info(unsigned index)
{
    PJ_ASSERT_RETURN(index==0, NULL);
    return &null_info;
}

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(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);

    *p_snd_strm = (void*)1;

    return PJ_SUCCESS;
}

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(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);

    *p_snd_strm = (void*)1;

    return PJ_SUCCESS;
}

PJ_DEF(pj_status_t) pj_snd_stream_start(pj_snd_stream *stream)
{
    PJ_UNUSED_ARG(stream);
    return PJ_SUCCESS;
}

PJ_DEF(pj_status_t) pj_snd_stream_stop(pj_snd_stream *stream)
{
    PJ_UNUSED_ARG(stream);
    return PJ_SUCCESS;
}

PJ_DEF(pj_status_t) pj_snd_stream_close(pj_snd_stream *stream)
{
    PJ_UNUSED_ARG(stream);
    return PJ_SUCCESS;
}

PJ_DEF(pj_status_t) pj_snd_deinit(void)
{
    return PJ_SUCCESS;
}


#endif	/* PJMEDIA_HAS_NULL_SOUND */