Wasabi ExpressPlay SDK for Embedded Systems  1.23.0
Data Structures | Macros | Typedefs | Enumerations | Functions
Ts2Packet.h File Reference
#include "Atomix.h"
#include "Ts2Config.h"

Go to the source code of this file.

Data Structures

struct  TS2_AdaptationField_Extension
 
struct  TS2_AdaptationField
 
struct  TS2_Packet
 
struct  TS2_PacketHandler
 

Macros

#define TS2_NULL_PACKET_PID   0x1FFF
 
#define TS2_INVALID_PID   0xFFFF
 
#define TS2_SYSTEM_CLOCK_FREQUENCY   27000000.0 /* 27 MHz */
 
#define TS2_INVALID_PCR_IN_SECS   -1.0
 
#define TS2_MAX_PCR_IN_SECS   95443.717696703708 /* ((2**33-1)*300+(2**9-1)) / 27000000.0 */
 
#define TS2_PACKET_SIZE   188
 
#define TS2_PACKET_HEADER_SIZE   4
 
#define TS2_PACKET_PAYLOAD_SIZE   (TS2_PACKET_SIZE - TS2_PACKET_HEADER_SIZE)
 
#define TS2_PACKET_SYNC_BYTE   0x47
 
#define TS2_PACKET_AF_CLOCK_REFERENCE_DATA_SIZE   6
 
#define TS2_PACKET_AF_EXTENSION_SEAMLESS_SIZE   5
 
#define TS2_STUFFING_BYTE   0xFF
 
#define TS2_PACKET_TRANSPORT_ERROR_INDICATOR_FLAG_MASK   0x04
 
#define TS2_PACKET_PAYLOAD_UNIT_START_INDICATOR_FLAG_MASK   0x02
 
#define TS2_PACKET_TRANSPORT_PRIORITY_FLAG_MASK   0x01
 
#define TS2_AF_Flags_DiscontinuityIndicator(flags)   ((flags) & 0x80)
 
#define TS2_AF_Flags_RandomAccessIndicator(flags)   ((flags) & 0x40)
 
#define TS2_AF_Flags_EsPriorityIndicator(flags)   ((flags) & 0x20)
 
#define TS2_AF_Flags_PcrFlag(flags)   ((flags) & 0x10)
 
#define TS2_AF_Flags_OpcrFlag(flags)   ((flags) & 0x08)
 
#define TS2_AF_Flags_SplicingPointFlag(flags)   ((flags) & 0x04)
 
#define TS2_AF_Flags_TransportPrivateDataFlag(flags)   ((flags) & 0x02)
 
#define TS2_AF_Flags_ExtensionFlag(flags)   ((flags) & 0x01)
 
#define TS2_AF_Extension_Flags_LtwFlag(flags)   ((flags) & 0x80)
 
#define TS2_AF_Extension_Flags_PiecewiseRateFlag(flags)   ((flags) & 0x40)
 
#define TS2_AF_Extension_Flags_SeamlessSpliceFlag(flags)   ((flags) & 0x20)
 
#define TS2_Packet_HasAdaptationField(packet)   ((packet)->af_control & 0x02)
 
#define TS2_Packet_HasPayload(packet)   ((packet)->af_control & 0x01)
 
#define TS2_Packet_HasPcr(packet)
 
#define TS2_Packet_Flags_TransportError(pflags)   (((pflags) & 0x04) >> 2)
 
#define TS2_Packet_Flags_PayloadUnitStart(pflags)   (((pflags) & 0x02) >> 1)
 
#define TS2_Packet_Flags_TransportPriority(pflags)   (((pflags) & 0x01) )
 

Typedefs

typedef struct TS2_PacketDispatcher TS2_PacketDispatcher
 
typedef struct TS2_PacketPump TS2_PacketPump
 

Enumerations

enum  TS2_ScramblingControl {
  TS2_NO_SCRAMBLING = 0x00,
  TS2_DEFAULT_CK_SCRAMBLING = 0x01,
  TS2_EVEN_CK_SCRAMBLING = 0x02,
  TS2_ODD_CK_SCRAMBLING = 0x03
}
 
enum  TS2_AfControl {
  TS2_AF_CONTROL_NULL_PACKET = 0x00,
  TS2_AF_CONTROL_PAYLOAD_ONLY = 0x01,
  TS2_AF_CONTROL_AF_ONLY = 0x02,
  TS2_AF_CONTROL_AF_AND_PAYLOAD = 0x03
}
 

