blob: 99c9e6a499bbe9f90a3acdb3c093f4f9e3f08b96 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11/*
12 * Packet buffer for DTMF messages.
13 */
14
15#ifndef DTMF_BUFFER_H
16#define DTMF_BUFFER_H
17
18#include "typedefs.h"
19
20#include "neteq_defines.h"
21
22/* Include this code only if ATEVENT (DTMF) is defined in */
23#ifdef NETEQ_ATEVENT_DECODE
24
25#define MAX_DTMF_QUEUE_SIZE 4
26
27typedef struct dtmf_inst_t_
28{
pbos@webrtc.org0946a562013-04-09 00:28:06 +000029 int16_t MaxPLCtime;
30 int16_t CurrentPLCtime;
31 int16_t EventQueue[MAX_DTMF_QUEUE_SIZE];
32 int16_t EventQueueVolume[MAX_DTMF_QUEUE_SIZE];
33 int16_t EventQueueEnded[MAX_DTMF_QUEUE_SIZE];
34 uint32_t EventQueueStartTime[MAX_DTMF_QUEUE_SIZE];
35 uint32_t EventQueueEndTime[MAX_DTMF_QUEUE_SIZE];
36 int16_t EventBufferSize;
37 int16_t framelen;
niklase@google.com470e71d2011-07-07 08:21:25 +000038} dtmf_inst_t;
39
40/****************************************************************************
41 * WebRtcNetEQ_DtmfDecoderInit(...)
42 *
43 * This function initializes a DTMF instance.
44 *
45 * Input:
46 * - DTMF_decinst_t : DTMF instance
47 * - fs : The sample rate used for the DTMF
48 * - MaxPLCtime : Maximum length for a PLC before zeros should be inserted
49 *
50 * Return value : 0 - Ok
51 * -1 - Error
52 */
53
pbos@webrtc.org0946a562013-04-09 00:28:06 +000054int16_t WebRtcNetEQ_DtmfDecoderInit(dtmf_inst_t *DTMFdec_inst, uint16_t fs,
55 int16_t MaxPLCtime);
niklase@google.com470e71d2011-07-07 08:21:25 +000056
57/****************************************************************************
58 * WebRtcNetEQ_DtmfInsertEvent(...)
59 *
60 * This function decodes a packet with DTMF frames.
61 *
62 * Input:
63 * - DTMFdec_inst : DTMF instance
64 * - encoded : Encoded DTMF frame(s)
65 * - len : Bytes in encoded vector
66 *
67 *
68 * Return value : 0 - Ok
69 * -1 - Error
70 */
71
pbos@webrtc.org0946a562013-04-09 00:28:06 +000072int16_t WebRtcNetEQ_DtmfInsertEvent(dtmf_inst_t *DTMFdec_inst,
73 const int16_t *encoded, int16_t len,
74 uint32_t timeStamp);
niklase@google.com470e71d2011-07-07 08:21:25 +000075
76/****************************************************************************
77 * WebRtcNetEQ_DtmfDecode(...)
78 *
79 * This function decodes a packet with DTMF frame(s). Output will be the
80 * event that should be played for next 10 ms.
81 *
82 * Input:
83 * - DTMFdec_inst : DTMF instance
84 * - currTimeStamp : The current playout timestamp
85 *
86 * Output:
87 * - event : Event number to be played
88 * - volume : Event volume to be played
89 *
90 * Return value : >0 - There is a event to be played
91 * 0 - No event to be played
92 * -1 - Error
93 */
94
pbos@webrtc.org0946a562013-04-09 00:28:06 +000095int16_t WebRtcNetEQ_DtmfDecode(dtmf_inst_t *DTMFdec_inst, int16_t *event,
96 int16_t *volume, uint32_t currTimeStamp);
niklase@google.com470e71d2011-07-07 08:21:25 +000097
98#endif /* NETEQ_ATEVENT_DECODE */
99
100#endif /* DTMF_BUFFER_H */
101