FFmpegh.264解码
- (int)DecodeH264Frames: (unsigned char*)inputBuffer withLength:(int)aLength
{
int gotPicPtr=;
int result=; av_init_packet(&pAvPackage);
pAvPackage.data=(unsigned char*)inputBuffer;
pAvPackage.size=aLength;
//解码
result=avcodec_decode_video2(pCodecCtx, pVideoFrame, &gotPicPtr, &pAvPackage); //如果视频尺寸更改,我们丢掉这个frame
if((pictureWidth!=)&&(pictureWidth!=pCodecCtx->width)){
setRecordResolveState=;
pictureWidth=pCodecCtx->width;
return -;
} //YUV 420 Y U V -> RGB
if(gotPicPtr)
{ unsigned int lumaLength= (pCodecCtx->height)*(MIN(pVideoFrame->linesize[], pCodecCtx->width));// W * H
unsigned int chromBLength=((pCodecCtx->height)/)*(MIN(pVideoFrame->linesize[], (pCodecCtx->width)/));// w * h/4
unsigned int chromRLength=((pCodecCtx->height)/)*(MIN(pVideoFrame->linesize[], (pCodecCtx->width)/)); H264YUV_Frame yuvFrame;
memset(&yuvFrame, , sizeof(H264YUV_Frame)); yuvFrame.luma.length = lumaLength;
yuvFrame.chromaB.length = chromBLength;
yuvFrame.chromaR.length =chromRLength;
yuvFrame.luma.dataBuffer=(unsigned char*)malloc(lumaLength);
yuvFrame.chromaB.dataBuffer=(unsigned char*)malloc(chromBLength);
yuvFrame.chromaR.dataBuffer=(unsigned char*)malloc(chromRLength);
copyDecodedFrame(pVideoFrame->data[],yuvFrame.luma.dataBuffer,pVideoFrame->linesize[],
pCodecCtx->width,pCodecCtx->height);
copyDecodedFrame(pVideoFrame->data[], yuvFrame.chromaB.dataBuffer,pVideoFrame->linesize[],
pCodecCtx->width / ,pCodecCtx->height / );
copyDecodedFrame(pVideoFrame->data[], yuvFrame.chromaR.dataBuffer,pVideoFrame->linesize[],
pCodecCtx->width / ,pCodecCtx->height / ); yuvFrame.width=pCodecCtx->width;
yuvFrame.height=pCodecCtx->height; dispatch_sync(dispatch_get_main_queue(), ^{ [self updateYUVFrameOnMainThread:(H264YUV_Frame*)&yuvFrame];
}); free(yuvFrame.luma.dataBuffer);
free(yuvFrame.chromaB.dataBuffer);
free(yuvFrame.chromaR.dataBuffer); }
av_free_packet(&pAvPackage); return ;
}
FFmpegh.264解码的更多相关文章
- [ffmpeg] h.264解码所用的主要缓冲区介绍
在进行h264解码过程中,有两个最重要的结构体,分别为H264Picture.H264SliceContext. H264Picture H264Picture用于维护一帧图像以及与该图像相关的语法元 ...
- <开源项目分析>Cisco的开源视频加解码器THOR(H.264解码)
原创博客,转载请联系博主! 题外话:自学了快两个月的Perl语言,本来打算写两篇基础介绍的博文来科普一下一些小技巧,但是仔细想想还是没有必要了吧,毕竟现在无论是在用Perl5还是Perl6的人都是小众 ...
- h.264并行解码算法分析
并行算法类型可以分为两类 Function-level Decomposition,按照功能模块进行并行 Data-level Decomposition,按照数据划分进行并行 Function-le ...
- H.264视频在android手机端的解码与播放(转)
随着无线网络和智能手机的发展,智能手机与人们日常生活联系越来越紧密,娱乐.商务应用.金融应用.交通出行各种功能的软件大批涌现,使得人们的生活丰富多彩.快捷便利,也让它成为人们生活中不可取代的一部分.其 ...
- (转载)H.264码流的RTP封包说明
H.264的NALU,RTP封包说明(转自牛人) 2010-06-30 16:28 H.264 RTP payload 格式 H.264 视频 RTP 负载格式 1. 网络抽象层单元类型 (NALU) ...
- H.264码流结构解析
from:http://wenku.baidu.com/link?url=hYQHJcAWUIS-8C7nSBbf-8lGagYGXKb5msVwQKWyXFAcPLU5gR4BKOVLrFOw4bX ...
- FFmpeg源码结构图 - 解码
===================================================== FFmpeg的库函数源码分析文章列表: [架构图] FFmpeg源码结构图 - 解码 FFm ...
- FFmpeg源代码结构图 - 解码
===================================================== FFmpeg的库函数源代码分析文章列表: [架构图] FFmpeg源代码结构图 - 解码 F ...
- H.264开源解码器评测
转自:http://wmnmtm.blog.163.com/blog/static/38245714201142883032575/ 要播放HDTV,就首先要正确地解开封装,然后进行视频音频解码.所以 ...
随机推荐
- DevExpress Report打印边距越界问题
DevExpress Report Print的时候,出现这样的问题:one or more margins are set outside the printable area of the pa ...
- selenium与phantomjs简单结合
selenium工具安装 Windows安装pip install selenium Linux安装apt-get install selenium 查看selenium支持的浏览器from sele ...
- 【 正确使用vim编辑器的姿势】
vi:可视化接口(Visual Interface) vim:是vi的增强版(vi iMprove) vi编辑器是所有Unix及Linux系统下标准的编辑器,他就相当于windows系统中的记事本一样 ...
- react入门安装
react的入门安装 1.react的适用方法有两种,其一是依赖在线的cdn地址: https://reactjs.org/docs/cdn-links.html 官方给的cdn地址如下 <sc ...
- 今日SGU 5.15
最近事情好多,数据库作业,没天要学2个小时java,所以更新的sgu就比较少了 SGU 131 题意:给你两种小块一种,1*1,一种2*2-1*1,问你填满一个m*n的矩形有多少钟方法,n和m小于等于 ...
- 实现IE下兼容CSS3的圆角效果
有些CSS3的牛逼的效果在IE下展示不出来是最烦人的啦,在项目中做的圆角效果到了IE下一堆方块....忒尴尬了...,找了个替代解决方案 1.首先下载一个js插件PIE.js百度一搜都是的,我也就不写 ...
- react-native-swiper苹果正常显示,Android不显示
在使用react-native-swiper时,最好不要放到(FlatList , SectionList,ListView,ScrollView 等)组件中,否则Android 可能不会正常显示图片 ...
- [Parcel] Bundle a React App with Parcel
Parcel comes in as the new cool kid in the bundlers world. Unlike other bundlers which take lots of ...
- Android 採用HTML设计界面
由于Android软件开发分工眼下还没有细化,程序猿往往须要负责软件界面的开发,尽管软件的界面图片已经由美工设计好了.可是假设使用layout技术把软件做成美丽的界面确实非常困难,而是也比較耗时.An ...
- Js经典实例收集
跨浏览器添加事件 //跨浏览器添加事件 function addEvent(obj,type,fn){ if(obj.addEventListener){ obj.addEventListener(t ...