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_
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::media::mp2t::Mpeg1Header::GetObjectType
uint8_t GetObjectType() const override
Definition: mpeg1_header.cc:218
shaka::media::mp2t::AudioHeader
Definition: audio_header.h:19
shaka::media::mp2t::Mpeg1Header::GetMinFrameSize
size_t GetMinFrameSize() const override
Definition: mpeg1_header.cc:103
shaka::media::mp2t::Mpeg1Header::GetAudioSpecificConfig
void GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const override
Definition: mpeg1_header.cc:182
shaka::media::mp2t::Mpeg1Header::GetNumChannels
uint8_t GetNumChannels() const override
Definition: mpeg1_header.cc:235
shaka::media::mp2t::Mpeg1Header::GetSamplesPerFrame
size_t GetSamplesPerFrame() const override
Definition: mpeg1_header.cc:107
shaka::media::mp2t::Mpeg1Header::GetFrameSizeWithoutParsing
size_t GetFrameSizeWithoutParsing(const uint8_t *data, size_t num_bytes) const override
Definition: mpeg1_header.cc:164
shaka::media::mp2t::Mpeg1Header::IsSyncWord
bool IsSyncWord(const uint8_t *buf) const override
Definition: mpeg1_header.cc:94
shaka::media::mp2t::Mpeg1Header::GetFrameSize
size_t GetFrameSize() const override
Definition: mpeg1_header.cc:160
shaka::media::mp2t::Mpeg1Header::Parse
bool Parse(const uint8_t *mpeg1_frame, size_t mpeg1_frame_size) override
Definition: mpeg1_header.cc:113
shaka::media::mp2t::Mpeg1Header
Definition: mpeg1_header.h:17
shaka::media::mp2t::Mpeg1Header::GetSamplingFrequency
uint32_t GetSamplingFrequency() const override
Definition: mpeg1_header.cc:231
shaka::media::mp2t::Mpeg1Header::GetHeaderSize
size_t GetHeaderSize() const override
Definition: mpeg1_header.cc:154