#include "audio.h"
#include "avfilter.h"
#include "buffersrc.h"
#include "formats.h"
#include "internal.h"
#include "vsrc_buffer.h"
#include "avcodec.h"
#include "libavutil/audioconvert.h"
#include "libavutil/fifo.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
Go to the source code of this file.
Data Structures | |
struct | BufferSourceContext |
Defines | |
#define | CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format) |
#define | CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, format) |
#define | OFFSET(x) offsetof(BufferSourceContext, x) |
#define | A AV_OPT_FLAG_AUDIO_PARAM |
Functions | |
static AVFilterBufferRef * | copy_buffer_ref (AVFilterContext *ctx, AVFilterBufferRef *ref) |
static int | av_vsrc_buffer_add_frame_alt (AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect) |
int | av_buffersrc_add_frame (AVFilterContext *buffer_src, const AVFrame *frame, int flags) |
Add frame data to buffer_src. | |
int | av_buffersrc_write_frame (AVFilterContext *buffer_filter, AVFrame *frame) |
Add a frame to the buffer source. | |
int | av_buffersrc_add_ref (AVFilterContext *s, AVFilterBufferRef *buf, int flags) |
Add buffer data in picref to buffer_src. | |
int | av_buffersrc_buffer (AVFilterContext *s, AVFilterBufferRef *buf) |
Add a buffer to the filtergraph s. | |
unsigned | av_buffersrc_get_nb_failed_requests (AVFilterContext *buffer_src) |
Get the number of failed requests. | |
static av_cold int | init_video (AVFilterContext *ctx, const char *args, void *opaque) |
static av_cold int | init_audio (AVFilterContext *ctx, const char *args, void *opaque) |
static av_cold void | uninit (AVFilterContext *ctx) |
static int | query_formats (AVFilterContext *ctx) |
static int | config_props (AVFilterLink *link) |
static int | request_frame (AVFilterLink *link) |
static int | poll_frame (AVFilterLink *link) |
Variables | |
static const AVOption | audio_options [] |
static const AVClass | abuffer_class |
AVFilter | avfilter_vsrc_buffer |
AVFilter | avfilter_asrc_abuffer |
Definition in file buffersrc.c.
#define A AV_OPT_FLAG_AUDIO_PARAM |
Definition at line 247 of file buffersrc.c.
#define CHECK_AUDIO_PARAM_CHANGE | ( | s, | |||
c, | |||||
srate, | |||||
ch_layout, | |||||
format | ) |
Value:
if (c->sample_fmt != format || c->sample_rate != srate ||\ c->channel_layout != ch_layout) {\ av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\ return AVERROR(EINVAL);\ }
Definition at line 68 of file buffersrc.c.
Referenced by av_buffersrc_add_ref().
Value:
if (c->w != width || c->h != height || c->pix_fmt != format) {\ av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\ return AVERROR(EINVAL);\ }
Definition at line 62 of file buffersrc.c.
Referenced by av_buffersrc_add_ref().
#define OFFSET | ( | x | ) | offsetof(BufferSourceContext, x) |
Definition at line 246 of file buffersrc.c.
int av_buffersrc_add_frame | ( | AVFilterContext * | buffer_src, | |
const AVFrame * | frame, | |||
int | flags | |||
) |
Add frame data to buffer_src.
buffer_src | pointer to a buffer source context | |
frame | a frame, or NULL to mark EOF | |
flags | a combination of AV_BUFFERSRC_FLAG_* |
Definition at line 132 of file buffersrc.c.
Referenced by av_buffersrc_write_frame(), decode_audio(), decode_video(), and main().
int av_buffersrc_add_ref | ( | AVFilterContext * | buffer_src, | |
AVFilterBufferRef * | picref, | |||
int | flags | |||
) |
Add buffer data in picref to buffer_src.
buffer_src | pointer to a buffer source context | |
picref | a buffer reference, or NULL to mark EOF | |
flags | a combination of AV_BUFFERSRC_FLAG_* |
Definition at line 164 of file buffersrc.c.
Referenced by av_asrc_buffer_add_audio_buffer_ref(), av_buffersrc_add_frame(), av_buffersrc_buffer(), av_vsrc_buffer_add_video_buffer_ref(), decode_audio(), and decode_video().
int av_buffersrc_buffer | ( | AVFilterContext * | s, | |
AVFilterBufferRef * | buf | |||
) |
Add a buffer to the filtergraph s.
buf | buffer containing frame data to be passed down the filtergraph. This function will take ownership of buf, the user must not free it. A NULL buf signals EOF -- i.e. no more frames will be sent to this filter. |
Definition at line 208 of file buffersrc.c.
unsigned av_buffersrc_get_nb_failed_requests | ( | AVFilterContext * | buffer_src | ) |
Get the number of failed requests.
A failed request is when the request_frame method is called while no frame is present in the buffer. The number is reset when a frame is added.
Definition at line 213 of file buffersrc.c.
int av_buffersrc_write_frame | ( | AVFilterContext * | s, | |
AVFrame * | frame | |||
) |
Add a frame to the buffer source.
s | an instance of the buffersrc filter. | |
frame | frame to be added. |
Definition at line 159 of file buffersrc.c.
Referenced by av_vsrc_buffer_add_frame_alt().
static int av_vsrc_buffer_add_frame_alt | ( | AVFilterContext * | buffer_filter, | |
AVFrame * | frame, | |||
int64_t | pts, | |||
AVRational | pixel_aspect | |||
) | [static] |
Definition at line 114 of file buffersrc.c.
static int config_props | ( | AVFilterLink * | link | ) | [static] |
Definition at line 350 of file buffersrc.c.
static AVFilterBufferRef* copy_buffer_ref | ( | AVFilterContext * | ctx, | |
AVFilterBufferRef * | ref | |||
) | [static] |
static av_cold int init_audio | ( | AVFilterContext * | ctx, | |
const char * | args, | |||
void * | opaque | |||
) | [static] |
Definition at line 263 of file buffersrc.c.
static av_cold int init_video | ( | AVFilterContext * | ctx, | |
const char * | args, | |||
void * | opaque | |||
) | [static] |
Definition at line 218 of file buffersrc.c.
static int poll_frame | ( | AVFilterLink * | link | ) | [static] |
Definition at line 403 of file buffersrc.c.
static int query_formats | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 321 of file buffersrc.c.
static int request_frame | ( | AVFilterLink * | link | ) | [static] |
Definition at line 372 of file buffersrc.c.
static av_cold void uninit | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 309 of file buffersrc.c.
const AVClass abuffer_class [static] |
Initial value:
{ .class_name = "abuffer source", .item_name = av_default_item_name, .option = audio_options, .version = LIBAVUTIL_VERSION_INT, }
Definition at line 256 of file buffersrc.c.
const AVOption audio_options[] [static] |
Initial value:
{ { "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, A }, { "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { 0 }, 0, INT_MAX, A }, { "sample_fmt", NULL, OFFSET(sample_fmt_str), AV_OPT_TYPE_STRING, .flags = A }, { "channel_layout", NULL, OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A }, { NULL }, }
Definition at line 248 of file buffersrc.c.
Initial value:
{ .name = "abuffer", .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."), .priv_size = sizeof(BufferSourceContext), .query_formats = query_formats, .init = init_audio, .uninit = uninit, .inputs = (AVFilterPad[]) {{ .name = NULL }}, .outputs = (AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_AUDIO, .request_frame = request_frame, .poll_frame = poll_frame, .config_props = config_props, }, { .name = NULL}}, }
Definition at line 430 of file buffersrc.c.
Referenced by avfilter_register_all().
Initial value:
{ .name = "buffer", .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."), .priv_size = sizeof(BufferSourceContext), .query_formats = query_formats, .init = init_video, .uninit = uninit, .inputs = (AVFilterPad[]) {{ .name = NULL }}, .outputs = (AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, .poll_frame = poll_frame, .config_props = config_props, }, { .name = NULL}}, }
Definition at line 412 of file buffersrc.c.
Referenced by avfilter_register_all().