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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
| 14 |
| 15 struct SubsampleEntry; |
| 16 |
14 namespace mp4 { | 17 namespace mp4 { |
15 | 18 |
16 struct AVCDecoderConfigurationRecord; | 19 struct AVCDecoderConfigurationRecord; |
17 | 20 |
18 class MEDIA_EXPORT AVC { | 21 class MEDIA_EXPORT AVC { |
19 public: | 22 public: |
20 static bool ConvertFrameToAnnexB(int length_size, std::vector<uint8>* buffer); | 23 static bool ConvertFrameToAnnexB(int length_size, std::vector<uint8>* buffer); |
21 | 24 |
| 25 // Inserts the SPS & PPS data from |avc_config| into |buffer|. |
| 26 // |buffer| is expected to contain AnnexB conformant data. |
| 27 // |subsamples| contains the SubsampleEntry info if |buffer| contains |
| 28 // encrypted data. |
| 29 // Returns true if the param sets were successfully inserted. |
| 30 static bool InsertParamSetsAnnexB( |
| 31 const AVCDecoderConfigurationRecord& avc_config, |
| 32 std::vector<uint8>* buffer, |
| 33 std::vector<SubsampleEntry>* subsamples); |
| 34 |
22 static bool ConvertConfigToAnnexB( | 35 static bool ConvertConfigToAnnexB( |
23 const AVCDecoderConfigurationRecord& avc_config, | 36 const AVCDecoderConfigurationRecord& avc_config, |
24 std::vector<uint8>* buffer); | 37 std::vector<uint8>* buffer, |
| 38 std::vector<SubsampleEntry>* subsamples); |
| 39 |
| 40 // Verifies that the contents of |buffer| conform to |
| 41 // Section 7.4.1.2.3 of ISO/IEC 14496-10. |
| 42 // Returns true if |buffer| contains conformant AnnexB data. |
| 43 static bool IsValidAnnexB(const std::vector<uint8>& buffer); |
25 }; | 44 }; |
26 | 45 |
27 } // namespace mp4 | 46 } // namespace mp4 |
28 } // namespace media | 47 } // namespace media |
29 | 48 |
30 #endif // MEDIA_FORMATS_MP4_AVC_H_ | 49 #endif // MEDIA_FORMATS_MP4_AVC_H_ |
OLD | NEW |