26 #include "libavutil/avassert.h"
27 #include "libavutil/avstring.h"
28 #include "libavutil/opt.h"
42 #define OFFSET(x) offsetof(InterleaveContext, x)
44 #define DEFINE_OPTIONS(filt_name, flags_) \
45 static const AVOption filt_name##_options[] = { \
46 { "nb_inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
47 { "n", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64 = 2}, 1, INT_MAX, .flags = flags_ }, \
55 int i, queue_idx = -1;
56 int64_t pts_min = INT64_MAX;
66 if (frame->
pts < pts_min) {
91 "NOPTS value for input frame cannot be accepted, frame discarded\n");
124 switch (outpad->
type) {
158 outlink->
w = inlink0->
w;
159 outlink->
h = inlink0->
h;
166 if (outlink->
w != inlink->
w ||
167 outlink->
h != inlink->
h ||
171 "(size %dx%d, SAR %d:%d) do not match the corresponding "
172 "output link parameters (%dx%d, SAR %d:%d)\n",
176 outlink->
w, outlink->
h,
205 #if CONFIG_INTERLEAVE_FILTER
221 .
name =
"interleave",
227 .priv_class = &interleave_class,
233 #if CONFIG_AINTERLEAVE_FILTER
248 AVFilter avfilter_af_ainterleave = {
249 .
name =
"ainterleave",
254 .
outputs = ainterleave_outputs,
255 .priv_class = &ainterleave_class,
static AVFrame * ff_bufqueue_get(struct FFBufQueue *queue)
Get the first buffer from the queue and remove it.
void * av_calloc(size_t nmemb, size_t size) av_malloc_attrib
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
void * priv
private data for use by the filter
#define AV_LOG_WARNING
Something somehow does not look correct.
static const AVFilterPad outputs[]
int h
agreed upon image height
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
enum AVMediaType type
AVFilterPad type.
static av_always_inline void interleave(IDWTELEM *dst, IDWTELEM *src0, IDWTELEM *src1, int w2, int add, int shift)
static int config_output(AVFilterLink *outlink)
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
Structure holding the queue.
const char * name
Pad name.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
const AVFilterPad * outputs
List of outputs, terminated by a zeroed element.
static double av_q2d(AVRational a)
Convert rational to double.
#define AV_OPT_FLAG_VIDEO_PARAM
#define DEFINE_OPTIONS(filt_name, flags_)
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int closed
True if the link is closed.
unsigned flags
Link processing flags.
Frame requests may need to loop in order to be fulfilled.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown; if left to 0/0, will be automatically be cop...
#define AV_OPT_FLAG_AUDIO_PARAM
struct FFBufQueue * queues
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int(* filter_frame)(AVFilterLink *link, AVFrame *frame)
Filtering callback.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVFilterContext * src
source filter
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int w
agreed upon image width
unsigned nb_inputs
number of input pads
static av_cold void uninit(AVFilterContext *ctx)
const AVFilter * filter
the AVFilter of which this is an instance
static av_cold int init(AVFilterContext *ctx)
static void ff_bufqueue_discard_all(struct FFBufQueue *queue)
Unref and remove all buffers from the queue.
AVFrame * ff_null_get_audio_buffer(AVFilterLink *link, int nb_samples)
get_audio_buffer() handler for filters which simply pass audio along
size_t char * av_asprintf(const char *fmt,...) av_printf_format(1
Print arguments following specified format into a large enough auto allocated buffer.
int format
agreed upon media format
AVFrame *(* get_audio_buffer)(AVFilterLink *link, int nb_samples)
Callback function to get an audio buffer.
Main libavfilter public API header.
AVFilterLink ** outputs
array of pointers to output links
AVFrame *(* get_video_buffer)(AVFilterLink *link, int w, int h)
Callback function to get a video buffer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
unsigned short available
number of available buffers
AVFilterPad * input_pads
array of input pads
Describe the class of an AVClass context structure.
AVFilterLink ** inputs
array of pointers to input links
rational number numerator/denominator
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterContext * dst
dest filter
enum AVMediaType type
filter media type
#define FF_INLINK_IDX(link)
Find the index of a link.
static int request_frame(AVFilterLink *outlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
#define AVERROR_INVALIDDATA
#define AVFILTER_DEFINE_CLASS(fname)
static void ff_bufqueue_add(void *log, struct FFBufQueue *queue, AVFrame *buf)
Add a buffer to the queue.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
static int push_frame(AVFilterContext *ctx)
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.
static AVFrame * ff_bufqueue_peek(struct FFBufQueue *queue, unsigned index)
Get a buffer from the queue without altering it.