X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg.c;h=becd5dfc3367fb950389fc477b2f25d0cfafb85f;hb=edf217ebb7d518be3030184d03b5534033e82d0f;hp=698fea49970dcd501b82f5f62d2545aaadcf7537;hpb=6c9dfa5a1b45a02e85c308e53bd39cd4a32826df;p=ffmpeg diff --git a/ffmpeg.c b/ffmpeg.c index 698fea49970..becd5dfc336 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -62,8 +62,6 @@ #include "libavutil/threadmessage.h" #include "libavformat/os_support.h" -#include "libavformat/ffm.h" // not public API - # include "libavfilter/avcodec.h" # include "libavfilter/avfilter.h" # include "libavfilter/buffersrc.h" @@ -155,8 +153,9 @@ static struct termios oldtty; static int restore_tty; #endif +#if HAVE_PTHREADS static void free_input_threads(void); - +#endif /* sub2video hack: Convert subtitles to video with alpha to insert them in filter graphs. @@ -963,7 +962,9 @@ static void do_video_out(AVFormatContext *s, } case VSYNC_CFR: // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c - if (delta < -1.1) + if (frame_drop_threshold && delta < frame_drop_threshold && ost->frame_number) { + nb_frames = 0; + } else if (delta < -1.1) nb_frames = 0; else if (delta > 1.1) { nb_frames = lrintf(delta); @@ -1527,8 +1528,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti nb_frames_drop += ost->last_droped; } - secs = pts / AV_TIME_BASE; - us = pts % AV_TIME_BASE; + secs = FFABS(pts) / AV_TIME_BASE; + us = FFABS(pts) % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; @@ -1540,6 +1541,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti "size=N/A time="); else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); + if (pts < 0) + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); @@ -2968,6 +2971,37 @@ static int transcode_init(void) } } } + + if (ost->disposition) { + static const AVOption opts[] = { + { "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, + { "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DEFAULT }, .unit = "flags" }, + { "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DUB }, .unit = "flags" }, + { "original" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_ORIGINAL }, .unit = "flags" }, + { "comment" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_COMMENT }, .unit = "flags" }, + { "lyrics" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_LYRICS }, .unit = "flags" }, + { "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_KARAOKE }, .unit = "flags" }, + { "forced" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_FORCED }, .unit = "flags" }, + { "hearing_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_HEARING_IMPAIRED }, .unit = "flags" }, + { "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_VISUAL_IMPAIRED }, .unit = "flags" }, + { "clean_effects" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CLEAN_EFFECTS }, .unit = "flags" }, + { "captions" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_CAPTIONS }, .unit = "flags" }, + { "descriptions" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_DESCRIPTIONS }, .unit = "flags" }, + { "metadata" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_DISPOSITION_METADATA }, .unit = "flags" }, + { NULL }, + }; + static const AVClass class = { + .class_name = "", + .item_name = av_default_item_name, + .option = opts, + .version = LIBAVUTIL_VERSION_INT, + }; + const AVClass *pclass = &class; + + ret = av_opt_eval_flags(&pclass, &opts[0], ost->disposition, &ost->st->disposition); + if (ret < 0) + goto dump_format; + } } /* open each encoder */ @@ -3879,6 +3913,7 @@ static int transcode(void) } av_freep(&ost->forced_kf_pts); av_freep(&ost->apad); + av_freep(&ost->disposition); av_dict_free(&ost->encoder_opts); av_dict_free(&ost->swr_opts); av_dict_free(&ost->resample_opts);