28 #include "libavutil/avstring.h"
29 #include "libavutil/common.h"
30 #include "libavutil/eval.h"
31 #include "libavutil/opt.h"
32 #include "libavutil/pixdesc.h"
63 enum {VF_FADE_WAITING=0, VF_FADE_FADING, VF_FADE_DONE} fade_state;
81 "type:%s start_frame:%d nb_frames:%d alpha:%d\n",
87 "type:%s start_time:%f duration:%f alpha:%d\n",
146 int slice_start = (frame->
height * jobnr ) / nb_jobs;
150 for (i = slice_start; i <
slice_end; i++) {
152 for (j = 0; j < frame->
width * s->
bpp; j++) {
172 int slice_start = (height * jobnr ) / nb_jobs;
173 int slice_end = (height * (jobnr+1)) / nb_jobs;
175 for (plane = 1; plane < 3; plane++) {
176 for (i = slice_start; i <
slice_end; i++) {
178 for (j = 0; j <
width; j++) {
182 *p = ((*p - 128) * s->
factor + 8421367) >> 16;
197 int slice_start = (frame->
height * jobnr ) / nb_jobs;
201 for (i = slice_start; i <
slice_end; i++) {
204 for (j = 0; j < frame->
width; j++) {
232 s->
start_time = frame_timestamp*(double)AV_TIME_BASE;
270 if (s->
factor < UINT16_MAX) {
279 if (frame->
data[1] && frame->
data[2]) {
293 #define OFFSET(x) offsetof(FadeContext, x)
294 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
301 {
"start_frame",
"Number of the first frame to which to apply the effect.",
303 {
"s",
"Number of the first frame to which to apply the effect.",
305 {
"nb_frames",
"Number of frames to which the effect should be applied.",
307 {
"n",
"Number of frames to which the effect should be applied.",
310 {
"start_time",
"Number of seconds of the beginning of the effect.",
312 {
"st",
"Number of seconds of the beginning of the effect.",
314 {
"duration",
"Duration of the effect in seconds.",
316 {
"d",
"Duration of the effect in seconds.",
347 .priv_class = &fade_class,
349 .
inputs = avfilter_vf_fade_inputs,
350 .
outputs = avfilter_vf_fade_outputs,
This structure describes decoded (raw) audio or video data.
static const AVFilterPad avfilter_vf_fade_outputs[]
const char * name
Filter name.
void * priv
private data for use by the filter
static const AVFilterPad outputs[]
packed RGB 8:8:8, 24bpp, RGBRGB...
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
static int config_props(AVFilterLink *inlink)
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
static const AVOption fade_options[]
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
packed RGB 8:8:8, 24bpp, BGRBGR...
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static int64_t start_time
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define FF_CEIL_RSHIFT(a, b)
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
static double av_q2d(AVRational a)
Convert rational to double.
int nb_threads
Maximum number of threads used by filters in this graph.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_LOG_VERBOSE
Detailed information.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
A filter pad used for either input or output.
A link between two filters.
static int query_formats(AVFilterContext *ctx)
static double alpha(void *priv, double x, double y)
int width
width and height of the video frame
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
static av_cold int init(AVFilterContext *ctx)
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range ...
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
enum FadeContext::@128 fade_state
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
AVPixelFormat
Pixel format.
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
#define AV_TIME_BASE
Internal time base represented as integer.
static int filter_slice_chroma(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad avfilter_vf_fade_inputs[]
int format
agreed upon media format
int ff_fill_rgba_map(uint8_t *rgba_map, enum AVPixelFormat pix_fmt)
Main libavfilter public API header.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_...
AVFilterLink ** outputs
array of pointers to output links
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVFilter avfilter_vf_fade
static void fade(AudioVectorScopeContext *p)
BYTE int const BYTE int int int height
Describe the class of an AVClass context structure.
static int filter_slice_luma(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const AVFilterPad inputs[]
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static const int factor[16]
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
AVFilterContext * dst
dest filter
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
struct AVFilterGraph * graph
filtergraph this filter belongs to
avfilter_execute_func * execute
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
#define AVFILTER_DEFINE_CLASS(fname)
unsigned int black_level_scaled
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
static int filter_slice_alpha(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static const enum AVPixelFormat studio_level_pix_fmts[]
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
#define AV_NOPTS_VALUE
Undefined timestamp value.