libclosedcaption 1.0.3
ISDB-Tb/SBTVD (Brazilian DTV) closed caption extraction from MPEG-TS
Loading...
Searching...
No Matches
caption-data.h File Reference

Reading the caption data_group (ARIB STD-B24, Volume 3, 9.2). More...

#include "caption-common.h"
#include "packet-pes.h"
Include dependency graph for caption-data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CaptionData_t
 

Macros

#define CAPTION_MANAGEMENT_DGI_A   0x00
 
#define CAPTION_MANAGEMENT_DGI_B   0x20
 

Typedefs

typedef struct CaptionData_t CaptionData_t
 

Functions

bool caption_data_check_crc16 (const uint8_t *data, const uint16_t *datalen, const uint16_t *crc16)
 
bool caption_data_load (const PacketPES_t *pes, CaptionData_t *caption)
 

Detailed Description

Reading the caption data_group (ARIB STD-B24, Volume 3, 9.2).

Author
Jorge Pereira jpere.nosp@m.iran.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
Thu Aug 12 13:49:21 BRT 2010

Each caption PES carries a data_group:

* data_group_id(6) data_group_version(2) data_group_link_number(8)
* last_data_group_link_number(8) data_group_size(16)
* data_group_data_byte[data_group_size] CRC_16(16)
* 

The data_group_id tells the content: 0x00/0x20 is the "caption management data" (groups A and B) and the others are the "caption statement data" of each language (see caption-management.h).

Definition in file caption-data.h.

Macro Definition Documentation

◆ CAPTION_MANAGEMENT_DGI_A

#define CAPTION_MANAGEMENT_DGI_A   0x00

data_group_id of the "caption management data", group A.

Definition at line 25 of file caption-data.h.

◆ CAPTION_MANAGEMENT_DGI_B

#define CAPTION_MANAGEMENT_DGI_B   0x20

data_group_id of the "caption management data", group B.

Definition at line 26 of file caption-data.h.

Typedef Documentation

◆ CaptionData_t

typedef struct CaptionData_t CaptionData_t

data_group loaded by caption_data_load().

Function Documentation

◆ caption_data_check_crc16()

bool caption_data_check_crc16 ( const uint8_t *  data,
const uint16_t *  datalen,
const uint16_t *  crc16 
)

Checks the CRC-16 of a data_group.

The CRC is the CRC-16/CCITT (polynomial x^16 + x^12 + x^5 + 1, initial value 0), calculated over the whole data_group, from the data_group_id to the last data byte (ARIB STD-B24, Volume 3, 9.2).

Parameters
dataStart of the data_group (the data_group_id byte).
datalenNumber of bytes of data covered by the CRC (5 of header + data_group_size).
crc16CRC read from the packet.
Returns
TRUE if the CRC matches.

◆ caption_data_load()

bool caption_data_load ( const PacketPES_t *  pes,
CaptionData_t *  caption 
)

Loads the data_group of a PES and checks the CRC.

Stuffing bytes after the data_group are ignored.

Parameters
pesPES loaded by packet_pes_load().
captionReceives the data_group. The pointers point inside the PES buffer.
Returns
TRUE if the data_group is valid and the CRC matches.