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  void GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const override;
36  uint8_t GetObjectType() const override;
37  uint32_t GetSamplingFrequency() const override;
38  uint8_t GetNumChannels() const override;
40 
41  private:
42  Ac3Header(const Ac3Header&) = delete;
43  Ac3Header& operator=(const Ac3Header&) = delete;
44 
45  uint8_t fscod_ = 0; // Sample rate code
46  uint8_t frmsizecod_ = 0; // Frame size code
47  uint8_t bsid_ = 0; // Bit stream identification
48  uint8_t bsmod_ = 0; // Bit stream mode
49  uint8_t acmod_ = 0; // Audio coding mode
50  uint8_t lfeon_ = 0; // Low frequency effects channel on
51 };
52 
53 } // namespace mp2t
54 } // namespace media
55 } // namespace shaka
56 
57 #endif // PACKAGER_MEDIA_FORMATS_MP2T_AC3_HEADER_H_
size_t GetHeaderSize() const override
Definition: ac3_header.cc:99
bool IsSyncWord(const uint8_t *buf) const override
Definition: ac3_header.cc:44
All the methods that are virtual are virtual for mocking.
size_t GetMinFrameSize() const override
Definition: ac3_header.cc:50
uint32_t GetSamplingFrequency() const override
Definition: ac3_header.cc:131
size_t GetFrameSize() const override
Definition: ac3_header.cc:105
uint8_t GetObjectType() const override
Definition: ac3_header.cc:126
bool Parse(const uint8_t *adts_frame, size_t adts_frame_size) override
Definition: ac3_header.cc:63
size_t GetSamplesPerFrame() const override
Definition: ac3_header.cc:56
uint8_t GetNumChannels() const override
Definition: ac3_header.cc:136
void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override
Definition: ac3_header.cc:111