Shaka Packager SDK
audio_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_AUDIO_HEADER_H_
8 #define PACKAGER_MEDIA_FORMATS_MP2T_AUDIO_HEADER_H_
9 
10 #include <cstddef>
11 #include <cstdint>
12 #include <vector>
13 
14 namespace shaka {
15 namespace media {
16 namespace mp2t {
17 
18 class AudioHeader {
19  public:
20  AudioHeader() = default;
21  virtual ~AudioHeader() = default;
22 
26  virtual bool IsSyncWord(const uint8_t* buf) const = 0;
27 
29  virtual size_t GetMinFrameSize() const = 0;
30 
32  virtual size_t GetSamplesPerFrame() const = 0;
33 
42  virtual bool Parse(const uint8_t* audio_frame, size_t audio_frame_size) = 0;
43 
46  virtual size_t GetHeaderSize() const = 0;
47 
50  virtual size_t GetFrameSize() const = 0;
51 
55  virtual size_t GetFrameSizeWithoutParsing(const uint8_t* data,
56  size_t num_bytes) const = 0;
57 
64  virtual void GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const = 0;
65 
68  virtual uint8_t GetObjectType() const = 0;
69 
72  virtual uint32_t GetSamplingFrequency() const = 0;
73 
76  virtual uint8_t GetNumChannels() const = 0;
77 
78  private:
79  AudioHeader(const AudioHeader&) = delete;
80  AudioHeader& operator=(const AudioHeader&) = delete;
81 };
82 
83 } // namespace mp2t
84 } // namespace media
85 } // namespace shaka
86 
87 #endif // PACKAGER_MEDIA_FORMATS_MP2T_AUDIO_HEADER_H_
virtual bool IsSyncWord(const uint8_t *buf) const =0
virtual bool Parse(const uint8_t *audio_frame, size_t audio_frame_size)=0
virtual uint8_t GetNumChannels() const =0
virtual size_t GetHeaderSize() const =0
virtual void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const =0
virtual size_t GetMinFrameSize() const =0
virtual uint8_t GetObjectType() const =0
virtual size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const =0
virtual size_t GetSamplesPerFrame() const =0
virtual uint32_t GetSamplingFrequency() const =0
virtual size_t GetFrameSize() const =0
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66