libklvanc
 All Classes Files Functions Variables Enumerations Macros
Classes | Functions
smpte2038.h File Reference

Functions to parse, create and inspect SMPTE2038 formatted packets. More...

#include <libklvanc/vanc-packets.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  klvanc_smpte2038_anc_data_line_s
 TODO - Brief description goes here. More...
 
struct  klvanc_smpte2038_anc_data_packet_s
 TODO - Brief description goes here. More...
 
struct  klvanc_smpte2038_packetizer_s
 TODO - Brief description goes here. More...
 

Functions

int klvanc_smpte2038_parse_pes_packet (uint8_t *section, unsigned int byteCount, struct klvanc_smpte2038_anc_data_packet_s **result)
 Inspect a section, if its deemed valid, create a VANC packet and return it to the caller.
Typically this is a line of SDI data, 10bit video. We parse the content in this function,
if we find a VANC header signiture we'll create an ancillary packet to represet it,
we'll attempt to parse the structure and return a user representation of it.

Callers must release the returned struct using klvanc_smpte2038_anc_data_packet_free(). More...
 
int klvanc_smpte2038_parse_pes_payload (uint8_t *payload, unsigned int byteCount, struct klvanc_smpte2038_anc_data_packet_s **result)
 Inspect a section payload. This function is identical to klvanc_smpte2038_parse_pes_packet(),
except it takes just the payload section of a section, rather than the full section which
would include the section headers (e.g. start code prefix, stream id, etc). This routine
is for use in cases where the calling application is responsible for parsing the PES and
only hands off the payload section to decoders (such as the mpegts demux in libavformat).

Callers must release the returned struct using klvanc_smpte2038_anc_data_packet_free(). More...
 
void klvanc_smpte2038_anc_data_packet_dump (struct klvanc_smpte2038_anc_data_packet_s *h)
 Inspect structure and output textual information to console. More...
 
void klvanc_smpte2038_anc_data_packet_free (struct klvanc_smpte2038_anc_data_packet_s *pkt)
 Deallocate and release a previously allocated pkt, see klvanc_smpte2038_parse_section(). More...
 
int klvanc_smpte2038_packetizer_alloc (struct klvanc_smpte2038_packetizer_s **ctx)
 Allocate a context so we can use this with the rest of the library. More...
 
void klvanc_smpte2038_packetizer_free (struct klvanc_smpte2038_packetizer_s **ctx)
 Deallocate and release a previously allocated context, see klvanc_smpte2038_packetizer_alloc(). More...
 
int klvanc_smpte2038_packetizer_begin (struct klvanc_smpte2038_packetizer_s *ctx)
 Initialize state, typically done at the beginning of each incoming SDI frame
must be done before attempting to append decoded VANC packets. More...
 
int klvanc_smpte2038_packetizer_append (struct klvanc_smpte2038_packetizer_s *ctx, struct klvanc_packet_header_s *pkt)
 TODO - Brief description goes here. More...
 
int klvanc_smpte2038_packetizer_end (struct klvanc_smpte2038_packetizer_s *ctx, uint64_t pts)
 Finalize VANC collection state. Typically done when the last VANC line in a frame
has been passed to klvanc_smpte2038_packetizer_append().
Don't attempt to append without first calling klvanc_smpte2038_packetizer_begin(). More...
 
int klvanc_smpte2038_convert_line_to_words (struct klvanc_smpte2038_anc_data_line_s *l, uint16_t **words, uint16_t *wordCount)
 Convert type struct klvanc_smpte2038_anc_data_line_s into a more traditional line of
vanc words, so that we may push it into the vanc parser. On success, caller MUST free the resulting *words array. More...
 

Detailed Description

Functions to parse, create and inspect SMPTE2038 formatted packets.

Author
Steven Toth stoth.nosp@m.@ker.nosp@m.nella.nosp@m.bs.c.nosp@m.om

Function Documentation

void klvanc_smpte2038_anc_data_packet_dump ( struct klvanc_smpte2038_anc_data_packet_s h)

Inspect structure and output textual information to console.

Parameters
[in]structklvanc_smpte2038_anc_data_packet_s *pkt - Packet
void klvanc_smpte2038_anc_data_packet_free ( struct klvanc_smpte2038_anc_data_packet_s pkt)

Deallocate and release a previously allocated pkt, see klvanc_smpte2038_parse_section().

