寻找自己的采集图像设备
av_find_input_format()
根据名称查找链表当中的输入的格式
如果要查找设备在使用之前去调用: avdevice_register_all();
AVInputFormat *av_find_input_format(const char *short_name);
/*
@param short_name : 指定输入的名称,可以是设备名称avfoundation,或者编码格式:H264, h265...
@return:
AVInputFormat 结构体看下面
*/
typedef struct AVInputFormat {
const char *name; // 封装格式名称简写(short_name)[h264]
const char *long_name; // 码流输入格式的长名称[raw H.264 video]
int flags;
const char *extensions;
const struct AVCodecTag * const *codec_tag;
const AVClass *priv_class;
const char *mime_type;
struct AVInputFormat *next;
int raw_codec_id
int priv_data_size;
int (*read_probe)(AVProbeData *);
int (*read_header)(struct AVFormatContext *);
int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,int64_t *pos, int64_t pos_limit);
int (*read_play)(struct AVFormatContext *);
int (*read_pause)(struct AVFormatContext *);
int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list);
int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps);
} AVInputFormat;
avformat_open_input()
主要用来打开输入流并存储到格式化上下文AVFormatContext中。这个api是不会打开编解码器的
打开的格式化上下文必须要使用:avformat_close_input()来关闭!
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options);
/*
@param ps : 打开之后的数据传入的格式化上线文的指针,失败会自动释放打开的内容
@param url : 要打开的流的URL,可以是设备ID、rtmp、http
@param fmt : 输入的格式,如果为空则会自动查找输入的格式
@param options :AVFormatContext和demuxer私有选项的字典。
@return
0: 成功
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?