Index: media/formats/mp4/hevc.h |
diff --git a/media/formats/mp4/hevc.h b/media/formats/mp4/hevc.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4776f14c67b36e860a0782d797054d2dea2b7de7 |
--- /dev/null |
+++ b/media/formats/mp4/hevc.h |
@@ -0,0 +1,64 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_FORMATS_MP4_HEVC_H_ |
+#define MEDIA_FORMATS_MP4_HEVC_H_ |
+ |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "media/base/media_export.h" |
+#include "media/formats/mp4/bitstream_converter.h" |
+ |
+namespace media { |
+ |
+struct SubsampleEntry; |
+ |
+namespace mp4 { |
+ |
+struct HEVCDecoderConfigurationRecord; |
+ |
+class MEDIA_EXPORT HEVC { |
+ public: |
+ static bool ConvertConfigToAnnexB( |
+ const HEVCDecoderConfigurationRecord& hevc_config, |
+ std::vector<uint8>* buffer); |
+ |
+ static bool InsertParamSetsAnnexB( |
+ const HEVCDecoderConfigurationRecord& hevc_config, |
+ std::vector<uint8>* buffer, |
+ std::vector<SubsampleEntry>* subsamples); |
+ |
+ // Verifies that the contents of |buffer| conform to |
+ // Section 7.4.2.4.4 of ISO/IEC 23008-2. |
+ // |subsamples| contains the information about what parts of the buffer are |
+ // encrypted and which parts are clear. |
+ // Returns true if |buffer| contains conformant Annex B data |
+ // TODO(servolk): Remove the std::vector version when we can use, |
+ // C++11's std::vector<T>::data() method. |
+ static bool IsValidAnnexB(const std::vector<uint8>& buffer, |
+ const std::vector<SubsampleEntry>& subsamples); |
+ static bool IsValidAnnexB(const uint8* buffer, size_t size, |
+ const std::vector<SubsampleEntry>& subsamples); |
+}; |
+ |
+class HEVCBitstreamConverter : public BitstreamConverter { |
+ public: |
+ explicit HEVCBitstreamConverter( |
+ scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config); |
+ |
+ // BitstreamConverter interface |
+ bool ConvertFrame(std::vector<uint8>* frame_buf, |
+ bool is_keyframe, |
+ std::vector<SubsampleEntry>* subsamples) const override; |
+ private: |
+ ~HEVCBitstreamConverter() override; |
+ scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config_; |
+}; |
+ |
+} // namespace mp4 |
+} // namespace media |
+ |
+#endif // MEDIA_FORMATS_MP4_HEVC_H_ |