122 #define OFFSET(x) offsetof(TrimContext, x)
123 #define COMMON_OPTS \
124 { "starti", "Timestamp of the first frame that " \
125 "should be passed", OFFSET(start_time), AV_OPT_TYPE_DURATION, { .i64 = INT64_MAX }, INT64_MIN, INT64_MAX, FLAGS }, \
126 { "endi", "Timestamp of the first frame that " \
127 "should be dropped again", OFFSET(end_time), AV_OPT_TYPE_DURATION, { .i64 = INT64_MAX }, INT64_MIN, INT64_MAX, FLAGS }, \
128 { "start_pts", "Timestamp of the first frame that should be " \
129 " passed", OFFSET(start_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, FLAGS }, \
130 { "end_pts", "Timestamp of the first frame that should be " \
131 "dropped again", OFFSET(end_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, FLAGS }, \
132 { "durationi", "Maximum duration of the output", OFFSET(duration), AV_OPT_TYPE_DURATION, { .i64 = 0 }, 0, INT64_MAX, FLAGS },
134 #define COMPAT_OPTS \
135 { "start", "Timestamp in seconds of the first frame that " \
136 "should be passed", OFFSET(start_time_dbl),AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, \
137 { "end", "Timestamp in seconds of the first frame that " \
138 "should be dropped again", OFFSET(end_time_dbl), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, \
139 { "duration", "Maximum duration of the output in seconds", OFFSET(duration_dbl), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, DBL_MAX, FLAGS },
142 #if CONFIG_TRIM_FILTER
197 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
198 static const AVOption trim_options[] = {
200 {
"start_frame",
"Number of the first frame that should be passed "
202 {
"end_frame",
"Number of the first frame that should be dropped "
215 .filter_frame = trim_filter_frame,
232 .description =
NULL_IF_CONFIG_SMALL(
"Pick one continuous section from the input, drop the rest."),
235 .priv_class = &trim_class,
239 #endif // CONFIG_TRIM_FILTER
241 #if CONFIG_ATRIM_FILTER
246 int64_t start_sample, end_sample = frame->
nb_samples;
320 start_sample =
FFMAX(0, start_sample);
352 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
353 static const AVOption atrim_options[] = {
355 {
"start_sample",
"Number of the first audio sample that should be "
357 {
"end_sample",
"Number of the first audio sample that should be "
370 .filter_frame = atrim_filter_frame,
387 .description =
NULL_IF_CONFIG_SMALL(
"Pick one continuous section from the input, drop the rest."),
390 .priv_class = &atrim_class,
394 #endif // CONFIG_ATRIM_FILTER