| FFmpegKit iOS / macOS / tvOS API 4.5

Macros | Functions | Variables
fftools_ffmpeg_filter.c File Reference

Go to the source code of this file.

## Macros
#define | DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, printf_format, get_name)
#define | AUTO_INSERT_FILTER(opt_name, filter_name, arg)
#define | AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg)

## Functions
static enum AVPixelFormat * | get_compliance_normal_pix_fmts (const AVCodec *codec, const enum AVPixelFormat default_formats[])
enum AVPixelFormat | choose_pixel_fmt (AVStream *st, AVCodecContext *enc_ctx, const AVCodec *codec, enum AVPixelFormat target)
static char * | choose_pix_fmts (OutputFilter *ofilter)
| DEF_CHOOSE_FORMAT (sample_fmts, enum AVSampleFormat, format, formats, AV_SAMPLE_FMT_NONE, "%s", av_get_sample_fmt_name) DEF_CHOOSE_FORMAT(sample_rates
| DEF_CHOOSE_FORMAT (channel_layouts, uint64_t, channel_layout, channel_layouts, 0, "0x%"PRIx64,) int init_simple_filtergraph(InputStream *ist
| if (!fg) exit_program(1)
| GROW_ARRAY (fg->outputs, fg->nb_outputs)
| if (!(fg->outputs[0]=av_mallocz(sizeof(*fg->outputs[0])))) exit_program(1)
| if (!(fg->inputs[0]=av_mallocz(sizeof(*fg->inputs[0])))) exit_program(1)
| if (!fg->inputs[0]->frame_queue) exit_program(1)
| GROW_ARRAY (ist->filters, ist->nb_filters)
| GROW_ARRAY (filtergraphs, nb_filtergraphs)
static char * | describe_filter_link (FilterGraph *fg, AVFilterInOut *inout, int in)
static void | init_input_filter (FilterGraph *fg, AVFilterInOut *in)
int | init_complex_filtergraph (FilterGraph *fg)
static int | insert_trim (int64_t start_time, int64_t duration, AVFilterContext **last_filter, int *pad_idx, const char *filter_name)
static int | insert_filter (AVFilterContext **last_filter, int *pad_idx, const char *filter_name, const char *args)
static int | configure_output_video_filter (FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
static int | configure_output_audio_filter (FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
int | configure_output_filter (FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
void | check_filter_outputs (void)
static int | sub2video_prepare (InputStream *ist, InputFilter *ifilter)
static int | configure_input_video_filter (FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
static int | configure_input_audio_filter (FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
static int | configure_input_filter (FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in)
static void | cleanup_filtergraph (FilterGraph *fg)
int | configure_filtergraph (FilterGraph *fg)
int | ifilter_parameters_from_frame (InputFilter *ifilter, const AVFrame *frame)
int | filtergraph_is_simple (FilterGraph *fg)

## Variables
| int
| sample_rate
| sample_rates
| d
OutputStream * | ost
fg | index = nb_filtergraphs
fg outputs[0] | graph = fg
fg outputs[0] | format = -1
ost | filter = fg->outputs[0]
fg inputs[0] | ist = ist
fg inputs[0] | frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*))
ist | filters [ist->nb_filters - 1] = fg->inputs[0]
| filtergraphs [nb_filtergraphs - 1] = fg
| return

## Macro Definition Documentation

## ◆ AUTO_INSERT_FILTER

#define AUTO_INSERT_FILTER | ( |  | opt_name,
|  |  | filter_name,
|  |  | arg
| ) |  |

Value:
do { \
AVFilterContext *filt_ctx; \
\
av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
"similarly to -af " filter_name "=%s.\n", arg); \
\
ret = avfilter_graph_create_filter(&filt_ctx, \
avfilter_get_by_name(filter_name), \
filter_name, arg, NULL, fg->graph); \
if (ret < 0) \
goto fail; \
\
ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \
if (ret < 0) \
goto fail; \
\
last_filter = filt_ctx; \
pad_idx = 0; \
} while (0)

## ◆ AUTO_INSERT_FILTER_INPUT

#define AUTO_INSERT_FILTER_INPUT | ( |  | opt_name,
|  |  | filter_name,
|  |  | arg
| ) |  |

Value:
do { \
AVFilterContext *filt_ctx; \
\
av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
"similarly to -af " filter_name "=%s.\n", arg); \
\
snprintf(name, sizeof(name), "graph_%d_%s_in_%d_%d", \
fg->index, filter_name, ist->file_index, ist->st->index); \
ret = avfilter_graph_create_filter(&filt_ctx, \
avfilter_get_by_name(filter_name), \
name, arg, NULL, fg->graph); \
if (ret < 0) \
return ret; \
\
ret = avfilter_link(last_filter, 0, filt_ctx, 0); \
if (ret < 0) \
return ret; \
\
last_filter = filt_ctx; \
} while (0)
ist
fg inputs[0] ist
Definition: fftools_ffmpeg_filter.c:191

## ◆ DEF_CHOOSE_FORMAT

#define DEF_CHOOSE_FORMAT | ( |  | name,
|  |  | type,
|  |  | var,
|  |  | supported_list,
|  |  | none,
|  |  | printf_format,
|  |  | get_name
| ) |  |

