Commit f3f13502 authored by Richard Li's avatar Richard Li Committed by Commit Bot

Move HDRMetadata mojom bind to ui/gl/

media::HDRMetadata is going to be moved to ui/gl/, so its corresponding
mojom bind should be move to that path.
This is a preparation for passing HDRMetadata to SwapChainPresenter.

Bug: 1122910
Change-Id: Id62709d95acc7517578cc37e940f0dca9a3f6d9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389103Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Richard Li <richard.li@intel.com>
Cr-Commit-Position: refs/heads/master@{#805570}
parent 3f501e0c
......@@ -66,6 +66,7 @@ mojom("mojom") {
"//services/service_manager/public/mojom",
"//ui/gfx/geometry/mojom",
"//ui/gfx/mojom",
"//ui/gl/mojom",
"//url/mojom:url_mojom_gurl",
"//url/mojom:url_mojom_origin",
]
......@@ -218,20 +219,7 @@ mojom("mojom") {
"//media/base/ipc",
]
},
{
types = [
{
mojom = "media.mojom.MasteringMetadata"
cpp = "::media::MasteringMetadata"
},
{
mojom = "media.mojom.HDRMetadata"
cpp = "::media::HDRMetadata"
},
]
traits_headers = [ "hdr_metadata_mojom_traits.h" ]
traits_public_deps = [ "//media" ]
},
{
types = [
{
......
// 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_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
#define MEDIA_MOJO_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
#include "media/base/hdr_metadata.h"
#include "media/mojo/mojom/media_types.mojom.h"
namespace mojo {
template <>
struct StructTraits<media::mojom::MasteringMetadataDataView,
media::MasteringMetadata> {
static gfx::PointF primary_r(const media::MasteringMetadata& input) {
return input.primary_r;
}
static gfx::PointF primary_g(const media::MasteringMetadata& input) {
return input.primary_g;
}
static gfx::PointF primary_b(const media::MasteringMetadata& input) {
return input.primary_b;
}
static gfx::PointF white_point(const media::MasteringMetadata& input) {
return input.white_point;
}
static float luminance_max(const media::MasteringMetadata& input) {
return input.luminance_max;
}
static float luminance_min(const media::MasteringMetadata& input) {
return input.luminance_min;
}
static bool Read(media::mojom::MasteringMetadataDataView data,
media::MasteringMetadata* output) {
output->luminance_max = data.luminance_max();
output->luminance_min = data.luminance_min();
if (!data.ReadPrimaryR(&output->primary_r))
return false;
if (!data.ReadPrimaryG(&output->primary_g))
return false;
if (!data.ReadPrimaryB(&output->primary_b))
return false;
if (!data.ReadWhitePoint(&output->white_point))
return false;
return true;
}
};
template <>
struct StructTraits<media::mojom::HDRMetadataDataView, media::HDRMetadata> {
static unsigned max_content_light_level(const media::HDRMetadata& input) {
return input.max_content_light_level;
}
static unsigned max_frame_average_light_level(
const media::HDRMetadata& input) {
return input.max_frame_average_light_level;
}
static media::MasteringMetadata mastering_metadata(
const media::HDRMetadata& input) {
return input.mastering_metadata;
}
static bool Read(media::mojom::HDRMetadataDataView data,
media::HDRMetadata* output) {
output->max_content_light_level = data.max_content_light_level();
output->max_frame_average_light_level =
data.max_frame_average_light_level();
if (!data.ReadMasteringMetadata(&output->mastering_metadata))
return false;
return true;
}
};
} // namespace mojo
#endif // MEDIA_MOJO_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
......@@ -12,6 +12,7 @@ import "mojo/public/mojom/base/unguessable_token.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "ui/gfx/mojom/buffer_types.mojom";
import "ui/gfx/mojom/color_space.mojom";
import "ui/gl/mojom/hdr_metadata.mojom";
// See media/base/audio_codecs.h for descriptions.
[Native]
......@@ -133,22 +134,6 @@ struct VideoColorSpace {
RangeID range;
};
// This defines a mojo transport format for media::HDRMetadata.
// See media/base/hdr_metadata.h for description.
struct MasteringMetadata {
gfx.mojom.PointF primary_r;
gfx.mojom.PointF primary_g;
gfx.mojom.PointF primary_b;
gfx.mojom.PointF white_point;
float luminance_max;
float luminance_min;
};
struct HDRMetadata {
MasteringMetadata mastering_metadata;
uint32 max_content_light_level;
uint32 max_frame_average_light_level;
};
// This defines a mojo transport format for media::AudioDecoderConfig.
// See media/base/audio_decoder_config.h for descriptions.
......@@ -178,7 +163,7 @@ struct VideoDecoderConfig {
array<uint8> extra_data;
EncryptionScheme encryption_scheme;
VideoColorSpace color_space_info;
HDRMetadata? hdr_metadata;
gl.mojom.HDRMetadata? hdr_metadata;
};
// Native struct media::SubsampleEntry;
......@@ -362,7 +347,7 @@ struct VideoFrame {
VideoFrameMetadata metadata;
gfx.mojom.ColorSpace color_space;
HDRMetadata? hdr_metadata;
gl.mojom.HDRMetadata? hdr_metadata;
};
// Possible choices for storing VideoFrame data.
......
......@@ -7,11 +7,11 @@
#include "media/base/ipc/media_param_traits.h"
#include "media/base/video_decoder_config.h"
#include "media/mojo/mojom/hdr_metadata_mojom_traits.h"
#include "media/mojo/mojom/media_types.mojom.h"
#include "media/mojo/mojom/video_color_space_mojom_traits.h"
#include "media/mojo/mojom/video_transformation_mojom_traits.h"
#include "ui/gfx/geometry/mojom/geometry_mojom_traits.h"
#include "ui/gl/mojom/hdr_metadata_mojom_traits.h"
namespace mojo {
......
......@@ -14,12 +14,12 @@
#include "media/base/color_plane_layout.h"
#include "media/base/format_utils.h"
#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/hdr_metadata_mojom_traits.h"
#include "media/mojo/mojom/video_frame_metadata_mojom_traits.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"
#include "mojo/public/cpp/system/handle.h"
#include "ui/gfx/mojom/buffer_types_mojom_traits.h"
#include "ui/gfx/mojom/color_space_mojom_traits.h"
#include "ui/gl/mojom/hdr_metadata_mojom_traits.h"
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#include "base/posix/eintr_wrapper.h"
......
......@@ -5,8 +5,16 @@
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
sources = [ "gpu_preference.mojom" ]
public_deps = [ "//mojo/public/mojom/base" ]
generate_java = true
sources = [
"gpu_preference.mojom",
"hdr_metadata.mojom",
]
public_deps = [
"//mojo/public/mojom/base",
"//ui/gfx/geometry/mojom",
]
cpp_typemaps = [
{
types = [
......@@ -18,6 +26,21 @@ mojom("mojom") {
traits_headers = [ "gpu_preference_mojom_traits.h" ]
traits_public_deps = [ "//ui/gl" ]
},
{
types = [
{
mojom = "gl.mojom.MasteringMetadata"
cpp = "::gl::MasteringMetadata"
},
{
mojom = "gl.mojom.HDRMetadata"
cpp = "::gl::HDRMetadata"
},
]
traits_headers = [ "hdr_metadata_mojom_traits.h" ]
traits_sources = [ "hdr_metadata_mojom_traits.cc" ]
traits_public_deps = [ "//ui/gl" ]
},
]
}
......
// Copyright 2020 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.
module gl.mojom;
import "ui/gfx/geometry/mojom/geometry.mojom";
// This defines a mojo transport format for gl::HDRMetadata.
// See ui/gl/hdr_metadata.h for description.
struct MasteringMetadata {
gfx.mojom.PointF primary_r;
gfx.mojom.PointF primary_g;
gfx.mojom.PointF primary_b;
gfx.mojom.PointF white_point;
float luminance_max;
float luminance_min;
};
struct HDRMetadata {
MasteringMetadata mastering_metadata;
uint32 max_content_light_level;
uint32 max_frame_average_light_level;
};
\ No newline at end of file
// 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.
#include "ui/gl/mojom/hdr_metadata_mojom_traits.h"
namespace mojo {
bool StructTraits<gl::mojom::MasteringMetadataDataView, gl::MasteringMetadata>::
Read(gl::mojom::MasteringMetadataDataView data,
gl::MasteringMetadata* output) {
output->luminance_max = data.luminance_max();
output->luminance_min = data.luminance_min();
if (!data.ReadPrimaryR(&output->primary_r))
return false;
if (!data.ReadPrimaryG(&output->primary_g))
return false;
if (!data.ReadPrimaryB(&output->primary_b))
return false;
if (!data.ReadWhitePoint(&output->white_point))
return false;
return true;
}
bool StructTraits<gl::mojom::HDRMetadataDataView, gl::HDRMetadata>::Read(
gl::mojom::HDRMetadataDataView data,
gl::HDRMetadata* output) {
output->max_content_light_level = data.max_content_light_level();
output->max_frame_average_light_level = data.max_frame_average_light_level();
if (!data.ReadMasteringMetadata(&output->mastering_metadata))
return false;
return true;
}
} // namespace mojo
// 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 UI_GL_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
#define UI_GL_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
#include "ui/gl/hdr_metadata.h"
#include "ui/gl/mojom/hdr_metadata.mojom.h"
namespace mojo {
template <>
struct StructTraits<gl::mojom::MasteringMetadataDataView,
gl::MasteringMetadata> {
static const gfx::PointF& primary_r(const gl::MasteringMetadata& input) {
return input.primary_r;
}
static const gfx::PointF& primary_g(const gl::MasteringMetadata& input) {
return input.primary_g;
}
static const gfx::PointF& primary_b(const gl::MasteringMetadata& input) {
return input.primary_b;
}
static const gfx::PointF& white_point(const gl::MasteringMetadata& input) {
return input.white_point;
}
static float luminance_max(const gl::MasteringMetadata& input) {
return input.luminance_max;
}
static float luminance_min(const gl::MasteringMetadata& input) {
return input.luminance_min;
}
static bool Read(gl::mojom::MasteringMetadataDataView data,
gl::MasteringMetadata* output);
};
template <>
struct StructTraits<gl::mojom::HDRMetadataDataView, gl::HDRMetadata> {
static unsigned max_content_light_level(const gl::HDRMetadata& input) {
return input.max_content_light_level;
}
static unsigned max_frame_average_light_level(const gl::HDRMetadata& input) {
return input.max_frame_average_light_level;
}
static const gl::MasteringMetadata& mastering_metadata(
const gl::HDRMetadata& input) {
return input.mastering_metadata;
}
static bool Read(gl::mojom::HDRMetadataDataView data,
gl::HDRMetadata* output);
};
} // namespace mojo
#endif // UI_GL_MOJOM_HDR_METADATA_MOJOM_TRAITS_H_
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