OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FORMATS_MP4_AVC_H_ | 5 #ifndef MEDIA_FORMATS_MP4_AVC_H_ |
6 #define MEDIA_FORMATS_MP4_AVC_H_ | 6 #define MEDIA_FORMATS_MP4_AVC_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... | |
24 | 24 |
25 class MEDIA_EXPORT AVC { | 25 class MEDIA_EXPORT AVC { |
26 public: | 26 public: |
27 static bool ConvertFrameToAnnexB(int length_size, | 27 static bool ConvertFrameToAnnexB(int length_size, |
28 std::vector<uint8_t>* buffer, | 28 std::vector<uint8_t>* buffer, |
29 std::vector<SubsampleEntry>* subsamples); | 29 std::vector<SubsampleEntry>* subsamples); |
30 | 30 |
31 // Inserts the SPS & PPS data from |avc_config| into |buffer|. | 31 // Inserts the SPS & PPS data from |avc_config| into |buffer|. |
32 // |buffer| is expected to contain AnnexB conformant data. | 32 // |buffer| is expected to contain AnnexB conformant data. |
33 // |subsamples| contains the SubsampleEntry info if |buffer| contains | 33 // |subsamples| contains the SubsampleEntry info if |buffer| contains |
34 // encrypted data. | 34 // encrypted data. |
wolenetz
2017/01/25 23:42:41
Please add comment for what |annexb_validation| me
erickung1
2017/02/03 18:18:31
Done.
| |
35 // Returns true if the param sets were successfully inserted. | 35 // Returns true if the param sets were successfully inserted. |
36 static bool InsertParamSetsAnnexB( | 36 static bool InsertParamSetsAnnexB( |
37 const AVCDecoderConfigurationRecord& avc_config, | 37 const AVCDecoderConfigurationRecord& avc_config, |
38 std::vector<uint8_t>* buffer, | 38 std::vector<uint8_t>* buffer, |
39 std::vector<SubsampleEntry>* subsamples); | 39 std::vector<SubsampleEntry>* subsamples, |
40 bool annexb_validation); | |
40 | 41 |
41 static bool ConvertConfigToAnnexB( | 42 static bool ConvertConfigToAnnexB( |
42 const AVCDecoderConfigurationRecord& avc_config, | 43 const AVCDecoderConfigurationRecord& avc_config, |
43 std::vector<uint8_t>* buffer); | 44 std::vector<uint8_t>* buffer); |
44 | 45 |
45 // Verifies that the contents of |buffer| conform to | 46 // Verifies that the contents of |buffer| conform to |
46 // Section 7.4.1.2.3 of ISO/IEC 14496-10. | 47 // Section 7.4.1.2.3 of ISO/IEC 14496-10. |
47 // |subsamples| contains the information about what parts of the buffer are | 48 // |subsamples| contains the information about what parts of the buffer are |
48 // encrypted and which parts are clear. | 49 // encrypted and which parts are clear. |
49 // Returns true if |buffer| contains conformant Annex B data | 50 // Returns true if |buffer| contains conformant Annex B data |
(...skipping 13 matching lines...) Expand all Loading... | |
63 }; | 64 }; |
64 | 65 |
65 // AVCBitstreamConverter converts AVC/H.264 bitstream from MP4 container format | 66 // AVCBitstreamConverter converts AVC/H.264 bitstream from MP4 container format |
66 // with embedded NALU lengths into AnnexB bitstream format (described in ISO/IEC | 67 // with embedded NALU lengths into AnnexB bitstream format (described in ISO/IEC |
67 // 14496-10) with 4-byte start codes. It also knows how to handle CENC-encrypted | 68 // 14496-10) with 4-byte start codes. It also knows how to handle CENC-encrypted |
68 // streams and adjusts subsample data for those streams while converting. | 69 // streams and adjusts subsample data for those streams while converting. |
69 class AVCBitstreamConverter : public BitstreamConverter { | 70 class AVCBitstreamConverter : public BitstreamConverter { |
70 public: | 71 public: |
71 explicit AVCBitstreamConverter( | 72 explicit AVCBitstreamConverter( |
72 std::unique_ptr<AVCDecoderConfigurationRecord> avc_config); | 73 std::unique_ptr<AVCDecoderConfigurationRecord> avc_config); |
74 void DisablePostAnnexbValidation() { post_annexb_validation_ = false; } | |
wolenetz
2017/01/25 23:42:41
Please add comment describing the effect of this n
erickung1
2017/02/03 18:18:31
Done.
| |
73 | 75 |
74 // BitstreamConverter interface | 76 // BitstreamConverter interface |
75 bool ConvertFrame(std::vector<uint8_t>* frame_buf, | 77 bool ConvertFrame(std::vector<uint8_t>* frame_buf, |
76 bool is_keyframe, | 78 bool is_keyframe, |
77 std::vector<SubsampleEntry>* subsamples) const override; | 79 std::vector<SubsampleEntry>* subsamples) const override; |
78 | 80 |
79 private: | 81 private: |
80 ~AVCBitstreamConverter() override; | 82 ~AVCBitstreamConverter() override; |
81 std::unique_ptr<AVCDecoderConfigurationRecord> avc_config_; | 83 std::unique_ptr<AVCDecoderConfigurationRecord> avc_config_; |
84 bool post_annexb_validation_; | |
wolenetz
2017/01/25 23:42:41
Please add comment describing this new field.
erickung1
2017/02/03 18:18:31
Done.
| |
82 }; | 85 }; |
83 | 86 |
84 } // namespace mp4 | 87 } // namespace mp4 |
85 } // namespace media | 88 } // namespace media |
86 | 89 |
87 #endif // MEDIA_FORMATS_MP4_AVC_H_ | 90 #endif // MEDIA_FORMATS_MP4_AVC_H_ |
OLD | NEW |