Value:
static void choose_ ## name (OutputFilter *ofilter, AVBPrint *bprint) \
{ \
if (ofilter->var == none && !ofilter->supported_list) \
return; \
av_bprintf(bprint, #name "="); \
if (ofilter->var != none) { \
av_bprintf(bprint, printf_format, get_name(ofilter->var)); \
} else { \
const type *p; \
\
for (p = ofilter->supported_list; *p != none; p++) { \
av_bprintf(bprint, printf_format "|", get_name(*p)); \
} \
if (bprint->len > 0) \
bprint->str[--bprint->len] = '\0'; \
} \
av_bprint_chars(bprint, ':', 1); \
}
OutputFilter
Definition: fftools_ffmpeg.h:288

Definition at line 139 of file fftools_ffmpeg_filter.c.

## Function Documentation

## ◆ check_filter_outputs()

void check_filter_outputs | ( | void |  | ) |

Definition at line 643 of file fftools_ffmpeg_filter.c.

## ◆ choose_pix_fmts()

static char * choose_pix_fmts | ( | OutputFilter * | ofilter | ) |
| static

Definition at line 95 of file fftools_ffmpeg_filter.c.

## ◆ choose_pixel_fmt()

enum AVPixelFormat choose_pixel_fmt | ( | AVStream * | st,
|  | AVCodecContext * | enc_ctx,
|  | const AVCodec * | codec,
|  | enum AVPixelFormat | target
| ) |  |

Definition at line 65 of file fftools_ffmpeg_filter.c.

## ◆ cleanup_filtergraph()

static void cleanup_filtergraph | ( | FilterGraph * | fg | ) |
| static

Definition at line 953 of file fftools_ffmpeg_filter.c.

## ◆ configure_filtergraph()

int configure_filtergraph | ( | FilterGraph * | fg | ) |

Definition at line 963 of file fftools_ffmpeg_filter.c.

## ◆ configure_input_audio_filter()

static int configure_input_audio_filter | ( | FilterGraph * | fg,
|  | InputFilter * | ifilter,
|  | AVFilterInOut * | in
| ) |  |
| static

Definition at line 827 of file fftools_ffmpeg_filter.c.

## ◆ configure_input_filter()

static int configure_input_filter | ( | FilterGraph * | fg,
|  | InputFilter * | ifilter,
|  | AVFilterInOut * | in
| ) |  |
| static

Definition at line 937 of file fftools_ffmpeg_filter.c.

## ◆ configure_input_video_filter()

static int configure_input_video_filter | ( | FilterGraph * | fg,
|  | InputFilter * | ifilter,
|  | AVFilterInOut * | in
| ) |  |
| static

Definition at line 705 of file fftools_ffmpeg_filter.c.

## ◆ configure_output_audio_filter()

static int configure_output_audio_filter | ( | FilterGraph * | fg,
|  | OutputFilter * | ofilter,
|  | AVFilterInOut * | out
| ) |  |
| static

Definition at line 521 of file fftools_ffmpeg_filter.c.

## ◆ configure_output_filter()

int configure_output_filter | ( | FilterGraph * | fg,
|  | OutputFilter * | ofilter,
|  | AVFilterInOut * | out
| ) |  |

Definition at line 629 of file fftools_ffmpeg_filter.c.

## ◆ configure_output_video_filter()

static int configure_output_video_filter | ( | FilterGraph * | fg,
|  | OutputFilter * | ofilter,
|  | AVFilterInOut * | out
| ) |  |
| static

Definition at line 428 of file fftools_ffmpeg_filter.c.

## ◆ DEF_CHOOSE_FORMAT() [1/2]

DEF_CHOOSE_FORMAT | ( | channel_layouts | ,
|  | uint64_t | ,
|  | channel_layout | ,
|  | channel_layouts | ,
|  | 0 | ,
|  | "0x%" | PRIx64
| ) |  |

## ◆ DEF_CHOOSE_FORMAT() [2/2]

DEF_CHOOSE_FORMAT | ( | sample_fmts | ,
|  | enum | AVSampleFormat,
|  | format | ,
|  | formats | ,
|  | AV_SAMPLE_FMT_NONE | ,
|  | "%s" | ,
|  | av_get_sample_fmt_name |
| ) |  |

## ◆ describe_filter_link()

static char * describe_filter_link | ( | FilterGraph * | fg,
|  | AVFilterInOut * | inout,
|  | int | in
| ) |  |
| static

Definition at line 208 of file fftools_ffmpeg_filter.c.

## ◆ filtergraph_is_simple()

int filtergraph_is_simple | ( | FilterGraph * | fg | ) |

Definition at line 1164 of file fftools_ffmpeg_filter.c.

## ◆ get_compliance_normal_pix_fmts()

static enum AVPixelFormat * get_compliance_normal_pix_fmts | ( | const AVCodec * | codec,
|  | const enum AVPixelFormat | default_formats[]
| ) |  |
| static

Definition at line 52 of file fftools_ffmpeg_filter.c.

## ◆ GROW_ARRAY() [1/3]

GROW_ARRAY | ( | fg-> | outputs,
|  | fg-> | nb_outputs
| ) |  |

## ◆ GROW_ARRAY() [2/3]

GROW_ARRAY | ( | filtergraphs | ,
|  | nb_filtergraphs |
| ) |  |

## ◆ GROW_ARRAY() [3/3]

GROW_ARRAY | ( | ist-> | filters,
|  | ist-> | nb_filters
| ) |  |

## ◆ if() [1/4]

if | ( | ! | fg->inputs[0]=av_mallocz(sizeof(*fg->inputs[0])) | ) |

## ◆ if() [2/4]

if | ( | ! | fg->outputs[0]=av_mallocz(sizeof(*fg->outputs[0])) | ) |

## ◆ if() [3/4]

if | ( | ! | fg | ) |

## ◆ if() [4/4]

if | ( | !fg->inputs-> | frame_queue[0] | ) |

## ◆ ifilter_parameters_from_frame()

int ifilter_parameters_from_frame | ( | InputFilter * | ifilter,
|  | const AVFrame * | frame
| ) |  |

Definition at line 1141 of file fftools_ffmpeg_filter.c.

## ◆ init_complex_filtergraph()

int init_complex_filtergraph | ( | FilterGraph * | fg | ) |

Definition at line 314 of file fftools_ffmpeg_filter.c.

## ◆ init_input_filter()

static void init_input_filter | ( | FilterGraph * | fg,
|  | AVFilterInOut * | in
| ) |  |
| static

Definition at line 227 of file fftools_ffmpeg_filter.c.

## ◆ insert_filter()

static int insert_filter | ( | AVFilterContext ** | last_filter,
|  | int * | pad_idx,
|  | const char * | filter_name,
|  | const char * | args
| ) |  |
| static

Definition at line 406 of file fftools_ffmpeg_filter.c.

## ◆ insert_trim()

static int insert_trim | ( | int64_t | start_time,
|  | int64_t | duration,
|  | AVFilterContext ** | last_filter,
|  | int * | pad_idx,
|  | const char * | filter_name
| ) |  |
| static

Definition at line 355 of file fftools_ffmpeg_filter.c.

## ◆ sub2video_prepare()

static int sub2video_prepare | ( | InputStream * | ist,
|  | InputFilter * | ifilter
| ) |  |
| static

Definition at line 658 of file fftools_ffmpeg_filter.c.

## Variable Documentation

## ◆ d

d

Definition at line 166 of file fftools_ffmpeg_filter.c.

## ◆ filter

ost filter = fg->outputs[0]

Definition at line 186 of file fftools_ffmpeg_filter.c.

## ◆ filtergraphs

filtergraphs[nb_filtergraphs - 1] = fg

Definition at line 203 of file fftools_ffmpeg_filter.c.

## ◆ filters

ist filters[ist->nb_filters - 1] = fg->inputs[0]

Definition at line 200 of file fftools_ffmpeg_filter.c.

## ◆ format

fg inputs [0] format = -1

Definition at line 184 of file fftools_ffmpeg_filter.c.

## ◆ frame_queue

fg inputs [0] frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*))

Definition at line 195 of file fftools_ffmpeg_filter.c.

## ◆ graph

fg inputs [0] graph = fg

Definition at line 183 of file fftools_ffmpeg_filter.c.

## ◆ index

fg index = nb_filtergraphs

Definition at line 177 of file fftools_ffmpeg_filter.c.

## ◆ int

int

Definition at line 165 of file fftools_ffmpeg_filter.c.

## ◆ ist

fg inputs [0] ist = ist

Definition at line 191 of file fftools_ffmpeg_filter.c.

## ◆ ost

fg outputs [0] ost

Initial value:
{
FilterGraph *fg = av_mallocz(sizeof(*fg))
FilterGraph
Definition: fftools_ffmpeg.h:311

Definition at line 171 of file fftools_ffmpeg_filter.c.

## ◆ return

return

Definition at line 205 of file fftools_ffmpeg_filter.c.

## ◆ sample_rate

sample_rate

Definition at line 165 of file fftools_ffmpeg_filter.c.

## ◆ sample_rates

sample_rates

Definition at line 165 of file fftools_ffmpeg_filter.c.