Shaka Packager SDK
mpeg1_header.h
1 #ifndef PACKAGER_MEDIA_FORMATS_MP2T_MPEG1_HEADER_H_
2 #define PACKAGER_MEDIA_FORMATS_MP2T_MPEG1_HEADER_H_
3 
4 #include <cstdint>
5 #include <vector>
6 
7 #include <packager/media/formats/mp2t/audio_header.h>
8 
9 namespace shaka {
10 namespace media {
11 namespace mp2t {
16 class Mpeg1Header : public AudioHeader {
17  public:
18  Mpeg1Header() = default;
19  ~Mpeg1Header() override = default;
20 
23  bool IsSyncWord(const uint8_t* buf) const override;
24  size_t GetMinFrameSize() const override;
25  size_t GetSamplesPerFrame() const override;
26  bool Parse(const uint8_t* mpeg1_frame, size_t mpeg1_frame_size) override;
27  size_t GetHeaderSize() const override;
28  size_t GetFrameSize() const override;
29  size_t GetFrameSizeWithoutParsing(const uint8_t* data,
30  size_t num_bytes) const override;
31  void GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const override;
32  uint8_t GetObjectType() const override;
33  uint32_t GetSamplingFrequency() const override;
34  uint8_t GetNumChannels() const override;
36 
37  private:
38  Mpeg1Header(const Mpeg1Header&) = delete;
39  Mpeg1Header& operator=(const Mpeg1Header&) = delete;
40 
41  uint8_t version_ = 0;
42  uint8_t layer_ = 0;
43  uint8_t protection_absent_ = 0;
44 
45  uint32_t bitrate_ = 0;
46  uint32_t sample_rate_ = 0; /* in hz */
47  uint8_t padded_ = 0;
48  uint8_t channel_mode_ = 0;
49 };
50 
51 } // namespace mp2t
52 } // namespace media
53 } // namespace shaka
54 
55 #endif // PACKAGER_MEDIA_FORMATS_MP2T_MPEG1_HEADER_H_
size_t GetMinFrameSize() const override
size_t GetFrameSize() const override
void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override
size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const override
bool IsSyncWord(const uint8_t *buf) const override
uint8_t GetObjectType() const override
uint8_t GetNumChannels() const override
size_t GetSamplesPerFrame() const override
uint32_t GetSamplingFrequency() const override
bool Parse(const uint8_t *mpeg1_frame, size_t mpeg1_frame_size) override
size_t GetHeaderSize() const override
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66