OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_FORMATS_MP4_HEVC_H_ |
| 6 #define MEDIA_FORMATS_MP4_HEVC_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "media/base/media_export.h" |
| 13 #include "media/formats/mp4/bitstream_converter.h" |
| 14 |
| 15 namespace media { |
| 16 |
| 17 struct SubsampleEntry; |
| 18 |
| 19 namespace mp4 { |
| 20 |
| 21 struct HEVCDecoderConfigurationRecord; |
| 22 |
| 23 class MEDIA_EXPORT HEVC { |
| 24 public: |
| 25 static bool ConvertConfigToAnnexB( |
| 26 const HEVCDecoderConfigurationRecord& hevc_config, |
| 27 std::vector<uint8>* buffer); |
| 28 |
| 29 static bool InsertParamSetsAnnexB( |
| 30 const HEVCDecoderConfigurationRecord& hevc_config, |
| 31 std::vector<uint8>* buffer, |
| 32 std::vector<SubsampleEntry>* subsamples); |
| 33 |
| 34 // Verifies that the contents of |buffer| conform to |
| 35 // Section 7.4.2.4.4 of ISO/IEC 23008-2. |
| 36 // |subsamples| contains the information about what parts of the buffer are |
| 37 // encrypted and which parts are clear. |
| 38 // Returns true if |buffer| contains conformant Annex B data |
| 39 // TODO(servolk): Remove the std::vector version when we can use, |
| 40 // C++11's std::vector<T>::data() method. |
| 41 static bool IsValidAnnexB(const std::vector<uint8>& buffer, |
| 42 const std::vector<SubsampleEntry>& subsamples); |
| 43 static bool IsValidAnnexB(const uint8* buffer, size_t size, |
| 44 const std::vector<SubsampleEntry>& subsamples); |
| 45 }; |
| 46 |
| 47 class HEVCBitstreamConverter : public BitstreamConverter { |
| 48 public: |
| 49 explicit HEVCBitstreamConverter( |
| 50 scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config); |
| 51 |
| 52 // BitstreamConverter interface |
| 53 bool ConvertFrame(std::vector<uint8>* frame_buf, |
| 54 bool is_keyframe, |
| 55 std::vector<SubsampleEntry>* subsamples) const override; |
| 56 private: |
| 57 ~HEVCBitstreamConverter() override; |
| 58 scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config_; |
| 59 }; |
| 60 |
| 61 } // namespace mp4 |
| 62 } // namespace media |
| 63 |
| 64 #endif // MEDIA_FORMATS_MP4_HEVC_H_ |
OLD | NEW |