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;
163#if CONFIG_AREVERSE_FILTER
165static void reverse_samples_planar(
AVFrame *
out)
167 for (
int p = 0;
p <
out->ch_layout.nb_channels;
p++) {
168 switch (
out->format) {
170 uint8_t *
dst = (uint8_t *)
out->extended_data[p];
171 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
176 int16_t *
dst = (int16_t *)
out->extended_data[p];
177 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
183 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
189 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
194 float *
dst = (
float *)
out->extended_data[p];
195 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
200 double *
dst = (
double *)
out->extended_data[p];
201 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
209static void reverse_samples_packed(
AVFrame *
out)
213 switch (
out->format) {
215 uint8_t *
dst = (uint8_t *)
out->extended_data[0];
216 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
222 int16_t *
dst = (int16_t *)
out->extended_data[0];
223 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
230 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
237 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
243 float *
dst = (
float *)
out->extended_data[0];
244 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
250 double *
dst = (
double *)
out->extended_data[0];
251 for (
int i = 0, j =
out->nb_samples - 1;
i < j;
i++, j--)
269 out->duration =
s->duration[
s->flush_idx];
270 out->pts =
s->pts[
s->flush_idx++] -
s->nb_samples;
271 if (
s->nb_frames > 1)
272 s->nb_samples +=
s->pts[
s->flush_idx] -
s->pts[
s->flush_idx - 1] -
out->nb_samples;
275 reverse_samples_planar(
out);
277 reverse_samples_packed(
out);
279 s->frames[
s->nb_frames - 1] =
NULL;
299 .request_frame = areverse_request_frame,
304 .p.name =
"areverse",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int request_frame(AVFilterLink *outlink)
const FFFilter ff_vf_reverse
const FFFilter ff_af_areverse
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
int(* init)(AVBSFContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static av_cold void uninit(AVFilterContext *ctx)
#define AVERROR_EOF
End of file.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
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.
@ AV_SAMPLE_FMT_FLTP
float, planar
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
@ AV_SAMPLE_FMT_S64
signed 64 bits
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
@ AV_SAMPLE_FMT_DBLP
double, planar
@ AV_SAMPLE_FMT_DBL
double
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
@ AV_SAMPLE_FMT_S16
signed 16 bits
static av_cold void uninit(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
#define FF_FILTER_FLAG_DYNAMIC_FRAME_PARAMS
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define FFSWAP(type, a, b)
Memory handling functions.
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
A link between two filters.
AVFilterContext * src
source filter
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
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).
int64_t duration
Duration of the frame, in the same units as pts.
unsigned int duration_size