UniMRCP
1.3.0
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
libs
mpf
include
mpf_stream.h
Go to the documentation of this file.
1
/*
2
* Copyright 2008-2014 Arsen Chaloyan
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*
16
* $Id: mpf_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17
*/
18
19
#ifndef MPF_STREAM_H
20
#define MPF_STREAM_H
21
22
/**
23
* @file mpf_stream.h
24
* @brief MPF Bidirectional Stream
25
*/
26
27
#include "
mpf_types.h
"
28
#include "
mpf_frame.h
"
29
#include "
mpf_stream_descriptor.h
"
30
#include "
mpf_codec.h
"
31
#include "
apt_text_stream.h
"
32
33
APT_BEGIN_EXTERN_C
34
35
/** Declaration of virtual table of audio stream */
36
typedef
struct
mpf_audio_stream_vtable_t
mpf_audio_stream_vtable_t
;
37
38
/** Audio stream */
39
struct
mpf_audio_stream_t
{
40
/** External object */
41
void
*
obj
;
42
/** Table of virtual methods */
43
const
mpf_audio_stream_vtable_t
*
vtable
;
44
/** Back pointer */
45
mpf_termination_t
*
termination
;
46
47
/** Stream capabilities */
48
const
mpf_stream_capabilities_t
*
capabilities
;
49
50
/** Stream direction send/receive (bitmask of mpf_stream_direction_e) */
51
mpf_stream_direction_e
direction
;
52
/** Rx codec descriptor */
53
mpf_codec_descriptor_t
*
rx_descriptor
;
54
/** Rx event descriptor */
55
mpf_codec_descriptor_t
*
rx_event_descriptor
;
56
/** Tx codec descriptor */
57
mpf_codec_descriptor_t
*
tx_descriptor
;
58
/** Tx event descriptor */
59
mpf_codec_descriptor_t
*
tx_event_descriptor
;
60
};
61
62
/** Video stream */
63
struct
mpf_video_stream_t
{
64
/** Back pointer */
65
mpf_termination_t
*
termination
;
66
/** Stream direction send/receive (bitmask of mpf_stream_direction_e) */
67
mpf_stream_direction_e
direction
;
68
};
69
70
/** Table of audio stream virtual methods */
71
struct
mpf_audio_stream_vtable_t
{
72
/** Virtual destroy method */
73
apt_bool_t
(*
destroy
)(
mpf_audio_stream_t
*stream);
74
75
/** Virtual open receiver method */
76
apt_bool_t
(*
open_rx
)(
mpf_audio_stream_t
*stream,
mpf_codec_t
*codec);
77
/** Virtual close receiver method */
78
apt_bool_t
(*
close_rx
)(
mpf_audio_stream_t
*stream);
79
/** Virtual read frame method */
80
apt_bool_t
(*
read_frame
)(
mpf_audio_stream_t
*stream,
mpf_frame_t
*frame);
81
82
/** Virtual open transmitter method */
83
apt_bool_t
(*
open_tx
)(
mpf_audio_stream_t
*stream,
mpf_codec_t
*codec);
84
/** Virtual close transmitter method */
85
apt_bool_t
(*
close_tx
)(
mpf_audio_stream_t
*stream);
86
/** Virtual write frame method */
87
apt_bool_t
(*
write_frame
)(
mpf_audio_stream_t
*stream,
const
mpf_frame_t
*frame);
88
89
/** Virtual trace method */
90
void (*
trace
)(
mpf_audio_stream_t
*stream,
mpf_stream_direction_e
direction,
apt_text_stream_t
*output);
91
};
92
93
/** Create audio stream */
94
MPF_DECLARE
(
mpf_audio_stream_t
*)
mpf_audio_stream_create
(
void
*obj, const
mpf_audio_stream_vtable_t
*vtable, const
mpf_stream_capabilities_t
*capabilities, apr_pool_t *pool);
95
96
/** Validate audio stream receiver */
97
MPF_DECLARE
(
apt_bool_t
)
mpf_audio_stream_rx_validate
(
98
mpf_audio_stream_t
*stream,
99
const
mpf_codec_descriptor_t
*descriptor,
100
const
mpf_codec_descriptor_t
*event_descriptor,
101
apr_pool_t *pool);
102
103
/** Validate audio stream transmitter */
104
MPF_DECLARE
(
apt_bool_t
)
mpf_audio_stream_tx_validate
(
105
mpf_audio_stream_t
*stream,
106
const
mpf_codec_descriptor_t
*descriptor,
107
const
mpf_codec_descriptor_t
*event_descriptor,
108
apr_pool_t *pool);
109
110
/** Destroy audio stream */
111
static APR_INLINE
apt_bool_t
mpf_audio_stream_destroy(
mpf_audio_stream_t
*stream)
112
{
113
if
(stream->vtable->destroy)
114
return
stream->vtable->destroy(stream);
115
return
TRUE;
116
}
117
118
/** Open audio stream receiver */
119
static
APR_INLINE
apt_bool_t
mpf_audio_stream_rx_open(
mpf_audio_stream_t
*stream,
mpf_codec_t
*codec)
120
{
121
if
(stream->
vtable
->
open_rx
)
122
return
stream->
vtable
->
open_rx
(stream,codec);
123
return
TRUE;
124
}
125
126
/** Close audio stream receiver */
127
static
APR_INLINE
apt_bool_t
mpf_audio_stream_rx_close(
mpf_audio_stream_t
*stream)
128
{
129
if
(stream->
vtable
->
close_rx
)
130
return
stream->
vtable
->
close_rx
(stream);
131
return
TRUE;
132
}
133
134
/** Read frame */
135
static
APR_INLINE
apt_bool_t
mpf_audio_stream_frame_read(
mpf_audio_stream_t
*stream,
mpf_frame_t
*frame)
136
{
137
if
(stream->
vtable
->
read_frame
)
138
return
stream->
vtable
->
read_frame
(stream,frame);
139
return
TRUE;
140
}
141
142
/** Open audio stream transmitter */
143
static
APR_INLINE
apt_bool_t
mpf_audio_stream_tx_open(
mpf_audio_stream_t
*stream,
mpf_codec_t
*codec)
144
{
145
if
(stream->
vtable
->
open_tx
)
146
return
stream->
vtable
->
open_tx
(stream,codec);
147
return
TRUE;
148
}
149
150
/** Close audio stream transmitter */
151
static
APR_INLINE
apt_bool_t
mpf_audio_stream_tx_close(
mpf_audio_stream_t
*stream)
152
{
153
if
(stream->
vtable
->
close_tx
)
154
return
stream->
vtable
->
close_tx
(stream);
155
return
TRUE;
156
}
157
158
/** Write frame */
159
static
APR_INLINE
apt_bool_t
mpf_audio_stream_frame_write(
mpf_audio_stream_t
*stream,
const
mpf_frame_t
*frame)
160
{
161
if
(stream->
vtable
->
write_frame
)
162
return
stream->
vtable
->
write_frame
(stream,frame);
163
return
TRUE;
164
}
165
166
/** Trace media path */
167
MPF_DECLARE
(
void
)
mpf_audio_stream_trace
(
mpf_audio_stream_t
*stream,
mpf_stream_direction_e
direction,
apt_text_stream_t
*output);
168
169
APT_END_EXTERN_C
170
171
#endif
/* MPF_STREAM_H */
Generated on Mon Feb 2 2015 19:41:38 for UniMRCP by
1.8.3.1