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