Shaka Packager SDK
ac3_header.h
1 // Copyright 2017 Google LLC. 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 <cstdint>
11 #include <vector>
12 
13 #include <packager/media/formats/mp2t/audio_header.h>
14 
15 namespace shaka {
16 namespace media {
17 namespace mp2t {
18 
21 class Ac3Header : public AudioHeader {
22  public:
23  Ac3Header() = default;
24  ~Ac3Header() override = default;
25 
28  bool IsSyncWord(const uint8_t* buf) const override;
29  size_t GetMinFrameSize() const override;
30  size_t GetSamplesPerFrame() const override;
31  bool Parse(const uint8_t* adts_frame, size_t adts_frame_size) override;
32  size_t GetHeaderSize() const override;
33  size_t GetFrameSize() const override;
34  size_t GetFrameSizeWithoutParsing(const uint8_t* data,
35  size_t num_bytes) const override;
36  void GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const override;
37  uint8_t GetObjectType() const override;
38  uint32_t GetSamplingFrequency() const override;
39  uint8_t GetNumChannels() const override;
41 
42  private:
43  Ac3Header(const Ac3Header&) = delete;
44  Ac3Header& operator=(const Ac3Header&) = delete;
45 
46  uint8_t fscod_ = 0; // Sample rate code
47  uint8_t frmsizecod_ = 0; // Frame size code
48  uint8_t bsid_ = 0; // Bit stream identification
49  uint8_t bsmod_ = 0; // Bit stream mode
50  uint8_t acmod_ = 0; // Audio coding mode
51  uint8_t lfeon_ = 0; // Low frequency effects channel on
52 };
53 
54 } // namespace mp2t
55 } // namespace media
56 } // namespace shaka
57 
58 #endif // PACKAGER_MEDIA_FORMATS_MP2T_AC3_HEADER_H_
bool Parse(const uint8_t *adts_frame, size_t adts_frame_size) override
Definition: ac3_header.cc:79
size_t GetMinFrameSize() const override
Definition: ac3_header.cc:66
bool IsSyncWord(const uint8_t *buf) const override
Definition: ac3_header.cc:60
uint8_t GetObjectType() const override
Definition: ac3_header.cc:148
size_t GetHeaderSize() const override
Definition: ac3_header.cc:115
size_t GetFrameSize() const override
Definition: ac3_header.cc:121
size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const override
Definition: ac3_header.cc:125
void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override
Definition: ac3_header.cc:133
uint32_t GetSamplingFrequency() const override
Definition: ac3_header.cc:153
uint8_t GetNumChannels() const override
Definition: ac3_header.cc:158
size_t GetSamplesPerFrame() const override
Definition: ac3_header.cc:72
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66