Functions

ATX_Float TS2_AdaptationField_PcrInSecs (TS2_AdaptationField *self)
 
ATX_Result TS2_Packet_InitFromInputStream (ATX_InputStream *stream, TS2_Packet *packet)
 
ATX_Result TS2_Packet_InitFromBuffer (const ATX_Byte *buffer, TS2_Packet *packet)
 
ATX_Result TS2_Packet_SerializeToBuffer (TS2_Packet *packet, ATX_Byte *buffer)
 TS2_PACKET_SIZE bytes will be written into buffer. More...
 
void TS2_Packet_Destruct (TS2_Packet *packet)
 
void TS2_FormatPacketHeader (ATX_Byte *buffer, ATX_UInt32 transport_error_indicator, ATX_UInt32 payload_unit_start_indicator, ATX_UInt32 transport_priority, ATX_UInt16 pid, TS2_ScramblingControl scrambling_control, TS2_AfControl af_control, ATX_UInt32 continuity_counter)
 
ATX_Result TS2_PacketDispatcher_Create (TS2_PacketDispatcher **dispatcher)
 
TS2_EXPORT ATX_Result TS2_PacketDispatcher_SetHandler (TS2_PacketDispatcher *self, ATX_UInt16 pid, TS2_PacketHandler handler)
 
TS2_EXPORT ATX_Result TS2_PacketDispatcher_ResetHandler (TS2_PacketDispatcher *self, ATX_UInt16 pid)
 
ATX_Result TS2_PacketDispatcher_SetDefaultHandler (TS2_PacketDispatcher *self, TS2_PacketHandler handler)
 
ATX_Result TS2_PacketDispatcher_ResetDefaultHandler (TS2_PacketDispatcher *self)
 
ATX_Result TS2_PacketDispatcher_Dispatch (TS2_PacketDispatcher *self, TS2_Packet *packet)
 
ATX_UInt16 TS2_PacketDispatcher_GetNextAvailablePid (TS2_PacketDispatcher *self)
 
ATX_Boolean TS2_PacketDispatcher_IsPidUsed (TS2_PacketDispatcher *self, ATX_UInt16 pid)
 
void TS2_PacketDispatcher_Destroy (TS2_PacketDispatcher *self)
 
TS2_EXPORT ATX_Result TS2_PacketPump_Create (ATX_InputStream *stream, TS2_PacketDispatcher *dispatcher, TS2_PacketPump **pump)
 
TS2_EXPORT TS2_PacketDispatcherTS2_PacketPump_GetDispatcher (TS2_PacketPump *self)
 
TS2_EXPORT ATX_Result TS2_PacketPump_Pump (TS2_PacketPump *self)
 
TS2_EXPORT ATX_Result TS2_PacketPump_ResetStream (TS2_PacketPump *self, ATX_InputStream *stream)
 
TS2_EXPORT void TS2_PacketPump_Destroy (TS2_PacketPump *self)
 

Macro Definition Documentation

◆ TS2_AF_Extension_Flags_LtwFlag

#define TS2_AF_Extension_Flags_LtwFlag (   flags)    ((flags) & 0x80)

◆ TS2_AF_Extension_Flags_PiecewiseRateFlag

#define TS2_AF_Extension_Flags_PiecewiseRateFlag (   flags)    ((flags) & 0x40)

◆ TS2_AF_Extension_Flags_SeamlessSpliceFlag

#define TS2_AF_Extension_Flags_SeamlessSpliceFlag (   flags)    ((flags) & 0x20)

◆ TS2_AF_Flags_DiscontinuityIndicator

#define TS2_AF_Flags_DiscontinuityIndicator (   flags)    ((flags) & 0x80)

◆ TS2_AF_Flags_EsPriorityIndicator

#define TS2_AF_Flags_EsPriorityIndicator (   flags)    ((flags) & 0x20)

◆ TS2_AF_Flags_ExtensionFlag

#define TS2_AF_Flags_ExtensionFlag (   flags)    ((flags) & 0x01)

◆ TS2_AF_Flags_OpcrFlag

#define TS2_AF_Flags_OpcrFlag (   flags)    ((flags) & 0x08)

◆ TS2_AF_Flags_PcrFlag

#define TS2_AF_Flags_PcrFlag (   flags)    ((flags) & 0x10)

