#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/filters/dav1d_video_decoder.h"
#include <memory>
#include <string>
#include <utility>
#include "base/bits.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "media/base/decoder_buffer.h"
#include "media/base/limits.h"
#include "media/base/media_log.h"
#include "media/base/video_aspect_ratio.h"
#include "media/base/video_util.h"
extern "C" {
#include "third_party/dav1d/libdav1d/include/dav1d/dav1d.h"
}
namespace media {
static void GetDecoderThreadCounts(const int coded_height,
int* tile_threads,
int* frame_threads) { … }
static VideoPixelFormat Dav1dImgFmtToVideoPixelFormat(
const Dav1dPictureParameters* pic) { … }
static void ReleaseDecoderBuffer(const uint8_t* buffer, void* opaque) { … }
static void LogDav1dMessage(void* cookie, const char* format, va_list ap) { … }
struct ScopedDav1dDataFree { … };
struct ScopedDav1dPictureFree { … };
SupportedVideoDecoderConfigs Dav1dVideoDecoder::SupportedConfigs() { … }
Dav1dVideoDecoder::Dav1dVideoDecoder(std::unique_ptr<MediaLog> media_log,
OffloadState offload_state)
: … { … }
Dav1dVideoDecoder::~Dav1dVideoDecoder() { … }
VideoDecoderType Dav1dVideoDecoder::GetDecoderType() const { … }
void Dav1dVideoDecoder::Initialize(const VideoDecoderConfig& config,
bool low_delay,
CdmContext* ,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& ) { … }
void Dav1dVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) { … }
void Dav1dVideoDecoder::Reset(base::OnceClosure reset_cb) { … }
void Dav1dVideoDecoder::Detach() { … }
void Dav1dVideoDecoder::Dav1dContextDeleter::operator()(Dav1dContext* ptr) { … }
void Dav1dVideoDecoder::CloseDecoder() { … }
bool Dav1dVideoDecoder::DecodeBuffer(scoped_refptr<DecoderBuffer> buffer) { … }
scoped_refptr<VideoFrame> Dav1dVideoDecoder::BindImageToVideoFrame(
const Dav1dPicture* pic) { … }
}