X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_opt.c;h=75c80e792e2847c98a014c61a6bd2f789a15bb01;hb=066b92e91d678f500c64c947d86cd8bf73ee6c61;hp=39c5f49d67296bb32a78c3cefd63589d64ea1b0d;hpb=b12eacb3837cad2daaeda1f77ceb1045bca68789;p=ffmpeg diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 39c5f49d672..75c80e792e2 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -110,6 +110,7 @@ static int no_file_overwrite = 0; static int do_psnr = 0; static int input_sync; static int override_ffserver = 0; +static int input_stream_potentially_available = 0; static void uninit_options(OptionsContext *o) { @@ -918,7 +919,7 @@ static int open_input_file(OptionsContext *o, const char *filename) timestamp = (o->start_time == AV_NOPTS_VALUE) ? 0 : o->start_time; /* add the stream start time */ - if (ic->start_time != AV_NOPTS_VALUE) + if (!o->seek_timestamp && ic->start_time != AV_NOPTS_VALUE) timestamp += ic->start_time; /* if seeking requested, we execute it */ @@ -1008,6 +1009,8 @@ static int open_input_file(OptionsContext *o, const char *filename) av_dict_free(&opts[i]); av_freep(&opts); + input_stream_potentially_available = 1; + return 0; } @@ -2035,8 +2038,8 @@ loop_end: ost->stream_copy = 0; ost->attachment_filename = o->attachments[i]; ost->finished = 1; - ost->enc_ctx->extradata = attachment; - ost->enc_ctx->extradata_size = len; + ost->st->codec->extradata = attachment; + ost->st->codec->extradata_size = len; p = strrchr(o->attachments[i], '/'); av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE); @@ -2104,6 +2107,12 @@ loop_end: } } + if (!(oc->oformat->flags & AVFMT_NOSTREAMS) && !input_stream_potentially_available) { + av_log(NULL, AV_LOG_ERROR, + "No input streams but output needs an input stream\n"); + exit_program(1); + } + if (!(oc->oformat->flags & AVFMT_NOFILE)) { /* test if it already exists to avoid losing precious files */ assert_file_overwrite(filename); @@ -2608,6 +2617,9 @@ static int opt_filter_complex(void *optctx, const char *opt, const char *arg) filtergraphs[nb_filtergraphs - 1]->graph_desc = av_strdup(arg); if (!filtergraphs[nb_filtergraphs - 1]->graph_desc) return AVERROR(ENOMEM); + + input_stream_potentially_available = 1; + return 0; } @@ -2622,6 +2634,9 @@ static int opt_filter_complex_script(void *optctx, const char *opt, const char * return AVERROR(ENOMEM); filtergraphs[nb_filtergraphs - 1]->index = nb_filtergraphs - 1; filtergraphs[nb_filtergraphs - 1]->graph_desc = graph_desc; + + input_stream_potentially_available = 1; + return 0; } @@ -2850,6 +2865,9 @@ const OptionDef options[] = { { "ss", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) }, "set the start time offset", "time_off" }, + { "seek_timestamp", HAS_ARG | OPT_INT | OPT_OFFSET | + OPT_INPUT, { .off = OFFSET(seek_timestamp) }, + "enable/disable seeking by timestamp with -ss" }, { "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(accurate_seek) }, "enable/disable accurate seeking with -ss" }, @@ -3025,7 +3043,7 @@ const OptionDef options[] = { OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) }, "top=1/bottom=0/auto=-1 field first", "" }, { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | - OPT_OUTPUT, { .func_arg = opt_old2new }, + OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_old2new }, "force video tag/fourcc", "fourcc/tag" }, { "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist }, "show QP histogram" },