DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
adts_header.h
1 // Copyright 2014 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 MEDIA_FORMATS_MP2T_ADTS_HEADER_H_
8 #define MEDIA_FORMATS_MP2T_ADTS_HEADER_H_
9 
10 #include <stdint.h>
11 
12 #include <vector>
13 
14 #include "packager/base/macros.h"
15 
16 namespace shaka {
17 namespace media {
18 namespace mp2t {
19 
22 class AdtsHeader {
23  public:
24  AdtsHeader();
25  ~AdtsHeader() {}
26 
32  static size_t GetAdtsFrameSize(const uint8_t* data, size_t num_bytes);
33 
38  static size_t GetAdtsHeaderSize(const uint8_t* data, size_t num_bytes);
39 
45  bool Parse(const uint8_t* adts_frame, size_t adts_frame_size);
46 
52  bool GetAudioSpecificConfig(std::vector<uint8_t>* buffer) const;
53 
55  uint8_t GetObjectType() const;
56 
58  uint32_t GetSamplingFrequency() const;
59 
61  uint8_t GetNumChannels() const;
62 
63  private:
64  bool valid_config_;
65  uint8_t profile_;
66  uint8_t sampling_frequency_index_;
67  uint8_t channel_configuration_;
68 
69  DISALLOW_COPY_AND_ASSIGN(AdtsHeader);
70 };
71 
72 } // namespace mp2t
73 } // namespace media
74 } // namespace shaka
75 
76 #endif // MEDIA_FORMATS_MP2T_ADTS_HEADER_H_
uint8_t GetObjectType() const
Definition: adts_header.cc:97
uint8_t GetNumChannels() const
Definition: adts_header.cc:106
bool Parse(const uint8_t *adts_frame, size_t adts_frame_size)
Definition: adts_header.cc:39
uint32_t GetSamplingFrequency() const
Definition: adts_header.cc:101
static size_t GetAdtsFrameSize(const uint8_t *data, size_t num_bytes)
Definition: adts_header.cc:23
bool GetAudioSpecificConfig(std::vector< uint8_t > *buffer) const
Definition: adts_header.cc:85
static size_t GetAdtsHeaderSize(const uint8_t *data, size_t num_bytes)
Definition: adts_header.cc:31