chromium/services/video_capture/public/mojom/video_capture_service.mojom

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

module video_capture.mojom;

import "sandbox/policy/mojom/sandbox.mojom";
import "services/video_capture/public/mojom/testing_controls.mojom";
import "services/video_capture/public/mojom/video_source_provider.mojom";

[EnableIf=is_chromeos_ash]
import "components/chromeos_camera/common/mjpeg_decode_accelerator.mojom";
[EnableIf=is_chromeos_ash]
import "media/capture/video/chromeos/mojom/camera_app.mojom";
[EnableIf=is_chromeos_ash]
import "chromeos/crosapi/mojom/video_capture.mojom";

[EnableIf=is_win]
import "gpu/ipc/common/luid.mojom";

[EnableIf=is_chromeos_ash]
interface AcceleratorFactory {
  // Creates a new JpegDecodeAccelerator and binds it to |jda|.
  CreateJpegDecodeAccelerator(
      pending_receiver<chromeos_camera.mojom.MjpegDecodeAccelerator> jda);
};

[EnableIf=is_fuchsia]
const sandbox.mojom.Sandbox kVideoCaptureSandbox
  = sandbox.mojom.Sandbox.kVideoCapture;
[EnableIfNot=is_fuchsia]
const sandbox.mojom.Sandbox kVideoCaptureSandbox
  = sandbox.mojom.Sandbox.kNoSandbox;

// Entry point to the Video Capture Service API.
// This interface is executed in the Video Capture Utility process.
// It is used from the Browser process.
// The factory provides access to the capture devices connected to the system.
// By using command-line switches, it is possible to replace this with a "fake"
// factory, which provides access to fake devices that generates test frames.
// The video capture supports gpu accelerated decoding of MJPEG frames
// delivered by camera devices, but to do it requires InjectGpuDependencies()
// to be called once before any call to ConnectToDeviceFactory() is made.
// Calling InjectGpuDependencies() is optional. If it is not called, MJPEG
// decoding will be performed without gpu acceleration.
[ServiceSandbox=kVideoCaptureSandbox]
interface VideoCaptureService  {
  [EnableIf=is_chromeos_ash]
  InjectGpuDependencies(pending_remote<AcceleratorFactory> accelerator_factory);

  // Binds a bridge for Chrome OS camera app and device.
  [EnableIf=is_chromeos_ash]
  ConnectToCameraAppDeviceBridge(
      pending_receiver<cros.mojom.CameraAppDeviceBridge> receiver);

  // Interface to expose the internal DeviceFactory to be passed from ash
  // to lacros.
  [EnableIf=is_chromeos_ash]
  BindVideoCaptureDeviceFactory(
      pending_receiver<crosapi.mojom.VideoCaptureDeviceFactory> receiver);

  // Current API. Supports multiple clients per source.
  ConnectToVideoSourceProvider(pending_receiver<VideoSourceProvider> receiver);

  // Binds a test-only interface for use by unit tests.
  BindControlsForTesting(pending_receiver<TestingControls> receiver);

  // Notify the capture service about change of the GPU adapter used in
  // the GPU process.
  [EnableIf=is_win]
  OnGpuInfoUpdate(gpu.mojom.Luid luid);
};