利用ffmpeg来分析wma文件信息
STEP1: 参考ffprobe编写如下测试代码。
fileParse.c
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avstring.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
#include <libavutil/dict.h>
#define print_error(a, b) printf(" Open %s with error (%d) \n", a, b)
int dec_init()
{
av_register_all();
avformat_network_init();
}
int dec_exit()
{
avformat_network_deinit();
}
int dec_parse(const char *filename)
{
int err, i;
AVFormatContext *fmt_ctx = NULL;
AVDictionaryEntry *t;
AVInputFormat *iformat = NULL;
AVDictionary *format_opts = NULL;
if ((err = avformat_open_input(&fmt_ctx, filename, iformat, &format_opts)) < 0) {
print_error(filename, err);
return err;
}
if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
return AVERROR_OPTION_NOT_FOUND;
}
/* fill the streams in the format c
STEP1: 参考ffprobe编写如下测试代码。
fileParse.c
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avstring.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
#include <libavutil/dict.h>
#define print_error(a, b) printf(" Open %s with error (%d) \n", a, b)
int dec_init()
{
av_register_all();
avformat_network_init();
}
int dec_exit()
{
avformat_network_deinit();
}
int dec_parse(const char *filename)
{
int err, i;
AVFormatContext *fmt_ctx = NULL;
AVDictionaryEntry *t;
AVInputFormat *iformat = NULL;
AVDictionary *format_opts = NULL;
if ((err = avformat_open_input(&fmt_ctx, filename, iformat, &format_opts)) < 0) {
print_error(filename, err);
return err;
}
if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
return AVERROR_OPTION_NOT_FOUND;
}
/* fill the streams in the format c