mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-16 20:43:42 +00:00
do not initialize omx on every startup
This commit is contained in:
@@ -119,23 +119,31 @@ int main(int argc, char *argv[]) {
|
|||||||
LOGGING_INIT;
|
LOGGING_INIT;
|
||||||
A_THREAD_RENAME("main");
|
A_THREAD_RENAME("main");
|
||||||
|
|
||||||
# ifdef WITH_OMX
|
|
||||||
bcm_host_init();
|
|
||||||
OMX_ERRORTYPE omx_error;
|
|
||||||
if ((omx_error = OMX_Init()) != OMX_ErrorNone) {
|
|
||||||
LOG_ERROR_OMX(omx_error, "Can't initialize OMX Core");
|
|
||||||
exit_code = -1;
|
|
||||||
goto omx_error;
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
options_s *options = options_init(argc, argv);
|
options_s *options = options_init(argc, argv);
|
||||||
device_s *dev = device_init();
|
device_s *dev = device_init();
|
||||||
encoder_s *enc = encoder_init();
|
encoder_s *enc = encoder_init();
|
||||||
stream_s *stream = stream_init(dev, enc);
|
stream_s *stream = stream_init(dev, enc);
|
||||||
server_s *server = server_init(stream);
|
server_s *server = server_init(stream);
|
||||||
|
|
||||||
|
# ifdef WITH_OMX
|
||||||
|
bool i_bcm_host = false;
|
||||||
|
OMX_ERRORTYPE omx_error = OMX_ErrorUndefined;
|
||||||
|
# endif
|
||||||
|
|
||||||
if ((exit_code = options_parse(options, dev, enc, stream, server)) == 0) {
|
if ((exit_code = options_parse(options, dev, enc, stream, server)) == 0) {
|
||||||
|
# ifdef WITH_OMX
|
||||||
|
if (enc->type == ENCODER_TYPE_OMX || stream->h264_sink) {
|
||||||
|
bcm_host_init();
|
||||||
|
i_bcm_host = true;
|
||||||
|
}
|
||||||
|
if (enc->type == ENCODER_TYPE_OMX) {
|
||||||
|
if ((omx_error = OMX_Init()) != OMX_ErrorNone) {
|
||||||
|
LOG_ERROR_OMX(omx_error, "Can't initialize OMX Core; forced CPU encoder");
|
||||||
|
enc->type = ENCODER_TYPE_CPU;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef WITH_GPIO
|
# ifdef WITH_GPIO
|
||||||
gpio_init();
|
gpio_init();
|
||||||
# endif
|
# endif
|
||||||
@@ -173,9 +181,12 @@ int main(int argc, char *argv[]) {
|
|||||||
options_destroy(options);
|
options_destroy(options);
|
||||||
|
|
||||||
# ifdef WITH_OMX
|
# ifdef WITH_OMX
|
||||||
OMX_Deinit();
|
if (omx_error == OMX_ErrorNone) {
|
||||||
omx_error:
|
OMX_Deinit();
|
||||||
bcm_host_deinit();
|
}
|
||||||
|
if (i_bcm_host) {
|
||||||
|
bcm_host_deinit();
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (exit_code == 0) {
|
if (exit_code == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user