chromium/components/media_effects/media_device_info.h

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

#ifndef COMPONENTS_MEDIA_EFFECTS_MEDIA_DEVICE_INFO_H_
#define COMPONENTS_MEDIA_EFFECTS_MEDIA_DEVICE_INFO_H_

#include "base/system/system_monitor.h"
#include "media/audio/audio_device_description.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/audio/public/mojom/system_info.mojom.h"
#include "services/video_capture/public/mojom/video_source_provider.mojom.h"

namespace media_effects {

// Get the id of the real default device if present in the passed `infos`,
// otherwise return nullopt.
std::optional<std::string> GetRealDefaultDeviceId(
    const std::vector<media::AudioDeviceDescription>& infos);

// Get the id of the real communications device if present in the passed
// `infos`, otherwise return nullopt. Only relevant on Windows.
std::optional<std::string> GetRealCommunicationsDeviceId(
    const std::vector<media::AudioDeviceDescription>& infos);

// Returns a list of the real mics names by excluding virtual devices such as
// default.
std::vector<std::string> GetRealAudioDeviceNames(
    const std::vector<media::AudioDeviceDescription>& infos);

// Returns a list of the cameras names.
std::vector<std::string> GetRealVideoDeviceNames(
    const std::vector<media::VideoCaptureDeviceInfo>& infos);

// This class manages a cache of device infos for currently connected audio and
// video capture devices. It is similar to `MediaCaptureDevicesImpl` from
// content, but it holds the media::types instead of blink::MediaStreamDevice.
// It allows usages within chrome to access the full device information.
class MediaDeviceInfo : public base::SystemMonitor::DevicesChangedObserver {};

}  // namespace media_effects
#endif  // COMPONENTS_MEDIA_EFFECTS_MEDIA_DEVICE_INFO_H_