FFmpeg和SDL的API
来源:互联网 发布:知乎 王西安 编辑:程序博客网 时间:2024/05/22 13:41
FFmpeg和SDL的API
使用FFmpeg的API和SDL的API进行视频的解码和显示,似乎还是有点技术含量的东西,我最近收到一些email询问视频的解码和显示的实 现,今天hanyionet就献上博文一篇简单地说明一下如何使用这些API,其实使用这些API其实一点都不难,不要被复杂描述吓到。我们所要做就是先 要了解视频的解码和显示到底是怎样的一个过程,然后了解各个API的作用。
进行解码和视频的现实一般来说就是这样的步骤:
初始化–>解码–>图像缩放–>视频显示
以下是一个简单的过程流程图,在每一个步骤中给出一些比较重要的API。
可以看出,不同的步骤的实现,就是找到并使用相对应的API。
图中的API的具体说明,今天一同给出。
FFmpeg API
描述
av_register_all()
Initializes libavformat and registers all the muxers, demuxers and protocols.
avcodec_find_decoder(…)
Finds a decoder with a matching codec ID.
avcodec_alloc_context()
Allocates an AVCodecContext and sets its fields to default values.
avcodec_alloc_frame()
Allocates an AVFrame and sets its fields to default values.
sws_getContext(…)
Returns an SwsContext to be used in sws_scale().
sws_scale(…)
Scales the data in source according to our settings in our SwsContext c. srcStride and dstStride are the source and destination linesize.
avcodec_decode_video(…)
Decodes a video frame from buffer into picture.
SDL API
描述
SDL_SetVideoMode()
Set up a video mode with the specified width, height, and bits-per-pixel.
SDL_CreateYUVOverlay()
It is used to create a YUV overlay of the specified width, height and format for the provided display.
SDL_BlitSurface()
This performs a fast blit from the source surface to the destination surface.
SDL_FreeSurface()
Frees (deletes) a SDL surface.
SDL_UpdateRect()
Makes sure the given area is updated on the given screen.
SDL_Flip()
It is used to swap screen buffers. On hardware that supports double-buffering, this function sets up a flip and returns.
SDL_FreeYUVOverlay()
Free a YUV video overlay.
其实要理解FFmpeg的API还有一个非常重要的地方就是理解,各种数据结构的具体内容,譬如AVFrame和AVCodecContext,个人认为这两个结构是比较重要的。
了解的这些API的使用方法后,现在应该做的就是找一个例子例如ffplay.c或者http://dranger.com/ffmpeg/里的例程,体会一下,最后使用这些API搭建出属于自己的视频播放程序。
Enjoy!
This entry was posted in 流媒体技术
(hanyionet)本站文章除注明转载外,均
使用FFmpeg的API和SDL的API进行视频的解码和显示,似乎还是有点技术含量的东西,我最近收到一些email询问视频的解码和显示的实 现,今天hanyionet就献上博文一篇简单地说明一下如何使用这些API,其实使用这些API其实一点都不难,不要被复杂描述吓到。我们所要做就是先 要了解视频的解码和显示到底是怎样的一个过程,然后了解各个API的作用。
进行解码和视频的现实一般来说就是这样的步骤:
初始化–>解码–>图像缩放–>视频显示
以下是一个简单的过程流程图,在每一个步骤中给出一些比较重要的API。
可以看出,不同的步骤的实现,就是找到并使用相对应的API。
图中的API的具体说明,今天一同给出。
FFmpeg API
描述
av_register_all()
Initializes libavformat and registers all the muxers, demuxers and protocols.
avcodec_find_decoder(…)
Finds a decoder with a matching codec ID.
avcodec_alloc_context()
Allocates an AVCodecContext and sets its fields to default values.
avcodec_alloc_frame()
Allocates an AVFrame and sets its fields to default values.
sws_getContext(…)
Returns an SwsContext to be used in sws_scale().
sws_scale(…)
Scales the data in source according to our settings in our SwsContext c. srcStride and dstStride are the source and destination linesize.
avcodec_decode_video(…)
Decodes a video frame from buffer into picture.
SDL API
描述
SDL_SetVideoMode()
Set up a video mode with the specified width, height, and bits-per-pixel.
SDL_CreateYUVOverlay()
It is used to create a YUV overlay of the specified width, height and format for the provided display.
SDL_BlitSurface()
This performs a fast blit from the source surface to the destination surface.
SDL_FreeSurface()
Frees (deletes) a SDL surface.
SDL_UpdateRect()
Makes sure the given area is updated on the given screen.
SDL_Flip()
It is used to swap screen buffers. On hardware that supports double-buffering, this function sets up a flip and returns.
SDL_FreeYUVOverlay()
Free a YUV video overlay.
其实要理解FFmpeg的API还有一个非常重要的地方就是理解,各种数据结构的具体内容,譬如AVFrame和AVCodecContext,个人认为这两个结构是比较重要的。
了解的这些API的使用方法后,现在应该做的就是找一个例子例如ffplay.c或者http://dranger.com/ffmpeg/里的例程,体会一下,最后使用这些API搭建出属于自己的视频播放程序。
Enjoy!
This entry was posted in 流媒体技术
(hanyionet)
- FFmpeg和SDL的API
- FFmpeg和SDL的API
- FFmpeg和SDL的API
- FFmpeg和SDL的API
- FFmpeg和SDL的API
- ffmpeg和SDL的配置
- ffmpeg 和 SDL 教程
- ffmpeg和SDL指南
- ffmpeg 和 SDL 教程
- ffmpeg 和 SDL 教程
- ffmpeg 和 SDL 教程
- ffmpeg和SDL学习笔记
- 如何基于FFMPEG和SDL的视频播放器
- ffmpeg 和 SDL 教程(转至CSDN ThinkingAboutLife的专栏)
- ffmpeg和SDL实现的视频播放程序
- Qt中使用SDL和FFmpeg的编译问题
- 如何基于FFMPEG和SDL的视频播放器
- 详细介绍Qt,ffmpeg 和SDl 教程之间的联系
- String与InputStream转换
- signal 详解
- hdu 1025 Constructing Roads In JGShining's Kingdom (最长上升子序列)
- Java 反射 方法调用
- Bloom Filter算法
- FFmpeg和SDL的API
- 非递归遍历二叉树
- SQL server2008 收缩数据库日志文件
- 页面缓存概述
- C#数组
- ABAP OO静态和实例方法区别
- 高盛:若中国信贷泡沫破裂或面临18.6万亿坏账
- 详解struts2中struts.properties
- Java微信公众平台开发模式+自定义按钮源码