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  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  AdtsHeader(const AdtsHeader&) = delete;
45  AdtsHeader& operator=(const AdtsHeader&) = delete;
46 
47  uint8_t protection_absent_ = 0;
48  uint16_t frame_size_ = 0;
49  uint8_t profile_ = 0;
50  uint8_t sampling_frequency_index_ = 0;
51  uint8_t channel_configuration_ = 0;
52 };
53 
54 } // namespace mp2t
55 } // namespace media
56 } // namespace shaka
57 
58 #endif // PACKAGER_MEDIA_FORMATS_MP2T_ADTS_HEADER_H_
size_t GetHeaderSize() const override
Definition: adts_header.cc:82
uint8_t GetObjectType() const override
Definition: adts_header.cc:108
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:117
uint32_t GetSamplingFrequency() const override
Definition: adts_header.cc:112
void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override
Definition: adts_header.cc:98
size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const override
Definition: adts_header.cc:91
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:87