Go to the documentation of this file.
21 #include "config_components.h"
27 #define DEFAULT_LENGTH 300
67 while (
s->nb_frames > 0) {
83 if (
s->nb_frames + 1 >
s->pts_size /
sizeof(*(
s->pts))) {
90 if (
s->nb_frames + 1 >
s->duration_size /
sizeof(*(
s->duration))) {
97 if (
s->nb_frames + 1 >
s->frames_size /
sizeof(*(
s->frames))) {
104 s->frames[
s->nb_frames] = in;
105 s->pts[
s->nb_frames] = in->
pts;
112 #if CONFIG_REVERSE_FILTER
124 out->duration=
s->duration[
s->flush_idx];
125 out->pts =
s->pts[
s->flush_idx++];
127 s->frames[
s->nb_frames - 1] =
NULL;
162 #if CONFIG_AREVERSE_FILTER
164 static void reverse_samples_planar(
AVFrame *
out)
166 for (
int p = 0; p <
out->ch_layout.nb_channels; p++) {
167 switch (
out->format) {
169 uint8_t *
dst = (uint8_t *)
out->extended_data[p];
170 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
175 int16_t *
dst = (int16_t *)
out->extended_data[p];
176 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
182 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
188 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
193 float *
dst = (
float *)
out->extended_data[p];
194 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
199 double *
dst = (
double *)
out->extended_data[p];
200 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
208 static void reverse_samples_packed(
AVFrame *
out)
212 switch (
out->format) {
214 uint8_t *
dst = (uint8_t *)
out->extended_data[0];
215 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
221 int16_t *
dst = (int16_t *)
out->extended_data[0];
222 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
229 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
236 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
242 float *
dst = (
float *)
out->extended_data[0];
243 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
249 double *
dst = (
double *)
out->extended_data[0];
250 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
258 static int areverse_request_frame(
AVFilterLink *outlink)
268 out->duration =
s->duration[
s->flush_idx];
269 out->pts =
s->pts[
s->flush_idx++] -
s->nb_samples;
270 if (
s->nb_frames > 1)
271 s->nb_samples +=
s->pts[
s->flush_idx] -
s->pts[
s->flush_idx - 1] -
out->nb_samples;
274 reverse_samples_planar(
out);
276 reverse_samples_packed(
out);
278 s->frames[
s->nb_frames - 1] =
NULL;
298 .request_frame = areverse_request_frame,
@ AV_SAMPLE_FMT_FLTP
float, planar
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int64_t duration
Duration of the frame, in the same units as pts.
#define AVERROR_EOF
End of file.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
const char * name
Filter name.
static av_cold void uninit(AVFilterContext *ctx)
A link between two filters.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
A filter pad used for either input or output.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
static av_cold int init(AVFilterContext *ctx)
#define FILTER_OUTPUTS(array)
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
AVFilterContext * src
source filter
const AVFilter ff_af_areverse
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
#define i(width, name, range_min, range_max)
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
@ AV_SAMPLE_FMT_S16
signed 16 bits
const char * name
Pad name.
#define FFSWAP(type, a, b)
unsigned int duration_size
static int request_frame(AVFilterLink *outlink)
const AVFilter ff_vf_reverse
@ AV_SAMPLE_FMT_DBLP
double, planar
@ AV_SAMPLE_FMT_DBL
double
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_S64
signed 64 bits