YARP  2.3.70
Yet Another Robot Platform
yarp::os::MjpegStream Class Reference

#include <mjpeg_carrier/MjpegStream.h>

+ Inheritance diagram for yarp::os::MjpegStream:

Public Member Functions

 MjpegStream (TwoWayStream *delegate, bool sender, bool autocompress)
 
virtual ~MjpegStream ()
 
virtual InputStreamgetInputStream () override
 Get an InputStream to read from. More...
 
virtual OutputStreamgetOutputStream () override
 Get an OutputStream to write to. More...
 
virtual const ContactgetLocalAddress () override
 Get the address of the local side of the stream. More...
 
virtual const ContactgetRemoteAddress () override
 Get the address of the remote side of the stream. More...
 
virtual bool isOk () override
 Check if the stream is ok or in an error state. More...
 
virtual void reset () override
 Reset the stream. More...
 
virtual void close () override
 Terminate the stream. More...
 
virtual void beginPacket () override
 Mark the beginning of a logical packet. More...
 
virtual void endPacket () override
 Mark the end of a logical packet (see beginPacket). More...
 
virtual void write (const Bytes &b) override
 Write a block of bytes to the stream. More...
 
virtual YARP_SSIZE_T read (const Bytes &b) override
 Read a block of data from the stream. More...
 
virtual void interrupt () override
 Interrupt the stream. More...
 
virtual bool setReadEnvelopeCallback (InputStream::readEnvelopeCallbackType callback, void *data) override
 Install a callback that the InputStream will have to call when the envelope is read from a message in carriers that cannot be escaped. More...
 
- Public Member Functions inherited from yarp::os::TwoWayStream
virtual ~TwoWayStream ()
 Destructor. More...
 
- Public Member Functions inherited from yarp::os::InputStream
 InputStream ()
 Constructor. More...
 
virtual ~InputStream ()
 Destructor. More...
 
virtual void check ()
 Perform maintenance actions, if needed. More...
 
virtual int read ()
 Read and return a single byte. More...
 
virtual YARP_SSIZE_T read (const Bytes &b, size_t offset, YARP_SSIZE_T len)
 Read a block of data from the stream. More...
 
virtual YARP_SSIZE_T partialRead (const yarp::os::Bytes &b)
 Like read, but solicit partial responses. More...
 
virtual bool setReadTimeout (double timeout)
 Set activity timeout. More...
 
ConstString readLine (int terminal='\n', bool *success=YARP_NULLPTR)
 Read a block of text terminated with a specific marker (or EOF). More...
 
YARP_SSIZE_T readFull (const Bytes &b)
 Keep reading until buffer is full. More...
 
YARP_SSIZE_T readDiscard (size_t len)
 Read and discard a fixed number of bytes. More...
 
- Public Member Functions inherited from yarp::os::OutputStream
virtual ~OutputStream ()
 Destructor. More...
 
virtual void write (char ch)
 Write a single byte to the stream. More...
 
virtual void write (const Bytes &b, int offset, int len)
 Write a block of bytes to the stream. More...
 
virtual void flush ()
 Make sure all pending write operations are finished. More...
 
virtual void writeLine (const char *data, int len)
 Write some text followed by a line feed. More...
 
virtual bool setWriteTimeout (double timeout)
 Set activity timeout. More...
 
virtual bool setTypeOfService (int tos)
 
virtual int getTypeOfService ()
 

Private Attributes

TwoWayStreamdelegate
 
StringInputStream sis
 
StringOutputStream sos
 
yarp::sig::ImageOf< yarp::sig::PixelRgbimg
 
yarp::sig::ImageNetworkHeader imgHeader
 
BlobNetworkHeader blobHeader
 
ManagedBytes cimg
 
yarp::mjpeg::MjpegDecompression decompression
 
int phase
 
char * cursor
 
int remaining
 
bool sender
 
bool firstRound
 
bool autocompress
 
yarp::os::Bytes envelope
 
readEnvelopeCallbackType readEnvelopeCallback
 
void * readEnvelopeCallbackData
 

Additional Inherited Members

- Public Types inherited from yarp::os::InputStream
typedef void(* readEnvelopeCallbackType) (void *, const yarp::os::Bytes &envelope)
 Callback type for setting the envelope from a message in carriers that cannot be escaped. More...
 

Detailed Description

Definition at line 30 of file MjpegStream.h.

Constructor & Destructor Documentation

◆ MjpegStream()

yarp::os::MjpegStream::MjpegStream ( TwoWayStream delegate,
bool  sender,
bool  autocompress 
)
inline

Definition at line 53 of file MjpegStream.h.

◆ ~MjpegStream()

virtual yarp::os::MjpegStream::~MjpegStream ( )
inlinevirtual

Definition at line 65 of file MjpegStream.h.

Member Function Documentation

◆ beginPacket()

virtual void yarp::os::MjpegStream::beginPacket ( )
inlineoverridevirtual

Mark the beginning of a logical packet.

This is a unit that should be treated in an atomic fashion by YARP. If any part is corrupted, the whole should be dropped.

Implements yarp::os::TwoWayStream.

Definition at line 96 of file MjpegStream.h.

◆ close()

virtual void yarp::os::MjpegStream::close ( )
inlineoverridevirtual

Terminate the stream.

Implements yarp::os::InputStream.

Definition at line 92 of file MjpegStream.h.

◆ endPacket()

virtual void yarp::os::MjpegStream::endPacket ( )
inlineoverridevirtual

Mark the end of a logical packet (see beginPacket).

Implements yarp::os::TwoWayStream.

Definition at line 100 of file MjpegStream.h.

