Go to the documentation of this file.
27 #define DEFAULT_LENGTH 300
62 while (
s->nb_frames > 0) {
77 if (
s->nb_frames + 1 >
s->pts_size /
sizeof(*(
s->pts))) {
84 if (
s->nb_frames + 1 >
s->frames_size /
sizeof(*(
s->frames))) {
91 s->frames[
s->nb_frames] = in;
92 s->pts[
s->nb_frames] = in->
pts;
98 #if CONFIG_REVERSE_FILTER
110 out->pts =
s->pts[
s->flush_idx++];
112 s->frames[
s->nb_frames - 1] =
NULL;
147 #if CONFIG_AREVERSE_FILTER
149 static void reverse_samples_planar(
AVFrame *
out)
151 for (
int p = 0; p <
out->channels; p++) {
152 switch (
out->format) {
154 uint8_t *dst = (uint8_t *)
out->extended_data[p];
155 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
156 FFSWAP(uint8_t, dst[
i], dst[j]);
160 int16_t *dst = (int16_t *)
out->extended_data[p];
161 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
162 FFSWAP(int16_t, dst[
i], dst[j]);
167 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
172 int64_t *dst = (int64_t *)
out->extended_data[p];
173 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
174 FFSWAP(int64_t, dst[
i], dst[j]);
178 float *dst = (
float *)
out->extended_data[p];
179 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
184 double *dst = (
double *)
out->extended_data[p];
185 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
186 FFSWAP(
double, dst[
i], dst[j]);
193 static void reverse_samples_packed(
AVFrame *
out)
197 switch (
out->format) {
199 uint8_t *dst = (uint8_t *)
out->extended_data[0];
200 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
206 int16_t *dst = (int16_t *)
out->extended_data[0];
207 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
214 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
220 int64_t *dst = (int64_t *)
out->extended_data[0];
221 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
227 float *dst = (
float *)
out->extended_data[0];
228 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
234 double *dst = (
double *)
out->extended_data[0];
235 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
243 static int areverse_request_frame(
AVFilterLink *outlink)
253 out->pts =
s->pts[
s->flush_idx++] -
s->nb_samples;
254 s->nb_samples +=
s->pts[
s->flush_idx] -
s->pts[
s->flush_idx - 1] -
out->nb_samples;
257 reverse_samples_planar(
out);
259 reverse_samples_packed(
out);
261 s->frames[
s->nb_frames - 1] =
NULL;
281 .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.
#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)
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.