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

Side by Side Diff: media/formats/mp4/dolby_vision.cc

Issue 2640113004: Introduce Dolby Vision video codec and Demuxer support (Closed)
Patch Set: fix build break on Android Created 3 years, 9 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/dolby_vision.h ('k') | media/formats/mp4/dolby_vision_unittest.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 2017 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 #include "media/formats/mp4/dolby_vision.h"
6
7 #include "base/logging.h"
8 #include "media/base/video_codecs.h"
9 #include "media/formats/mp4/box_definitions.h"
10 #include "media/formats/mp4/box_reader.h"
11
12 namespace media {
13 namespace mp4 {
14
15 DolbyVisionConfiguration::DolbyVisionConfiguration()
16 : dv_version_major(0),
17 dv_version_minor(0),
18 dv_profile(0),
19 dv_level(0),
20 rpu_present_flag(0),
21 el_present_flag(0),
22 bl_present_flag(0),
23 codec_profile(VIDEO_CODEC_PROFILE_UNKNOWN) {}
24
25 DolbyVisionConfiguration::~DolbyVisionConfiguration() {}
26
27 FourCC DolbyVisionConfiguration::BoxType() const {
28 return FOURCC_DVCC;
29 }
30
31 bool DolbyVisionConfiguration::Parse(BoxReader* reader) {
32 return ParseInternal(reader, reader->media_log());
33 }
34
35 bool DolbyVisionConfiguration::Parse(const uint8_t* data, int data_size) {
36 BufferReader reader(data, data_size);
37 return ParseInternal(&reader, new MediaLog());
38 }
39
40 bool DolbyVisionConfiguration::ParseInternal(
41 BufferReader* reader,
42 const scoped_refptr<MediaLog>& media_log) {
43 uint16_t profile_track_indication = 0;
44 RCHECK(reader->Read1(&dv_version_major) && reader->Read1(&dv_version_minor) &&
45 reader->Read2(&profile_track_indication));
46
47 dv_profile = profile_track_indication >> 9;
48 dv_level = (profile_track_indication >> 3) & 0x3F;
49 rpu_present_flag = (profile_track_indication >> 2) & 1;
50 el_present_flag = (profile_track_indication >> 1) & 1;
51 bl_present_flag = profile_track_indication & 1;
52
53 switch (dv_profile) {
54 case 0:
55 codec_profile = DOLBYVISION_PROFILE0;
56 break;
57 case 4:
58 codec_profile = DOLBYVISION_PROFILE4;
59 break;
60 case 5:
61 codec_profile = DOLBYVISION_PROFILE5;
62 break;
63 case 7:
64 codec_profile = DOLBYVISION_PROFILE7;
65 break;
66 default:
67 DVLOG(2) << "Deprecated or invalid Dolby Vision profile:"
68 << static_cast<int>(dv_profile);
69 return false;
70 }
71
72 DVLOG(2) << "Dolby Vision profile:" << static_cast<int>(dv_profile)
73 << " level:" << static_cast<int>(dv_level)
74 << " has_bl:" << static_cast<int>(bl_present_flag)
75 << " has_el:" << static_cast<int>(el_present_flag)
76 << " has_rpu:" << static_cast<int>(rpu_present_flag)
77 << " profile type:" << codec_profile;
78
79 return true;
80 }
81
82 } // namespace mp4
83 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/dolby_vision.h ('k') | media/formats/mp4/dolby_vision_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698