1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61

media / capture / mojom / video_effects_manager.mojom [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module media.mojom;

import "ui/gfx/geometry/mojom/geometry.mojom";

// Settings that adjust color, exposure and white balance of the image.
struct ImageEnhancement {
  bool lighting;
  // Additional parameters/adjustments will be added in the future.
};

// Settings that control a blur effect.
struct Blur {};

// Settings to control automatic framing.
struct Framing {
  // Padding is applied as a percentage of the size of the region of
  // interest.
  gfx.mojom.InsetsF padding_ratios;
};

// Contains all of the configuration needed to apply effects to live video
// streams. It is used by both the browser UI and the video capture service.
// All fields are optional. If the value isn't present, then the effect will be
// disabled.
struct VideoEffectsConfiguration {
  ImageEnhancement? image_enhancement;
  Blur? blur;
  Framing? framing;
};

// Callback interface for clients who want to get notified when the video
// effect configuration changes.
interface VideoEffectsConfigurationObserver {
  // This method is called with the new configuration value when the
  // configuration changes.
  OnConfigurationChanged(VideoEffectsConfiguration configuration);
};

enum SetConfigurationResult {
  kOk,
  kError,
};

// The interface for controlling the effects that are applied to live video
// streams.
interface VideoEffectsManager {
  // Returns the current configuration.
  GetConfiguration() => (VideoEffectsConfiguration configuration);

  // Sets the configuration value.
  SetConfiguration(VideoEffectsConfiguration configuration)
    => (SetConfigurationResult result);

  // Registers an observer to receive configuration change callbacks.
  AddObserver(
    pending_remote<VideoEffectsConfigurationObserver> observer);
};