FFmpeg
Loading...
Searching...
No Matches
f_sendcmd.c File Reference

send commands filter More...

#include "config_components.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/eval.h"
#include "libavutil/file.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
#include "filters.h"
#include "audio.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  Command
 
struct  Interval
 
struct  SendCmdContext
 

Macros

#define COMMAND_FLAG_ENTER   1
 
#define COMMAND_FLAG_LEAVE   2
 
#define COMMAND_FLAG_EXPR   4
 
#define OFFSET(x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
 
#define SPACES   " \f\t\n\r"
 
#define COMMAND_DELIMS   " \f\t\n\r,;"
 
#define DELIMS   " \f\t\n\r,;"
 
#define WITHIN_INTERVAL(ts, start_ts, end_ts)
 

Enumerations

enum  var_name {
  VAR_N , VAR_T , VAR_PTS , VAR_TS ,
  VAR_TE , VAR_TI , VAR_W , VAR_H ,
  VAR_VARS_NB
}
 

Functions

static char * make_command_flags_str (AVBPrint *pbuf, int flags)
 
static void skip_comments (const char **buf)
 
static void clear_command (Command *cmd)
 Clears fields and frees the buffers used by cmd.
 
static int parse_command (Command *cmd, int cmd_count, int interval_count, const char **buf, void *log_ctx)
 
static int parse_commands (Command **cmds, int *nb_cmds, int interval_count, const char **buf, void *log_ctx)
 
static int parse_interval (Interval *interval, int interval_count, const char **buf, void *log_ctx)
 
static int parse_intervals (Interval **intervals, int *nb_intervals, const char *buf, void *log_ctx)
 
static int cmp_intervals (const void *a, const void *b)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *ref)
 
 AVFILTER_DEFINE_CLASS_EXT (sendcmd, "(a)sendcmd", options)
 

Variables

static const char *const var_names []
 
static const AVOption options []
 

Detailed Description

send commands filter

Definition in file f_sendcmd.c.

Macro Definition Documentation

◆ COMMAND_FLAG_ENTER

#define COMMAND_FLAG_ENTER   1

Definition at line 40 of file f_sendcmd.c.

Referenced by filter_frame(), and parse_command().

◆ COMMAND_FLAG_LEAVE

#define COMMAND_FLAG_LEAVE   2

Definition at line 41 of file f_sendcmd.c.

Referenced by filter_frame(), and parse_command().

◆ COMMAND_FLAG_EXPR

#define COMMAND_FLAG_EXPR   4

Definition at line 42 of file f_sendcmd.c.

Referenced by filter_frame(), and parse_command().

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 110 of file f_sendcmd.c.

◆ FLAGS

◆ SPACES

#define SPACES   " \f\t\n\r"

◆ COMMAND_DELIMS

#define COMMAND_DELIMS   " \f\t\n\r,;"

Definition at line 139 of file f_sendcmd.c.

Referenced by parse_command().

◆ DELIMS

#define DELIMS   " \f\t\n\r,;"

Definition at line 287 of file f_sendcmd.c.

Referenced by parse_interval().

◆ WITHIN_INTERVAL

#define WITHIN_INTERVAL ( ts,
start_ts,
end_ts )
Value:
((ts) >= (start_ts) && (ts) < (end_ts))

Referenced by filter_frame().

Enumeration Type Documentation

◆ var_name

enum var_name
Enumerator
VAR_N 
VAR_T 
VAR_PTS 
VAR_TS 
VAR_TE 
VAR_TI 
VAR_W 
VAR_H 
VAR_VARS_NB 

Definition at line 56 of file f_sendcmd.c.

Function Documentation

◆ make_command_flags_str()

static char * make_command_flags_str ( AVBPrint * pbuf,
int flags )
inlinestatic

Definition at line 68 of file f_sendcmd.c.

Referenced by filter_frame(), init(), and parse_commands().

◆ skip_comments()

static void skip_comments ( const char ** buf)
static

Definition at line 122 of file f_sendcmd.c.

Referenced by parse_intervals().

◆ clear_command()

static void clear_command ( Command * cmd)
static

Clears fields and frees the buffers used by cmd.

Definition at line 144 of file f_sendcmd.c.

Referenced by parse_command(), parse_commands(), and uninit().

◆ parse_command()

static int parse_command ( Command * cmd,
int cmd_count,
int interval_count,
const char ** buf,
void * log_ctx )
static

Definition at line 153 of file f_sendcmd.c.

Referenced by parse_commands().

◆ parse_commands()

static int parse_commands ( Command ** cmds,
int * nb_cmds,
int interval_count,
const char ** buf,
void * log_ctx )
static

Definition at line 236 of file f_sendcmd.c.

Referenced by parse_interval().

◆ parse_interval()

static int parse_interval ( Interval * interval,
int interval_count,
const char ** buf,
void * log_ctx )
static

Definition at line 289 of file f_sendcmd.c.

Referenced by parse_intervals().

◆ parse_intervals()

static int parse_intervals ( Interval ** intervals,
int * nb_intervals,
const char * buf,
void * log_ctx )
static

Definition at line 359 of file f_sendcmd.c.

Referenced by init().

◆ cmp_intervals()

static int cmp_intervals ( const void * a,
const void * b )
static

Definition at line 410 of file f_sendcmd.c.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext * ctx)
static

Definition at line 417 of file f_sendcmd.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext * ctx)
static

Definition at line 476 of file f_sendcmd.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink * inlink,
AVFrame * ref )
static

Definition at line 492 of file f_sendcmd.c.

◆ AVFILTER_DEFINE_CLASS_EXT()

AVFILTER_DEFINE_CLASS_EXT ( sendcmd ,
"(a)sendcmd" ,
options  )

Variable Documentation

◆ var_names

const char* const var_names[]
static
Initial value:
= {
"N",
"T",
"PTS",
"TS",
"TE",
"TI",
"W",
"H",
}
#define NULL
Definition coverity.c:32

Definition at line 44 of file f_sendcmd.c.

◆ options

const AVOption options[]
static
Initial value:
= {
{ "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ "c", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ "filename", "set commands file", OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ "f", "set commands file", OFFSET(commands_filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
{ NULL }
}
#define FLAGS
Definition cmdutils.c:598
#define OFFSET(x)
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition opt.h:275

Definition at line 112 of file f_sendcmd.c.