libdvbpsi  2.0.0-git
MPEG Transport Stream PSI table parser
Data Structures | Typedefs | Functions
descriptor.h File Reference

Common descriptor tools. More...

Go to the source code of this file.

Data Structures

struct  dvbpsi_descriptor_s
 Descriptor structure. More...
 

Typedefs

typedef uint8_t iso_639_language_code_t[3]
 ISO639 three letter language codes.
 
typedef struct dvbpsi_descriptor_s dvbpsi_descriptor_t
 dvbpsi_descriptor_t type definition. More...
 

Functions

dvbpsi_descriptor_tdvbpsi_NewDescriptor (uint8_t i_tag, uint8_t i_length, uint8_t *p_data)
 Creation of a new dvbpsi_descriptor_t structure. More...
 
void dvbpsi_DeleteDescriptors (dvbpsi_descriptor_t *p_descriptor)
 Destruction of a dvbpsi_descriptor_t structure together with the decoded descriptor, if present. More...
 
dvbpsi_descriptor_tdvbpsi_AddDescriptor (dvbpsi_descriptor_t *p_list, dvbpsi_descriptor_t *p_descriptor)
 Add a descriptor to the end of descriptor list. More...
 
bool dvbpsi_CanDecodeAsDescriptor (dvbpsi_descriptor_t *p_descriptor, const uint8_t i_tag)
 Checks if descriptor tag matches. More...
 
bool dvbpsi_IsDescriptorDecoded (dvbpsi_descriptor_t *p_descriptor)
 Checks if descriptor was already decoded. More...
 
void * dvbpsi_DuplicateDecodedDescriptor (void *p_decoded, ssize_t i_size)
 Duplicate a decoded descriptor. The caller is responsible for releasing the associated memory. More...
 

Detailed Description

Common descriptor tools.

>

Author
Arnaud de Bossoreille de Ribou bozo@.nosp@m.via..nosp@m.ecp.f.nosp@m.r

Descriptor structure and its Manipulation tools.

NOTE: Descriptor generators and decoder functions return a pointer on success and NULL on error. They do not use a dvbpsi_t handle as first argument.

Typedef Documentation

◆ dvbpsi_descriptor_t

dvbpsi_descriptor_t type definition.

The common descriptor header and its payload is contained in this structure. The payload is the raw descriptor data and its interpretation depends on the the p_descriptor::i_tag value.

After passing the descriptor to a dvbpsi_DecodeXXXXDr function the raw descriptor data is interpreted and decoded into a descriptor specific structure. This structure is stored in the p_descriptor::p_decoded member by the dvbpsi_DecodeXXXXDr function.

NOTE: It is mandatory to add a decoded descriptor to the 'p_decoded' member of this struct. Failing to do so will result in memory leakage when deleting descriptor with

See also
dvbpsi_DeleteDescriptor.

Function Documentation

◆ dvbpsi_AddDescriptor()

dvbpsi_descriptor_t * dvbpsi_AddDescriptor ( dvbpsi_descriptor_t p_list,
dvbpsi_descriptor_t p_descriptor 
)

Add a descriptor to the end of descriptor list.

Parameters
p_listthe first descriptor in the descriptor list.
p_descriptorthe descriptor to add to the list
Returns
a pointer to the first element in the descriptor list.

◆ dvbpsi_CanDecodeAsDescriptor()

bool dvbpsi_CanDecodeAsDescriptor ( dvbpsi_descriptor_t p_descriptor,
const uint8_t  i_tag 
)

Checks if descriptor tag matches.

Parameters
p_descriptorpointer to descriptor allocated with
See also
dvbpsi_NewDescriptor
Parameters
i_tagdescriptor tag to evaluate against
Returns
true if descriptor can be decoded, false if not.

◆ dvbpsi_DeleteDescriptors()

void dvbpsi_DeleteDescriptors ( dvbpsi_descriptor_t p_descriptor)

Destruction of a dvbpsi_descriptor_t structure together with the decoded descriptor, if present.

Parameters
p_descriptorpointer to the first descriptor structure
Returns
nothing.

◆ dvbpsi_DuplicateDecodedDescriptor()

void * dvbpsi_DuplicateDecodedDescriptor ( void *  p_decoded,
ssize_t  i_size 
)

Duplicate a decoded descriptor. The caller is responsible for releasing the associated memory.

Parameters
p_decodedpointer to decoded descriptor obtained with dvbpsi_Decode* function
i_sizethe sizeof decoded descriptor
Returns
pointer to duplicated descriptor, NULL on error.

◆ dvbpsi_IsDescriptorDecoded()

bool dvbpsi_IsDescriptorDecoded ( dvbpsi_descriptor_t p_descriptor)

Checks if descriptor was already decoded.

Parameters
p_descriptorpointer to descriptor allocated with
See also
dvbpsi_NewDescriptor
Returns
true if descriptor can be decoded, false if already decoded.

◆ dvbpsi_NewDescriptor()

dvbpsi_descriptor_t * dvbpsi_NewDescriptor ( uint8_t  i_tag,
uint8_t  i_length,
uint8_t *  p_data 
)

Creation of a new dvbpsi_descriptor_t structure.

Parameters
i_tagdescriptor's tag
i_lengthdescriptor's length
p_datadescriptor's data
Returns
a pointer to the descriptor.