13f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org/*
23f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
33f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org *
43f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org *  Use of this source code is governed by a BSD-style license
53f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org *  that can be found in the LICENSE file in the root of the source
63f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org *  tree. An additional intellectual property rights grant can be found
73f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org *  in the file PATENTS.  All contributing project authors may
83f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
93f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org */
103f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
11ed0b4fb2f28fa291e726fc1cf6852611f2176392turaj@webrtc.org#ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
12ed0b4fb2f28fa291e726fc1cf6852611f2176392turaj@webrtc.org#define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
133f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
14d54aa969545bd9c5ccc0077dd6645e742bf11418pbos@webrtc.org#include "webrtc/base/thread_annotations.h"
15ed0b4fb2f28fa291e726fc1cf6852611f2176392turaj@webrtc.org#include "webrtc/modules/audio_coding/main/acm2/acm_generic_codec.h"
163f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
173f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.orgtypedef struct WebRtcG722EncInst G722EncInst;
183f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.orgtypedef struct WebRtcG722DecInst G722DecInst;
193f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
203f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.orgnamespace webrtc {
213f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
220a1c75a50d10621f70d5921c5b8b9c0eb144bb42turaj@webrtc.orgnamespace acm2 {
230a1c75a50d10621f70d5921c5b8b9c0eb144bb42turaj@webrtc.org
243f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org// Forward declaration.
253f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.orgstruct ACMG722EncStr;
263f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.orgstruct ACMG722DecStr;
273f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
283f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.orgclass ACMG722 : public ACMGenericCodec {
293f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org public:
303f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  explicit ACMG722(int16_t codec_id);
313f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  ~ACMG722();
323f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
333f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  // For FEC.
343f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  ACMGenericCodec* CreateInstance(void);
353f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
3647b4b9d94cafb22e19bc8a6e6ca83b0568dcb973henrik.lundin@webrtc.org  int16_t InternalEncode(uint8_t* bitstream,
3747b4b9d94cafb22e19bc8a6e6ca83b0568dcb973henrik.lundin@webrtc.org                         int16_t* bitstream_len_byte) OVERRIDE
3847b4b9d94cafb22e19bc8a6e6ca83b0568dcb973henrik.lundin@webrtc.org      EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
393f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
403f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
413f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
423f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org protected:
433f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  int32_t Add10MsDataSafe(const uint32_t timestamp,
443f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org                          const int16_t* data,
453f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org                          const uint16_t length_smpl,
460c145390636e0936dadd96d9c34087577e69d95ahenrik.lundin@webrtc.org                          const uint8_t audio_channel)
470c145390636e0936dadd96d9c34087577e69d95ahenrik.lundin@webrtc.org      EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
483f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
4947b4b9d94cafb22e19bc8a6e6ca83b0568dcb973henrik.lundin@webrtc.org  void DestructEncoderSafe() OVERRIDE
5047b4b9d94cafb22e19bc8a6e6ca83b0568dcb973henrik.lundin@webrtc.org      EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
513f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
523f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  int16_t InternalCreateEncoder();
533f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
543f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  ACMG722EncStr* ptr_enc_str_;
553f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
563f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  G722EncInst* encoder_inst_ptr_;
573f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org  G722EncInst* encoder_inst_ptr_right_;  // Prepared for stereo
583f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org};
593f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
600a1c75a50d10621f70d5921c5b8b9c0eb144bb42turaj@webrtc.org}  // namespace acm2
610a1c75a50d10621f70d5921c5b8b9c0eb144bb42turaj@webrtc.org
623f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org}  // namespace webrtc
633f39c00d9875d7e09062725757b789f4da375ef9turaj@webrtc.org
64ed0b4fb2f28fa291e726fc1cf6852611f2176392turaj@webrtc.org#endif  // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_G722_H_
65