◆ TS2_AF_Flags_RandomAccessIndicator

#define TS2_AF_Flags_RandomAccessIndicator (   flags)    ((flags) & 0x40)

◆ TS2_AF_Flags_SplicingPointFlag

#define TS2_AF_Flags_SplicingPointFlag (   flags)    ((flags) & 0x04)

◆ TS2_AF_Flags_TransportPrivateDataFlag

#define TS2_AF_Flags_TransportPrivateDataFlag (   flags)    ((flags) & 0x02)

◆ TS2_INVALID_PCR_IN_SECS

#define TS2_INVALID_PCR_IN_SECS   -1.0

◆ TS2_INVALID_PID

#define TS2_INVALID_PID   0xFFFF

◆ TS2_MAX_PCR_IN_SECS

#define TS2_MAX_PCR_IN_SECS   95443.717696703708 /* ((2**33-1)*300+(2**9-1)) / 27000000.0 */

◆ TS2_NULL_PACKET_PID

#define TS2_NULL_PACKET_PID   0x1FFF

◆ TS2_PACKET_AF_CLOCK_REFERENCE_DATA_SIZE

#define TS2_PACKET_AF_CLOCK_REFERENCE_DATA_SIZE   6

◆ TS2_PACKET_AF_EXTENSION_SEAMLESS_SIZE

#define TS2_PACKET_AF_EXTENSION_SEAMLESS_SIZE   5

◆ TS2_Packet_Flags_PayloadUnitStart

#define TS2_Packet_Flags_PayloadUnitStart (   pflags)    (((pflags) & 0x02) >> 1)

◆ TS2_Packet_Flags_TransportError

#define TS2_Packet_Flags_TransportError (   pflags)    (((pflags) & 0x04) >> 2)

◆ TS2_Packet_Flags_TransportPriority

#define TS2_Packet_Flags_TransportPriority (   pflags)    (((pflags) & 0x01) )

◆ TS2_Packet_HasAdaptationField

#define TS2_Packet_HasAdaptationField (   packet)    ((packet)->af_control & 0x02)

◆ TS2_Packet_HasPayload

#define TS2_Packet_HasPayload (   packet)    ((packet)->af_control & 0x01)

◆ TS2_Packet_HasPcr

#define TS2_Packet_HasPcr (   packet)
Value:
( \
TS2_Packet_HasAdaptationField(packet) && \
packet->adaptation_field != NULL && \
TS2_AF_Flags_PcrFlag(packet->adaptation_field->flags) \
)
#define NULL
Definition: WsbTypes.h:60

◆ TS2_PACKET_HEADER_SIZE

#define TS2_PACKET_HEADER_SIZE   4

◆ TS2_PACKET_PAYLOAD_SIZE

#define TS2_PACKET_PAYLOAD_SIZE   (TS2_PACKET_SIZE - TS2_PACKET_HEADER_SIZE)

◆ TS2_PACKET_PAYLOAD_UNIT_START_INDICATOR_FLAG_MASK

#define TS2_PACKET_PAYLOAD_UNIT_START_INDICATOR_FLAG_MASK   0x02

◆ TS2_PACKET_SIZE

#define TS2_PACKET_SIZE   188

◆ TS2_PACKET_SYNC_BYTE

#define TS2_PACKET_SYNC_BYTE   0x47

◆ TS2_PACKET_TRANSPORT_ERROR_INDICATOR_FLAG_MASK

#define TS2_PACKET_TRANSPORT_ERROR_INDICATOR_FLAG_MASK   0x04

◆ TS2_PACKET_TRANSPORT_PRIORITY_FLAG_MASK

#define TS2_PACKET_TRANSPORT_PRIORITY_FLAG_MASK   0x01

◆ TS2_STUFFING_BYTE

#define TS2_STUFFING_BYTE   0xFF

◆ TS2_SYSTEM_CLOCK_FREQUENCY

#define TS2_SYSTEM_CLOCK_FREQUENCY   27000000.0 /* 27 MHz */

Typedef Documentation

◆ TS2_PacketDispatcher

◆ TS2_PacketPump

Enumeration Type Documentation

◆ TS2_AfControl

Enumerator
TS2_AF_CONTROL_NULL_PACKET 
TS2_AF_CONTROL_PAYLOAD_ONLY 
TS2_AF_CONTROL_AF_ONLY 
TS2_AF_CONTROL_AF_AND_PAYLOAD 

◆ TS2_ScramblingControl

Enumerator
TS2_NO_SCRAMBLING 
TS2_DEFAULT_CK_SCRAMBLING 
TS2_EVEN_CK_SCRAMBLING 
TS2_ODD_CK_SCRAMBLING 

Function Documentation

◆ TS2_AdaptationField_PcrInSecs()

ATX_Float TS2_AdaptationField_PcrInSecs ( TS2_AdaptationField self)

◆ TS2_FormatPacketHeader()

void TS2_FormatPacketHeader ( ATX_Byte *  buffer,
ATX_UInt32  transport_error_indicator,
ATX_UInt32  payload_unit_start_indicator,
ATX_UInt32  transport_priority,
ATX_UInt16  pid,
TS2_ScramblingControl  scrambling_control,
TS2_AfControl  af_control,
ATX_UInt32  continuity_counter 
)

◆ TS2_Packet_Destruct()

void TS2_Packet_Destruct ( TS2_Packet packet)

◆ TS2_Packet_InitFromBuffer()

ATX_Result TS2_Packet_InitFromBuffer ( const ATX_Byte *  buffer,
TS2_Packet packet 
)

◆ TS2_Packet_InitFromInputStream()

ATX_Result TS2_Packet_InitFromInputStream ( ATX_InputStream *  stream,
TS2_Packet packet 
)

◆ TS2_Packet_SerializeToBuffer()

ATX_Result TS2_Packet_SerializeToBuffer ( TS2_Packet packet,
ATX_Byte *  buffer 
)

TS2_PACKET_SIZE bytes will be written into buffer.

◆ TS2_PacketDispatcher_Create()

ATX_Result TS2_PacketDispatcher_Create ( TS2_PacketDispatcher **  dispatcher)

◆ TS2_PacketDispatcher_Destroy()

void TS2_PacketDispatcher_Destroy ( TS2_PacketDispatcher self)

◆ TS2_PacketDispatcher_Dispatch()

ATX_Result TS2_PacketDispatcher_Dispatch ( TS2_PacketDispatcher self,
TS2_Packet packet 
)

◆ TS2_PacketDispatcher_GetNextAvailablePid()

ATX_UInt16 TS2_PacketDispatcher_GetNextAvailablePid ( TS2_PacketDispatcher self)

◆ TS2_PacketDispatcher_IsPidUsed()

ATX_Boolean TS2_PacketDispatcher_IsPidUsed ( TS2_PacketDispatcher self,
ATX_UInt16  pid 
)

◆ TS2_PacketDispatcher_ResetDefaultHandler()

ATX_Result TS2_PacketDispatcher_ResetDefaultHandler ( TS2_PacketDispatcher self)

◆ TS2_PacketDispatcher_ResetHandler()

TS2_EXPORT ATX_Result TS2_PacketDispatcher_ResetHandler ( TS2_PacketDispatcher self,
ATX_UInt16  pid 
)

◆ TS2_PacketDispatcher_SetDefaultHandler()

ATX_Result TS2_PacketDispatcher_SetDefaultHandler ( TS2_PacketDispatcher self,
TS2_PacketHandler  handler 
)

◆ TS2_PacketDispatcher_SetHandler()

TS2_EXPORT ATX_Result TS2_PacketDispatcher_SetHandler ( TS2_PacketDispatcher self,
ATX_UInt16  pid,
TS2_PacketHandler  handler 
)

◆ TS2_PacketPump_Create()

TS2_EXPORT ATX_Result TS2_PacketPump_Create ( ATX_InputStream *  stream,
TS2_PacketDispatcher dispatcher,
TS2_PacketPump **  pump 
)

◆ TS2_PacketPump_Destroy()

TS2_EXPORT void TS2_PacketPump_Destroy ( TS2_PacketPump self)

◆ TS2_PacketPump_GetDispatcher()

TS2_EXPORT TS2_PacketDispatcher* TS2_PacketPump_GetDispatcher ( TS2_PacketPump self)

◆ TS2_PacketPump_Pump()

TS2_EXPORT ATX_Result TS2_PacketPump_Pump ( TS2_PacketPump self)

◆ TS2_PacketPump_ResetStream()

TS2_EXPORT ATX_Result TS2_PacketPump_ResetStream ( TS2_PacketPump self,
ATX_InputStream *  stream 
)