Commit b7d4b4a1 authored by Fredrik Hubinette's avatar Fredrik Hubinette Committed by Commit Bot

add color space to VideoFrame mojo

Change-Id: I5381ace23e4cf2729555d952f23d25f5901a259d
Reviewed-on: https://chromium-review.googlesource.com/c/1292401Reviewed-by: default avatarChris Palmer <palmer@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Fredrik Hubinette <hubbe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602470}
parent 201d8216
...@@ -8,6 +8,7 @@ import "gpu/ipc/common/mailbox_holder.mojom"; ...@@ -8,6 +8,7 @@ import "gpu/ipc/common/mailbox_holder.mojom";
import "mojo/public/mojom/base/time.mojom"; import "mojo/public/mojom/base/time.mojom";
import "mojo/public/mojom/base/values.mojom"; import "mojo/public/mojom/base/values.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom";
import "ui/gfx/mojo/color_space.mojom";
// See media/base/audio_codecs.h for descriptions. // See media/base/audio_codecs.h for descriptions.
[Native] [Native]
...@@ -248,6 +249,8 @@ struct VideoFrame { ...@@ -248,6 +249,8 @@ struct VideoFrame {
// Extra properties associated with the VideoFrame. // Extra properties associated with the VideoFrame.
mojo_base.mojom.DictionaryValue metadata; mojo_base.mojom.DictionaryValue metadata;
gfx.mojom.ColorSpace color_space;
}; };
// Possible choices for storing VideoFrame data. // Possible choices for storing VideoFrame data.
......
...@@ -150,6 +150,11 @@ bool StructTraits<media::mojom::VideoFrameDataView, ...@@ -150,6 +150,11 @@ bool StructTraits<media::mojom::VideoFrameDataView,
frame->metadata()->MergeInternalValuesFrom(metadata); frame->metadata()->MergeInternalValuesFrom(metadata);
gfx::ColorSpace color_space;
if (!input.ReadColorSpace(&color_space))
return false;
frame->set_color_space(color_space);
*output = std::move(frame); *output = std::move(frame);
return true; return true;
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "media/mojo/interfaces/media_types.mojom.h" #include "media/mojo/interfaces/media_types.mojom.h"
#include "mojo/public/cpp/bindings/struct_traits.h" #include "mojo/public/cpp/bindings/struct_traits.h"
#include "ui/gfx/geometry/mojo/geometry_struct_traits.h" #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
#include "ui/gfx/ipc/color/gfx_param_traits.h"
namespace mojo { namespace mojo {
...@@ -52,6 +53,13 @@ struct StructTraits<media::mojom::VideoFrameDataView, ...@@ -52,6 +53,13 @@ struct StructTraits<media::mojom::VideoFrameDataView,
return input->timestamp(); return input->timestamp();
} }
// TODO(hubbe): Return const ref when VideoFrame::ColorSpace()
// returns const ref.
static gfx::ColorSpace color_space(
const scoped_refptr<media::VideoFrame>& input) {
return input->ColorSpace();
}
static media::mojom::VideoFrameDataPtr data( static media::mojom::VideoFrameDataPtr data(
const scoped_refptr<media::VideoFrame>& input); const scoped_refptr<media::VideoFrame>& input);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment