下面解析AVOutputFormat ff_rtsp_muxer 结构体
与AVInputFormat ff_rtsp_demuxer 结构体类似, ff_rtsp_muxer也是通过函数指针对外暴露一些具体操作。
AVOutputFormat ff_rtsp_muxer = {
.name = "rtsp",
.long_name = NULL_IF_CONFIG_SMALL("RTSP output"),
.priv_data_size = sizeof(RTSPState),
.audio_codec = AV_CODEC_ID_AAC,
.video_codec = AV_CODEC_ID_MPEG4,
.write_header = rtsp_write_header,
.write_packet = rtsp_write_packet,
.write_trailer = rtsp_write_close,
.flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
.priv_class = &rtsp_muxer_class,
};
结构体通过函数指针对外暴露
rtsp_write_header、rtsp_write_packet、 rtsp_write_close7个操作
rtsp_write_header用于链接并发送RECORD命令
rtsp_write_packet 用于写包数据
rtsp_write_close 用于关闭rtsp
这边单独看AVOutputFormat的功能可能不是很明白,需要结合ffserver再看看具体的业务流程