| 3251 | } |
| 3252 | |
| 3253 | static int process_forced_keyframes(Muxer *mux, const OptionsContext *o) |
| 3254 | { |
| 3255 | for (int i = 0; i < mux->of.nb_streams; i++) { |
| 3256 | OutputStream *ost = mux->of.streams[i]; |
| 3257 | const char *forced_keyframes = NULL; |
| 3258 | |
| 3259 | opt_match_per_stream_str(ost, &o->forced_key_frames, |
| 3260 | mux->fc, ost->st, &forced_keyframes); |
| 3261 | |
| 3262 | if (!(ost->type == AVMEDIA_TYPE_VIDEO && |
| 3263 | ost->enc && forced_keyframes)) |
| 3264 | continue; |
| 3265 | |
| 3266 | if (!strncmp(forced_keyframes, "expr:", 5)) { |
| 3267 | int ret = av_expr_parse(&ost->kf.pexpr, forced_keyframes + 5, |
| 3268 | forced_keyframes_const_names, NULL, NULL, NULL, NULL, 0, NULL); |
| 3269 | if (ret < 0) { |
| 3270 | av_log(ost, AV_LOG_ERROR, |
| 3271 | "Invalid force_key_frames expression '%s'\n", forced_keyframes + 5); |
| 3272 | return ret; |
| 3273 | } |
| 3274 | ost->kf.expr_const_values[FKF_N] = 0; |
| 3275 | ost->kf.expr_const_values[FKF_N_FORCED] = 0; |
| 3276 | ost->kf.expr_const_values[FKF_PREV_FORCED_N] = NAN; |
| 3277 | ost->kf.expr_const_values[FKF_PREV_FORCED_T] = NAN; |
| 3278 | |
| 3279 | // Don't parse the 'forced_keyframes' in case of 'keep-source-keyframes', |
| 3280 | // parse it only for static kf timings |
| 3281 | } else if (!strcmp(forced_keyframes, "source")) { |
| 3282 | ost->kf.type = KF_FORCE_SOURCE; |
| 3283 | #if FFMPEG_OPT_FORCE_KF_SOURCE_NO_DROP |
| 3284 | } else if (!strcmp(forced_keyframes, "source_no_drop")) { |
| 3285 | av_log(ost, AV_LOG_WARNING, "The 'source_no_drop' value for " |
| 3286 | "-force_key_frames is deprecated, use just 'source'\n"); |
| 3287 | ost->kf.type = KF_FORCE_SOURCE; |
| 3288 | #endif |
| 3289 | } else if (!strcmp(forced_keyframes, "scd_metadata")) { |
| 3290 | ost->kf.type = KF_FORCE_SCD_METADATA; |
| 3291 | } else { |
| 3292 | int ret = parse_forced_key_frames(ost, &ost->kf, mux, forced_keyframes); |
| 3293 | if (ret < 0) |
| 3294 | return ret; |
| 3295 | } |
| 3296 | } |
| 3297 | |
| 3298 | return 0; |
| 3299 | } |
| 3300 | |
| 3301 | static const char *output_file_item_name(void *obj) |
| 3302 | { |
no test coverage detected