Tegra_Multimedia API 例程学习之--00_video_decode

概述

视频解码示例应用程序演示如何使用libv4l2组件分配的缓冲区来解码H.264、H.265、vp8、vp9、mpeg4或mpeg2视频流。
应用程序读取H.264、H.265、VP8、VP9、MPEG4或MPEG2基本视频文件,对其进行解码,并将其传递给EGL渲染器,以显示解码图像,而无需任何额外的内存copy。
支持的视频格式有:

  • H.264

  • H.265号

  • VP8型

  • VP9型

  • MPEG4标准

  • MPEG2标准

编译运行

$ cd $HOME/multimedia_api/samples/00_video_decode
 $ make

运行

 $ ./video_decode <in-format> [options] <in-file>
$ ./video_decode H264 ../../data/Video/sample_outdoor_car_1080p_10fps.h264

流程图

在这里插入图片描述
1.Output Plane接收比特流格式的输入并将其传送给解码器进行解码。
2. 应用程序将解码后的帧以yuv格式传输到Capture Plane。
3. 对于Output Plane,应用程序支持MMAP和USRPTR内存类型。对于Capture Plane,它支持MMAP和DMABUF内存类型。
4. 应用程序还可以从 Capture Plane转储文件。

关键类和结构体

关键的类有两个:NvVideoDeocder,NvEglRenderer,前者是硬件解码器,后者是显示用的渲染器,用于显示图像。
NvVideoDeocder里面有一些成员函数,
NvVideoDecoder包含以下成员:

元素描述
output_planeV4l2 output plane
capture_planeV4l2 capture plane
createVideoDecoder创建Decoder的静态函数
subscribeEvent订阅事件
setExtControlsSet external control to V4l2 device
setOutputPlaneFormatSet output plane format.
setCapturePlaneFormatSet capture plane format.
getControlTBD
dqEventDqueue the event which report by V4l2 device.
isInErrorCheck if under error state.

NvVideoDecoder有两个关键成员,output_plane and capture_plane 都继承自NvV4l2ElementPlane.包含以下成员:

ElementDescription
setupPlaneSetup the plane of V4l2 element.
deinitPlaneDestroy the plane of V4l2 element.
setStreamStatusStart/Stop the stream.
setDQThreadCallbackSet the callback function of dqueue buffer thread.
startDQThreadStart the thread of dqueue buffer.
stopDQThreadStop the thread of dqueue buffer.
qBufferQueue V4l2 buffer.
dqBufferDqueue V4l2 buffer.
getNumBuffersGet the number of V4l2 buffer.
getNumQueuedBuffersGet the number of V4l2 buffer which under queue.
getNthBufferGets the NvBuffer object at index n.

代码分析

下面来看一下代码的具体流程。
程序使用一个

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值