Skip to content

Commit e39699d

Browse files
committed
Make the fix compatible with older distributions
1 parent deb9fe4 commit e39699d

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ if(${cv_bridge_VERSION} VERSION_LESS "3.3.0")
4141
add_compile_definitions(CV_BRIDGE_USES_OLD_HEADERS)
4242
endif()
4343

44+
if(${image_transport_VERSION} VERSION_LESS "6.4.0")
45+
add_compile_definitions(IMAGE_TRANSPORT_USES_OLD_API)
46+
endif()
47+
4448
## Declare a cpp library
4549
add_library(${PROJECT_NAME} SHARED
4650
src/web_video_server.cpp

src/streamers/image_transport_streamer.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ void ImageTransportStreamerBase::start()
118118
return;
119119
}
120120

121+
#ifdef IMAGE_TRANSPORT_USES_OLD_API
122+
const image_transport::TransportHints hints(node.get(), default_transport_);
123+
#else
121124
const image_transport::TransportHints hints(*node.get(), default_transport_);
125+
#endif
122126
auto tnat = node->get_topic_names_and_types();
123127
inactive_ = true;
124128
for (auto topic_and_types : tnat) {
@@ -147,10 +151,17 @@ void ImageTransportStreamerBase::start()
147151
}
148152

149153
// Create subscriber
154+
#ifdef IMAGE_TRANSPORT_USES_OLD_API
155+
image_sub_ = image_transport::create_subscription(
156+
node.get(), topic_,
157+
std::bind(&ImageTransportStreamerBase::image_callback, this, std::placeholders::_1),
158+
default_transport_, qos_profile.get_rmw_qos_profile());
159+
#else
150160
image_sub_ = image_transport::create_subscription(
151161
*node.get(), topic_,
152162
std::bind(&ImageTransportStreamerBase::image_callback, this, std::placeholders::_1),
153163
default_transport_, qos_profile.value());
164+
#endif
154165
}
155166

156167
#pragma GCC diagnostic pop

0 commit comments

Comments
 (0)