Skip to content

Commit

Permalink
Move Mojo structs and enums to media/capture/mojo.
Browse files Browse the repository at this point in the history
There are several structs and enums whose native C++ representation lives in media/capture, but whose correpsonding Mojo types and typemaps live in either content/common or services/video_capture.

This CL moves the Mojo types and typemaps to media/capture/mojo, so that Mojo types and corresponding native types live together.

This CL is part of the Mojo Video Capture work. For the bigger picture, see [1] CL1.7.2

BUG=584797
TEST=video_capture_unittests, content_unittests, capture_unittests

[1] https://docs.google.com/a/chromium.org/document/d/1Qw7rw1AJy0QHXjha36jZNiEuxsxWslJ_X-zpOhijvI8/edit?usp=sharing

Review-Url: https://codereview.chromium.org/2405423002
Cr-Commit-Position: refs/heads/master@{#428186}
  • Loading branch information
chfremer authored and Commit bot committed Oct 27, 2016
1 parent 7839ed7 commit b689c2a
Show file tree
Hide file tree
Showing 31 changed files with 356 additions and 402 deletions.
1 change: 1 addition & 0 deletions chrome/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ static_library("renderer") {
"//content/public/common",
"//content/public/renderer",
"//media",
"//media/capture",
"//net",
"//ppapi/features",
"//skia",
Expand Down
2 changes: 2 additions & 0 deletions content/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ source_set("common") {
"//media:shared_memory_support",
"//media/base/ipc",
"//media/capture",
"//media/capture/ipc",
"//media/gpu/ipc/client",
"//media/gpu/ipc/common",
"//media/midi",
Expand Down Expand Up @@ -591,6 +592,7 @@ mojom("mojo_bindings") {
# TODO(mcasas): remove the following dep after https://crbug.com/653994
"//gpu/ipc/common:interfaces",
"//ipc:mojom",
"//media/capture/mojo:capture_types",
"//media/mojo/interfaces",
"//mojo/common:common_custom_types",
"//services/service_manager/public/interfaces",
Expand Down
1 change: 1 addition & 0 deletions content/common/indexed_db/indexed_db_struct_traits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "content/common/indexed_db/indexed_db_param_traits.h"
#include "content/common/indexed_db/indexed_db_struct_traits.h"
#include "mojo/common/common_custom_types_struct_traits.h"

namespace mojo {

Expand Down
1 change: 0 additions & 1 deletion content/common/typemaps.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ typemaps = [
"//content/common/url_request.typemap",
"//content/common/url_response_head.typemap",
"//content/common/url_sync_load_result.typemap",
"//content/common/video_capture.typemap",
"//content/common/web_preferences.typemap",
"//content/common/media/media_session.typemap",
]
19 changes: 6 additions & 13 deletions content/common/video_capture.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ module content.mojom;

import "gpu/ipc/common/sync_token.mojom";
import "media/mojo/interfaces/media_types.mojom";
import "media/capture/mojo/video_capture_types.mojom";
import "mojo/common/common_custom_types.mojom";
import "services/video_capture/public/interfaces/video_capture_device_proxy.mojom";
import "services/video_capture/public/interfaces/video_capture_format.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";

// This file decribes the communication between a given Renderer Host interface
Expand Down Expand Up @@ -52,17 +51,11 @@ import "ui/gfx/geometry/mojo/geometry.mojom";
// | ---> StopCapture |
// | OnStateChanged(STOPPED) <--- |

struct VideoCaptureParams {
video_capture.mojom.VideoCaptureFormat requested_format;
video_capture.mojom.ResolutionChangePolicy resolution_change_policy;
video_capture.mojom.PowerLineFrequency power_line_frequency;
};

struct VideoFrameInfo{
mojo.common.mojom.TimeDelta timestamp;
mojo.common.mojom.DictionaryValue metadata;
media.mojom.VideoPixelFormat pixel_format;
video_capture.mojom.VideoPixelStorage storage_type;
media.mojom.VideoPixelStorage storage_type;
gfx.mojom.Size coded_size;
gfx.mojom.Rect visible_rect;
};
Expand Down Expand Up @@ -97,7 +90,7 @@ interface VideoCaptureHost {
// Start the |session_id| session with |params|. The video capture will be
// identified as |device_id|, a new id picked by the renderer process.
// |observer| will be used for notifications.
Start(int32 device_id, int32 session_id, VideoCaptureParams params,
Start(int32 device_id, int32 session_id, media.mojom.VideoCaptureParams params,
VideoCaptureObserver observer);

// Closes the video capture specified by |device_id|.
Expand All @@ -107,7 +100,7 @@ interface VideoCaptureHost {
Pause(int32 device_id);

// Resume |device_id| video capture, in |session_id| and with |params|.
Resume(int32 device_id, int32 session_id, VideoCaptureParams params);
Resume(int32 device_id, int32 session_id, media.mojom.VideoCaptureParams params);

// Requests that the video capturer send a frame "soon" (e.g., to resolve
// picture loss or quality issues).
Expand All @@ -120,9 +113,9 @@ interface VideoCaptureHost {

// Get the formats supported by a device referenced by |session_id|.
GetDeviceSupportedFormats(int32 device_id, int32 session_id)
=> (array<video_capture.mojom.VideoCaptureFormat> formats_supported);
=> (array<media.mojom.VideoCaptureFormat> formats_supported);

// Get the format(s) in use by a device referenced by |session_id|.
GetDeviceFormatsInUse(int32 device_id, int32 session_id)
=> (array<video_capture.mojom.VideoCaptureFormat> formats_in_use);
=> (array<media.mojom.VideoCaptureFormat> formats_in_use);
};
19 changes: 0 additions & 19 deletions content/common/video_capture.typemap

This file was deleted.

26 changes: 0 additions & 26 deletions content/common/video_capture_struct_traits.cc

This file was deleted.

38 changes: 0 additions & 38 deletions content/common/video_capture_struct_traits.h

This file was deleted.

1 change: 1 addition & 0 deletions content/public/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ target(link_target_type, "renderer_sources") {
"//content/renderer",
"//gin",
"//media",
"//media/capture",
"//media/gpu/ipc/client",
"//net",
"//ppapi/c",
Expand Down
1 change: 1 addition & 0 deletions content/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ static_library("content_shell_lib") {
"//gpu",
"//ipc",
"//media",
"//media/capture",
"//mojo/edk/js",
"//net",
"//net:net_resources",
Expand Down
1 change: 1 addition & 0 deletions media/capture/ipc/capture_param_traits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "base/strings/stringprintf.h"
#include "ipc/ipc_message_utils.h"
#include "media/base/ipc/media_param_traits.h"
#include "media/base/limits.h"
#include "media/capture/video_capture_types.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
Expand Down
16 changes: 16 additions & 0 deletions media/capture/mojo/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2016 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.

import("//mojo/public/tools/bindings/mojom.gni")

mojom("capture_types") {
sources = [
"video_capture_types.mojom",
]

public_deps = [
"//media/mojo/interfaces",
"//ui/gfx/geometry/mojo",
]
}
4 changes: 4 additions & 0 deletions media/capture/mojo/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
per-file *_struct_traits*.*=set noparent
per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS
5 changes: 5 additions & 0 deletions media/capture/mojo/typemaps.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2016 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.

typemaps = [ "//media/capture/mojo/video_capture_types.typemap" ]
58 changes: 58 additions & 0 deletions media/capture/mojo/video_capture_types.mojom
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2016 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 media.mojom;

import "media/mojo/interfaces/media_types.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";

enum ResolutionChangePolicy {
FIXED_RESOLUTION,
FIXED_ASPECT_RATIO,
ANY_WITHIN_LIMIT,
};

enum PowerLineFrequency {
DEFAULT,
HZ_50,
HZ_60
};

enum VideoPixelStorage {
CPU,
GPUMEMORYBUFFER
};

enum VideoCaptureApi {
LINUX_V4L2_SINGLE_PLANE,
WIN_MEDIA_FOUNDATION,
WIN_DIRECT_SHOW,
MACOSX_AVFOUNDATION,
MACOSX_DECKLINK,
ANDROID_API1,
ANDROID_API2_LEGACY,
ANDROID_API2_FULL,
ANDROID_API2_LIMITED,
ANDROID_TANGO,
UNKNOWN
};

enum VideoCaptureTransportType {
// For MACOSX_AVFOUNDATION Api, identifies devices that are built-in or USB.
MACOSX_USB_OR_BUILT_IN,
OTHER_TRANSPORT
};

struct VideoCaptureFormat {
gfx.mojom.Size frame_size;
float frame_rate;
VideoPixelFormat pixel_format;
VideoPixelStorage pixel_storage;
};

struct VideoCaptureParams {
VideoCaptureFormat requested_format;
ResolutionChangePolicy resolution_change_policy;
PowerLineFrequency power_line_frequency;
};
30 changes: 30 additions & 0 deletions media/capture/mojo/video_capture_types.typemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2016 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.

mojom = "//media/capture/mojo/video_capture_types.mojom"

public_headers = [ "//media/capture/video_capture_types.h" ]

traits_headers = [
"//media/capture/ipc/capture_param_traits_macros.h",
"//media/capture/ipc/capture_param_traits.h",
"//media/capture/mojo/video_capture_types_typemap_traits.h",
]

sources = [
"//media/capture/mojo/video_capture_types_typemap_traits.cc",
]

deps = [
"//media",
"//media/capture/ipc",
]

type_mappings = [
"media.mojom.ResolutionChangePolicy=media::ResolutionChangePolicy",
"media.mojom.PowerLineFrequency=media::PowerLineFrequency",
"media.mojom.VideoCaptureFormat=media::VideoCaptureFormat",
"media.mojom.VideoPixelStorage=media::VideoPixelStorage",
"media.mojom.VideoCaptureParams=media::VideoCaptureParams",
]
Loading

0 comments on commit b689c2a

Please sign in to comment.