123 #define OFFSET(x) offsetof(TrimContext, x)
124 #define COMMON_OPTS \
125 { "starti", "Timestamp of the first frame that " \
126 "should be passed", OFFSET(start_time), AV_OPT_TYPE_DURATION, { .i64 = INT64_MAX }, INT64_MIN, INT64_MAX, FLAGS }, \
127 { "endi", "Timestamp of the first frame that " \
128 "should be dropped again", OFFSET(end_time), AV_OPT_TYPE_DURATION, { .i64 = INT64_MAX }, INT64_MIN, INT64_MAX, FLAGS }, \
129 { "start_pts", "Timestamp of the first frame that should be " \
130 " passed", OFFSET(start_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, FLAGS }, \
131 { "end_pts", "Timestamp of the first frame that should be " \
132 "dropped again", OFFSET(end_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, FLAGS }, \
133 { "durationi", "Maximum duration of the output", OFFSET(duration), AV_OPT_TYPE_DURATION, { .i64 = 0 }, 0, INT64_MAX, FLAGS },
135 #define COMPAT_OPTS \
136 { "start", "Timestamp in seconds of the first frame that " \
137 "should be passed", OFFSET(start_time_dbl),AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, \
138 { "end", "Timestamp in seconds of the first frame that " \
139 "should be dropped again", OFFSET(end_time_dbl), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, \
140 { "duration", "Maximum duration of the output in seconds", OFFSET(duration_dbl), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, DBL_MAX, FLAGS },
143 #if CONFIG_TRIM_FILTER
198 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
199 static const AVOption trim_options[] = {
201 {
"start_frame",
"Number of the first frame that should be passed "
203 {
"end_frame",
"Number of the first frame that should be dropped "
216 .filter_frame = trim_filter_frame,
233 .description =
NULL_IF_CONFIG_SMALL(
"Pick one continuous section from the input, drop the rest."),
236 .priv_class = &trim_class,
240 #endif // CONFIG_TRIM_FILTER
242 #if CONFIG_ATRIM_FILTER
247 int64_t start_sample, end_sample;
321 start_sample =
FFMAX(0, start_sample);
353 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
354 static const AVOption atrim_options[] = {
356 {
"start_sample",
"Number of the first audio sample that should be "
358 {
"end_sample",
"Number of the first audio sample that should be "
371 .filter_frame = atrim_filter_frame,
388 .description =
NULL_IF_CONFIG_SMALL(
"Pick one continuous section from the input, drop the rest."),
391 .priv_class = &atrim_class,
395 #endif // CONFIG_ATRIM_FILTER