草稿
作者:罗上文,微信:Loken1,公众号:FFmpeg弦外之音
注意它是怎么提取出 码率 跟 codec_id 的?
st->codecpar->bit_rate = st->internal->avctx->bit_rate;
st->codecpar->channels = st->internal->avctx->channels;
st->codecpar->channel_layout = st->internal->avctx->channel_layout;
st->codecpar->codec_id = st->internal->avctx->codec_id;
扩展知识:下面这样使用内存非常安全,这是引用技术的技巧,可以另起一篇文章介绍这种用法。
sps_buf = av_buffer_allocz(sizeof(*sps));
if (!sps_buf)
return AVERROR(ENOMEM);
sps = (SPS*)sps_buf->data;