@@ -118,15 +118,12 @@ namespace librealsense
118118 return source.allocate_composite_frame (results);
119119 }
120120
121- stream_filter_processing_block::stream_filter_processing_block () :
122- _stream_filter (RS2_STREAM_ANY ),
123- _stream_format_filter (RS2_FORMAT_ANY ),
124- _stream_index_filter (-1 )
121+ stream_filter_processing_block::stream_filter_processing_block ()
125122 {
126123 register_option (RS2_OPTION_FRAMES_QUEUE_SIZE , _source.get_published_size_option ());
127124 _source.init (std::shared_ptr<metadata_parser_map>());
128125
129- auto stream_selector = std::make_shared<ptr_option<int >>(RS2_STREAM_ANY , RS2_STREAM_FISHEYE , 1 , RS2_STREAM_ANY , (int *)&_stream_filter, " Stream type" );
126+ auto stream_selector = std::make_shared<ptr_option<int >>(RS2_STREAM_ANY , RS2_STREAM_FISHEYE , 1 , RS2_STREAM_ANY , (int *)&_stream_filter. stream , " Stream type" );
130127 for (int s = RS2_STREAM_ANY ; s < RS2_STREAM_COUNT ; s++)
131128 {
132129 stream_selector->set_description (s, " Process - " + std::string (rs2_stream_to_string ((rs2_stream)s)));
@@ -139,10 +136,10 @@ namespace librealsense
139136 throw invalid_value_exception (to_string ()
140137 << " Unsupported stream filter, " << val << " is out of range." );
141138
142- _stream_filter = static_cast <rs2_stream>((int )val);
139+ _stream_filter. stream = static_cast <rs2_stream>((int )val);
143140 });
144141
145- auto format_selector = std::make_shared<ptr_option<int >>(RS2_FORMAT_ANY , RS2_FORMAT_DISPARITY32 , 1 , RS2_FORMAT_ANY , (int *)&_stream_format_filter , " Stream format" );
142+ auto format_selector = std::make_shared<ptr_option<int >>(RS2_FORMAT_ANY , RS2_FORMAT_DISPARITY32 , 1 , RS2_FORMAT_ANY , (int *)&_stream_filter. format , " Stream format" );
146143 for (int f = RS2_FORMAT_ANY ; f < RS2_FORMAT_COUNT ; f++)
147144 {
148145 format_selector->set_description (f, " Process - " + std::string (rs2_format_to_string ((rs2_format)f)));
@@ -155,10 +152,10 @@ namespace librealsense
155152 throw invalid_value_exception (to_string ()
156153 << " Unsupported stream format filter, " << val << " is out of range." );
157154
158- _stream_format_filter = static_cast <rs2_format>((int )val);
155+ _stream_filter. format = static_cast <rs2_format>((int )val);
159156 });
160157
161- auto index_selector = std::make_shared<ptr_option<int >>(0 , std::numeric_limits<int >::max (), 1 , -1 , &_stream_index_filter , " Stream index" );
158+ auto index_selector = std::make_shared<ptr_option<int >>(0 , std::numeric_limits<int >::max (), 1 , -1 , &_stream_filter. index , " Stream index" );
162159 index_selector->on_set ([this , index_selector](float val)
163160 {
164161 std::lock_guard<std::mutex> lock (_mutex);
@@ -167,7 +164,7 @@ namespace librealsense
167164 throw invalid_value_exception (to_string ()
168165 << " Unsupported stream index filter, " << val << " is out of range." );
169166
170- _stream_index_filter = (int )val;
167+ _stream_filter. index = (int )val;
171168 });
172169
173170 register_option (RS2_OPTION_STREAM_FILTER , stream_selector);
@@ -191,20 +188,20 @@ namespace librealsense
191188 rs2_format format = profile.format ();
192189 int index = profile.stream_index ();
193190
194- if (_stream_filter != RS2_STREAM_ANY && _stream_filter != stream)
191+ if (_stream_filter. stream != RS2_STREAM_ANY && _stream_filter. stream != stream)
195192 return false ;
196- if (is_z_or_disparity (_stream_format_filter ))
193+ if (is_z_or_disparity (_stream_filter. format ))
197194 {
198- if (_stream_format_filter != RS2_FORMAT_ANY && !is_z_or_disparity (format))
195+ if (_stream_filter. format != RS2_FORMAT_ANY && !is_z_or_disparity (format))
199196 return false ;
200197 }
201198 else
202199 {
203- if (_stream_format_filter != RS2_FORMAT_ANY && _stream_format_filter != format)
200+ if (_stream_filter. format != RS2_FORMAT_ANY && _stream_filter. format != format)
204201 return false ;
205202 }
206203
207- if (_stream_index_filter != -1 && _stream_index_filter != index)
204+ if (_stream_filter. index != -1 && _stream_filter. index != index)
208205 return false ;
209206 return true ;
210207 }
@@ -214,19 +211,7 @@ namespace librealsense
214211 if (!frame || frame.is <rs2::frameset>())
215212 return false ;
216213 auto profile = frame.get_profile ();
217- rs2_stream stream = profile.stream_type ();
218- rs2_format format = profile.format ();
219- int index = profile.stream_index ();
220-
221- if (_stream_filter != RS2_STREAM_ANY && _stream_filter != stream)
222- return false ;
223-
224- if (_stream_format_filter != RS2_FORMAT_ANY && _stream_format_filter != format)
225- return false ;
226-
227- if (_stream_index_filter != -1 && _stream_index_filter != index)
228- return false ;
229- return true ;
214+ return _stream_filter.match (frame);
230215 }
231216
232217 void synthetic_source::frame_ready (frame_holder result)
0 commit comments