CMSampleBufferRef获取h264 char*数据及sps/pps
来源:互联网 发布:索尼a5000 知乎 编辑:程序博客网 时间:2024/06/05 09:13
直接看代码:
CMBlockBufferRef blockBuffer = CMSampleBufferGetDataBuffer(sampleBuf); size_t len_offset = 0 , len_total = 0 ; char * addr = NULL ; OSStatus status = CMBlockBufferGetDataPointer(blockBuffer, 0, &len_offset, &len_total, &addr); if(addr){ NSLog(@"h264 data : %d,%d,%d,%d,%d,%d,%d,%d,%d,%d",addr[0],addr[1],addr[2],addr[3],addr[4],addr[5],addr[6],addr[7],addr[8],addr[9]); } CFArrayRef cfArr = CMSampleBufferGetSampleAttachmentsArray(sampleBuf, true); if (!cfArr) { return YES; } CFDictionaryRef cfDict = (CFDictionaryRef)(CFArrayGetValueAtIndex(cfArr, 0)); bool keyframe = !CFDictionaryContainsKey(cfDict, kCMSampleAttachmentKey_NotSync); if (status == noErr) { if (keyframe) { CMFormatDescriptionRef format = CMSampleBufferGetFormatDescription(sampleBuf); size_t sparameterSetSize, sparameterSetCount; const uint8_t *sparameterSet; OSStatus statusCode = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(format, 0, &sparameterSet, &sparameterSetSize, &sparameterSetCount, 0 ); if (statusCode == noErr) { // Found sps and now check for pps size_t pparameterSetSize, pparameterSetCount; const uint8_t *pparameterSet; OSStatus statusCode = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(format, 1, &pparameterSet, &pparameterSetSize, &pparameterSetCount, 0 ); if (statusCode == noErr) { } } else { NSLog(@"================ error GetH264Parameter..."); } } }
阅读全文
0 0
- CMSampleBufferRef获取h264 char*数据及sps/pps
- H264 获取SPS与PPS
- H264 获取SPS与PPS(附源码)
- H264 获取SPS与PPS(附源码)
- FFmpeg 获取H264流中的sps pps
- FFmpeg 获取H264流中的sps pps
- live555 H264及sps和pps
- h264 sps pps
- H264之SPS PPS
- h264 sps pps
- H264--NALU/SPS/PPS
- h264 sps pps
- H264 pps sps作用
- h264 sps pps笔记
- h264 sps pps详解
- H264 sps pps 解析
- h264 sps pps详解
- 关于h264的avc box中数据的提取。sps pps的获取。
- Unity编译Android包错误,Unable to list target platforms
- git---commit 操作遇到提交失败,tell me who you are
- LeetCode 448. Find All Numbers Disappeared in an Array (数组查缺)
- 欢迎使用CSDN-markdown编辑器
- WPF TabControl模版改造工程(口胡)
- CMSampleBufferRef获取h264 char*数据及sps/pps
- ajax 和jsonp 不是一码事 细读详解
- unity切换vs版本
- JAVA环境变量配置详解
- OC与Swift如何相互调用
- 哈希函数
- Reporting Services- Web Service
- c++多线程创建的几种方式
- st7789 320*240 显示屏,uboot驱动移植笔记