#include "audio.h"
#include "avfilter.h"
#include "buffersrc.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "avcodec.h"
#include "libavutil/audioconvert.h"
#include "libavutil/common.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 | FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM |
| #define | FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM |
Functions | |
| 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, const 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. | |
| AVFILTER_DEFINE_CLASS (buffer) | |
| static av_cold int | init_video (AVFilterContext *ctx, const char *args) |
| AVFILTER_DEFINE_CLASS (abuffer) | |
| static av_cold int | init_audio (AVFilterContext *ctx, const char *args) |
| 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 | buffer_options [] |
| static const AVOption | abuffer_options [] |
| AVFilter | avfilter_vsrc_buffer |
| AVFilter | avfilter_asrc_abuffer |
Definition in 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 71 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 65 of file buffersrc.c.
Referenced by av_buffersrc_add_ref().
| #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM |
Definition at line 240 of file buffersrc.c.
| #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM |
Definition at line 240 of file buffersrc.c.
| #define OFFSET | ( | x | ) | offsetof(BufferSourceContext, x) |
Definition at line 170 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 78 of file buffersrc.c.
Referenced by av_buffersrc_write_frame(), 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 102 of file buffersrc.c.
Referenced by av_asrc_buffer_add_audio_buffer_ref(), av_buffersrc_add_frame(), av_buffersrc_buffer(), decode_audio(), decode_video(), sub2video_flush(), sub2video_push_ref(), and video_thread().
| 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 159 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 165 of file buffersrc.c.
Referenced by sub2video_heartbeat(), and transcode_from_filter().
| int av_buffersrc_write_frame | ( | AVFilterContext * | s, | |
| const AVFrame * | frame | |||
| ) |
Add a frame to the buffer source.
| s | an instance of the buffersrc filter. | |
| frame | frame to be added. |
Definition at line 97 of file buffersrc.c.
Referenced by video_thread().
| AVFILTER_DEFINE_CLASS | ( | abuffer | ) |
| AVFILTER_DEFINE_CLASS | ( | buffer | ) |
| static int config_props | ( | AVFilterLink * | link | ) | [static] |
Definition at line 339 of file buffersrc.c.
| static av_cold int init_audio | ( | AVFilterContext * | ctx, | |
| const char * | args | |||
| ) | [static] |
Definition at line 251 of file buffersrc.c.
| static av_cold int init_video | ( | AVFilterContext * | ctx, | |
| const char * | args | |||
| ) | [static] |
Definition at line 185 of file buffersrc.c.
| static int poll_frame | ( | AVFilterLink * | link | ) | [static] |
Definition at line 394 of file buffersrc.c.
| static int query_formats | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 310 of file buffersrc.c.
| static int request_frame | ( | AVFilterLink * | link | ) | [static] |
Definition at line 362 of file buffersrc.c.
| static av_cold void uninit | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 297 of file buffersrc.c.
const AVOption abuffer_options[] [static] |
Initial value:
{
{ "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, FLAGS },
{ "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "sample_fmt", NULL, OFFSET(sample_fmt_str), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "channel_layout", NULL, OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ NULL },
}
Definition at line 241 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 = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.request_frame = request_frame,
.poll_frame = poll_frame,
.config_props = config_props, },
{ .name = NULL}},
.priv_class = &abuffer_class,
}
Definition at line 422 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 = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.request_frame = request_frame,
.poll_frame = poll_frame,
.config_props = config_props, },
{ .name = NULL}},
.priv_class = &buffer_class,
}
Definition at line 403 of file buffersrc.c.
Referenced by avfilter_register_all().
const AVOption buffer_options[] [static] |
Initial value:
{
{ "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, FLAGS },
{ "frame_rate", NULL, OFFSET(frame_rate), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, FLAGS },
{ "video_size", NULL, OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, .flags = FLAGS },
{ "pix_fmt", NULL, OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, .flags = FLAGS },
{ "pixel_aspect", NULL, OFFSET(pixel_aspect), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, FLAGS },
{ "sws_param", NULL, OFFSET(sws_param), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ NULL },
}
Definition at line 172 of file buffersrc.c.
1.5.8