2022-11-05 10:53:26 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-11-06 11:19:24 +01:00
|
|
|
#include "video_sink.h"
|
2022-11-05 10:53:26 +01:00
|
|
|
|
|
|
|
|
enum class recording_mode
|
|
|
|
|
{
|
|
|
|
|
stopped = 0,
|
|
|
|
|
rpcs3,
|
|
|
|
|
cell
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
namespace utils
|
|
|
|
|
{
|
|
|
|
|
class video_provider
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
video_provider() = default;
|
|
|
|
|
~video_provider();
|
|
|
|
|
|
2022-11-06 11:19:24 +01:00
|
|
|
bool set_video_sink(std::shared_ptr<video_sink> sink, recording_mode type);
|
2023-11-22 01:21:05 +01:00
|
|
|
void set_pause_time_us(usz pause_time_us);
|
2022-11-06 11:19:24 +01:00
|
|
|
|
2022-11-05 10:53:26 +01:00
|
|
|
bool can_consume_frame();
|
2023-08-12 23:06:22 +02:00
|
|
|
void present_frame(std::vector<u8>& data, u32 pitch, u32 width, u32 height, bool is_bgra);
|
2022-11-05 10:53:26 +01:00
|
|
|
|
2022-11-06 11:19:24 +01:00
|
|
|
void present_samples(u8* buf, u32 sample_count, u16 channels);
|
|
|
|
|
|
2022-11-05 10:53:26 +01:00
|
|
|
private:
|
2023-11-14 21:51:42 +01:00
|
|
|
recording_mode check_mode();
|
2022-11-06 11:19:24 +01:00
|
|
|
|
2022-11-05 10:53:26 +01:00
|
|
|
recording_mode m_type = recording_mode::stopped;
|
2022-11-06 11:19:24 +01:00
|
|
|
std::shared_ptr<video_sink> m_video_sink;
|
2023-11-29 19:12:06 +01:00
|
|
|
shared_mutex m_video_mutex{};
|
|
|
|
|
shared_mutex m_audio_mutex{};
|
2022-11-05 10:53:26 +01:00
|
|
|
atomic_t<bool> m_active{false};
|
2023-11-29 19:12:06 +01:00
|
|
|
atomic_t<usz> m_start_time_us{umax};
|
2022-11-06 11:19:24 +01:00
|
|
|
s64 m_last_video_pts_incoming = -1;
|
|
|
|
|
s64 m_last_audio_pts_incoming = -1;
|
2023-11-22 01:21:05 +01:00
|
|
|
usz m_pause_time_us = 0;
|
2022-11-05 10:53:26 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace utils
|