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

memory buffer sink API for audio and video More...

#include "avfilter.h"

Go to the source code of this file.

Data Structures

struct  AVBufferSinkParams
 Struct to use for initializing a buffersink context. More...
 
struct  AVABufferSinkParams
 Struct to use for initializing an abuffersink context. More...
 

Macros

#define AV_BUFFERSINK_FLAG_PEEK   1
 Tell av_buffersink_get_buffer_ref() to read video/samples buffer reference, but not remove it from the buffer.
 
#define AV_BUFFERSINK_FLAG_NO_REQUEST   2
 Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
 

Functions

AVBufferSinkParamsav_buffersink_params_alloc (void)
 Create an AVBufferSinkParams structure.
 
AVABufferSinkParamsav_abuffersink_params_alloc (void)
 Create an AVABufferSinkParams structure.
 
void av_buffersink_set_frame_size (AVFilterContext *ctx, unsigned frame_size)
 Set the frame size for an audio buffer sink.
 
int av_buffersink_get_buffer_ref (AVFilterContext *buffer_sink, AVFilterBufferRef **bufref, int flags)
 Get an audio/video buffer data from buffer_sink and put it in bufref.
 
int av_buffersink_poll_frame (AVFilterContext *ctx)
 Get the number of immediately available frames.
 
AVRational av_buffersink_get_frame_rate (AVFilterContext *ctx)
 Get the frame rate of the input.
 
int av_buffersink_read (AVFilterContext *ctx, AVFilterBufferRef **buf)
 Get a buffer with filtered data from sink and put it in buf.
 
int av_buffersink_read_samples (AVFilterContext *ctx, AVFilterBufferRef **buf, int nb_samples)
 Same as av_buffersink_read, but with the ability to specify the number of samples read.
 

Detailed Description

memory buffer sink API for audio and video

Definition in file buffersink.h.

Macro Definition Documentation

#define AV_BUFFERSINK_FLAG_PEEK   1

Tell av_buffersink_get_buffer_ref() to read video/samples buffer reference, but not remove it from the buffer.

This is useful if you need only to read a video/samples buffer, without to fetch it.

Definition at line 75 of file buffersink.h.

Referenced by av_buffersink_get_buffer_ref(), av_buffersink_read(), av_buffersink_read_samples(), and lavfi_read_packet().

#define AV_BUFFERSINK_FLAG_NO_REQUEST   2

Tell av_buffersink_get_buffer_ref() not to request a frame from its input.

If a frame is already buffered, it is read (and removed from the buffer), but if no frame is present, return AVERROR(EAGAIN).

Definition at line 82 of file buffersink.h.

Referenced by av_buffersink_get_buffer_ref(), and reap_filters().

Function Documentation

AVBufferSinkParams* av_buffersink_params_alloc ( void  )

Create an AVBufferSinkParams structure.

Must be freed with av_free().

Examples:
doc/examples/filtering_video.c.

Definition at line 34 of file sink_buffer.c.

Referenced by configure_output_video_filter(), init_filters(), and lavfi_read_header().

AVABufferSinkParams* av_abuffersink_params_alloc ( void  )

Create an AVABufferSinkParams structure.

Must be freed with av_free().

Examples:
doc/examples/filtering_audio.c.

Definition at line 45 of file sink_buffer.c.

Referenced by configure_output_audio_filter(), init_filters(), and lavfi_read_header().

void av_buffersink_set_frame_size ( AVFilterContext ctx,
unsigned  frame_size 
)

Set the frame size for an audio buffer sink.

All calls to av_buffersink_get_buffer_ref will return a buffer with exactly the specified number of samples, or AVERROR(EAGAIN) if there is not enough. The last buffer at EOF will be padded with 0.

Definition at line 136 of file sink_buffer.c.

Referenced by decode_audio(), and transcode_init().

int av_buffersink_get_buffer_ref ( AVFilterContext buffer_sink,
AVFilterBufferRef **  bufref,
int  flags 
)

Get an audio/video buffer data from buffer_sink and put it in bufref.

This function works with both audio and video buffer sinks.

Parameters
buffer_sinkpointer to a buffersink or abuffersink context
flagsa combination of AV_BUFFERSINK_FLAG_* flags
Returns
>= 0 in case of success, a negative AVERROR code in case of failure
Examples:
doc/examples/filtering_audio.c, and doc/examples/filtering_video.c.

Definition at line 144 of file sink_buffer.c.

Referenced by av_buffersink_read(), av_buffersink_read_samples(), lavfi_read_packet(), main(), reap_filters(), and video_thread().

int av_buffersink_poll_frame ( AVFilterContext ctx)

Get the number of immediately available frames.

Definition at line 184 of file sink_buffer.c.

AVRational av_buffersink_get_frame_rate ( AVFilterContext ctx)

Get the frame rate of the input.

Definition at line 176 of file sink_buffer.c.

Referenced by transcode_init().