68 #define OFFSET(x) offsetof(JoinContext, x) 69 #define A AV_OPT_FLAG_AUDIO_PARAM 70 #define F AV_OPT_FLAG_FILTERING_PARAM 73 {
"channel_layout",
"Channel layout of the " 75 {
"map",
"A comma-separated list of channels maps in the format " 76 "'input_stream.input_channel-output_channel.",
92 int input_idx, out_ch_idx, in_ch_idx;
94 next = strchr(cur, separator);
99 if (!(sep = strchr(cur,
'-'))) {
106 #define PARSE_CHANNEL(str, var, inout) \ 107 if (!(var = av_get_channel_layout(str))) { \ 108 av_log(ctx, AV_LOG_ERROR, "Invalid " inout " channel: %s.\n", str);\ 109 return AVERROR(EINVAL); \ 111 if (av_get_channel_layout_nb_channels(var) != 1) { \ 112 av_log(ctx, AV_LOG_ERROR, "Channel map describes more than one " \ 113 inout " channel.\n"); \ 114 return AVERROR(EINVAL); \ 121 "requested channel layout.\n", sep);
134 input_idx = strtol(cur, &cur, 0);
135 if (input_idx < 0 || input_idx >= s->
inputs) {
144 in_ch_idx = strtol(cur, &p, 0);
188 for (i = 0; i < s->
inputs; i++) {
335 "output channel '%s'.\n",
370 int linesize = INT_MAX;
371 int nb_samples = INT_MAX;
412 for (j = 0; j < nb_buffers; j++)
416 s->
buffers[nb_buffers++] = buf;
432 if (!frame->
buf[i]) {
499 for (i = 1; i < ctx->
nb_inputs && nb_samples > 0; i++) {
534 "multi-channel output."),
536 .priv_class = &join_class,
542 .
outputs = avfilter_af_join_outputs,
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
uint64_t in_channel
layout describing the input channel
This structure describes decoded (raw) audio or video data.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Main libavfilter public API header.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
static av_cold int init(AVCodecContext *avctx)
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
int nb_extended_buf
Number of elements in extended_buf.
enum AVMediaType type
AVFilterPad type.
#define FF_ARRAY_ELEMS(a)
AVFilterFormatsConfig outcfg
Lists of supported formats / etc.
int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
Test if enough samples are available on the link.
AVBufferRef ** buffers
Temporary storage for buffer references, for assembling the output frame.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
const char * name
Pad name.
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static av_cold void join_uninit(AVFilterContext *ctx)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static av_cold int uninit(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static av_cold int join_init(AVFilterContext *ctx)
static void guess_map_matching(AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
int input
input stream index
#define AV_LOG_VERBOSE
Detailed information.
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function.If this function returns true
static int join_query_formats(AVFilterContext *ctx)
A filter pad used for either input or output.
A link between two filters.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
AVFilterPad * input_pads
array of input pads
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int sample_rate
samples per second
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
simple assert() macros that are a bit more flexible than ISO C assert().
uint64_t channel_layout
Channel layout of the audio data.
char * av_asprintf(const char *fmt,...)
static const AVOption join_options[]
int channels
number of audio channels, only used for audio.
audio channel layout utility functions
unsigned nb_inputs
number of input pads
AVBufferRef ** extended_buf
For planar audio which requires more than AV_NUM_DATA_POINTERS AVBufferRef pointers, this array will hold all the references which cannot fit into AVFrame.buf.
AVBufferRef * av_frame_get_plane_buffer(AVFrame *frame, int plane)
Get the buffer reference a given data plane is stored in.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
AVFilterContext * src
source filter
static const AVFilterPad avfilter_af_join_outputs[]
static const AVFilterPad outputs[]
int format
agreed upon media format
int in_channel_idx
index of in_channel in the input stream data
A list of supported channel layouts.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
static int activate(AVFilterContext *ctx)
AVFILTER_DEFINE_CLASS(join)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int ff_inlink_consume_samples(AVFilterLink *link, unsigned min, unsigned max, AVFrame **rframe)
Take samples from the link's FIFO and update the link's stats.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Describe the class of an AVClass context structure.
int sample_rate
Sample rate of the audio data.
#define PARSE_CHANNEL(str, var, inout)
uint64_t out_channel
layout describing the output channel
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
const char * name
Filter name.
const VDPAUPixFmtMap * map
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 link
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
int av_get_channel_layout_channel_index(uint64_t channel_layout, uint64_t channel)
Get the index of a channel in channel_layout.
#define flags(name, subs,...)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVFrame ** input_frames
Temporary storage for input frames, until we get one on each input.
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
A reference to a data buffer.
static int query_formats(AVFilterContext *ctx)
static void guess_map_any(AVFilterContext *ctx, ChannelMap *ch, uint64_t *inputs)
common internal and external API header
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
Get the channel with the given index in channel_layout.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
static int parse_maps(AVFilterContext *ctx)
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
int channels
Number of channels.
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
char * channel_layout_str
const char * av_get_channel_name(uint64_t channel)
Get the name of a given channel.
static int try_push_frame(AVFilterContext *ctx)
static int join_config_output(AVFilterLink *outlink)
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
uint8_t ** extended_data
pointers to the data planes/channels.
int nb_samples
number of audio samples (per channel) described by this frame
void * av_mallocz_array(size_t nmemb, size_t size)
static int ff_insert_inpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new input pad for the filter.