decoded_frame = NULL;
format_ctx = NULL;
c = orig_c = NULL;
codec = NULL;
in_format = NULL;
options = NULL;
avcodec_register_all();
if ((error = avformat_open_input(&format_ctx, argv[1], in_format, &options)) < 0) {
fprintf(stderr, "Unable to open file %s (error %s)\n", argv[1], get_error_text(error));
return EXIT_FAILURE;
}
if (avformat_find_stream_info(format_ctx, NULL)<0) {
fprintf(stderr, "Unable to find stream info\n");
return EXIT_FAILURE;
}
av_dump_format(format_ctx, 0, argv[1], 0);
audio_stream = -1;
for (i = 0; i < format_ctx->nb_streams; ++i)
if (format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
audio_stream = i;
break;
}
if (audio_stream == -1) {
fprintf(stderr, "Unable to find audio stream\n");
return EXIT_FAILURE;
}