1/*
2 *  Copyright (c) 2012 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#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_AMR_H_
12#define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_AMR_H_
13
14#include "webrtc/modules/audio_coding/main/acm2/acm_generic_codec.h"
15
16// forward declaration
17struct AMR_encinst_t_;
18struct AMR_decinst_t_;
19
20namespace webrtc {
21
22enum ACMAMRPackingFormat;
23
24namespace acm2 {
25
26class ACMAMR : public ACMGenericCodec {
27 public:
28  explicit ACMAMR(int16_t codec_id);
29  ~ACMAMR();
30
31  // for FEC
32  ACMGenericCodec* CreateInstance(void);
33
34  int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
35
36  int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
37
38  int16_t SetAMREncoderPackingFormat(const ACMAMRPackingFormat packing_format);
39
40  ACMAMRPackingFormat AMREncoderPackingFormat() const;
41
42  int16_t SetAMRDecoderPackingFormat(const ACMAMRPackingFormat packing_format);
43
44  ACMAMRPackingFormat AMRDecoderPackingFormat() const;
45
46 protected:
47  void DestructEncoderSafe();
48
49  int16_t InternalCreateEncoder();
50
51  int16_t SetBitRateSafe(const int32_t rate);
52
53  int16_t EnableDTX();
54
55  int16_t DisableDTX();
56
57  AMR_encinst_t_* encoder_inst_ptr_;
58  int16_t encoding_mode_;
59  int16_t encoding_rate_;
60  ACMAMRPackingFormat encoder_packing_format_;
61};
62
63}  // namespace acm2
64
65}  // namespace webrtc
66
67#endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_AMR_H_
68