◆ getInputStream()

virtual InputStream& yarp::os::MjpegStream::getInputStream ( )
inlineoverridevirtual

Get an InputStream to read from.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Definition at line 72 of file MjpegStream.h.

◆ getLocalAddress()

virtual const Contact& yarp::os::MjpegStream::getLocalAddress ( )
inlineoverridevirtual

Get the address of the local side of the stream.

Returns
the address of the local side of the stream. The address will be tagged as invalid if the stream is not set up.

Implements yarp::os::TwoWayStream.

Definition at line 76 of file MjpegStream.h.

◆ getOutputStream()

virtual OutputStream& yarp::os::MjpegStream::getOutputStream ( )
inlineoverridevirtual

Get an OutputStream to write to.

Returns
the InputStream associated with this object.

Implements yarp::os::TwoWayStream.

Definition at line 73 of file MjpegStream.h.

◆ getRemoteAddress()

virtual const Contact& yarp::os::MjpegStream::getRemoteAddress ( )
inlineoverridevirtual

Get the address of the remote side of the stream.

Returns
the address of the remote side of the stream. The address will be tagged as invalid if the stream is not set up.

Implements yarp::os::TwoWayStream.

Definition at line 80 of file MjpegStream.h.

◆ interrupt()

virtual void yarp::os::MjpegStream::interrupt ( )
inlineoverridevirtual

Interrupt the stream.

If the stream is currently in a blocked state, it must be unblocked.

Reimplemented from yarp::os::InputStream.

Definition at line 110 of file MjpegStream.h.

◆ isOk()

virtual bool yarp::os::MjpegStream::isOk ( )
inlineoverridevirtual

Check if the stream is ok or in an error state.

Returns
true iff the stream is ok

Implements yarp::os::InputStream.

Definition at line 84 of file MjpegStream.h.

◆ read()

YARP_SSIZE_T MjpegStream::read ( const Bytes b)
overridevirtual

Read a block of data from the stream.

Should block and wait for data.

Parameters
bthe block of data to read to
Returns
the number of bytes read, or -1 upon error

Implements yarp::os::InputStream.

Definition at line 23 of file MjpegStream.cpp.

◆ reset()

virtual void yarp::os::MjpegStream::reset ( )
inlineoverridevirtual

Reset the stream.

Implements yarp::os::TwoWayStream.

Definition at line 88 of file MjpegStream.h.

◆ setReadEnvelopeCallback()

virtual bool yarp::os::MjpegStream::setReadEnvelopeCallback ( InputStream::readEnvelopeCallbackType  callback,
void *  data 
)
inlineoverridevirtual

Install a callback that the InputStream will have to call when the envelope is read from a message in carriers that cannot be escaped.

Parameters
callbackthe callback to execute
dataa pointer that should be passed as first parameter to the callback function
Returns
true iff the callback was installed.

Reimplemented from yarp::os::InputStream.

Definition at line 114 of file MjpegStream.h.

◆ write()

void MjpegStream::write ( const Bytes b)
overridevirtual

Write a block of bytes to the stream.

Parameters
bthe bytes to write

Implements yarp::os::OutputStream.

Definition at line 128 of file MjpegStream.cpp.

Member Data Documentation

◆ autocompress

bool yarp::os::MjpegStream::autocompress
private

Definition at line 48 of file MjpegStream.h.

◆ blobHeader

BlobNetworkHeader yarp::os::MjpegStream::blobHeader
private

Definition at line 40 of file MjpegStream.h.

◆ cimg

ManagedBytes yarp::os::MjpegStream::cimg
private

Definition at line 41 of file MjpegStream.h.

◆ cursor

char* yarp::os::MjpegStream::cursor
private

Definition at line 44 of file MjpegStream.h.

◆ decompression

yarp::mjpeg::MjpegDecompression yarp::os::MjpegStream::decompression
private

Definition at line 42 of file MjpegStream.h.

◆ delegate

TwoWayStream* yarp::os::MjpegStream::delegate
private

Definition at line 35 of file MjpegStream.h.

◆ envelope

yarp::os::Bytes yarp::os::MjpegStream::envelope
private

Definition at line 49 of file MjpegStream.h.

◆ firstRound

bool yarp::os::MjpegStream::firstRound
private

Definition at line 47 of file MjpegStream.h.

◆ img

yarp::sig::ImageOf<yarp::sig::PixelRgb> yarp::os::MjpegStream::img
private

Definition at line 38 of file MjpegStream.h.

◆ imgHeader

yarp::sig::ImageNetworkHeader yarp::os::MjpegStream::imgHeader
private

Definition at line 39 of file MjpegStream.h.

◆ phase

int yarp::os::MjpegStream::phase
private

Definition at line 43 of file MjpegStream.h.

◆ readEnvelopeCallback

readEnvelopeCallbackType yarp::os::MjpegStream::readEnvelopeCallback
private

Definition at line 50 of file MjpegStream.h.

◆ readEnvelopeCallbackData

void* yarp::os::MjpegStream::readEnvelopeCallbackData
private

Definition at line 51 of file MjpegStream.h.

◆ remaining

int yarp::os::MjpegStream::remaining
private

Definition at line 45 of file MjpegStream.h.

◆ sender

bool yarp::os::MjpegStream::sender
private

Definition at line 46 of file MjpegStream.h.

◆ sis

StringInputStream yarp::os::MjpegStream::sis
private

Definition at line 36 of file MjpegStream.h.

◆ sos

StringOutputStream yarp::os::MjpegStream::sos
private

Definition at line 37 of file MjpegStream.h.


The documentation for this class was generated from the following files: