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

Side by Side Diff: chromecast/media/cma/ipc_streamer/video_decoder_config_marshaller.cc

Issue 1786733004: Revert of media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
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 #include "chromecast/media/cma/ipc_streamer/video_decoder_config_marshaller.h" 5 #include "chromecast/media/cma/ipc_streamer/video_decoder_config_marshaller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "chromecast/media/cma/ipc/media_message.h" 13 #include "chromecast/media/cma/ipc/media_message.h"
14 #include "chromecast/media/cma/ipc_streamer/encryption_scheme_marshaller.h"
15 #include "media/base/video_decoder_config.h" 14 #include "media/base/video_decoder_config.h"
16 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
18 17
19 namespace chromecast { 18 namespace chromecast {
20 namespace media { 19 namespace media {
21 20
22 namespace { 21 namespace {
23 const size_t kMaxExtraDataSize = 16 * 1024; 22 const size_t kMaxExtraDataSize = 16 * 1024;
24 23
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // static 60 // static
62 void VideoDecoderConfigMarshaller::Write( 61 void VideoDecoderConfigMarshaller::Write(
63 const ::media::VideoDecoderConfig& config, MediaMessage* msg) { 62 const ::media::VideoDecoderConfig& config, MediaMessage* msg) {
64 CHECK(msg->WritePod(config.codec())); 63 CHECK(msg->WritePod(config.codec()));
65 CHECK(msg->WritePod(config.profile())); 64 CHECK(msg->WritePod(config.profile()));
66 CHECK(msg->WritePod(config.format())); 65 CHECK(msg->WritePod(config.format()));
67 CHECK(msg->WritePod(config.color_space())); 66 CHECK(msg->WritePod(config.color_space()));
68 SizeMarshaller::Write(config.coded_size(), msg); 67 SizeMarshaller::Write(config.coded_size(), msg);
69 RectMarshaller::Write(config.visible_rect(), msg); 68 RectMarshaller::Write(config.visible_rect(), msg);
70 SizeMarshaller::Write(config.natural_size(), msg); 69 SizeMarshaller::Write(config.natural_size(), msg);
71 EncryptionSchemeMarshaller::Write(config.encryption_scheme(), msg); 70 CHECK(msg->WritePod(config.is_encrypted()));
72 CHECK(msg->WritePod(config.extra_data().size())); 71 CHECK(msg->WritePod(config.extra_data().size()));
73 if (!config.extra_data().empty()) 72 if (!config.extra_data().empty())
74 CHECK(msg->WriteBuffer(&config.extra_data()[0], 73 CHECK(msg->WriteBuffer(&config.extra_data()[0],
75 config.extra_data().size())); 74 config.extra_data().size()));
76 } 75 }
77 76
78 // static 77 // static
79 ::media::VideoDecoderConfig VideoDecoderConfigMarshaller::Read( 78 ::media::VideoDecoderConfig VideoDecoderConfigMarshaller::Read(
80 MediaMessage* msg) { 79 MediaMessage* msg) {
81 ::media::VideoCodec codec; 80 ::media::VideoCodec codec;
82 ::media::VideoCodecProfile profile; 81 ::media::VideoCodecProfile profile;
83 ::media::VideoPixelFormat format; 82 ::media::VideoPixelFormat format;
84 ::media::ColorSpace color_space; 83 ::media::ColorSpace color_space;
85 gfx::Size coded_size; 84 gfx::Size coded_size;
86 gfx::Rect visible_rect; 85 gfx::Rect visible_rect;
87 gfx::Size natural_size; 86 gfx::Size natural_size;
87 bool is_encrypted;
88 size_t extra_data_size; 88 size_t extra_data_size;
89 ::media::EncryptionScheme encryption_scheme;
90 std::vector<uint8_t> extra_data; 89 std::vector<uint8_t> extra_data;
91 90
92 CHECK(msg->ReadPod(&codec)); 91 CHECK(msg->ReadPod(&codec));
93 CHECK(msg->ReadPod(&profile)); 92 CHECK(msg->ReadPod(&profile));
94 CHECK(msg->ReadPod(&format)); 93 CHECK(msg->ReadPod(&format));
95 CHECK(msg->ReadPod(&color_space)); 94 CHECK(msg->ReadPod(&color_space));
96 coded_size = SizeMarshaller::Read(msg); 95 coded_size = SizeMarshaller::Read(msg);
97 visible_rect = RectMarshaller::Read(msg); 96 visible_rect = RectMarshaller::Read(msg);
98 natural_size = SizeMarshaller::Read(msg); 97 natural_size = SizeMarshaller::Read(msg);
99 encryption_scheme = EncryptionSchemeMarshaller::Read(msg); 98 CHECK(msg->ReadPod(&is_encrypted));
100 CHECK(msg->ReadPod(&extra_data_size)); 99 CHECK(msg->ReadPod(&extra_data_size));
101 100
102 CHECK_GE(codec, ::media::kUnknownVideoCodec); 101 CHECK_GE(codec, ::media::kUnknownVideoCodec);
103 CHECK_LE(codec, ::media::kVideoCodecMax); 102 CHECK_LE(codec, ::media::kVideoCodecMax);
104 CHECK_GE(profile, ::media::VIDEO_CODEC_PROFILE_UNKNOWN); 103 CHECK_GE(profile, ::media::VIDEO_CODEC_PROFILE_UNKNOWN);
105 CHECK_LE(profile, ::media::VIDEO_CODEC_PROFILE_MAX); 104 CHECK_LE(profile, ::media::VIDEO_CODEC_PROFILE_MAX);
106 CHECK_GE(format, ::media::PIXEL_FORMAT_UNKNOWN); 105 CHECK_GE(format, ::media::PIXEL_FORMAT_UNKNOWN);
107 CHECK_LE(format, ::media::PIXEL_FORMAT_MAX); 106 CHECK_LE(format, ::media::PIXEL_FORMAT_MAX);
108 CHECK_GE(color_space, ::media::COLOR_SPACE_UNSPECIFIED); 107 CHECK_GE(color_space, ::media::COLOR_SPACE_UNSPECIFIED);
109 CHECK_LE(color_space, ::media::COLOR_SPACE_MAX); 108 CHECK_LE(color_space, ::media::COLOR_SPACE_MAX);
110 CHECK_LT(extra_data_size, kMaxExtraDataSize); 109 CHECK_LT(extra_data_size, kMaxExtraDataSize);
111 if (extra_data_size > 0) { 110 if (extra_data_size > 0) {
112 extra_data.resize(extra_data_size); 111 extra_data.resize(extra_data_size);
113 CHECK(msg->ReadBuffer(&extra_data[0], extra_data.size())); 112 CHECK(msg->ReadBuffer(&extra_data[0], extra_data.size()));
114 } 113 }
115 114
116 return ::media::VideoDecoderConfig( 115 return ::media::VideoDecoderConfig(
117 codec, profile, format, color_space, 116 codec, profile, format, color_space,
118 coded_size, visible_rect, natural_size, 117 coded_size, visible_rect, natural_size,
119 extra_data, encryption_scheme); 118 extra_data, is_encrypted);
120 } 119 }
121 120
122 } // namespace media 121 } // namespace media
123 } // namespace chromecast 122 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698