win-capture: Use macros for intervals

Having macros that state what these numbers mean is much more ideal than
just having a random number thrown in there, wondering why it was used
and what its purpose is (magic numbers).
master
jp9000 2015-01-06 01:41:13 -08:00
parent 4f2c48a937
commit 2e6010b36d
1 changed files with 7 additions and 4 deletions

View File

@ -44,6 +44,9 @@
#define TEXT_LIMIT_FRAMERATE obs_module_text("GameCapture.LimitFramerate") #define TEXT_LIMIT_FRAMERATE obs_module_text("GameCapture.LimitFramerate")
#define TEXT_CAPTURE_OVERLAYS obs_module_text("GameCapture.CaptureOverlays") #define TEXT_CAPTURE_OVERLAYS obs_module_text("GameCapture.CaptureOverlays")
#define DEFAULT_RETRY_INTERVAL 2.0f
#define ERROR_RETRY_INTERVAL 4.0f
struct game_capture_config { struct game_capture_config {
char *title; char *title;
char *class; char *class;
@ -323,7 +326,7 @@ static void game_capture_update(void *data, obs_data_t *settings)
free_config(&gc->config); free_config(&gc->config);
gc->config = cfg; gc->config = cfg;
gc->activate_hook = !!window && !!*window; gc->activate_hook = !!window && !!*window;
gc->retry_interval = 2.0f; gc->retry_interval = DEFAULT_RETRY_INTERVAL;
if (!gc->initial_config) { if (!gc->initial_config) {
if (reset_capture) { if (reset_capture) {
@ -339,7 +342,7 @@ static void *game_capture_create(obs_data_t *settings, obs_source_t *source)
struct game_capture *gc = bzalloc(sizeof(*gc)); struct game_capture *gc = bzalloc(sizeof(*gc));
gc->source = source; gc->source = source;
gc->initial_config = true; gc->initial_config = true;
gc->retry_interval = 2.0f; gc->retry_interval = DEFAULT_RETRY_INTERVAL;
game_capture_update(gc, settings); game_capture_update(gc, settings);
return gc; return gc;
@ -964,7 +967,7 @@ static void game_capture_tick(void *data, float seconds)
gc->error_acquiring = true; gc->error_acquiring = true;
} else if (!gc->capturing) { } else if (!gc->capturing) {
gc->retry_interval = 4.0f; gc->retry_interval = ERROR_RETRY_INTERVAL;
stop_capture(gc); stop_capture(gc);
} }
} }
@ -972,7 +975,7 @@ static void game_capture_tick(void *data, float seconds)
if (gc->hook_ready && object_signalled(gc->hook_ready)) { if (gc->hook_ready && object_signalled(gc->hook_ready)) {
gc->capturing = start_capture(gc); gc->capturing = start_capture(gc);
if (!gc->capturing) { if (!gc->capturing) {
gc->retry_interval = 4.0f; gc->retry_interval = ERROR_RETRY_INTERVAL;
stop_capture(gc); stop_capture(gc);
} }
} }