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
|
/*
* Copyright (C) 2009-2010 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou(at)doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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 3 of the License, or
* (at your option) any later version.
*
* DOUBANGO 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 DOUBANGO.
*
*/
/**@file tdav_consumer_audio.h
* @brief Base class for all Audio consumers.
*
* @author Mamadou Diop <diopmamadou(at)doubango.org>
*
* @date Created: Sat Nov 8 16:54:58 2009 mdiop
*/
#ifndef TINYDAV_CONSUMER_AUDIO_H
#define TINYDAV_CONSUMER_AUDIO_H
#include "tinydav_config.h"
#include "tinymedia/tmedia_consumer.h"
#include "tinydav/audio/tdav_jitterbuffer.h"
#include "tsk_safeobj.h"
TDAV_BEGIN_DECLS
#define TDAV_CONSUMER_AUDIO(self) ((tdav_consumer_audio_t*)(self))
typedef struct tdav_consumer_audio_s
{
TMEDIA_DECLARE_CONSUMER;
uint8_t channels;
uint32_t rate;
uint8_t bits_per_sample;
uint8_t ptime;
struct{
jitterbuffer *jbuffer;
uint8_t jcodec;
uint64_t ref_timestamp;
} jb;
struct tmedia_denoise_s* denoise;
TSK_DECLARE_SAFEOBJ;
}
tdav_consumer_audio_t;
TINYDAV_API int tdav_consumer_audio_init(tdav_consumer_audio_t* self);
TINYDAV_API int tdav_consumer_audio_cmp(const tsk_object_t* consumer1, const tsk_object_t* consumer2);
#define tdav_consumer_audio_prepare(self, codec) tmedia_consumer_prepare(TDAV_CONSUMER_AUDIO(self), codec)
#define tdav_consumer_audio_start(self) tmedia_consumer_start(TDAV_CONSUMER_AUDIO(self))
#define tdav_consumer_audio_consume(self, buffer, size) tmedia_consumer_consume(TDAV_CONSUMER_AUDIO(self), buffer, size)
#define tdav_consumer_audio_pause(self) tmedia_consumer_pause(TDAV_CONSUMER_AUDIO(self))
#define tdav_consumer_audio_stop(self) tmedia_consumer_stop(TDAV_CONSUMER_AUDIO(self))
TINYDAV_API int tdav_consumer_audio_put(tdav_consumer_audio_t* self, void** data, tsk_size_t size, const tsk_object_t* proto_hdr);
TINYDAV_API void* tdav_consumer_audio_get(tdav_consumer_audio_t* self, tsk_size_t* out_size);
void tdav_consumer_audio_set_denoise(tdav_consumer_audio_t* self, struct tmedia_denoise_s* denoise);
TINYDAV_API int tdav_consumer_audio_reset(tdav_consumer_audio_t* self);
TINYDAV_API int tdav_consumer_audio_deinit(tdav_consumer_audio_t* self);
#define TDAV_DECLARE_CONSUMER_AUDIO tdav_consumer_audio_t __consumer_audio__
TDAV_END_DECLS
#endif /* TINYDAV_CONSUMER_AUDIO_H */
|