Parameters
[in]structklvanc_smpte2038_anc_data_packet_s *pkt - Packet
int klvanc_smpte2038_convert_line_to_words ( struct klvanc_smpte2038_anc_data_line_s l,
uint16_t **  words,
uint16_t *  wordCount 
)

Convert type struct klvanc_smpte2038_anc_data_line_s into a more traditional line of
vanc words, so that we may push it into the vanc parser. On success, caller MUST free the resulting *words array.

Parameters
[in]structklvanc_smpte2038_anc_data_line_s *line - A line of decomposed vanc, received from the SMPTE2038 parser.
[out]uint16_t**words - An array of words reppresenting a fully formed vanc line.
[out]uint16_t*wordCount - Number of words in the array.
Returns
0 - Success
< 0 - Error
-ENOMEM - Not enough memory to satisfy request
int klvanc_smpte2038_packetizer_alloc ( struct klvanc_smpte2038_packetizer_s **  ctx)

Allocate a context so we can use this with the rest of the library.

Parameters
[out]structklvanc_smpte2038_packetizer_s **ctx - Context
Returns
0 - Success
< 0 - Error
int klvanc_smpte2038_packetizer_append ( struct klvanc_smpte2038_packetizer_s ctx,
struct klvanc_packet_header_s pkt 
)

TODO - Brief description goes here.

Parameters
[in]structklvanc_smpte2038_packetizer_s *ctx
[in]structklvanc_packet_header_s *pkt
Returns
TODO.
int klvanc_smpte2038_packetizer_begin ( struct klvanc_smpte2038_packetizer_s ctx)

Initialize state, typically done at the beginning of each incoming SDI frame
must be done before attempting to append decoded VANC packets.

Parameters
[in]structklvanc_smpte2038_packetizer_s **ctx - Context
Returns
0 - Success
< 0 - Error
int klvanc_smpte2038_packetizer_end ( struct klvanc_smpte2038_packetizer_s ctx,
uint64_t  pts 
)

Finalize VANC collection state. Typically done when the last VANC line in a frame
has been passed to klvanc_smpte2038_packetizer_append().
Don't attempt to append without first calling klvanc_smpte2038_packetizer_begin().

Parameters
[in]structklvanc_smpte2038_packetizer_s **ctx - Context
[in]structpacket_header_s pkt - A fully decoded VANC packet, from the vanc_() callbacks.
Returns
0 - Success
< 0 - Error
void klvanc_smpte2038_packetizer_free ( struct klvanc_smpte2038_packetizer_s **  ctx)

Deallocate and release a previously allocated context, see klvanc_smpte2038_packetizer_alloc().

Parameters
[in]structklvanc_smpte2038_packetizer_s **ctx - Context
int klvanc_smpte2038_parse_pes_packet ( uint8_t *  section,
unsigned int  byteCount,
struct klvanc_smpte2038_anc_data_packet_s **  result 
)

Inspect a section, if its deemed valid, create a VANC packet and return it to the caller.
Typically this is a line of SDI data, 10bit video. We parse the content in this function,
if we find a VANC header signiture we'll create an ancillary packet to represet it,
we'll attempt to parse the structure and return a user representation of it.

Callers must release the returned struct using klvanc_smpte2038_anc_data_packet_free().

Parameters
[in]uint8_t*section - An array of memory that likely contains a valic (or invalid) VANC message.
[in]unsignedint byteCount - Length of section.
[out]structklvanc_smpte2038_anc_data_packet_s **result - Packet
Returns
0 - Success, **result is valid for future use.
< 0 - Error
int klvanc_smpte2038_parse_pes_payload ( uint8_t *  payload,
unsigned int  byteCount,
struct klvanc_smpte2038_anc_data_packet_s **  result 
)

Inspect a section payload. This function is identical to klvanc_smpte2038_parse_pes_packet(),
except it takes just the payload section of a section, rather than the full section which
would include the section headers (e.g. start code prefix, stream id, etc). This routine
is for use in cases where the calling application is responsible for parsing the PES and
only hands off the payload section to decoders (such as the mpegts demux in libavformat).

Callers must release the returned struct using klvanc_smpte2038_anc_data_packet_free().

Parameters
[in]uint8_t*section - An array of memory that likely contains a valic (or invalid) VANC message.
[in]unsignedint byteCount - Length of section.
[out]structklvanc_smpte2038_anc_data_packet_s **result - Packet
Returns
0 - Success, **result is valid for future use.
< 0 - Error