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) {
117 outlink->
w = inlink->
w;
118 outlink->
h = inlink->
h;
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 .p.name =
"streamselect",
302 .p.priv_class = &streamselect_class,
312 .p.name =
"astreamselect",
314 .p.priv_class = &streamselect_class,
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const FFFilter ff_af_astreamselect
const FFFilter ff_vf_streamselect
static AVFormatContext * ctx
int ff_append_inpad_free_name(AVFilterContext *f, AVFilterPad *p)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Main libavfilter public API header.
char * av_asprintf(const char *fmt,...)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define fs(width, name, subs,...)
int(* init)(AVBSFContext *ctx)
static int parse_mapping(AVFilterContext *ctx, const char *map)
static const AVOption streamselect_options[]
static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int is_audio)
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static int activate(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
static int config_output(AVFilterLink *outlink)
static int process_frame(FFFrameSync *fs)
static av_always_inline int process_frame(AVTextFormatContext *tfc, InputFile *ifile, AVFrame *frame, const AVPacket *pkt, int *packet_new)
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
int ff_framesync_init(FFFrameSync *fs, AVFilterContext *parent, unsigned nb_in)
Initialize a frame sync structure.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ 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...
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
const VDPAUPixFmtMap * map
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define AVFILTER_DEFINE_CLASS_EXT(name, desc, options)
static FilterLink * ff_filter_link(AVFilterLink *link)
#define FF_OUTLINK_IDX(link)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
@ EXT_STOP
Completely stop all streams with this one.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
enum AVMediaType type
filter media type
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
int format
agreed upon media format
A filter pad used for either input or output.
int(* config_props)(AVFilterLink *link)
Link configuration callback.
enum AVMediaType type
AVFilterPad type.
const char * name
Pad name.
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).
enum FFFrameSyncExtMode after
Extrapolation mode for timestamps after the last frame.
enum FFFrameSyncExtMode before
Extrapolation mode for timestamps before the first frame.
AVRational time_base
Time base for the incoming frames.
unsigned sync
Synchronization level: frames on input at the highest sync level will generate output frame events.
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
int64_t frame_count_in
Number of past frames sent through the link.