Shaka Packager SDK
audio_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_AUDIO_HEADER_H_
8 #define PACKAGER_MEDIA_FORMATS_MP2T_AUDIO_HEADER_H_
9 
10 #include <stddef.h>
11 #include <stdint.h>
12 
13 #include <vector>
14 
15 namespace shaka {
16 namespace media {
17 namespace mp2t {
18 
19 class AudioHeader {
20  public:
21  AudioHeader() = default;
22  virtual ~AudioHeader() = default;
23 
27  virtual bool IsSyncWord(const uint8_t* buf) const = 0;
28 
30  virtual size_t GetMinFrameSize() const = 0;
31 
33  virtual size_t GetSamplesPerFrame() const = 0;
34 
43  virtual bool Parse(const uint8_t* audio_frame, size_t audio_frame_size) = 0;
44 
47  virtual size_t GetHeaderSize() const = 0;
48 
51  virtual size_t GetFrameSize() const = 0;
52 
56  virtual size_t GetFrameSizeWithoutParsing(const uint8_t* data,
57  size_t num_bytes) const = 0;
58 
65  virtual void GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const = 0;
66 
69  virtual uint8_t GetObjectType() const = 0;
70 
73  virtual uint32_t GetSamplingFrequency() const = 0;
74 
77  virtual uint8_t GetNumChannels() const = 0;
78 
79  private:
80  AudioHeader(const AudioHeader&) = delete;
81  AudioHeader& operator=(const AudioHeader&) = delete;
82 };
83 
84 } // namespace mp2t
85 } // namespace media
86 } // namespace shaka
87 
88 #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.