Shaka Packager SDK
adts_header.h
1 // Copyright 2014 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_ADTS_HEADER_H_
8 #define PACKAGER_MEDIA_FORMATS_MP2T_ADTS_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 AdtsHeader : public AudioHeader {
22  public:
23  AdtsHeader() = default;
24  ~AdtsHeader() 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  AdtsHeader(const AdtsHeader&) = delete;
44  AdtsHeader& operator=(const AdtsHeader&) = delete;
45 
46  uint8_t protection_absent_ = 0;
47  uint16_t frame_size_ = 0;
48  uint8_t profile_ = 0;
49  uint8_t sampling_frequency_index_ = 0;
50  uint8_t channel_configuration_ = 0;
51 };
52 
53 } // namespace mp2t
54 } // namespace media
55 } // namespace shaka
56 
57 #endif // PACKAGER_MEDIA_FORMATS_MP2T_ADTS_HEADER_H_
size_t GetSamplesPerFrame() const override
Definition: adts_header.cc:44
uint8_t GetNumChannels() const override
Definition: adts_header.cc:120
void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override
Definition: adts_header.cc:101
size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const override
Definition: adts_header.cc:94
size_t GetHeaderSize() const override
Definition: adts_header.cc:85
bool IsSyncWord(const uint8_t *buf) const override
Definition: adts_header.cc:36
bool Parse(const uint8_t *adts_frame, size_t adts_frame_size) override
Definition: adts_header.cc:49
size_t GetMinFrameSize() const override
Definition: adts_header.cc:40
uint8_t GetObjectType() const override
Definition: adts_header.cc:111
size_t GetFrameSize() const override
Definition: adts_header.cc:90
uint32_t GetSamplingFrequency() const override
Definition: adts_header.cc:115
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66