127 #define OFFSET(x) offsetof(TrimContext, x)
128 #define COMMON_OPTS \
129 { "start", "Timestamp in seconds of the first frame that " \
130 "should be passed", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, \
131 { "end", "Timestamp in seconds of the first frame that " \
132 "should be dropped again", OFFSET(end_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX }, -DBL_MAX, DBL_MAX, FLAGS }, \
133 { "start_pts", "Timestamp of the first frame that should be " \
134 " passed", OFFSET(start_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, FLAGS }, \
135 { "end_pts", "Timestamp of the first frame that should be " \
136 "dropped again", OFFSET(end_pts), AV_OPT_TYPE_INT64, { .i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, FLAGS }, \
137 { "duration", "Maximum duration of the output in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, DBL_MAX, FLAGS },
140 #if CONFIG_TRIM_FILTER
196 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM
197 static const AVOption trim_options[] = {
199 {
"start_frame",
"Number of the first frame that should be passed "
201 {
"end_frame",
"Number of the first frame that should be dropped "
207 static const AVClass trim_class = {
210 .option = trim_options,
218 .filter_frame = trim_filter_frame,
235 .description =
NULL_IF_CONFIG_SMALL(
"Pick one continuous section from the input, drop the rest."),
240 .priv_class = &trim_class,
245 #endif // CONFIG_TRIM_FILTER
247 #if CONFIG_ATRIM_FILTER
252 int64_t start_sample, end_sample = frame->
nb_samples;
326 start_sample =
FFMAX(0, start_sample);
359 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM
360 static const AVOption atrim_options[] = {
362 {
"start_sample",
"Number of the first audio sample that should be "
364 {
"end_sample",
"Number of the first audio sample that should be "
370 static const AVClass atrim_class = {
373 .option = atrim_options,
381 .filter_frame = atrim_filter_frame,
398 .description =
NULL_IF_CONFIG_SMALL(
"Pick one continuous section from the input, drop the rest."),
403 .priv_class = &atrim_class,
408 #endif // CONFIG_ATRIM_FILTER