Routines for managing VANC lines containing one or more VANC packets.
More...
#include <stdint.h>
#include <sys/types.h>
#include <sys/errno.h>
Go to the source code of this file.
|
#define | KLVANC_MAX_VANC_LINES 64 |
|
#define | KLVANC_MAX_VANC_ENTRIES 16 |
|
|
struct klvanc_line_s * | klvanc_line_create (int line_number) |
| Create a VANC line. More...
|
|
void | klvanc_line_free (struct klvanc_line_s *line) |
| Free a previously created klvanc_line_s structure. More...
|
|
int | klvanc_line_insert (struct klvanc_context_s *ctx, struct klvanc_line_set_s *vanc_lines, uint16_t *pixels, int pixel_width, int line_number, int horizontal_offset) |
| Insert a VANC packet into a VANC frame. More...
|
|
int | klvanc_generate_vanc_line (struct klvanc_context_s *ctx, struct klvanc_line_s *line, uint16_t **out_buf, int *out_len, int line_pixel_width) |
| Generate pixel array representing a fully formed VANC line. This function will take in a klvanc_line_s, format the VANC entries to ensure there are no gaps or overlapping packets, and create a final pixel array which can be colorspace converted and output over SDI. More...
|
|
int | klvanc_generate_vanc_line_v210 (struct klvanc_context_s *ctx, struct klvanc_line_s *line, uint8_t *out_buf, int line_pixel_width) |
| Generate byte array representing a fully formed VANC line. This function will take in a klvanc_line_s, format the VANC entries to ensure there are no gaps or overlapping packets, and create a final byte array which can be directly output over SDI in packed v210 format. More...
|
|
Routines for managing VANC lines containing one or more VANC packets.
- Author
- Devin Heitmueller dheit.nosp@m.muel.nosp@m.ler@k.nosp@m.erne.nosp@m.llabs.nosp@m..com
- Copyright
- Copyright (c) 2016 Kernel Labs Inc. All Rights Reserved. These routines allow a caller to take VANC packets and assemble a frame composed of a group of VANC lines. This includes:
- Ensuring no VANC packets with a given line/offset will overlap (moving VANC packets if necessary)
- Ensuring there are no gaps between VANC packets
- Ensuring the sum of all VANC packets does not overflow the line length
- Ensuring there are no illegal values in the VANC payload at a physical level
int klvanc_generate_vanc_line |
( |
struct klvanc_context_s * |
ctx, |
|
|
struct klvanc_line_s * |
line, |
|
|
uint16_t ** |
out_buf, |
|
|
int * |
out_len, |
|
|
int |
line_pixel_width |
|
) |
| |
Generate pixel array representing a fully formed VANC line. This function will take in a klvanc_line_s, format the VANC entries to ensure there are no gaps or overlapping packets, and create a final pixel array which can be colorspace converted and output over SDI.
- Parameters
-
[in] | struct | klvanc_context_s *ctx - Context. |
[in] | struct | klvanc_line_s *line - the VANC line to operate on |
[out] | uint16_t | **out_buf - a pointer to the buffer the function will output into. The memory for the buffer will be allocated by the function, and the caller will need to call free() to deallocate the resulting buffer. For 10-bit video, the array will contain 10-bit samples in 16-bit values. Bit packing or Colorspace conversion to other formats (such as V210) is the responsibility of the caller. |
[out] | int | *out_len - the size of the resulting out_buf buffer. This parameter allows the caller to know how large out_buf is to avoid buffer overflows. This value may be shorter than the pixel width of the overall line. Measured in number of 16-bit samples (i.e. not bytes). |
[in] | int | line_pixel_width - Size of the line the VANC will ultimately be inserted into, measured in number of samples. The function will not create an out_buf buffer which is larger than this value, nor will it insert VANC packets which exceed the line width specified. |
- Returns
- 0 - Success
-
-ENOMEM - insufficient memory to store the VANC packet
Generate byte array representing a fully formed VANC line. This function will take in a klvanc_line_s, format the VANC entries to ensure there are no gaps or overlapping packets, and create a final byte array which can be directly output over SDI in packed v210 format.
- Parameters
-
[in] | struct | klvanc_context_s *ctx - Context. |
[in] | struct | klvanc_line_s *line - the VANC line to operate on |
[out] | uint8_t | *out_buf - a pointer to the buffer the function will output into. The memory for the output buffer should be allocated by the caller (or in the case of working with Blackmagic cards, pass the buffer returned from vanc->GetBufferForVerticalBlankingLine(). Note that this function will determine whether to do HD interleaving (inserting into the Y region only) or SD interleaving (using both Y and UV regions) based on the value provided via the line_pixel_width argument. |
[in] | int | line_pixel_width - Size of the output buffer, measured in number of samples. When working with Blackmagic cards, this value will typically be the line width (e.g. 1920 for 1080i video), but there are special exceptions for certain 4K cards so review the Blackmagic SDK documentation for details. This function will it insert VANC packets which exceed the line width specified. |
- Returns
- 0 - Success
-
-ENOMEM - insufficient memory to store the VANC packet
Create a VANC line.
- Parameters
-
[in] | int | line_number - line number corresponding to where the line placed within the field |
- Returns
- struct klvanc_line_s containing the line or NULL on error
Free a previously created klvanc_line_s structure.
- Parameters
-
[in] | struct | klvanc_line_s *line - pointer to the line to be deleted. This will also deallocate any VANC packets previously inserted into the line |
int klvanc_line_insert |
( |
struct klvanc_context_s * |
ctx, |
|
|
struct klvanc_line_set_s * |
vanc_lines, |
|
|
uint16_t * |
pixels, |
|
|
int |
pixel_width, |
|
|
int |
line_number, |
|
|
int |
horizontal_offset |
|
) |
| |
Insert a VANC packet into a VANC frame.
- Parameters
-
[in] | struct | klvanc_line_set_s *klvanc_lines - pointer to set of VANC lines to insert into |
[in] | uint16_t | *pixels - Pointer to array of pixels to insert. For 10-bit pixels, these should be 10-bit values inserted into 16-bit padded fields. |
[in] | int | pixel_width - width of [pixels] argument, measured in number of samples |
[in] | int | line_number - line number this VANC packet should appear on in the resulting VANC frame |
[in] | int | horizontal_offset - offset into active video area the packet should ideally be inserted, measured in pixels |
- Returns
- 0 - Success
-
-ENOMEM - insufficient memory to store the VANC packet