From 5dde7fa7cf8b6b6e6a748f58d385d376917895eb Mon Sep 17 00:00:00 2001 From: ohadmeir Date: Mon, 23 Dec 2024 21:42:11 +0200 Subject: [PATCH] Set DDS processing block settings --- src/dds/rs-dds-sensor-proxy.cpp | 24 ++++++++++++++++++++++++ src/dds/rs-dds-sensor-proxy.h | 3 +++ 2 files changed, 27 insertions(+) diff --git a/src/dds/rs-dds-sensor-proxy.cpp b/src/dds/rs-dds-sensor-proxy.cpp index 4fc99588d0..06f3ce4a37 100644 --- a/src/dds/rs-dds-sensor-proxy.cpp +++ b/src/dds/rs-dds-sensor-proxy.cpp @@ -25,6 +25,7 @@ #include +#include #include using rsutils::json; @@ -664,7 +665,11 @@ void dds_sensor_proxy::add_processing_block( std::string const & filter_name ) if( ! ppb ) LOG_WARNING( "Unsupported processing block '" + filter_name + "' received" ); else + { + // Currently processing block factory does not support block settings, add here if needed. + add_processing_block_settings( filter_name, ppb ); super::add_processing_block( ppb ); + } } catch( std::exception const & e ) { @@ -673,5 +678,24 @@ void dds_sensor_proxy::add_processing_block( std::string const & filter_name ) } } +void dds_sensor_proxy::add_processing_block_settings( const std::string & filter_name, + std::shared_ptr< librealsense::processing_block_interface > & ppb ) const +{ + if( rsutils::string::nocase_equal( filter_name, "Decimation Filter" ) ) + if( !ppb->supports_option( RS2_OPTION_STREAM_FILTER ) ) + LOG_ERROR( "Decimation Filter does not support stream filter option" ); + else + if( rsutils::string::nocase_equal( get_name(), "RGB Camera" ) ) + { + ppb->get_option( RS2_OPTION_STREAM_FILTER ).set( RS2_STREAM_COLOR ); + ppb->get_option( RS2_OPTION_STREAM_FORMAT_FILTER ).set( RS2_FORMAT_ANY ); + } + else + { + ppb->get_option( RS2_OPTION_STREAM_FILTER ).set( RS2_STREAM_DEPTH ); + ppb->get_option( RS2_OPTION_STREAM_FORMAT_FILTER ).set( RS2_FORMAT_Z16 ); + } +} + } // namespace librealsense diff --git a/src/dds/rs-dds-sensor-proxy.h b/src/dds/rs-dds-sensor-proxy.h index 002020b1b0..cec1efba42 100644 --- a/src/dds/rs-dds-sensor-proxy.h +++ b/src/dds/rs-dds-sensor-proxy.h @@ -115,6 +115,9 @@ class dds_sensor_proxy : public software_sensor virtual void add_no_metadata( frame *, streaming_impl & ); virtual void add_frame_metadata( frame *, rsutils::json const & metadata, streaming_impl & ); + void add_processing_block_settings( const std::string & filter_name, + std::shared_ptr< librealsense::processing_block_interface > & ppb ) const; + friend class dds_device_proxy; // Currently calls handle_new_metadata };