开发环境介绍
这一次代码环境比较复杂,我使用的分别是VS2017与CygWin编译C文件
项目遇见的问题
1.VS2017中使用av_register_all(),显示4996错误。
2.cygwin环境中av_register_all() 函数已被声明,但是不能通过VS环境中的行为,解决函数已被声明的解决办法
项目源码
/*
* Copyright (c) 2017 Liming Shao <lmshao@163.com>
*/
#define _CRT_SECURE_NO_WARNINGS
// //4996 错误警告解决
#pragma warning(disable:4996)
#pragma comment(lib, "avformat.lib")
//
// linux 下只支持 正斜杠 不支持反斜杠
#include <stdio.h>
#include <libavutil/log.h>
#include <libavformat/avformat.h>
#include <stdbool.h>
int main(int argc, char *argv[])
{
av_log_set_level(AV_LOG_INFO);
int ret=0;
//注册所有编解码
char *src = NULL;
char *dst = NULL;
AVFormatContext *fmt_ctx = NULL;
//1. 通过命令行输入名字 params form console
//
//这里是命令行参数的个数
if (argc < 3)
{
av_log(NULL, AV_LOG_ERROR, "the params should be m