FFmpeg
Loading...
Searching...
No Matches
ccfifo.c File Reference
#include "ccfifo.h"
#include "libavutil/error.h"
#include "libavutil/fifo.h"

Go to the source code of this file.

Data Structures

struct  cc_lookup
 

Macros

#define MAX_CC_ELEMENTS   128
 
#define MAX_CC_ELEMENTS_LIMIT   (600 * 10)
 

Functions

void ff_ccfifo_uninit (CCFifo *ccf)
 Free all memory allocated in a CCFifo and clear the context.
 
int ff_ccfifo_init (CCFifo *ccf, AVRational framerate, void *log_ctx)
 Initialize a CCFifo.
 
int ff_ccfifo_injectbytes (CCFifo *ccf, uint8_t *cc_data, size_t len)
 Just like ff_ccfifo_inject(), but takes the raw bytes to insert the CC data int rather than an AVFrame.
 
int ff_ccfifo_inject (CCFifo *ccf, AVFrame *frame)
 Insert CC data from the FIFO into an AVFrame (as side data)
 
int ff_ccfifo_extractbytes (CCFifo *ccf, uint8_t *cc_bytes, size_t len)
 Just like ff_ccfifo_extract(), but takes the raw bytes instead of an AVFrame.
 
int ff_ccfifo_extract (CCFifo *ccf, AVFrame *frame)
 Extract CC data from an AVFrame.
 

Variables

static const struct cc_lookup cc_lookup_vals []
 

Macro Definition Documentation

◆ MAX_CC_ELEMENTS

#define MAX_CC_ELEMENTS   128

Definition at line 28 of file ccfifo.c.

Referenced by ff_ccfifo_init().

◆ MAX_CC_ELEMENTS_LIMIT

#define MAX_CC_ELEMENTS_LIMIT   (600 * 10)

Definition at line 31 of file ccfifo.c.

Referenced by ff_ccfifo_init().

Function Documentation

◆ ff_ccfifo_uninit()

void ff_ccfifo_uninit ( CCFifo * ccf)

Free all memory allocated in a CCFifo and clear the context.

Parameters
ccfPointer to the CCFifo which should be uninitialized

Definition at line 50 of file ccfifo.c.

Referenced by ff_ccfifo_init(), ff_decklink_write_trailer(), ff_yadif_uninit(), uninit(), uninit(), and uninit().

◆ ff_ccfifo_init()

int ff_ccfifo_init ( CCFifo * ccf,
AVRational framerate,
void * log_ctx )

Initialize a CCFifo.

Parameters
framerateoutput framerate
log_ctxused for any av_log() calls
Returns
Zero on success, or negative AVERROR code on failure.

Definition at line 57 of file ccfifo.c.

Referenced by config_input(), config_out_props(), config_props(), ff_decklink_write_header(), and ff_yadif_config_output_common().

◆ ff_ccfifo_injectbytes()

int ff_ccfifo_injectbytes ( CCFifo * ccf,
uint8_t * cc_data,
size_t len )

Just like ff_ccfifo_inject(), but takes the raw bytes to insert the CC data int rather than an AVFrame.

Definition at line 101 of file ccfifo.c.

Referenced by ff_ccfifo_inject().

◆ ff_ccfifo_inject()

int ff_ccfifo_inject ( CCFifo * ccf,
AVFrame * frame )

Insert CC data from the FIFO into an AVFrame (as side data)

Dequeue the appropriate number of CC tuples based on the frame rate, and insert them into the AVFrame

Parameters
afCCFifo to read from
frameAVFrame with the video frame to operate on
Returns
Zero on success, or negative AVERROR code on failure.

Definition at line 142 of file ccfifo.c.

Referenced by ff_yadif_filter_frame(), filter_frame(), filter_frame(), return_frame(), and write_frame().

◆ ff_ccfifo_extractbytes()

int ff_ccfifo_extractbytes ( CCFifo * ccf,
uint8_t * cc_bytes,
size_t len )

Just like ff_ccfifo_extract(), but takes the raw bytes instead of an AVFrame.

Definition at line 163 of file ccfifo.c.

Referenced by decklink_write_subtitle_packet(), and ff_ccfifo_extract().

◆ ff_ccfifo_extract()

int ff_ccfifo_extract ( CCFifo * ccf,
AVFrame * frame )

Extract CC data from an AVFrame.

Extract CC bytes from the AVFrame, insert them into our queue, and remove the side data from the AVFrame. The side data is removed as it will be re-inserted at the appropriate rate later in the filter.

Parameters
afCCFifo to write to
frameAVFrame with the video frame to operate on
Returns
Zero on success, or negative AVERROR code on failure. On failure, the tuples that fit are still queued and the side data is still removed.

Definition at line 200 of file ccfifo.c.

Referenced by ff_yadif_filter_frame(), filter_frame(), filter_frame(), and read_frame().

Variable Documentation

◆ cc_lookup_vals

const struct cc_lookup cc_lookup_vals[]
static
Initial value:
= {
{ 15, 1, 40, 4 },
{ 24, 1, 25, 3 },
{ 24000, 1001, 25, 3 },
{ 30, 1, 20, 2 },
{ 30000, 1001, 20, 2},
{ 60, 1, 10, 1 },
{ 60000, 1001, 10, 1},
}

Definition at line 40 of file ccfifo.c.

Referenced by ff_ccfifo_init().