blob: 098ded2111aa49f1aa835e05f7e860d0a7b49c9b [file] [log] [blame]
// 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;
// Equivalent to idl MediaSettingsRange, arbitrary range representing the
// allowed variations of a Capability or an Option.
// https://w3c.github.io/mediacapture-image/#mediasettingsrange
struct Range {
uint32 max;
uint32 min;
uint32 current;
};
// https://w3c.github.io/mediacapture-image/#idl-def-FocusMode
enum FocusMode { UNAVAILABLE, MANUAL, SINGLE_SHOT, CONTINUOUS };
// Equivalent to idl PhotoCapabilities,
// https://w3c.github.io/mediacapture-image/#photocapabilities
struct PhotoCapabilities {
Range iso;
Range height;
Range width;
Range zoom;
FocusMode focus_mode;
};
// Equivalent to idl Point2D.
// TODO(mcasas): use gfx::mojom::PointF after https://crbug.com/640049.
struct Point2D {
float x;
float y;
};
// Equivalent to idl PhotoSettings,
// https://w3c.github.io/mediacapture-image/index.html#photosettings
struct PhotoSettings {
// uint32 cannot be nullable, i.e. uint32? does not work, use instead a flag.
bool has_zoom;
uint32 zoom;
bool has_width;
uint32 width;
bool has_height;
uint32 height;
bool has_focus_mode;
FocusMode focus_mode;
array<Point2D> points_of_interest;
};
// This is a mojo move-only equivalent of a Blob, i.e. MIME type and Data.
struct Blob {
string mime_type;
array<uint8> data;
};
// |source_id| is the renderer-side UUID identifier of the image capture device.
interface ImageCapture
{
// Retrieves the image capture device capabilities and current settings.
// https://w3c.github.io/mediacapture-image/index.html#widl-ImageCapture-getPhotoCapabilities-Promise-PhotoCapabilities
GetCapabilities(string source_id)
=> (PhotoCapabilities capabilities);
// Sets the |settings| on the associated video capture device.
// https://w3c.github.io/mediacapture-image/index.html#widl-ImageCapture-setOptions-Promise-void--PhotoSettings-photoSettings
SetOptions(string source_id, PhotoSettings settings)
=> (bool success);
// Takes a Photo from the given |source_id|, returning it encoded in |blob|
// with the format specified in its |mime_type|.
// https://w3c.github.io/mediacapture-image/index.html#widl-ImageCapture-takePhoto-Promise-Blob
TakePhoto(string source_id)
=> (Blob blob);
};