mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-23 18:14:06 +00:00
Add option for skipping input, when encoding real-time input but the encoder is not fast enough
also clean up CMakeLists.txt
This commit is contained in:
parent
a28ad1509d
commit
fdcca0c76b
|
@ -144,7 +144,6 @@ endif()
|
||||||
target_include_directories(uvg266 PUBLIC src)
|
target_include_directories(uvg266 PUBLIC src)
|
||||||
target_include_directories(uvg266 PUBLIC src/extras)
|
target_include_directories(uvg266 PUBLIC src/extras)
|
||||||
target_include_directories(uvg266 PUBLIC src/strategies)
|
target_include_directories(uvg266 PUBLIC src/strategies)
|
||||||
target_include_directories(uvg266 PUBLIC "G:/Local/sainio/Documents/libzmq/out/install/include")
|
|
||||||
|
|
||||||
file(GLOB LIB_SOURCES_STRATEGIES_AVX2 RELATIVE ${PROJECT_SOURCE_DIR} "src/strategies/avx2/*.c")
|
file(GLOB LIB_SOURCES_STRATEGIES_AVX2 RELATIVE ${PROJECT_SOURCE_DIR} "src/strategies/avx2/*.c")
|
||||||
file(GLOB LIB_SOURCES_STRATEGIES_SSE41 RELATIVE ${PROJECT_SOURCE_DIR} "src/strategies/sse41/*.c")
|
file(GLOB LIB_SOURCES_STRATEGIES_SSE41 RELATIVE ${PROJECT_SOURCE_DIR} "src/strategies/sse41/*.c")
|
||||||
|
@ -166,8 +165,6 @@ endif()
|
||||||
|
|
||||||
add_executable(uvg266-bin ${CLI_SOURCES})
|
add_executable(uvg266-bin ${CLI_SOURCES})
|
||||||
|
|
||||||
target_link_libraries(uvg266-bin PUBLIC uvg266 "G:/Local/sainio/Documents/libzmq/out/install/lib/libzmq-mt-4_3_6.lib")
|
|
||||||
|
|
||||||
set_target_properties(uvg266-bin PROPERTIES OUTPUT_NAME uvg266)
|
set_target_properties(uvg266-bin PROPERTIES OUTPUT_NAME uvg266)
|
||||||
set_target_properties(uvg266-bin PROPERTIES RUNTIME_OUTPUT_NAME uvg266)
|
set_target_properties(uvg266-bin PROPERTIES RUNTIME_OUTPUT_NAME uvg266)
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,7 @@ static const struct option long_options[] = {
|
||||||
{ "version", no_argument, NULL, 0 },
|
{ "version", no_argument, NULL, 0 },
|
||||||
{ "help", no_argument, NULL, 0 },
|
{ "help", no_argument, NULL, 0 },
|
||||||
{ "loop-input", no_argument, NULL, 0 },
|
{ "loop-input", no_argument, NULL, 0 },
|
||||||
|
{ "skip-input", no_argument, NULL, 0 },
|
||||||
{ "mv-constraint", required_argument, NULL, 0 },
|
{ "mv-constraint", required_argument, NULL, 0 },
|
||||||
{ "hash", required_argument, NULL, 0 },
|
{ "hash", required_argument, NULL, 0 },
|
||||||
{"cu-split-termination",required_argument, NULL, 0 },
|
{"cu-split-termination",required_argument, NULL, 0 },
|
||||||
|
@ -339,6 +340,8 @@ cmdline_opts_t* cmdline_opts_parse(const uvg_api *const api, int argc, char *arg
|
||||||
goto done;
|
goto done;
|
||||||
} else if (!strcmp(name, "loop-input")) {
|
} else if (!strcmp(name, "loop-input")) {
|
||||||
opts->loop_input = true;
|
opts->loop_input = true;
|
||||||
|
} else if (!strcmp(name, "skip-input")) {
|
||||||
|
opts->skip_input = true;
|
||||||
} else if (!api->config_parse(opts->config, name, optarg)) {
|
} else if (!api->config_parse(opts->config, name, optarg)) {
|
||||||
fprintf(stderr, "invalid argument: %s=%s\n", name, optarg);
|
fprintf(stderr, "invalid argument: %s=%s\n", name, optarg);
|
||||||
ok = 0;
|
ok = 0;
|
||||||
|
|
|
@ -59,6 +59,8 @@ typedef struct cmdline_opts_t {
|
||||||
bool version;
|
bool version;
|
||||||
/** \brief Whether to loop input */
|
/** \brief Whether to loop input */
|
||||||
bool loop_input;
|
bool loop_input;
|
||||||
|
|
||||||
|
bool skip_input;
|
||||||
} cmdline_opts_t;
|
} cmdline_opts_t;
|
||||||
|
|
||||||
cmdline_opts_t* cmdline_opts_parse(const uvg_api *api, int argc, char *argv[]);
|
cmdline_opts_t* cmdline_opts_parse(const uvg_api *api, int argc, char *argv[]);
|
||||||
|
|
|
@ -271,11 +271,20 @@ static void* input_read_thread(void* in_args)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__MINGW32__)
|
#if defined(__GNUC__) && !defined(__MINGW32__)
|
||||||
usleep(33000);
|
// usleep(33000);
|
||||||
#else
|
#else
|
||||||
// Sleep(33);
|
// Sleep(33);
|
||||||
#endif
|
#endif
|
||||||
|
if (!args->opts->skip_input) {
|
||||||
|
uvg_sem_wait(args->available_input_slots);
|
||||||
|
args->img_in = frame_in;
|
||||||
|
args->retval = retval;
|
||||||
|
// Unlock main_thread_mutex to notify main thread that the new img_in
|
||||||
|
// and retval have been placed to args.
|
||||||
|
uvg_sem_post(args->filled_input_slots);
|
||||||
|
frame_in = NULL;
|
||||||
|
|
||||||
|
} else
|
||||||
// Wait until main thread is ready to receive the next frame.
|
// Wait until main thread is ready to receive the next frame.
|
||||||
if (uvg_sem_trywait(args->available_input_slots) == 0) {
|
if (uvg_sem_trywait(args->available_input_slots) == 0) {
|
||||||
args->img_in = frame_in;
|
args->img_in = frame_in;
|
||||||
|
|
Loading…
Reference in a new issue