Fix recursive code
This commit is contained in:
parent
df0f7657d0
commit
69eed56256
|
@ -43,6 +43,7 @@ static int s_width;
|
||||||
static int s_height;
|
static int s_height;
|
||||||
static u64 s_last_frame;
|
static u64 s_last_frame;
|
||||||
static bool s_start_dumping = false;
|
static bool s_start_dumping = false;
|
||||||
|
static bool s_stop_dumping = false;
|
||||||
static u64 s_last_pts;
|
static u64 s_last_pts;
|
||||||
static int s_current_width;
|
static int s_current_width;
|
||||||
static int s_current_height;
|
static int s_current_height;
|
||||||
|
@ -85,6 +86,8 @@ bool AVIDump::Start(int w, int h, DumpFormat format)
|
||||||
s_last_frame = CoreTiming::GetTicks();
|
s_last_frame = CoreTiming::GetTicks();
|
||||||
s_last_pts = 0;
|
s_last_pts = 0;
|
||||||
|
|
||||||
|
s_stop_dumping = false;
|
||||||
|
|
||||||
InitAVCodec();
|
InitAVCodec();
|
||||||
bool success = CreateFile();
|
bool success = CreateFile();
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -181,7 +184,8 @@ static void PreparePacket(AVPacket* pkt)
|
||||||
void AVIDump::AddFrame(const u8* data, int width, int height)
|
void AVIDump::AddFrame(const u8* data, int width, int height)
|
||||||
{
|
{
|
||||||
// Store current frame data in case frame dumping stops before next frame update
|
// Store current frame data in case frame dumping stops before next frame update
|
||||||
StoreFrameData(data, width, height);
|
if (!s_stop_dumping)
|
||||||
|
StoreFrameData(data, width, height);
|
||||||
CheckResolution(width, height);
|
CheckResolution(width, height);
|
||||||
s_src_frame->data[0] = const_cast<u8*>(data);
|
s_src_frame->data[0] = const_cast<u8*>(data);
|
||||||
s_src_frame->linesize[0] = width * s_bytes_per_pixel;
|
s_src_frame->linesize[0] = width * s_bytes_per_pixel;
|
||||||
|
@ -257,6 +261,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height)
|
||||||
|
|
||||||
void AVIDump::Stop()
|
void AVIDump::Stop()
|
||||||
{
|
{
|
||||||
|
s_stop_dumping = true;
|
||||||
// Write the last stored frame just in case frame dumping stops before the next frame update
|
// Write the last stored frame just in case frame dumping stops before the next frame update
|
||||||
AddFrame(s_stored_frame_data, s_stored_frame_width, s_stored_frame_height);
|
AddFrame(s_stored_frame_data, s_stored_frame_width, s_stored_frame_height);
|
||||||
av_write_trailer(s_format_context);
|
av_write_trailer(s_format_context);
|
||||||
|
|
Loading…
Reference in New Issue