#include "content/renderer/media/codec_factory.h"
#include <memory>
#include <optional>
#include "base/functional/callback_forward.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "media/base/decoder.h"
#include "media/base/media_log.h"
#include "media/base/overlay_info.h"
#include "media/base/supported_video_decoder_config.h"
#include "media/mojo/clients/mojo_video_encode_accelerator.h"
#include "media/video/gpu_video_accelerator_factories.h"
namespace content {
CodecFactory::CodecFactory(
scoped_refptr<base::SequencedTaskRunner> media_task_runner,
scoped_refptr<viz::ContextProviderCommandBuffer> context_provider,
bool video_decode_accelerator_enabled,
bool video_encode_accelerator_enabled,
mojo::PendingRemote<media::mojom::VideoEncodeAcceleratorProvider>
pending_vea_provider_remote)
: … { … }
CodecFactory::~CodecFactory() = default;
std::unique_ptr<media::VideoEncodeAccelerator>
CodecFactory::CreateVideoEncodeAccelerator() { … }
media::VideoDecoderType CodecFactory::GetVideoDecoderType() { … }
std::optional<media::SupportedVideoDecoderConfigs>
CodecFactory::GetSupportedVideoDecoderConfigs() { … }
std::optional<media::VideoEncodeAccelerator::SupportedProfiles>
CodecFactory::GetVideoEncodeAcceleratorSupportedProfiles() { … }
bool CodecFactory::IsDecoderSupportKnown() { … }
bool CodecFactory::IsEncoderSupportKnown() { … }
void CodecFactory::NotifyDecoderSupportKnown(base::OnceClosure callback) { … }
void CodecFactory::NotifyEncoderSupportKnown(base::OnceClosure callback) { … }
CodecFactory::Notifier::Notifier() = default;
CodecFactory::Notifier::~Notifier() = default;
void CodecFactory::Notifier::Register(base::OnceClosure callback) { … }
void CodecFactory::Notifier::Notify() { … }
void CodecFactory::OnDecoderSupportFailed() { … }
void CodecFactory::OnGetSupportedDecoderConfigs() { … }
void CodecFactory::OnEncoderSupportFailed() { … }
void CodecFactory::OnGetVideoEncodeAcceleratorSupportedProfiles(
const media::VideoEncodeAccelerator::SupportedProfiles&
supported_profiles) { … }
void CodecFactory::BindOnTaskRunner(
mojo::PendingRemote<media::mojom::VideoEncodeAcceleratorProvider>
pending_vea_provider_remote) { … }
CodecFactoryDefault::CodecFactoryDefault(
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<viz::ContextProviderCommandBuffer> context_provider,
bool video_decode_accelerator_enabled,
bool video_encode_accelerator_enabled,
mojo::PendingRemote<media::mojom::VideoEncodeAcceleratorProvider>
pending_vea_provider_remote)
: … { … }
CodecFactoryDefault::~CodecFactoryDefault() = default;
std::unique_ptr<media::VideoDecoder> CodecFactoryDefault::CreateVideoDecoder(
media::GpuVideoAcceleratorFactories* gpu_factories,
media::MediaLog* media_log,
media::RequestOverlayInfoCB request_overlay_info_cb,
const gfx::ColorSpace& rendering_color_space) { … }
}