#include "media/mojo/clients/mojo_decryptor.h"
#include <stddef.h>
#include <stdint.h>
#include <utility>
#include "base/functional/bind.h"
#include "base/numerics/safe_conversions.h"
#include "media/base/audio_buffer.h"
#include "media/base/decoder_buffer.h"
#include "media/base/video_frame.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
#include "media/mojo/mojom/decryptor.mojom.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
namespace media {
namespace {
void ReleaseFrameResource(
mojo::PendingRemote<mojom::FrameResourceReleaser> releaser) { … }
}
MojoDecryptor::MojoDecryptor(
mojo::PendingRemote<mojom::Decryptor> remote_decryptor,
uint32_t writer_capacity)
: … { … }
MojoDecryptor::~MojoDecryptor() { … }
void MojoDecryptor::Decrypt(StreamType stream_type,
scoped_refptr<DecoderBuffer> encrypted,
DecryptCB decrypt_cb) { … }
void MojoDecryptor::CancelDecrypt(StreamType stream_type) { … }
void MojoDecryptor::InitializeAudioDecoder(const AudioDecoderConfig& config,
DecoderInitCB init_cb) { … }
void MojoDecryptor::InitializeVideoDecoder(const VideoDecoderConfig& config,
DecoderInitCB init_cb) { … }
void MojoDecryptor::DecryptAndDecodeAudio(
scoped_refptr<DecoderBuffer> encrypted,
AudioDecodeCB audio_decode_cb) { … }
void MojoDecryptor::DecryptAndDecodeVideo(
scoped_refptr<DecoderBuffer> encrypted,
VideoDecodeCB video_decode_cb) { … }
void MojoDecryptor::ResetDecoder(StreamType stream_type) { … }
void MojoDecryptor::DeinitializeDecoder(StreamType stream_type) { … }
void MojoDecryptor::OnBufferDecrypted(DecryptCB decrypt_cb,
Status status,
mojom::DecoderBufferPtr buffer) { … }
void MojoDecryptor::OnBufferRead(DecryptCB decrypt_cb,
Status status,
scoped_refptr<DecoderBuffer> buffer) { … }
void MojoDecryptor::OnAudioDecoded(
AudioDecodeCB audio_decode_cb,
Status status,
std::vector<mojom::AudioBufferPtr> audio_buffers) { … }
void MojoDecryptor::OnVideoDecoded(
VideoDecodeCB video_decode_cb,
Status status,
const scoped_refptr<VideoFrame>& video_frame,
mojo::PendingRemote<mojom::FrameResourceReleaser> releaser) { … }
void MojoDecryptor::OnConnectionError(uint32_t custom_reason,
const std::string& description) { … }
}