/* FFprobe context */
static const char *input_filename;
+static const char *print_input_filename;
static AVInputFormat *iformat = NULL;
static struct AVHashContext *hash;
writer_print_section_footer(w);
}
-static int open_input_file(InputFile *ifile, const char *filename)
+static int open_input_file(InputFile *ifile, const char *filename,
+ const char *print_filename)
{
int err, i;
AVFormatContext *fmt_ctx = NULL;
print_error(filename, err);
return err;
}
+ if (print_filename) {
+ av_freep(&fmt_ctx->url);
+ fmt_ctx->url = av_strdup(print_filename);
+ }
ifile->fmt_ctx = fmt_ctx;
if (scan_all_pmts_set)
av_dict_set(&format_opts, "scan_all_pmts", NULL, AV_DICT_MATCH_CASE);
avformat_close_input(&ifile->fmt_ctx);
}
-static int probe_file(WriterContext *wctx, const char *filename)
+static int probe_file(WriterContext *wctx, const char *filename,
+ const char *print_filename)
{
InputFile ifile = { 0 };
int ret, i;
do_read_frames = do_show_frames || do_count_frames;
do_read_packets = do_show_packets || do_count_packets;
- ret = open_input_file(&ifile, filename);
+ ret = open_input_file(&ifile, filename, print_filename);
if (ret < 0)
goto end;
return 0;
}
+static int opt_print_filename(void *optctx, const char *opt, const char *arg)
+{
+ print_input_filename = arg;
+ return 0;
+}
+
void show_help_default(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
{ "read_intervals", HAS_ARG, {.func_arg = opt_read_intervals}, "set read intervals", "read_intervals" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, "generic catch all option", "" },
{ "i", HAS_ARG, {.func_arg = opt_input_file_i}, "read specified file", "input_file"},
+ { "print_filename", HAS_ARG, {.func_arg = opt_print_filename}, "override the printed input filename", "print_file"},
{ "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info },
"read and decode the streams to fill missing information with heuristics" },
{ NULL, },
av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
ret = AVERROR(EINVAL);
} else if (input_filename) {
- ret = probe_file(wctx, input_filename);
+ ret = probe_file(wctx, input_filename, print_input_filename);
if (ret < 0 && do_show_error)
show_error(wctx, ret);
}