FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Enumerations | Functions
buffersrc.h File Reference

Memory buffer source API. More...

#include "libavcodec/avcodec.h"
#include "avfilter.h"

Go to the source code of this file.

Enumerations

enum  { AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT = 1, AV_BUFFERSRC_FLAG_PUSH = 4, AV_BUFFERSRC_FLAG_KEEP_REF = 8 }
 

Functions

int av_buffersrc_add_ref (AVFilterContext *buffer_src, AVFilterBufferRef *picref, int flags)
 Add buffer data in picref to buffer_src.
 
unsigned av_buffersrc_get_nb_failed_requests (AVFilterContext *buffer_src)
 Get the number of failed requests.
 
int av_buffersrc_write_frame (AVFilterContext *s, const AVFrame *frame)
 Add a frame to the buffer source.
 
int av_buffersrc_add_frame (AVFilterContext *ctx, AVFrame *frame)
 Add a frame to the buffer source.
 
int av_buffersrc_add_frame_flags (AVFilterContext *buffer_src, AVFrame *frame, int flags)
 Add a frame to the buffer source.
 

Detailed Description

Memory buffer source API.

Definition in file buffersrc.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
AV_BUFFERSRC_FLAG_NO_CHECK_FORMAT 

Do not check for format changes.

AV_BUFFERSRC_FLAG_PUSH 

Immediately push the frame to the output.

AV_BUFFERSRC_FLAG_KEEP_REF 

Keep a reference to the frame.

If the frame if reference-counted, create a new reference; otherwise copy the frame data.

Definition at line 31 of file buffersrc.h.

Function Documentation

int av_buffersrc_add_ref ( AVFilterContext buffer_src,
AVFilterBufferRef *  picref,
int  flags 
)

Add buffer data in picref to buffer_src.

Parameters
buffer_srcpointer to a buffer source context
picrefa buffer reference, or NULL to mark EOF
flagsa combination of AV_BUFFERSRC_FLAG_*
Returns
>= 0 in case of success, a negative AVERROR code in case of failure

Referenced by decode_audio(), decode_video(), and sub2video_flush().

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 314 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.

Parameters
san instance of the buffersrc filter.
frameframe to be added. If the frame is reference counted, this function will make a new reference to it. Otherwise the frame data will be copied.
Returns
0 on success, a negative AVERROR on error

This function is equivalent to av_buffersrc_add_frame_flags() with the AV_BUFFERSRC_FLAG_KEEP_REF flag.

Definition at line 81 of file buffersrc.c.

int av_buffersrc_add_frame ( AVFilterContext ctx,
AVFrame frame 
)

Add a frame to the buffer source.

Parameters
san instance of the buffersrc filter.
frameframe to be added. If the frame is reference counted, this function will take ownership of the reference(s) and reset the frame. Otherwise the frame data will be copied. If this function returns an error, the input frame is not touched.
Returns
0 on success, a negative AVERROR on error.
Note
the difference between this function and av_buffersrc_write_frame() is that av_buffersrc_write_frame() creates a new reference to the input frame, while this function takes ownership of the reference passed to it.

This function is equivalent to av_buffersrc_add_frame_flags() without the AV_BUFFERSRC_FLAG_KEEP_REF flag.

Definition at line 87 of file buffersrc.c.

Referenced by audio_decode_frame(), decode_audio(), decode_video(), and video_thread().

int av_buffersrc_add_frame_flags ( AVFilterContext buffer_src,
AVFrame frame,
int  flags 
)

Add a frame to the buffer source.

By default, if the frame is reference-counted, this function will take ownership of the reference(s) and reset the frame. This can be controled using the flags.

If this function returns an error, the input frame is not touched.

Parameters
buffer_srcpointer to a buffer source context
framea frame, or NULL to mark EOF
flagsa combination of AV_BUFFERSRC_FLAG_*
Returns
>= 0 in case of success, a negative AVERROR code in case of failure

Definition at line 95 of file buffersrc.c.

Referenced by av_buffersrc_add_frame(), av_buffersrc_write_frame(), decode_video(), main(), and sub2video_push_ref().