Plugin-based interface for compressing and decompressing images using codec plugins. More...
#include <list>
#include <memory>
#include <string>
#include <unordered_map>
#include <dynamic_reconfigure/Config.h>
#include <pluginlib/class_loader.hpp>
#include <topic_tools/shape_shifter.h>
#include <cras_cpp_common/c_api.h>
#include <cras_cpp_common/log_utils.h>
#include <cras_cpp_common/log_utils/node.h>
#include <cras_cpp_common/xmlrpc_value_utils.hpp>
#include <cras_topic_tools/shape_shifter.h>
#include <image_transport_codecs/image_transport_codec.h>
#include <image_transport_codecs/image_transport_codec_plugin.h>
Go to the source code of this file.
Classes | |
class | image_transport_codecs::ImageTransportCodecs |
Plugin-based interface for compressing and decompressing images using codec plugins. More... | |
Namespaces | |
image_transport_codecs | |
Functions | |
bool | getCompressedImageContents (const char *topicOrCodec, const char *compressedType, const char *compressedMd5sum, size_t compressedDataLength, const uint8_t compressedData[], const char *matchFormat, bool &hasData, cras::allocator_t formatAllocator, cras::allocator_t dataAllocator, cras::allocator_t errorStringAllocator, cras::allocator_t logMessagesAllocator) |
Return the part of the encoded message that represents the actual image data (i.e. the part that can be passed to external decoders or saved to a file). If the codec messages have no such meaning, empty result is returned. More... | |
bool | imageTransportCodecsDecode (const char *topicOrCodec, const char *compressedType, const char *compressedMd5sum, size_t compressedDataLength, const uint8_t compressedData[], sensor_msgs::Image::_height_type &rawHeight, sensor_msgs::Image::_width_type &rawWidth, cras::allocator_t rawEncodingAllocator, sensor_msgs::Image::_is_bigendian_type &rawIsBigEndian, sensor_msgs::Image::_step_type &rawStep, cras::allocator_t rawDataAllocator, size_t serializedConfigLength, const uint8_t serializedConfig[], cras::allocator_t errorStringAllocator, cras::allocator_t logMessagesAllocator) |
Decode the given compressed image using compressed codec with the given config. More... | |
bool | imageTransportCodecsEncode (const char *topicOrCodec, sensor_msgs::Image::_height_type rawHeight, sensor_msgs::Image::_width_type rawWidth, const char *rawEncoding, sensor_msgs::Image::_is_bigendian_type rawIsBigEndian, sensor_msgs::Image::_step_type rawStep, size_t rawDataLength, const uint8_t rawData[], cras::allocator_t compressedTypeAllocator, cras::allocator_t md5SumAllocator, cras::allocator_t compressedDataAllocator, size_t serializedConfigLength, const uint8_t serializedConfig[], cras::allocator_t errorStringAllocator, cras::allocator_t logMessagesAllocator) |
C API ///. More... | |
Plugin-based interface for compressing and decompressing images using codec plugins.
Definition in file image_transport_codecs.h.
bool getCompressedImageContents | ( | const char * | topicOrCodec, |
const char * | compressedType, | ||
const char * | compressedMd5sum, | ||
size_t | compressedDataLength, | ||
const uint8_t | compressedData[], | ||
const char * | matchFormat, | ||
bool & | hasData, | ||
cras::allocator_t | formatAllocator, | ||
cras::allocator_t | dataAllocator, | ||
cras::allocator_t | errorStringAllocator, | ||
cras::allocator_t | logMessagesAllocator | ||
) |
Return the part of the encoded message that represents the actual image data (i.e. the part that can be passed to external decoders or saved to a file). If the codec messages have no such meaning, empty result is returned.
This is a C API to allow interfacing this library from other programming languages. Do not use it in C++.
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | compressedType | The string version of the type of the compressed message. |
[in] | compressedMd5sum | The MD5 sum of the compressed message. |
[in] | compressedDataLength | Length of the compressed image data in bytes. |
[in] | compressedData | Bytes of the compressed image. |
[in] | matchFormat | If nonempty, the image data is only returned if their format field would match the given one. The matching should be case-insensitive. |
[out] | hasData | Whether some content data were found in the image. |
[in,out] | formatAllocator | Allocator for content format string. |
[in,out] | dataAllocator | Allocator for the content bytes. |
[in,out] | errorStringAllocator | Allocator for error string in case the encoding fails. |
[in,out] | logMessagesAllocator | Allocator for log messages to be passed to the calling code. Each allocated message should be properly reported by the native logging mechanism after this call finishes. The messages are serialized rosgraph_msgs::Log messages. |
formatAllocator
and dataAllocator
allocate their buffers and write the output to them. If not, errorStringAllocator
allocates its buffer and stores the error string in it. image_transport_codecs::ImageTransportCodecs::getCompressedImageContent()
. bool imageTransportCodecsDecode | ( | const char * | topicOrCodec, |
const char * | compressedType, | ||
const char * | compressedMd5sum, | ||
size_t | compressedDataLength, | ||
const uint8_t | compressedData[], | ||
sensor_msgs::Image::_height_type & | rawHeight, | ||
sensor_msgs::Image::_width_type & | rawWidth, | ||
cras::allocator_t | rawEncodingAllocator, | ||
sensor_msgs::Image::_is_bigendian_type & | rawIsBigEndian, | ||
sensor_msgs::Image::_step_type & | rawStep, | ||
cras::allocator_t | rawDataAllocator, | ||
size_t | serializedConfigLength, | ||
const uint8_t | serializedConfig[], | ||
cras::allocator_t | errorStringAllocator, | ||
cras::allocator_t | logMessagesAllocator | ||
) |
Decode the given compressed image using compressed
codec with the given config.
This is a C API to allow interfacing this library from other programming languages. Do not use it in C++.
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | compressedType | The string version of the type of the compressed message. |
[in] | compressedMd5sum | The MD5 sum of the compressed message. |
[in] | compressedDataLength | Length of the compressed image data in bytes. |
[in] | compressedData | Bytes of the compressed image. |
[out] | rawHeight | Raw image height, that is, number of rows. |
[out] | rawWidth | Raw image width, that is, number of columns. |
[in,out] | rawEncodingAllocator | Allocator for raw image encoding of pixels – channel meaning, ordering, size. |
[out] | rawIsBigEndian | Is raw image bigendian? |
[out] | rawStep | Raw image full row length in bytes. |
[in,out] | rawDataAllocator | Allocator for raw image bytes. |
[in] | serializedConfigLength | Length of the dynamic_reconfigure::Config serialization. |
[in] | serializedConfig | Bytes of the serialized dynamic_reconfigure::Config . |
[in,out] | errorStringAllocator | Allocator for error string in case the encoding fails. |
[in,out] | logMessagesAllocator | Allocator for log messages to be passed to the calling code. Each allocated message should be properly reported by the native logging mechanism after this call finishes. The messages are serialized rosgraph_msgs::Log messages. |
rawEncodingAllocator
and rawDataAllocator
allocate their buffers and write the output to them. If not, errorStringAllocator
allocates its buffer and stores the error string in it. image_transport_codecs::ImageTransportCodecs::decode()
. bool imageTransportCodecsEncode | ( | const char * | topicOrCodec, |
sensor_msgs::Image::_height_type | rawHeight, | ||
sensor_msgs::Image::_width_type | rawWidth, | ||
const char * | rawEncoding, | ||
sensor_msgs::Image::_is_bigendian_type | rawIsBigEndian, | ||
sensor_msgs::Image::_step_type | rawStep, | ||
size_t | rawDataLength, | ||
const uint8_t | rawData[], | ||
cras::allocator_t | compressedTypeAllocator, | ||
cras::allocator_t | md5SumAllocator, | ||
cras::allocator_t | compressedDataAllocator, | ||
size_t | serializedConfigLength, | ||
const uint8_t | serializedConfig[], | ||
cras::allocator_t | errorStringAllocator, | ||
cras::allocator_t | logMessagesAllocator | ||
) |
C API ///.
Encode the given raw image using an automatically determined codec with the given config.
This is a C API to allow interfacing this library from other programming languages. Do not use it in C++.
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | rawHeight | Raw image height, that is, number of rows. |
[in] | rawWidth | Raw image width, that is, number of columns. |
[in] | rawEncoding | Raw image encoding of pixels – channel meaning, ordering, size. |
[in] | rawIsBigEndian | Is raw image bigendian? |
[in] | rawStep | Raw image full row length in bytes. |
[in] | rawDataLength | Length of raw image data in bytes, should be step * rows . |
[in] | rawData | The raw image bytes. |
[in,out] | compressedTypeAllocator | Allocator for the string version of the type of the compressed message. |
[in,out] | md5SumAllocator | Allocator for the MD5 sum of the compressed message. |
[in,out] | compressedDataAllocator | Allocator for the byte data of the compressed image. |
[in] | serializedConfigLength | Length of the dynamic_reconfigure::Config serialization. |
[in] | serializedConfig | Bytes of the serialized dynamic_reconfigure::Config . |
[in,out] | errorStringAllocator | Allocator for error string in case the encoding fails. |
[in,out] | logMessagesAllocator | Allocator for log messages to be passed to the calling code. Each allocated message should be properly reported by the native logging mechanism after this call finishes. The messages are serialized rosgraph_msgs::Log messages. |
compressedFormatAllocator
and compressedDataAllocator
allocate their buffers and write the output to them. If not, errorStringAllocator
allocates its buffer and stores the error string in it. image_transport_codecs::ImageTransportCodecs::encode()
.