Go to the documentation of this file.
19 #include "config_components.h"
55 for (p = item_str; *p; p++) {
64 char *
arg, *p = item_str;
69 for (
int i = 0;
i < nb_points;
i++) {
80 if (
s->use_timestamps) {
83 if (sscanf(
arg,
"%"SCNd64, &points[
i]) != 1)
105 if (
s->timestamps_str &&
s->points_str) {
108 }
else if (
s->timestamps_str) {
109 s->use_timestamps = 1;
110 split_str =
s->timestamps_str;
111 }
else if (
s->points_str) {
112 split_str =
s->points_str;
121 s->points =
av_calloc(
s->nb_points,
sizeof(*
s->points));
129 s->points[
s->nb_points - 1] = INT64_MAX;
131 for (
int i = 0;
i <
s->nb_points;
i++) {
152 if (
s->use_timestamps) {
153 for (
int i = 0;
i <
s->nb_points - 1;
i++)
167 if (
s->use_timestamps) {
168 ret =
frame->pts >=
s->points[
s->current_point];
194 for (
int i =
s->current_point; i < s->nb_points;
i++) {
207 if (
s->current_point >=
s->nb_points)
212 if (
s->use_timestamps) {
217 if (max_samples <= 0 || max_samples > INT_MAX)
233 if (
s->current_point >=
s->nb_points) {
244 for (
int i =
s->current_point; i < s->nb_points;
i++)
248 for (
int i =
s->current_point; i < s->nb_points;
i++) {
263 #define OFFSET(x) offsetof(SegmentContext, x)
264 #define COMMON_OPTS \
265 { "timestamps", "timestamps of input at which to split input", OFFSET(timestamps_str), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, FLAGS }, \
267 #if CONFIG_SEGMENT_FILTER
274 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
275 static const AVOption segment_options[] = {
298 .priv_class = &segment_class,
304 #endif // CONFIG_SEGMENT_FILTER
306 #if CONFIG_ASEGMENT_FILTER
313 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
314 static const AVOption asegment_options[] = {
337 .priv_class = &asegment_class,
343 #endif // CONFIG_ASEGMENT_FILTER
static int current_segment_finished(AVFilterContext *ctx, AVFrame *frame)
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
static int parse_points(AVFilterContext *ctx, char *item_str, int nb_points, int64_t *points)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
#define AVERROR_EOF
End of file.
const AVFilter ff_af_asegment
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
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,...)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define FILTER_INPUTS(array)
This structure describes decoded (raw) audio or video data.
const char * name
Filter name.
A link between two filters.
Link properties exposed to filter code, but not external callers.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
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.
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.
static int activate(AVFilterContext *ctx)
Rational number (pair of numerator and denominator).
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
static void count_points(char *item_str, int *nb_items)
#define AVFILTER_DEFINE_CLASS(fname)
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
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.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int init(AVFilterContext *ctx, enum AVMediaType type)
static AVRational av_make_q(int num, int den)
Create an AVRational.
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
#define i(width, name, range_min, range_max)
const AVFilter ff_vf_segment
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
enum AVMediaType type
AVFilterPad type.
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
static av_cold void uninit(AVFilterContext *ctx)
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
static int ref[MAX_W *MAX_W]
int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
static int config_input(AVFilterLink *inlink)
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
@ 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...