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
164static 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--)
208static 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--)
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,
303 .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
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 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
static AVFormatContext * ctx