FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
avisynth.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/thread.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "config.h"
#include <dlfcn.h>
#include <avisynth/avisynth_c.h>

Go to the source code of this file.

Data Structures

struct  AviSynthLibrary
 
struct  AviSynthContext
 

Macros

#define AVSC_NO_DECLSPEC
 
#define AVISYNTH_NAME   "libavisynth"
 
#define AVISYNTH_LIB   AVISYNTH_NAME SLIBSUF
 
#define PCM(format)   (AV_CODEC_ID_PCM_ ## format ## LE)
 
#define AVSC_DECLARE_FUNC(name)   name ## _func name
 
#define LOAD_AVS_FUNC(name, continue_on_fail)
 
#define AVISYNTH_FRAMEPROP_DEFAULT
 
#define OFFSET(x)   offsetof(AviSynthContext, x)
 

Enumerations

enum  AviSynthFlags {
  AVISYNTH_FRAMEPROP_FIELD_ORDER = (1 << 0), AVISYNTH_FRAMEPROP_RANGE = (1 << 1), AVISYNTH_FRAMEPROP_PRIMARIES = (1 << 2), AVISYNTH_FRAMEPROP_TRANSFER = (1 << 3),
  AVISYNTH_FRAMEPROP_MATRIX = (1 << 4), AVISYNTH_FRAMEPROP_CHROMA_LOCATION = (1 << 5), AVISYNTH_FRAMEPROP_SAR = (1 << 6)
}
 

Functions

static av_cold int avisynth_load_library (AviSynthContext *avs)
 
static av_cold int avisynth_context_create (AVFormatContext *s)
 
static av_cold void avisynth_context_destroy (AviSynthContext *avs)
 
static int avisynth_create_stream_video (AVFormatContext *s, AVStream *st)
 
static int avisynth_create_stream_audio (AVFormatContext *s, AVStream *st)
 
static int avisynth_create_stream (AVFormatContext *s)
 
static int avisynth_open_file (AVFormatContext *s)
 
static void avisynth_next_stream (AVFormatContext *s, AVStream **st, AVPacket *pkt, int *discard)
 
static int avisynth_read_packet_video (AVFormatContext *s, AVPacket *pkt, int discard)
 
static int avisynth_read_packet_audio (AVFormatContext *s, AVPacket *pkt, int discard)
 
static av_cold int avisynth_read_header (AVFormatContext *s)
 
static int avisynth_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static av_cold int avisynth_read_close (AVFormatContext *s)
 
static int avisynth_read_seek (AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
 

Variables

static const AVOption avisynth_options []
 
static const AVClass avisynth_demuxer_class
 
const FFInputFormat ff_avisynth_demuxer
 

Macro Definition Documentation

◆ AVSC_NO_DECLSPEC

#define AVSC_NO_DECLSPEC

Definition at line 34 of file avisynth.c.

◆ AVISYNTH_NAME

#define AVISYNTH_NAME   "libavisynth"

Definition at line 44 of file avisynth.c.

◆ AVISYNTH_LIB

#define AVISYNTH_LIB   AVISYNTH_NAME SLIBSUF

Definition at line 45 of file avisynth.c.

◆ PCM

#define PCM (   format)    (AV_CODEC_ID_PCM_ ## format ## LE)

Definition at line 52 of file avisynth.c.

◆ AVSC_DECLARE_FUNC

#define AVSC_DECLARE_FUNC (   name)    name ## _func name

Definition at line 59 of file avisynth.c.

◆ LOAD_AVS_FUNC

#define LOAD_AVS_FUNC (   name,
  continue_on_fail 
)
Value:
avs->avs_library.name = (name ## _func) \
dlsym(avs->avs_library.library, #name); \
if (!continue_on_fail && !avs->avs_library.name) \
goto fail;

◆ AVISYNTH_FRAMEPROP_DEFAULT

#define AVISYNTH_FRAMEPROP_DEFAULT
Value:

Definition at line 1127 of file avisynth.c.

◆ OFFSET

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

Definition at line 1130 of file avisynth.c.

Enumeration Type Documentation

◆ AviSynthFlags

Enumerator
AVISYNTH_FRAMEPROP_FIELD_ORDER 
AVISYNTH_FRAMEPROP_RANGE 
AVISYNTH_FRAMEPROP_PRIMARIES 
AVISYNTH_FRAMEPROP_TRANSFER 
AVISYNTH_FRAMEPROP_MATRIX 
AVISYNTH_FRAMEPROP_CHROMA_LOCATION 
AVISYNTH_FRAMEPROP_SAR 

Definition at line 91 of file avisynth.c.

Function Documentation

◆ avisynth_load_library()

static av_cold int avisynth_load_library ( AviSynthContext avs)
static

Definition at line 121 of file avisynth.c.

Referenced by avisynth_context_create().

◆ avisynth_context_create()

static av_cold int avisynth_context_create ( AVFormatContext s)
static

Definition at line 173 of file avisynth.c.

Referenced by avisynth_open_file().

◆ avisynth_context_destroy()

static av_cold void avisynth_context_destroy ( AviSynthContext avs)
static

Definition at line 194 of file avisynth.c.

Referenced by avisynth_open_file(), and avisynth_read_close().

◆ avisynth_create_stream_video()

static int avisynth_create_stream_video ( AVFormatContext s,
AVStream st 
)
static

Definition at line 207 of file avisynth.c.

Referenced by avisynth_create_stream().

◆ avisynth_create_stream_audio()

static int avisynth_create_stream_audio ( AVFormatContext s,
AVStream st 
)
static

Definition at line 743 of file avisynth.c.

Referenced by avisynth_create_stream().

◆ avisynth_create_stream()

static int avisynth_create_stream ( AVFormatContext s)
static

Definition at line 782 of file avisynth.c.

Referenced by avisynth_open_file().

◆ avisynth_open_file()

static int avisynth_open_file ( AVFormatContext s)
static

Definition at line 808 of file avisynth.c.

Referenced by avisynth_read_header().

◆ avisynth_next_stream()

static void avisynth_next_stream ( AVFormatContext s,
AVStream **  st,
AVPacket pkt,
int *  discard 
)
static

Definition at line 881 of file avisynth.c.

Referenced by avisynth_read_packet().

◆ avisynth_read_packet_video()

static int avisynth_read_packet_video ( AVFormatContext s,
AVPacket pkt,
int  discard 
)
static

Definition at line 899 of file avisynth.c.

Referenced by avisynth_read_packet().

◆ avisynth_read_packet_audio()

static int avisynth_read_packet_audio ( AVFormatContext s,
AVPacket pkt,
int  discard 
)
static

Definition at line 969 of file avisynth.c.

Referenced by avisynth_read_packet().

◆ avisynth_read_header()

static av_cold int avisynth_read_header ( AVFormatContext s)
static

Definition at line 1036 of file avisynth.c.

◆ avisynth_read_packet()

static int avisynth_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1046 of file avisynth.c.

◆ avisynth_read_close()

static av_cold int avisynth_read_close ( AVFormatContext s)
static

Definition at line 1076 of file avisynth.c.

◆ avisynth_read_seek()

static int avisynth_read_seek ( AVFormatContext s,
int  stream_index,
int64_t  timestamp,
int  flags 
)
static

Definition at line 1088 of file avisynth.c.

Variable Documentation

◆ avisynth_options

const AVOption avisynth_options[]
static
Initial value:
= {
{ "avisynth_flags", "set flags related to reading frame properties from script (AviSynth+ v3.7.1 or higher)", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVISYNTH_FRAMEPROP_DEFAULT}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ "field_order", "read field order", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_FIELD_ORDER}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ "range", "read color range", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_RANGE}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ "primaries", "read color primaries", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_PRIMARIES}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ "transfer", "read color transfer characteristics", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_TRANSFER}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ "matrix", "read matrix coefficients", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_MATRIX}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ "chroma_location", "read chroma location", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_CHROMA_LOCATION}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ "sar", "read sample aspect ratio", 0, AV_OPT_TYPE_CONST, {.i64 = AVISYNTH_FRAMEPROP_SAR}, 0, 1, AV_OPT_FLAG_DECODING_PARAM, .unit = "flags" },
{ NULL },
}

