Go to the documentation of this file.
21 #include "config_components.h"
26 #define DEFAULT_LENGTH 300
66 while (
s->nb_frames > 0) {
82 if (
s->nb_frames + 1 >
s->pts_size /
sizeof(*(
s->pts))) {
89 if (
s->nb_frames + 1 >
s->duration_size /
sizeof(*(
s->duration))) {
96 if (
s->nb_frames + 1 >
s->frames_size /
sizeof(*(
s->frames))) {
103 s->frames[
s->nb_frames] = in;
104 s->pts[
s->nb_frames] = in->
pts;
111 #if CONFIG_REVERSE_FILTER
123 out->duration=
s->duration[
s->flush_idx];
124 out->pts =
s->pts[
s->flush_idx++];
126 s->frames[
s->nb_frames - 1] =
NULL;
161 #if CONFIG_AREVERSE_FILTER
163 static void reverse_samples_planar(
AVFrame *
out)
165 for (
int p = 0; p <
out->ch_layout.nb_channels; p++) {
166 switch (
out->format) {
168 uint8_t *dst = (uint8_t *)
out->extended_data[p];
169 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
170 FFSWAP(uint8_t, dst[
i], dst[j]);
174 int16_t *dst = (int16_t *)
out->extended_data[p];
175 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
176 FFSWAP(int16_t, dst[
i], dst[j]);
181 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
186 int64_t *dst = (int64_t *)
out->extended_data[p];
187 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
188 FFSWAP(int64_t, dst[
i], dst[j]);
192 float *dst = (
float *)
out->extended_data[p];
193 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
198 double *dst = (
double *)
out->extended_data[p];
199 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
200 FFSWAP(
double, dst[
i], dst[j]);
207 static void reverse_samples_packed(
AVFrame *
out)
211 switch (
out->format) {
213 uint8_t *dst = (uint8_t *)
out->extended_data[0];
214 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
220 int16_t *dst = (int16_t *)
out->extended_data[0];
221 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
228 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
234 int64_t *dst = (int64_t *)
out->extended_data[0];
235 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
241 float *dst = (
float *)
out->extended_data[0];
242 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
248 double *dst = (
double *)
out->extended_data[0];
249 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
257 static int areverse_request_frame(
AVFilterLink *outlink)
267 out->duration =
s->duration[
s->flush_idx];
268 out->pts =
s->pts[
s->flush_idx++] -
s->nb_samples;
269 if (
s->nb_frames > 1)
270 s->nb_samples +=
s->pts[
s->flush_idx] -
s->pts[
s->flush_idx - 1] -
out->nb_samples;
273 reverse_samples_planar(
out);
275 reverse_samples_packed(
out);
277 s->frames[
s->nb_frames - 1] =
NULL;
297 .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.
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_INPUTS(array)
#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
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
#define FILTER_OUTPUTS(array)
@ AV_SAMPLE_FMT_DBL
double
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_S64
signed 64 bits
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.