#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/test/video_frame_file_writer.h"
#include <utility>
#include <vector>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/gpu/buildflags.h"
#include "media/gpu/video_frame_mapper.h"
#include "media/gpu/video_frame_mapper_factory.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/codec/png_codec.h"
#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
#include <sys/mman.h>
#endif
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
#include "media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.h"
#endif
namespace media {
namespace test {
VideoFrameFileWriter::VideoFrameFileWriter(
const base::FilePath& output_folder,
OutputFormat output_format,
size_t output_limit,
const base::FilePath::StringType& output_file_prefix)
: … { … }
VideoFrameFileWriter::~VideoFrameFileWriter() { … }
void VideoFrameFileWriter::CleanUpOnWriterThread() { … }
std::unique_ptr<VideoFrameFileWriter> VideoFrameFileWriter::Create(
const base::FilePath& output_folder,
OutputFormat output_format,
size_t output_limit,
const base::FilePath::StringType& output_file_prefix) { … }
bool VideoFrameFileWriter::Initialize() { … }
void VideoFrameFileWriter::ProcessVideoFrame(
scoped_refptr<const VideoFrame> video_frame,
size_t frame_index) { … }
bool VideoFrameFileWriter::WaitUntilDone() { … }
void VideoFrameFileWriter::ProcessVideoFrameTask(
scoped_refptr<const VideoFrame> video_frame,
size_t frame_index) { … }
void VideoFrameFileWriter::WriteVideoFramePNG(
scoped_refptr<const VideoFrame> video_frame,
const base::FilePath& filename) { … }
void VideoFrameFileWriter::WriteVideoFrameYUV(
scoped_refptr<const VideoFrame> video_frame,
const base::FilePath& filename) { … }
}
}