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

Unified Diff: media/mojo/interfaces/video_color_space_struct_traits.h

Issue 2799843002: Implement Mojo IPC for media::VideoColorSpace (Closed)
Patch Set: Fixed the year in comment Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mojo/interfaces/video_color_space.typemap ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/interfaces/video_color_space_struct_traits.h
diff --git a/media/mojo/interfaces/video_color_space_struct_traits.h b/media/mojo/interfaces/video_color_space_struct_traits.h
new file mode 100644
index 0000000000000000000000000000000000000000..6e6f7321407b90ef72431c419b1a0dacc9b2ddd2
--- /dev/null
+++ b/media/mojo/interfaces/video_color_space_struct_traits.h
@@ -0,0 +1,47 @@
+// Copyright 2017 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_MOJO_INTERFACES_VIDEO_COLOR_SPACE_STRUCT_TRAITS_H_
+#define MEDIA_MOJO_INTERFACES_VIDEO_COLOR_SPACE_STRUCT_TRAITS_H_
+
+#include "media/base/video_color_space.h"
+#include "media/mojo/interfaces/media_types.mojom.h"
+
+namespace mojo {
+
+template <>
+struct StructTraits<media::mojom::VideoColorSpaceDataView,
+ media::VideoColorSpace> {
+ static media::VideoColorSpace::PrimaryID primaries(
+ const media::VideoColorSpace& input) {
+ return input.primaries;
+ }
+ static media::VideoColorSpace::TransferID transfer(
+ const media::VideoColorSpace& input) {
+ return input.transfer;
+ }
+ static media::VideoColorSpace::MatrixID matrix(
+ const media::VideoColorSpace& input) {
+ return input.matrix;
+ }
+ static gfx::ColorSpace::RangeID range(const media::VideoColorSpace& input) {
+ return input.range;
+ }
+
+ static bool Read(media::mojom::VideoColorSpaceDataView data,
+ media::VideoColorSpace* output) {
+ output->primaries =
+ static_cast<media::VideoColorSpace::PrimaryID>(data.primaries());
+ output->transfer =
+ static_cast<media::VideoColorSpace::TransferID>(data.transfer());
+ output->matrix =
+ static_cast<media::VideoColorSpace::MatrixID>(data.matrix());
+ output->range = static_cast<gfx::ColorSpace::RangeID>(data.range());
+ return true;
+ }
+};
+
+} // namespace mojo
+
+#endif // MEDIA_MOJO_INTERFACES_VIDEO_COLOR_SPACE_STRUCT_TRAITS_H_
« no previous file with comments | « media/mojo/interfaces/video_color_space.typemap ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698