diff --git a/include/frontend.hpp b/include/frontend.hpp index fab3a0e..f8aef42 100755 --- a/include/frontend.hpp +++ b/include/frontend.hpp @@ -158,6 +158,7 @@ private: const float v_sync_timeout = 5.0f; const float bad_resolution_timeout = 30.0f; const float menu_change_timeout = 0.3f; + const float input_data_format_change_timeout = 1.0f; CurrMenuType curr_menu = DEFAULT_MENU_TYPE; GenericMenu* curr_menu_ptr = NULL; @@ -213,6 +214,7 @@ private: FPSArray poll_fps; std::chrono::time_point last_poll_time; std::chrono::time_point last_menu_change_time; + std::chrono::time_point last_data_format_change_time; int curr_frame_texture_pos = 0; int num_frames_to_blend; diff --git a/source/WindowScreen_Menu.cpp b/source/WindowScreen_Menu.cpp index 98498c8..1f05bfe 100755 --- a/source/WindowScreen_Menu.cpp +++ b/source/WindowScreen_Menu.cpp @@ -97,6 +97,7 @@ static double FPSArrayGetAverage(FPSArray *array) { void WindowScreen::init_menus() { this->last_menu_change_time = std::chrono::high_resolution_clock::now(); + this->last_data_format_change_time = std::chrono::high_resolution_clock::now(); this->connection_menu = new ConnectionMenu(this->text_rectangle_pool); this->main_menu = new MainMenu(this->text_rectangle_pool); this->video_menu = new VideoMenu(this->text_rectangle_pool); @@ -589,8 +590,13 @@ void WindowScreen::devices_allowed_change(PossibleCaptureDevices device) { } void WindowScreen::input_video_data_format_request_change(bool positive) { + std::chrono::time_point curr_time = std::chrono::high_resolution_clock::now(); + const std::chrono::duration diff = curr_time - this->last_data_format_change_time; + if(diff.count() < this->input_data_format_change_timeout) + return; this->capture_status->request_low_bw_format = !this->capture_status->request_low_bw_format; this->print_notification("Changing data format...\nPlease wait..."); + this->last_data_format_change_time = curr_time; } bool WindowScreen::can_execute_cmd(const WindowCommand* window_cmd, bool is_extra, bool is_always) { diff --git a/source/conversions.cpp b/source/conversions.cpp index 17f6c19..125a60b 100755 --- a/source/conversions.cpp +++ b/source/conversions.cpp @@ -259,9 +259,9 @@ static inline void usb_rgb888convertInterleaveU16VideoToOutputDirectOpt(deinterl size_t input_halfline_pixel = (input_halfline * real_num_iters) + i; size_t output_halfline_pixel = (output_halfline * real_num_iters) + i; for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++) - out_ptr_bottom[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][bottom_pos]); + out_ptr_bottom[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][bottom_pos]; for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++) - out_ptr_top[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][top_pos]); + out_ptr_top[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][top_pos]; } } @@ -273,7 +273,7 @@ static inline void usb_rgb888convertInterleaveU16VideoToOutputDirectOptMonoTop(d size_t input_halfline_pixel = (input_halfline * real_num_iters) + i; size_t output_halfline_pixel = (output_halfline * real_num_iters) + i; for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++) - out_ptr_top[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][top_pos]); + out_ptr_top[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][top_pos]; } } @@ -285,7 +285,7 @@ static inline void usb_rgb888convertInterleaveU16VideoToOutputDirectOptMonoBotto size_t input_halfline_pixel = (input_halfline * real_num_iters) + i; size_t output_halfline_pixel = (output_halfline * real_num_iters) + i; for(size_t j = 0; j < INTERLEAVED_RGB888_TOTAL_SIZE; j++) - out_ptr_bottom[output_halfline_pixel].pixels[j] = _reverse_endianness(in_ptr[input_halfline_pixel].pixels[j][bottom_pos]); + out_ptr_bottom[output_halfline_pixel].pixels[j] = in_ptr[input_halfline_pixel].pixels[j][bottom_pos]; } }