Go to the documentation of this file.
42 #define OFFSET(x) offsetof(StreamSelectContext, x)
43 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
44 #define TFLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
58 int i, j,
ret = 0, have_out = 0;
60 for (
i = 0;
i <
ctx->nb_inputs;
i++) {
65 for (j = 0; j <
ctx->nb_inputs; j++) {
66 for (
i = 0;
i <
s->nb_map;
i++) {
71 if (
s->is_audio &&
s->last_pts[j] == in[j]->
pts &&
79 s->last_pts[j] = in[j]->
pts;
105 const int inlink_idx =
s->map[outlink_idx];
112 "with settings from input link %d\n",
113 outlink_idx, inlink_idx);
115 switch (outlink->
type) {
131 if (
s->fs.opaque ==
s)
141 for (
i = 0;
i <
ctx->nb_inputs;
i++) {
157 const char *padtype = is_input ?
"in" :
"out";
160 for (
i = 0;
i < nb_pads;
i++) {
195 new_map =
av_calloc(
s->nb_inputs,
sizeof(*new_map));
201 const int n = strtol(
map, &p, 0);
209 if (new_nb_map >=
s->nb_inputs) {
211 "input pads available\n",
s->nb_inputs);
216 if (n < 0 || n >=
ctx->nb_inputs) {
218 "(there is only %d input streams defined)\n",
225 new_map[new_nb_map++] = n;
236 s->nb_map = new_nb_map;
244 char *res,
int res_len,
int flags)
246 if (!strcmp(cmd,
"map")) {
259 int ret, nb_outputs = 0;
260 char *
map =
s->map_str;
262 if (!strcmp(
ctx->filter->name,
"astreamselect"))
275 s->last_pts =
av_calloc(
s->nb_inputs,
sizeof(*
s->last_pts));
284 ctx->nb_inputs,
ctx->nb_outputs);
300 .
name =
"streamselect",
307 .priv_class = &streamselect_class,
312 .
name =
"astreamselect",
314 .priv_class = &streamselect_class,
AVRational time_base
Time base for the incoming frames.
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
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
#define FF_OUTLINK_IDX(link)
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an 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
char * av_asprintf(const char *fmt,...)
AVFILTER_DEFINE_CLASS_EXT(streamselect, "(a)streamselect", streamselect_options)
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).
#define AV_LOG_VERBOSE
Detailed information.
static int parse_mapping(AVFilterContext *ctx, const char *map)
const char * name
Filter name.
int nb_channels
Number of channels in this layout.
A link between two filters.
static int process_frame(FFFrameSync *fs)
Link properties exposed to filter code, but not external callers.
@ EXT_STOP
Completely stop all streams with this one.
static const AVOption streamselect_options[]
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
A filter pad used for either input or output.
enum AVMediaType type
filter media type
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const AVFilter ff_vf_streamselect
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
const AVFilter ff_af_astreamselect
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static int activate(AVFilterContext *ctx)
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
Describe the class of an AVClass context structure.
static int config_output(AVFilterLink *outlink)
#define fs(width, name, subs,...)
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
int(* config_props)(AVFilterLink *link)
Link configuration callback.
static av_cold int init(AVFilterContext *ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int format
agreed upon media format
AVFilterContext * src
source filter
int sample_rate
samples per second
#define i(width, name, range_min, range_max)
int w
agreed upon image width
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
enum AVMediaType type
AVFilterPad type.
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
int h
agreed upon image height
@ AV_OPT_TYPE_INT
Underlying C type is int.
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
const VDPAUPixFmtMap * map
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
static av_cold void uninit(AVFilterContext *ctx)
#define flags(name, subs,...)
static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int is_audio)
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
int64_t frame_count_in
Number of past frames sent through the link.
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.