af_asyncts.c File Reference
#include "libavresample/avresample.h"
#include "libavutil/audio_fifo.h"
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "audio.h"
#include "avfilter.h"
#include "internal.h"
Include dependency graph for af_asyncts.c:

Go to the source code of this file.

Data Structures

struct  ASyncContext
 

Macros

#define OFFSET(x)   offsetof(ASyncContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM
 
#define F   AV_OPT_FLAG_FILTERING_PARAM
 

Typedefs

typedef struct ASyncContext ASyncContext
 

Functions

static int init (AVFilterContext *ctx)
 
static void uninit (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *link)
 
static int64_t get_delay (ASyncContext *s)
 
static void handle_trimming (AVFilterContext *ctx)
 
static int request_frame (AVFilterLink *link)
 
static int write_to_fifo (ASyncContext *s, AVFrame *buf)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *buf)
 

Variables

static const AVOption asyncts_options []
 
static const AVClass asyncts_class = { .class_name = "asyncts", .item_name = av_default_item_name, .option = asyncts_options, .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, }
 
static const AVFilterPad avfilter_af_asyncts_inputs []
 
static const AVFilterPad avfilter_af_asyncts_outputs []
 
AVFilter avfilter_af_asyncts
 

Macro Definition Documentation

#define A   AV_OPT_FLAG_AUDIO_PARAM

Definition at line 50 of file af_asyncts.c.

Definition at line 51 of file af_asyncts.c.

#define OFFSET (   x)    offsetof(ASyncContext, x)

Definition at line 49 of file af_asyncts.c.

Typedef Documentation

typedef struct ASyncContext ASyncContext

Function Documentation

static int config_props ( AVFilterLink link)
static

Definition at line 83 of file af_asyncts.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame buf 
)
static

Definition at line 174 of file af_asyncts.c.

static int64_t get_delay ( ASyncContext s)
static

Definition at line 112 of file af_asyncts.c.

Referenced by filter_frame(), and request_frame().

static void handle_trimming ( AVFilterContext ctx)
static

Definition at line 117 of file af_asyncts.c.

Referenced by filter_frame(), and request_frame().

static int init ( AVFilterContext ctx)
static

Definition at line 63 of file af_asyncts.c.

static int request_frame ( AVFilterLink link)
static

Definition at line 131 of file af_asyncts.c.

static void uninit ( AVFilterContext ctx)
static

Definition at line 73 of file af_asyncts.c.

static int write_to_fifo ( ASyncContext s,
AVFrame buf 
)
static

Definition at line 166 of file af_asyncts.c.

Referenced by filter_frame().

Variable Documentation

const AVClass asyncts_class = { .class_name = "asyncts", .item_name = av_default_item_name, .option = asyncts_options, .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_FILTER, }
static

Definition at line 61 of file af_asyncts.c.

const AVOption asyncts_options[]
static
Initial value:
= {
{ "compensate", "Stretch/squeeze the data to make it match the timestamps", offsetof(ASyncContext, resample ), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM },
{ "min_delta", "Minimum difference between timestamps and audio data "
"(in seconds) to trigger padding/trimmin the data.", offsetof(ASyncContext, min_delta_sec ), AV_OPT_TYPE_FLOAT, { .dbl = 0.1 }, 0, INT_MAX, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM },
{ "max_comp", "Maximum compensation in samples per second.", offsetof(ASyncContext, max_comp ), AV_OPT_TYPE_INT, { .i64 = 500 }, 0, INT_MAX, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM },
{ "first_pts", "Assume the first pts should be this value.", offsetof(ASyncContext, first_pts ), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM },
{ NULL },
}
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:284
static int resample(ResampleContext *c, void *dst, const void *src, int *consumed, int src_size, int dst_size, int update_ctx)
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
Definition: opt.h:287
NULL
Definition: eval.c:55
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:190

Definition at line 52 of file af_asyncts.c.

AVFilter avfilter_af_asyncts
Initial value:
= {
.name = "asyncts",
.description = NULL_IF_CONFIG_SMALL("Sync audio data to timestamps"),
.init = init,
.uninit = uninit,
.priv_size = sizeof(ASyncContext),
.priv_class = &asyncts_class,
}
static const AVFilterPad avfilter_af_asyncts_inputs[]
Definition: af_asyncts.c:287
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
struct ASyncContext ASyncContext
static int init(AVFilterContext *ctx)
Definition: af_asyncts.c:63
static void uninit(AVFilterContext *ctx)
Definition: af_asyncts.c:73
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVClass asyncts_class
Definition: af_asyncts.c:61
static const AVFilterPad avfilter_af_asyncts_outputs[]
Definition: af_asyncts.c:296
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs

Definition at line 306 of file af_asyncts.c.

const AVFilterPad avfilter_af_asyncts_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame
},
{ NULL }
}
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition: af_asyncts.c:174
NULL
Definition: eval.c:55

Definition at line 287 of file af_asyncts.c.

const AVFilterPad avfilter_af_asyncts_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.request_frame = request_frame
},
{ NULL }
}
static int request_frame(AVFilterLink *link)
Definition: af_asyncts.c:131
static int config_props(AVFilterLink *link)
Definition: af_asyncts.c:83
NULL
Definition: eval.c:55

Definition at line 296 of file af_asyncts.c.