UniMRCP  1.7.0
mpf_named_event.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 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 
17 #ifndef MPF_NAMED_EVENT_H
18 #define MPF_NAMED_EVENT_H
19 
20 /**
21  * @file mpf_named_event.h
22  * @brief MPF Named Events (RFC4733/RFC2833)
23  */
24 
25 #include "mpf_codec_descriptor.h"
26 
28 
29 /** Named event declaration */
31 
32 
33 /** Named event (RFC4733/RFC2833, out-of-band DTMF) */
35  /** event (DTMF, tone) identifier */
36  apr_uint32_t event_id: 8;
37 #if (APR_IS_BIGENDIAN == 1)
38  /** end of event */
39  apr_uint32_t edge: 1;
40  /** reserved */
41  apr_uint32_t reserved: 1;
42  /** tone volume */
43  apr_uint32_t volume: 6;
44 #else
45  /** tone volume */
46  apr_uint32_t volume: 6;
47  /** reserved */
48  apr_uint32_t reserved: 1;
49  /** end of event */
50  apr_uint32_t edge: 1;
51 #endif
52  /** event duration */
53  apr_uint32_t duration: 16;
54 };
55 
56 /** Create named event descriptor */
57 MPF_DECLARE(mpf_codec_descriptor_t*) mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool);
58 
59 /** Check whether the specified descriptor is named event one */
61 
62 /** Convert DTMF character to event identifier */
63 MPF_DECLARE(apr_uint32_t) mpf_dtmf_char_to_event_id(const char dtmf_char);
64 
65 /** Convert event identifier to DTMF character */
66 MPF_DECLARE(char) mpf_event_id_to_dtmf_char(const apr_uint32_t event_id);
67 
68 
70 
71 #endif /* MPF_NAMED_EVENT_H */
apr_uint32_t mpf_dtmf_char_to_event_id(const char dtmf_char)
apt_bool_t mpf_event_descriptor_check(const mpf_codec_descriptor_t *descriptor)
char mpf_event_id_to_dtmf_char(const apr_uint32_t event_id)
#define APT_END_EXTERN_C
Definition: apt.h:38
apr_uint32_t duration
Definition: mpf_named_event.h:53
int apt_bool_t
Definition: apt.h:57
apr_uint32_t reserved
Definition: mpf_named_event.h:48
apr_uint32_t edge
Definition: mpf_named_event.h:50
#define MPF_DECLARE(type)
Definition: mpf.h:40
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
Definition: mpf_named_event.h:34
MPF Codec Descriptor.
apr_uint32_t event_id
Definition: mpf_named_event.h:36
mpf_codec_descriptor_t * mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool)
apr_uint32_t volume
Definition: mpf_named_event.h:46
Definition: mpf_codec_descriptor.h:63