printf("pos=%"PRId64"\n" , pkt->pos);
printf("flags=%c\n" , pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
printf("[/PACKET]\n");
+ fflush(stdout);
}
static void show_packets(AVFormatContext *fmt_ctx)
}
printf("pix_fmt=%s\n", dec_ctx->pix_fmt != PIX_FMT_NONE ?
av_pix_fmt_descriptors[dec_ctx->pix_fmt].name : "unknown");
+ printf("level=%d\n", dec_ctx->level);
break;
case AVMEDIA_TYPE_AUDIO:
printf("TAG:%s=%s\n", tag->key, tag->value);
printf("[/STREAM]\n");
+ fflush(stdout);
}
static void show_format(AVFormatContext *fmt_ctx)
printf("TAG:%s=%s\n", tag->key, tag->value);
printf("[/FORMAT]\n");
+ fflush(stdout);
}
static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {
fprintf(stderr, "Unsupported codec with id %d for input stream %d\n",
stream->codec->codec_id, stream->index);
- } else if (avcodec_open(stream->codec, codec) < 0) {
+ } else if (avcodec_open2(stream->codec, codec, NULL) < 0) {
fprintf(stderr, "Error while opening codec for input stream %d\n",
stream->index);
}
static void show_usage(void)
{
printf("Simple multimedia streams analyzer\n");
- printf("usage: ffprobe [OPTIONS] [INPUT_FILE]\n");
+ printf("usage: %s [OPTIONS] [INPUT_FILE]\n", program_name);
printf("\n");
}
return 0;
}
-static void show_help(void)
+static int opt_help(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
printf("\n");
av_opt_show2(avformat_opts, NULL,
AV_OPT_FLAG_DECODING_PARAM, 0);
+ return 0;
}
-static void opt_pretty(void)
+static int opt_pretty(const char *opt, const char *arg)
{
show_value_unit = 1;
use_value_prefix = 1;
use_byte_value_binary_prefix = 1;
use_value_sexagesimal_format = 1;
+ return 0;
}
static const OptionDef options[] = {
if (!input_filename) {
show_usage();
fprintf(stderr, "You have to specify one input file.\n");
- fprintf(stderr, "Use -h to get full help or, even better, run 'man ffprobe'.\n");
+ fprintf(stderr, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
exit(1);
}