#include "media/gpu/chromeos/image_processor.h"
#include <memory>
#include <ostream>
#include <sstream>
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "media/base/video_types.h"
#include "media/gpu/macros.h"
namespace media {
namespace {
PortConfig;
template <class FrameType>
bool CheckFrameFormat(const ImageProcessor::PortConfig& config,
const FrameType& frame) { … }
}
ImageProcessor::ClientCallback::ClientCallback(FrameReadyCB ready_cb)
: … { … }
ImageProcessor::ClientCallback::ClientCallback(FrameResourceReadyCB ready_cb)
: … { … }
ImageProcessor::ClientCallback::ClientCallback(
LegacyFrameResourceReadyCB legacy_frame_resource_ready_cb)
: … { … }
ImageProcessor::ClientCallback::ClientCallback(ClientCallback&&) = default;
ImageProcessor::ClientCallback::~ClientCallback() = default;
std::unique_ptr<ImageProcessor> ImageProcessor::Create(
CreateBackendCB create_backend_cb,
const PortConfig& input_config,
const PortConfig& output_config,
OutputMode output_mode,
ErrorCB error_cb,
scoped_refptr<base::SequencedTaskRunner> client_task_runner) { … }
ImageProcessor::ImageProcessor(
std::unique_ptr<ImageProcessorBackend> backend,
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
scoped_refptr<base::SequencedTaskRunner> backend_task_runner)
: … { … }
ImageProcessor::~ImageProcessor() { … }
bool ImageProcessor::Process(scoped_refptr<VideoFrame> input_frame,
scoped_refptr<VideoFrame> output_frame,
FrameReadyCB cb) { … }
void ImageProcessor::OnProcessDoneThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
std::optional<base::WeakPtr<ImageProcessor>> weak_this,
int cb_index,
scoped_refptr<VideoFrame> frame) { … }
void ImageProcessor::OnProcessDone(int cb_index,
scoped_refptr<VideoFrame> frame) { … }
bool ImageProcessor::Process(scoped_refptr<FrameResource> input_frame,
scoped_refptr<FrameResource> output_frame,
FrameResourceReadyCB cb) { … }
void ImageProcessor::OnProcessFrameResourceDoneThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
std::optional<base::WeakPtr<ImageProcessor>> weak_this,
int cb_index,
scoped_refptr<FrameResource> frame) { … }
void ImageProcessor::OnProcessFrameResourceDone(
int cb_index,
scoped_refptr<FrameResource> frame) { … }
bool ImageProcessor::Process(scoped_refptr<FrameResource> frame,
LegacyFrameResourceReadyCB cb) { … }
void ImageProcessor::OnProcessFrameResourceLegacyDoneThunk(
scoped_refptr<base::SequencedTaskRunner> task_runner,
std::optional<base::WeakPtr<ImageProcessor>> weak_this,
int cb_index,
size_t buffer_id,
scoped_refptr<FrameResource> frame) { … }
void ImageProcessor::OnProcessFrameResourceLegacyDone(
int cb_index,
size_t buffer_id,
scoped_refptr<FrameResource> frame) { … }
bool ImageProcessor::Reset() { … }
int ImageProcessor::StoreCallback(ClientCallback cb) { … }
const PortConfig& ImageProcessor::input_config() const { … }
const PortConfig& ImageProcessor::output_config() const { … }
}