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 <stdint.h>
5 
6 #include <vector>
7 
8 #include "packager/media/formats/mp2t/audio_header.h"
9 
10 namespace shaka {
11 namespace media {
12 namespace mp2t {
17 class Mpeg1Header : public AudioHeader {
18  public:
19  Mpeg1Header() = default;
20  ~Mpeg1Header() override = default;
21 
24  bool IsSyncWord(const uint8_t* buf) const override;
25  size_t GetMinFrameSize() const override;
26  size_t GetSamplesPerFrame() const override;
27  bool Parse(const uint8_t* mpeg1_frame, size_t mpeg1_frame_size) override;
28  size_t GetHeaderSize() const override;
29  size_t GetFrameSize() const override;
30  size_t GetFrameSizeWithoutParsing(const uint8_t* data,
31  size_t num_bytes) const override;
32  void GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const override;
33  uint8_t GetObjectType() const override;
34  uint32_t GetSamplingFrequency() const override;
35  uint8_t GetNumChannels() const override;
37 
38  private:
39  Mpeg1Header(const Mpeg1Header&) = delete;
40  Mpeg1Header& operator=(const Mpeg1Header&) = delete;
41 
42  uint8_t version_ = 0;
43  uint8_t layer_ = 0;
44  uint8_t protection_absent_ = 0;
45 
46  uint32_t bitrate_ = 0;
47  uint32_t sample_rate_ = 0; /* in hz */
48  uint8_t padded_ = 0;
49  uint8_t channel_mode_ = 0;
50 };
51 
52 } // namespace mp2t
53 } // namespace media
54 } // namespace shaka
55 
56 #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
Definition: mpeg1_header.cc:94
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.