sipxmedialib  Version 3.3
Classes | Macros | Enumerations
MpBuf.h File Reference
#include <stdlib.h>
#include <assert.h>
#include "mp/MpBufPool.h"
Include dependency graph for MpBuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MpBuf
 Base class for all media buffers. More...
 
class  MpBufPtr
 Smart pointer to MpBuf. More...
 

Macros

#define MPBUF_DEFAULT_CONSTRUCTOR(classname)   classname##Ptr() {};
 Default constructor - construct invalid pointer. More...
 
#define MPBUF_FROM_BASE_CONSTRUCTOR_INIT(classname, buffer_type)
 
#define MPBUF_FROM_BASE_CONSTRUCTOR(classname, buffer_type, base_classname)
 This constructor owns MpBuf object. More...
 
#define MPBUF_TYPECHECKED_COPY(classname, buffer_type, base_classname)
 Copy object from base type with type check. More...
 
#define MPBUF_MEMBER_ACCESS_OPERATOR(classname)
 Return pointer to buffer. More...
 
#define MPBUF_CONST_MEMBER_ACCESS_OPERATOR(classname)
 Return readonly pointer to buffer. More...
 

Enumerations

enum  MP_BUFFERS_TREE {
  MP_BUF, MP_BUF_ARRAY, MP_BUF_ARRAY_END, MP_BUF_DATA,
  MP_BUF_AUDIO, MP_BUF_AUDIO_END, MP_BUF_VIDEO, MP_BUF_VIDEO_END,
  MP_BUF_UDP, MP_BUF_RTP, MP_BUF_RTP_END, MP_BUF_UDP_END,
  MP_BUF_DATA_END, MP_BUF_END
}
 Enum used for runtime type checks. More...
 

Macro Definition Documentation

#define MPBUF_DEFAULT_CONSTRUCTOR (   classname)    classname##Ptr() {};

Default constructor - construct invalid pointer.

#define MPBUF_FROM_BASE_CONSTRUCTOR_INIT (   classname,
  buffer_type 
)
Value:
classname *pBuffer = (classname*)mpBuffer; \
assert(pBuffer->mpPool->getBlockSize() >= sizeof(classname)); \
pBuffer->mType = buffer_type; \
pBuffer->init(); \
#define MPBUF_FROM_BASE_CONSTRUCTOR (   classname,
  buffer_type,
  base_classname 
)
Value:
classname##Ptr(MpBuf *buffer) \
: base_classname##Ptr(buffer) \
{ \
if (mpBuffer != NULL) { \
MPBUF_FROM_BASE_CONSTRUCTOR_INIT(classname, buffer_type) \
} \
};
#define MPBUF_FROM_BASE_CONSTRUCTOR_INIT(classname, buffer_type)
Definition: MpBuf.h:390
Base class for all media buffers.
Definition: MpBuf.h:74

This constructor owns MpBuf object.

#define MPBUF_TYPECHECKED_COPY (   classname,
  buffer_type,
  base_classname 
)
Value:
classname##Ptr(const MpBufPtr &buffer) \
: base_classname##Ptr(buffer) \
{ \
assert( (!buffer.isValid()) \
|| ( buffer->getType() >= buffer_type \
&& buffer->getType() < buffer_type##_END)); \
};
Smart pointer to MpBuf.
Definition: MpBuf.h:160

Copy object from base type with type check.

#define MPBUF_MEMBER_ACCESS_OPERATOR (   classname)
Value:
classname *operator->() \
{assert(mpBuffer!=NULL); return (classname*)mpBuffer;};

Return pointer to buffer.

#define MPBUF_CONST_MEMBER_ACCESS_OPERATOR (   classname)
Value:
const classname *operator->() const \
{assert(mpBuffer!=NULL); return (classname*)mpBuffer;};

Return readonly pointer to buffer.

Enumeration Type Documentation

Enum used for runtime type checks.

This enum is used to determine the real type of the buffer. Also this helps us to decide is it possible to convert from one buffer to other. E.g. MpAudioBuf could be converted to MpDataBuf, but could not be converted to MpArrayBuf. This check is done inside MpBufPtr's child classes.

Enumerator
MP_BUF 

Begin of the MpBuf type.

MP_BUF_ARRAY 

Begin of the MpArrayBuf type.

MP_BUF_ARRAY_END 

End of the MpArrayBuf type.

MP_BUF_DATA 

Begin of the MpDataBuf type.

MP_BUF_AUDIO 

Begin of the MpAudioBuf type.

MP_BUF_AUDIO_END 

End of the MpAudioBuf type.

MP_BUF_VIDEO 

Begin of the MpVideoBuf type.

MP_BUF_VIDEO_END 

End of the MpVideoBuf type.

MP_BUF_UDP 

Begin of the MpUdpBuf type.

MP_BUF_RTP 

Begin of the MpRtpBuf type.

MP_BUF_RTP_END 

End of the MpRtpBuf type.

MP_BUF_UDP_END 

End of the MpUdpBuf type.

MP_BUF_DATA_END 

End of the MpDataBuf type.

MP_BUF_END 

End of the MpBuf type.