13 Extractor(_ctx, _source), destination(_destination), roi(_roi) {
25 return destination.
topic;
32 void ZmqPubExtractor::extractSetup() {
33 destinationSocket =
new zmq::socket_t(
ctx, ZMQ_PUB);
34 destinationSocket->connect(destination.
endpoint.c_str());
37 void ZmqPubExtractor::extractImpl(
unsigned int width,
39 unsigned int bytesPerPixel,
42 zmq::message_t * sourceImage) {
46 zmq::message_t header(destination.
topic.length());
47 memcpy(header.data(), destination.
topic.c_str(), destination.
topic.length());
48 destinationSocket->send(header, ZMQ_SNDMORE);
60 zmq::message_t dimensions(5 * 4);
66 destinationSocket->send(dimensions, ZMQ_SNDMORE);
68 if(roi.
width > width) {
77 zmq::message_t destinationImage(roi.
width * roi.
height * bytesPerPixel);
78 for(
unsigned int i = 0; i < roi.
height; ++i) {
79 memcpy(((
char*)destinationImage.data()) + i * roi.
width * bytesPerPixel,
80 ((
char*)sourceImage->data()) + ((((roi.
y + i) * width) + roi.
x) * bytesPerPixel),
81 roi.
width * bytesPerPixel);
84 destinationSocket->send(destinationImage);
87 void ZmqPubExtractor::extractTeardown() {
88 delete destinationSocket;
void insertNetworkUInt32(void *buffer, uint32_t value)
std::string SSTR(Args &&...components)
Creates a temporary string stream for string concatenation.