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,
203 #if CONFIG_INTERLEAVE_FILTER
219 .
name =
"interleave",
225 .priv_class = &interleave_class,
231 #if CONFIG_AINTERLEAVE_FILTER
247 .
name =
"ainterleave",
252 .
outputs = ainterleave_outputs,
253 .priv_class = &ainterleave_class,
static AVFrame * ff_bufqueue_get(struct FFBufQueue *queue)
Get the first buffer from the queue and remove it.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
Main libavfilter public API header.
int h
agreed upon image height
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
#define AV_OPT_FLAG_AUDIO_PARAM
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
enum AVMediaType type
AVFilterPad type.
static int config_output(AVFilterLink *outlink)
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
Structure holding the queue.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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).
static double av_q2d(AVRational a)
Convert an AVRational to a double.
#define AVERROR_EOF
End of file.
#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)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
AVFilterPad * input_pads
array of input pads
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
struct FFBufQueue * queues
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#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...
simple assert() macros that are a bit more flexible than ISO C assert().
int w
agreed upon image width
char * av_asprintf(const char *fmt,...)
unsigned nb_inputs
number of input pads
static av_cold void uninit(AVFilterContext *ctx)
static av_cold int init(AVFilterContext *ctx)
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
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
int format
agreed upon media format
AVFrame *(* get_audio_buffer)(AVFilterLink *link, int nb_samples)
Callback function to get an audio buffer.
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
#define AV_OPT_FLAG_VIDEO_PARAM
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const char * name
Filter name.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
AVFilterLink ** outputs
array of pointers to output links
static void interleave(short *output, short **input, int channels, int samples)
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)
AVFilterContext * dst
dest filter
#define AVFILTER_DEFINE_CLASS(fname)
const AVFilterPad * outputs
List of outputs, terminated by a zeroed element.
static void ff_bufqueue_add(void *log, struct FFBufQueue *queue, AVFrame *buf)
Add a buffer to the queue.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
const AVFilter * filter
the AVFilter of which this is an instance
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.