Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: media/formats/mp4/hevc.h

Issue 816353010: Implemented HEVC video demuxing and parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved back h265_parser_unittest.cc in media/BUILD.gn Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/formats/mp4/fourccs.h ('k') | media/formats/mp4/hevc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "media/formats/mp4/box_definitions.h"
15
16 namespace media {
17
18 struct SubsampleEntry;
19
20 namespace mp4 {
21
22 struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box {
23 DECLARE_BOX_METHODS(HEVCDecoderConfigurationRecord);
24
25 // Parses HEVCDecoderConfigurationRecord data encoded in |data|.
26 // Note: This method is intended to parse data outside the MP4StreamParser
27 // context and therefore the box header is not expected to be present
28 // in |data|.
29 // Returns true if |data| was successfully parsed.
30 bool Parse(const uint8* data, int data_size);
31
32 uint8 configurationVersion;
33 uint8 general_profile_space;
34 uint8 general_tier_flag;
35 uint8 general_profile_idc;
36 uint32 general_profile_compatibility_flags;
37 uint64 general_constraint_indicator_flags;
38 uint8 general_level_idc;
39 uint16 min_spatial_segmentation_idc;
40 uint8 parallelismType;
41 uint8 chromaFormat;
42 uint8 bitDepthLumaMinus8;
43 uint8 bitDepthChromaMinus8;
44 uint16 avgFrameRate;
45 uint8 constantFrameRate;
46 uint8 numTemporalLayers;
47 uint8 temporalIdNested;
48 uint8 lengthSizeMinusOne;
49 uint8 numOfArrays;
50
51 typedef std::vector<uint8> HVCCNALUnit;
52 struct HVCCNALArray {
53 HVCCNALArray();
54 ~HVCCNALArray();
55 uint8 first_byte;
56 std::vector<HVCCNALUnit> units;
57 };
58 std::vector<HVCCNALArray> arrays;
59
60 private:
61 bool ParseInternal(BufferReader* reader,
62 const scoped_refptr<MediaLog>& media_log);
63 };
64
65 class MEDIA_EXPORT HEVC {
66 public:
67 static bool ConvertConfigToAnnexB(
68 const HEVCDecoderConfigurationRecord& hevc_config,
69 std::vector<uint8>* buffer);
70
71 static bool InsertParamSetsAnnexB(
72 const HEVCDecoderConfigurationRecord& hevc_config,
73 std::vector<uint8>* buffer,
74 std::vector<SubsampleEntry>* subsamples);
75
76 // Verifies that the contents of |buffer| conform to
77 // Section 7.4.2.4.4 of ISO/IEC 23008-2.
78 // |subsamples| contains the information about what parts of the buffer are
79 // encrypted and which parts are clear.
80 // Returns true if |buffer| contains conformant Annex B data
81 // TODO(servolk): Remove the std::vector version when we can use,
82 // C++11's std::vector<T>::data() method.
83 static bool IsValidAnnexB(const std::vector<uint8>& buffer,
84 const std::vector<SubsampleEntry>& subsamples);
85 static bool IsValidAnnexB(const uint8* buffer, size_t size,
86 const std::vector<SubsampleEntry>& subsamples);
87 };
88
89 class HEVCBitstreamConverter : public BitstreamConverter {
90 public:
91 explicit HEVCBitstreamConverter(
92 scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config);
93
94 // BitstreamConverter interface
95 bool ConvertFrame(std::vector<uint8>* frame_buf,
96 bool is_keyframe,
97 std::vector<SubsampleEntry>* subsamples) const override;
98 private:
99 ~HEVCBitstreamConverter() override;
100 scoped_ptr<HEVCDecoderConfigurationRecord> hevc_config_;
101 };
102
103 } // namespace mp4
104 } // namespace media
105
106 #endif // MEDIA_FORMATS_MP4_HEVC_H_
OLDNEW
« no previous file with comments | « media/formats/mp4/fourccs.h ('k') | media/formats/mp4/hevc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698