Home | History | Annotate | Download | only in acm2
      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_G722_H_
     12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
     13 
     14 #include "webrtc/base/thread_annotations.h"
     15 #include "webrtc/modules/audio_coding/main/acm2/acm_generic_codec.h"
     16 
     17 typedef struct WebRtcG722EncInst G722EncInst;
     18 typedef struct WebRtcG722DecInst G722DecInst;
     19 
     20 namespace webrtc {
     21 
     22 namespace acm2 {
     23 
     24 // Forward declaration.
     25 struct ACMG722EncStr;
     26 struct ACMG722DecStr;
     27 
     28 class ACMG722 : public ACMGenericCodec {
     29  public:
     30   explicit ACMG722(int16_t codec_id);
     31   ~ACMG722();
     32 
     33   // For FEC.
     34   ACMGenericCodec* CreateInstance(void);
     35 
     36   int16_t InternalEncode(uint8_t* bitstream,
     37                          int16_t* bitstream_len_byte) OVERRIDE
     38       EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
     39 
     40   int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
     41 
     42  protected:
     43   int32_t Add10MsDataSafe(const uint32_t timestamp,
     44                           const int16_t* data,
     45                           const uint16_t length_smpl,
     46                           const uint8_t audio_channel)
     47       EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
     48 
     49   void DestructEncoderSafe() OVERRIDE
     50       EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
     51 
     52   int16_t InternalCreateEncoder();
     53 
     54   ACMG722EncStr* ptr_enc_str_;
     55 
     56   G722EncInst* encoder_inst_ptr_;
     57   G722EncInst* encoder_inst_ptr_right_;  // Prepared for stereo
     58 };
     59 
     60 }  // namespace acm2
     61 
     62 }  // namespace webrtc
     63 
     64 #endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
     65