AVIDump: Merge redundant variables.

They were always the same. We also don't scale at all.
This commit is contained in:
degasus 2016-10-15 19:06:01 +02:00
parent 112e18a5d1
commit 03d8efc270
1 changed files with 2 additions and 9 deletions

View File

@ -43,8 +43,6 @@ static u64 s_last_frame;
static bool s_last_frame_is_valid = false; static bool s_last_frame_is_valid = false;
static bool s_start_dumping = false; static bool s_start_dumping = false;
static u64 s_last_pts; static u64 s_last_pts;
static int s_current_width;
static int s_current_height;
static int s_file_index = 0; static int s_file_index = 0;
static void InitAVCodec() static void InitAVCodec()
@ -63,8 +61,6 @@ bool AVIDump::Start(int w, int h)
s_width = w; s_width = w;
s_height = h; s_height = h;
s_current_width = w;
s_current_height = h;
s_last_frame_is_valid = false; s_last_frame_is_valid = false;
s_last_pts = 0; s_last_pts = 0;
@ -171,8 +167,7 @@ void AVIDump::AddFrame(const u8* data, int width, int height, int stride, u64 ti
s_src_frame->width = s_width; s_src_frame->width = s_width;
s_src_frame->height = s_height; s_src_frame->height = s_height;
// Convert image from {BGR24, RGBA} to desired pixel format, and scale to initial // Convert image from {BGR24, RGBA} to desired pixel format
// width and height
if ((s_sws_context = if ((s_sws_context =
sws_getCachedContext(s_sws_context, width, height, s_pix_fmt, s_width, s_height, sws_getCachedContext(s_sws_context, width, height, s_pix_fmt, s_width, s_height,
s_stream->codec->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr))) s_stream->codec->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr)))
@ -293,13 +288,11 @@ void AVIDump::CheckResolution(int width, int height)
// (possibly width as well, but no examples known) to have a value of zero. This can occur as the // (possibly width as well, but no examples known) to have a value of zero. This can occur as the
// VI is able to be set to a zero value for height/width to disable output. If this is the case, // VI is able to be set to a zero value for height/width to disable output. If this is the case,
// simply keep the last known resolution of the video for the added frame. // simply keep the last known resolution of the video for the added frame.
if ((width != s_current_width || height != s_current_height) && (width > 0 && height > 0)) if ((width != s_width || height != s_height) && (width > 0 && height > 0))
{ {
int temp_file_index = s_file_index; int temp_file_index = s_file_index;
Stop(); Stop();
s_file_index = temp_file_index + 1; s_file_index = temp_file_index + 1;
Start(width, height); Start(width, height);
s_current_width = width;
s_current_height = height;
} }
} }