chromium/media/capture/mojom/video_effects_manager.mojom

// 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 {
  uint16 kernel;
  float sigma;
};

// Effects that apply a mask to the video.
struct Masking {
  Blur background_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;
  Masking? masking;
  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);
};