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

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

Issue 1230593005: Reland: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: big rebase Created 5 years, 5 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chromecast/media/cma/ipc/media_message.h" 9 #include "chromecast/media/cma/ipc/media_message.h"
10 #include "media/base/video_decoder_config.h" 10 #include "media/base/video_decoder_config.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 }; 52 };
53 53
54 } // namespace 54 } // namespace
55 55
56 // static 56 // static
57 void VideoDecoderConfigMarshaller::Write( 57 void VideoDecoderConfigMarshaller::Write(
58 const ::media::VideoDecoderConfig& config, MediaMessage* msg) { 58 const ::media::VideoDecoderConfig& config, MediaMessage* msg) {
59 CHECK(msg->WritePod(config.codec())); 59 CHECK(msg->WritePod(config.codec()));
60 CHECK(msg->WritePod(config.profile())); 60 CHECK(msg->WritePod(config.profile()));
61 CHECK(msg->WritePod(config.format())); 61 CHECK(msg->WritePod(config.format()));
62 CHECK(msg->WritePod(config.color_space()));
62 SizeMarshaller::Write(config.coded_size(), msg); 63 SizeMarshaller::Write(config.coded_size(), msg);
63 RectMarshaller::Write(config.visible_rect(), msg); 64 RectMarshaller::Write(config.visible_rect(), msg);
64 SizeMarshaller::Write(config.natural_size(), msg); 65 SizeMarshaller::Write(config.natural_size(), msg);
65 CHECK(msg->WritePod(config.is_encrypted())); 66 CHECK(msg->WritePod(config.is_encrypted()));
66 CHECK(msg->WritePod(config.extra_data_size())); 67 CHECK(msg->WritePod(config.extra_data_size()));
67 if (config.extra_data_size() > 0) 68 if (config.extra_data_size() > 0)
68 CHECK(msg->WriteBuffer(config.extra_data(), config.extra_data_size())); 69 CHECK(msg->WriteBuffer(config.extra_data(), config.extra_data_size()));
69 } 70 }
70 71
71 // static 72 // static
72 ::media::VideoDecoderConfig VideoDecoderConfigMarshaller::Read( 73 ::media::VideoDecoderConfig VideoDecoderConfigMarshaller::Read(
73 MediaMessage* msg) { 74 MediaMessage* msg) {
74 ::media::VideoCodec codec; 75 ::media::VideoCodec codec;
75 ::media::VideoCodecProfile profile; 76 ::media::VideoCodecProfile profile;
76 ::media::VideoPixelFormat format; 77 ::media::VideoPixelFormat format;
78 ::media::ColorSpace color_space;
77 gfx::Size coded_size; 79 gfx::Size coded_size;
78 gfx::Rect visible_rect; 80 gfx::Rect visible_rect;
79 gfx::Size natural_size; 81 gfx::Size natural_size;
80 bool is_encrypted; 82 bool is_encrypted;
81 size_t extra_data_size; 83 size_t extra_data_size;
82 scoped_ptr<uint8[]> extra_data; 84 scoped_ptr<uint8[]> extra_data;
83 85
84 CHECK(msg->ReadPod(&codec)); 86 CHECK(msg->ReadPod(&codec));
85 CHECK(msg->ReadPod(&profile)); 87 CHECK(msg->ReadPod(&profile));
86 CHECK(msg->ReadPod(&format)); 88 CHECK(msg->ReadPod(&format));
89 CHECK(msg->ReadPod(&color_space));
87 coded_size = SizeMarshaller::Read(msg); 90 coded_size = SizeMarshaller::Read(msg);
88 visible_rect = RectMarshaller::Read(msg); 91 visible_rect = RectMarshaller::Read(msg);
89 natural_size = SizeMarshaller::Read(msg); 92 natural_size = SizeMarshaller::Read(msg);
90 CHECK(msg->ReadPod(&is_encrypted)); 93 CHECK(msg->ReadPod(&is_encrypted));
91 CHECK(msg->ReadPod(&extra_data_size)); 94 CHECK(msg->ReadPod(&extra_data_size));
92 95
93 CHECK_GE(codec, ::media::kUnknownVideoCodec); 96 CHECK_GE(codec, ::media::kUnknownVideoCodec);
94 CHECK_LE(codec, ::media::kVideoCodecMax); 97 CHECK_LE(codec, ::media::kVideoCodecMax);
95 CHECK_GE(profile, ::media::VIDEO_CODEC_PROFILE_UNKNOWN); 98 CHECK_GE(profile, ::media::VIDEO_CODEC_PROFILE_UNKNOWN);
96 CHECK_LE(profile, ::media::VIDEO_CODEC_PROFILE_MAX); 99 CHECK_LE(profile, ::media::VIDEO_CODEC_PROFILE_MAX);
97 CHECK_GE(format, ::media::PIXEL_FORMAT_UNKNOWN); 100 CHECK_GE(format, ::media::PIXEL_FORMAT_UNKNOWN);
98 CHECK_LE(format, ::media::PIXEL_FORMAT_MAX); 101 CHECK_LE(format, ::media::PIXEL_FORMAT_MAX);
102 CHECK_GE(color_space, ::media::COLOR_SPACE_UNSPECIFIED);
103 CHECK_LE(color_space, ::media::COLOR_SPACE_MAX);
99 CHECK_LT(extra_data_size, kMaxExtraDataSize); 104 CHECK_LT(extra_data_size, kMaxExtraDataSize);
100 if (extra_data_size > 0) { 105 if (extra_data_size > 0) {
101 extra_data.reset(new uint8[extra_data_size]); 106 extra_data.reset(new uint8[extra_data_size]);
102 CHECK(msg->ReadBuffer(extra_data.get(), extra_data_size)); 107 CHECK(msg->ReadBuffer(extra_data.get(), extra_data_size));
103 } 108 }
104 109
105 return ::media::VideoDecoderConfig( 110 return ::media::VideoDecoderConfig(
106 codec, profile, format, 111 codec, profile, format, color_space,
107 coded_size, visible_rect, natural_size, 112 coded_size, visible_rect, natural_size,
108 extra_data.get(), extra_data_size, 113 extra_data.get(), extra_data_size,
109 is_encrypted); 114 is_encrypted);
110 } 115 }
111 116
112 } // namespace media 117 } // namespace media
113 } // namespace chromecast 118 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/common/media/cma_param_traits_macros.h ('k') | chromecast/media/cma/pipeline/audio_video_pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698