Move libvpx parameters to user config

This commit is contained in:
Benau 2017-03-31 12:22:21 +08:00
parent 21ff135b04
commit 29d0839162
2 changed files with 23 additions and 14 deletions

View File

@ -562,19 +562,27 @@ namespace UserConfigParams
PARAM_PREFIX GroupUserConfigParam m_recording_group
PARAM_DEFAULT( GroupUserConfigParam("Recording", "Recording Settings") );
PARAM_PREFIX BoolUserConfigParam m_record_bmp
PARAM_DEFAULT(BoolUserConfigParam(false, "record_bmp",
&m_recording_group, "Record video using uncompressed bitmap, notice: this "
"will require a lot of space and fast disk access."));
PARAM_PREFIX BoolUserConfigParam m_limit_game_fps
PARAM_DEFAULT(BoolUserConfigParam(true, "limit_game_fps",
&m_recording_group, "Limit game framerate not beyond the fps of recording "
"video."));
&m_recording_group, "Limit game framerate not beyond the fps of"
" recording video."));
PARAM_PREFIX IntUserConfigParam m_record_compression
PARAM_DEFAULT(IntUserConfigParam(90, "record_compression",
&m_recording_group, "Specify the compression level of recording video"));
PARAM_PREFIX IntUserConfigParam m_vp_codec
PARAM_DEFAULT(IntUserConfigParam(0, "vp_codec",
&m_recording_group, "Specify the codec for libvpx (VP8 / VP9)"));
PARAM_PREFIX IntUserConfigParam m_vp_end_usage
PARAM_DEFAULT(IntUserConfigParam(0, "vp_end_usage",
&m_recording_group, "Specify the rate control algorithm for libvpx,"
" see enum vpx_rc_mode"));
PARAM_PREFIX IntUserConfigParam m_vp_bitrate
PARAM_DEFAULT(IntUserConfigParam(20000, "vp_bitrate",
&m_recording_group, "Specify the bitrate for libvpx"));
PARAM_PREFIX IntUserConfigParam m_recorder_jpg_quality
PARAM_DEFAULT(IntUserConfigParam(90, "recorder_jpg_quality",
&m_recording_group, "Specify the jpg compression level of recorder"));
PARAM_PREFIX IntUserConfigParam m_record_fps
PARAM_DEFAULT(IntUserConfigParam(30, "record_fps",

View File

@ -146,10 +146,9 @@ int vpxEncodeFrame(vpx_codec_ctx_t *codec, vpx_image_t *img, int frame_index,
// ----------------------------------------------------------------------------
void AVIWriter::resetCaptureFormat()
{
m_img_quality = UserConfigParams::m_record_compression;
m_img_quality = UserConfigParams::m_recorder_jpg_quality;
m_msec_per_frame = unsigned(1000 / UserConfigParams::m_record_fps);
m_avi_format =
UserConfigParams::m_record_bmp ? AVI_FORMAT_BMP : AVI_FORMAT_JPG;
m_avi_format = AVI_FORMAT_JPG;
} // resetCaptureFormat
// ----------------------------------------------------------------------------
@ -193,7 +192,9 @@ void* AVIWriter::vpxEncoder(void *obj)
cfg.g_h = height;
cfg.g_timebase.num = 1;
cfg.g_timebase.den = UserConfigParams::m_record_fps;
//cfg.rc_target_bitrate = 2000;
int end_usage = UserConfigParams::m_vp_end_usage;
cfg.rc_end_usage = (vpx_rc_mode)end_usage;
cfg.rc_target_bitrate = UserConfigParams::m_vp_bitrate;
if (vpx_codec_enc_init(&codec, vpx_codec_vp8_cx(), &cfg, 0) > 0)
{
Log::error("vpxEncoder", "Failed to initialize encoder");