Shaka Packager SDK
ac3_header.h
1 // Copyright 2017 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_FORMATS_MP2T_AC3_HEADER_H_
8 #define PACKAGER_MEDIA_FORMATS_MP2T_AC3_HEADER_H_
9 
10 #include <stdint.h>
11 
12 #include <vector>
13 
14 #include "packager/media/formats/mp2t/audio_header.h"
15 
16 namespace shaka {
17 namespace media {
18 namespace mp2t {
19 
22 class Ac3Header : public AudioHeader {
23  public:
24  Ac3Header() = default;
25  ~Ac3Header() override = default;
26 
29  bool IsSyncWord(const uint8_t* buf) const override;
30  size_t GetMinFrameSize() const override;
31  size_t GetSamplesPerFrame() const override;
32  bool Parse(const uint8_t* adts_frame, size_t adts_frame_size) override;
33  size_t GetHeaderSize() const override;
34  size_t GetFrameSize() const override;
35  size_t GetFrameSizeWithoutParsing(const uint8_t* data,
36  size_t num_bytes) const override;
37  void GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const override;
38  uint8_t GetObjectType() const override;
39  uint32_t GetSamplingFrequency() const override;
40  uint8_t GetNumChannels() const override;
42 
43  private:
44  Ac3Header(const Ac3Header&) = delete;
45  Ac3Header& operator=(const Ac3Header&) = delete;
46 
47  uint8_t fscod_ = 0; // Sample rate code
48  uint8_t frmsizecod_ = 0; // Frame size code
49  uint8_t bsid_ = 0; // Bit stream identification
50  uint8_t bsmod_ = 0; // Bit stream mode
51  uint8_t acmod_ = 0; // Audio coding mode
52  uint8_t lfeon_ = 0; // Low frequency effects channel on
53 };
54 
55 } // namespace mp2t
56 } // namespace media
57 } // namespace shaka
58 
59 #endif // PACKAGER_MEDIA_FORMATS_MP2T_AC3_HEADER_H_
shaka::media::mp2t::Ac3Header
Definition: ac3_header.h:22
shaka::media::mp2t::Ac3Header::GetHeaderSize
size_t GetHeaderSize() const override
Definition: ac3_header.cc:113
shaka::media::mp2t::Ac3Header::GetFrameSizeWithoutParsing
size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const override
Definition: ac3_header.cc:123
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::media::mp2t::AudioHeader
Definition: audio_header.h:19
shaka::media::mp2t::Ac3Header::IsSyncWord
bool IsSyncWord(const uint8_t *buf) const override
Definition: ac3_header.cc:58
shaka::media::mp2t::Ac3Header::GetMinFrameSize
size_t GetMinFrameSize() const override
Definition: ac3_header.cc:64
shaka::media::mp2t::Ac3Header::GetSamplingFrequency
uint32_t GetSamplingFrequency() const override
Definition: ac3_header.cc:151
shaka::media::mp2t::Ac3Header::GetFrameSize
size_t GetFrameSize() const override
Definition: ac3_header.cc:119
shaka::media::mp2t::Ac3Header::GetObjectType
uint8_t GetObjectType() const override
Definition: ac3_header.cc:146
shaka::media::mp2t::Ac3Header::Parse
bool Parse(const uint8_t *adts_frame, size_t adts_frame_size) override
Definition: ac3_header.cc:77
shaka::media::mp2t::Ac3Header::GetSamplesPerFrame
size_t GetSamplesPerFrame() const override
Definition: ac3_header.cc:70
shaka::media::mp2t::Ac3Header::GetNumChannels
uint8_t GetNumChannels() const override
Definition: ac3_header.cc:156
shaka::media::mp2t::Ac3Header::GetAudioSpecificConfig
void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override
Definition: ac3_header.cc:131