1817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org/*
2817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org *
4817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org *  Use of this source code is governed by a BSD-style license
5817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org *  that can be found in the LICENSE file in the root of the source
6817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org *  tree. An additional intellectual property rights grant can be found
7817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org *  in the file PATENTS.  All contributing project authors may
8817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org */
10817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
113c652b67468d182bd36aee4c31557621be50cc92kjellander@webrtc.org#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_
123c652b67468d182bd36aee4c31557621be50cc92kjellander@webrtc.org#define WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_
13817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
14dcccab3ebb623df74fbb1425da2cb9d9a42439faKarl Wiberg#include "webrtc/base/scoped_ptr.h"
153c652b67468d182bd36aee4c31557621be50cc92kjellander@webrtc.org#include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
16817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
17817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.orgnamespace webrtc {
18817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
1912cfc9b4dacd6942377df1f29a64bdbec591920ekwibergstruct CodecInst;
2012cfc9b4dacd6942377df1f29a64bdbec591920ekwiberg
213e89dbf45835896c8fd89f235f396d03bc2e6065Henrik Lundinclass AudioEncoderPcm16B final : public AudioEncoderPcm {
22817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org public:
23817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org  struct Config : public AudioEncoderPcm::Config {
24817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org   public:
25817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org    Config() : AudioEncoderPcm::Config(107), sample_rate_hz(8000) {}
26dcccab3ebb623df74fbb1425da2cb9d9a42439faKarl Wiberg    bool IsOk() const;
27817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
28817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org    int sample_rate_hz;
29817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org  };
30817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
31817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org  explicit AudioEncoderPcm16B(const Config& config)
32817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org      : AudioEncoderPcm(config, config.sample_rate_hz) {}
3312cfc9b4dacd6942377df1f29a64bdbec591920ekwiberg  explicit AudioEncoderPcm16B(const CodecInst& codec_inst);
34817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
35817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org protected:
36dce40cf804019a9898b6ab8d8262466b697c56e0Peter Kasting  size_t EncodeCall(const int16_t* audio,
37dce40cf804019a9898b6ab8d8262466b697c56e0Peter Kasting                    size_t input_len,
38dce40cf804019a9898b6ab8d8262466b697c56e0Peter Kasting                    uint8_t* encoded) override;
393e89dbf45835896c8fd89f235f396d03bc2e6065Henrik Lundin
4025702cb1628941427fa55e528f53483f239ae011pkasting  size_t BytesPerSample() const override;
418967183bf79322c5cb3cbd99e9b7aa298228d0a2kwiberg
423c652b67468d182bd36aee4c31557621be50cc92kjellander@webrtc.org private:
438967183bf79322c5cb3cbd99e9b7aa298228d0a2kwiberg  RTC_DISALLOW_COPY_AND_ASSIGN(AudioEncoderPcm16B);
44817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org};
45817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org
46817e50dd7d0a703fe537c63ea324d2d6c8f4cd0ehenrik.lundin@webrtc.org}  // namespace webrtc
478967183bf79322c5cb3cbd99e9b7aa298228d0a2kwiberg
483c652b67468d182bd36aee4c31557621be50cc92kjellander@webrtc.org#endif  // WEBRTC_MODULES_AUDIO_CODING_CODECS_PCM16B_AUDIO_ENCODER_PCM16B_H_
49