Definition at line 1131 of file avisynth.c.

◆ avisynth_demuxer_class

const AVClass avisynth_demuxer_class
static
Initial value:
= {
.class_name = "AviSynth demuxer",
.item_name = av_default_item_name,
.option = avisynth_options,
}

Definition at line 1143 of file avisynth.c.

◆ ff_avisynth_demuxer

const FFInputFormat ff_avisynth_demuxer
Initial value:
= {
.p.name = "avisynth",
.p.long_name = NULL_IF_CONFIG_SMALL("AviSynth script"),
.p.extensions = "avs",
.p.priv_class = &avisynth_demuxer_class,
.priv_data_size = sizeof(AviSynthContext),
}

Definition at line 1150 of file avisynth.c.

name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
avisynth_demuxer_class
static const AVClass avisynth_demuxer_class
Definition: avisynth.c:1143
OFFSET
#define OFFSET(x)
Definition: avisynth.c:1130
avisynth_read_seek
static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: avisynth.c:1088
avisynth_read_packet
static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: avisynth.c:1046
AVISYNTH_FRAMEPROP_MATRIX
@ AVISYNTH_FRAMEPROP_MATRIX
Definition: avisynth.c:96
fail
#define fail()
Definition: checkasm.h:189
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
AVISYNTH_FRAMEPROP_SAR
@ AVISYNTH_FRAMEPROP_SAR
Definition: avisynth.c:98
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
avisynth_read_close
static av_cold int avisynth_read_close(AVFormatContext *s)
Definition: avisynth.c:1076
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
avisynth_read_header
static av_cold int avisynth_read_header(AVFormatContext *s)
Definition: avisynth.c:1036
avisynth_options
static const AVOption avisynth_options[]
Definition: avisynth.c:1131
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AVISYNTH_FRAMEPROP_PRIMARIES
@ AVISYNTH_FRAMEPROP_PRIMARIES
Definition: avisynth.c:94
AviSynthContext
Definition: avisynth.c:101
AVISYNTH_FRAMEPROP_TRANSFER
@ AVISYNTH_FRAMEPROP_TRANSFER
Definition: avisynth.c:95
AVISYNTH_FRAMEPROP_CHROMA_LOCATION
@ AVISYNTH_FRAMEPROP_CHROMA_LOCATION
Definition: avisynth.c:97
AVISYNTH_FRAMEPROP_DEFAULT
#define AVISYNTH_FRAMEPROP_DEFAULT
Definition: avisynth.c:1127
AVISYNTH_FRAMEPROP_RANGE
@ AVISYNTH_FRAMEPROP_RANGE
Definition: avisynth.c:93
AVISYNTH_FRAMEPROP_FIELD_ORDER
@ AVISYNTH_FRAMEPROP_FIELD_ORDER
Definition: avisynth.c:92
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:356
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Definition: opt.h:255
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299