2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2009-03-28 21:27:48 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2009-03-28 21:27:48 +00:00
|
|
|
|
2020-10-21 14:37:16 +00:00
|
|
|
#include <ctime>
|
|
|
|
#include <memory>
|
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2013-02-27 01:47:48 +00:00
|
|
|
|
2020-10-21 14:37:16 +00:00
|
|
|
struct FrameDumpContext;
|
|
|
|
class PointerWrap;
|
2023-01-27 04:03:15 +00:00
|
|
|
struct FrameData;
|
|
|
|
struct FrameState;
|
2020-10-21 14:37:16 +00:00
|
|
|
|
2023-01-27 04:03:15 +00:00
|
|
|
class FFMpegFrameDump
|
2009-03-28 21:27:48 +00:00
|
|
|
{
|
2014-06-15 03:29:05 +00:00
|
|
|
public:
|
2023-01-27 04:03:15 +00:00
|
|
|
FFMpegFrameDump();
|
|
|
|
~FFMpegFrameDump();
|
2016-11-04 17:19:35 +00:00
|
|
|
|
2020-11-21 21:25:57 +00:00
|
|
|
bool Start(int w, int h, u64 start_ticks);
|
2020-10-21 14:37:16 +00:00
|
|
|
void AddFrame(const FrameData&);
|
|
|
|
void Stop();
|
|
|
|
void DoState(PointerWrap&);
|
|
|
|
bool IsStarted() const;
|
2020-11-21 21:25:57 +00:00
|
|
|
FrameState FetchState(u64 ticks, int frame_number) const;
|
2020-10-21 14:37:16 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool IsFirstFrameInCurrentFile() const;
|
2020-11-21 21:25:57 +00:00
|
|
|
bool PrepareEncoding(int w, int h, u64 start_ticks, u32 savestate_index);
|
2020-10-21 14:37:16 +00:00
|
|
|
bool CreateVideoFile();
|
|
|
|
void CloseVideoFile();
|
|
|
|
void CheckForConfigChange(const FrameData&);
|
2020-10-23 19:32:10 +00:00
|
|
|
void ProcessPackets();
|
2016-11-04 17:19:35 +00:00
|
|
|
|
2017-05-22 19:27:10 +00:00
|
|
|
#if defined(HAVE_FFMPEG)
|
2020-10-21 14:37:16 +00:00
|
|
|
std::unique_ptr<FrameDumpContext> m_context;
|
2016-11-04 17:19:35 +00:00
|
|
|
#endif
|
2020-10-21 14:37:16 +00:00
|
|
|
|
|
|
|
// Used for FetchState:
|
|
|
|
u32 m_savestate_index = 0;
|
|
|
|
|
|
|
|
// Used for filename generation.
|
|
|
|
std::time_t m_start_time = {};
|
|
|
|
u32 m_file_index = 0;
|
2009-03-28 21:27:48 +00:00
|
|
|
};
|
2020-10-21 14:37:16 +00:00
|
|
|
|
|
|
|
#if !defined(HAVE_FFMPEG)
|
|
|
|
inline FrameDump::FrameDump() = default;
|
|
|
|
inline FrameDump::~FrameDump() = default;
|
|
|
|
|
2023-01-27 04:03:15 +00:00
|
|
|
inline FrameState FrameDump::FetchState(u64 ticks, int frame_number) const
|
2020-10-21 14:37:16 +00:00
|
|
|
{
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
#endif
|