MediaX v1.0.0rc7 [7e6cb74]
Video streaming for military vehicles
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
rtp_utils.cc File Reference

RTP utility functions. More...

#include "rtp/rtp_utils.h"
#include "rtp/rtp_types.h"
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <random>
#include <string>
#include <thread>
Include dependency graph for rtp_utils.cc:

Data Structures

struct  Ball
 A simple bouncing ball test card. Ball position struct. More...
 

Namespaces

namespace  mediax
 The Astute Systems (MediaX) library for video streaming.
 

Functions

void mediax::InitRtp (int argc, char *argv[])
 Initialize the RTP library, mainly needed for GStreamer support.
 
bool mediax::IsRtpInitialised ()
 Check if the RTP library has been initialized.
 
void mediax::RtpCleanup ()
 Finalise the RTP library, mainly needed for GStreamer support.
 
std::string mediax::ColourspaceTypeToString (rtp::ColourspaceType)
 Convert enum to string.
 
rtp::ColourspaceType mediax::ColourspaceTypeFromString (std::string_view)
 Convert string to enum.
 
uint8_t mediax::BitsPerPixel (rtp::ColourspaceType mode)
 Get the number of bits per pixel for a given colour space.
 
uint8_t mediax::BytesPerPixel (rtp::ColourspaceType mode)
 Get the number of bytes per pixel for a given colour space.
 
void EndianSwap32 (uint32_t *data, unsigned int length)
 Swap the endianness of a 32-bit integer.
 
void EndianSwap16 (uint16_t *data, unsigned int length)
 Swap the endianness of a 16-bit integer.
 
void DumpHex (const void *data, size_t size)
 Dump a hex representation of a buffer.
 
void PackRgb (uint8_t *data, uint64_t pixel, mediax::rtp::Rgb rgb, mediax::rtp::ColourspaceType colourspace)
 Pack Red/Green/Blue values into a buffer.
 
void CreateColourBarEbuTestCard (uint8_t *data, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType colourspace)
 Create a Colour Bar Ebu Test Card object.
 
void CreateColourBarTestCard (uint8_t *data, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType colourspace)
 Create a Colour Bar Test Card object.
 
void CreateGreyScaleBarTestCard (uint8_t *data, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType colourspace)
 Create a Grey Scale Bar Test Card object.
 
void CreateQuadTestCard (uint8_t *data, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType colourspace)
 Create a Smtpe Test Card object.
 
void CreateCheckeredTestCard (uint8_t *data, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType colourspace)
 Create a Checkerd Test Card object.
 
void CreateSolidTestCard (uint8_t *data, uint32_t width, uint32_t height, uint8_t red, uint8_t green, uint8_t blue, mediax::rtp::ColourspaceType colourspace)
 Create a Solid Test Card object.
 
void CreateWhiteNoiseTestCard (uint8_t *data, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType colourspace)
 Create a White Noise Test Card object.
 
void CreateBouncingBallTestCard (uint8_t *data, uint32_t width, uint32_t height, mediax::rtp::ColourspaceType colourspace)
 Create a Bouncing Ball Test Card object.
 

Detailed Description

RTP utility functions.

Function Documentation

◆ CreateBouncingBallTestCard()

void CreateBouncingBallTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
mediax::rtp::ColourspaceType  colourspace 
)

Create a Bouncing Ball Test Card object.

Parameters
datathe buffer to write the test card to
widththe image width in pixels
heightthe image height in pixels
colourspaceThe colourspace to use

◆ CreateCheckeredTestCard()

void CreateCheckeredTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
mediax::rtp::ColourspaceType  colourspace 
)

Create a Checkerd Test Card object.

Parameters
datathe buffer to write the test card to
widththe image width in pixels
heightthe image height in pixels
colourspaceThe colourspace to use

◆ CreateColourBarEbuTestCard()

void CreateColourBarEbuTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
mediax::rtp::ColourspaceType  colourspace 
)

Create a Colour Bar Ebu Test Card object.

Parameters
data
width
height
colourspace

◆ CreateColourBarTestCard()

void CreateColourBarTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
mediax::rtp::ColourspaceType  colourspace 
)

Create a Colour Bar Test Card object.

Parameters
datathe buffer to write the test card to
widththe image width in pixels
heightthe image height in pixels
colourspaceThe colourspace to use

◆ CreateGreyScaleBarTestCard()

void CreateGreyScaleBarTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
mediax::rtp::ColourspaceType  colourspace 
)

Create a Grey Scale Bar Test Card object.

Parameters
datathe buffer to write the test card to
widththe image width in pixels
heightthe image height in pixels
colourspaceThe colourspace to use

◆ CreateQuadTestCard()

void CreateQuadTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
mediax::rtp::ColourspaceType  colourspace 
)

Create a Smtpe Test Card object.

Parameters
datathe buffer to write the test card to
widththe image width in pixels
heightthe image height in pixels
colourspaceThe colourspace to use

◆ CreateSolidTestCard()

void CreateSolidTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
uint8_t  red,
uint8_t  green,
uint8_t  blue,
mediax::rtp::ColourspaceType  colourspace 
)

Create a Solid Test Card object.

Parameters
datathe buffer to write the test card to
widththe image width in pixels
heightthe image height in pixels
redRGB value
greenRGB value
blueRGB value
colourspaceThe colourspace to use

◆ CreateWhiteNoiseTestCard()

void CreateWhiteNoiseTestCard ( uint8_t *  data,
uint32_t  width,
uint32_t  height,
mediax::rtp::ColourspaceType  colourspace 
)

Create a White Noise Test Card object.

Parameters
datathe buffer to write the test card to
widththe image width in pixels
heightthe image height in pixels
colourspaceThe colourspace to use

◆ DumpHex()

void DumpHex ( const void *  data,
size_t  size 
)

Dump a hex representation of a buffer.

Parameters
datathe buffer to write the test card to
sizethe size of the buffer

◆ EndianSwap16()

void EndianSwap16 ( uint16_t *  data,
unsigned int  length 
)

Swap the endianness of a 16-bit integer.

Parameters
dataA pointer to the data
lengthThe length of the data

◆ EndianSwap32()

void EndianSwap32 ( uint32_t *  data,
unsigned int  length 
)

Swap the endianness of a 32-bit integer.

Parameters
dataA pointer to the data
lengthThe length of the data

◆ PackRgb()

void PackRgb ( uint8_t *  data,
uint64_t  pixel,
mediax::rtp::Rgb  rgb,
mediax::rtp::ColourspaceType  colourspace 
)

Pack Red/Green/Blue values into a buffer.

Parameters
datathe buffer to pack into
pixelthe pixel number
rgbred/green/blue values
colourspacethe colourspace to use