(原)关于ffmpeg使用custom io-context遇到的一些坑


int FileSource::ReadSeek( int offset, int whence){
// 参数检查.
int ret=-;
if (offset > m_nFileSize || !m_file.is_open()){
LOGI("seek offset=%d> file size:%d,or file is close.",offset,m_nFileSize);
return -;
}
if (m_bIsMultithread)
m_mutex.Lock();
std::ios_base::seekdir way = (std::ios_base::seekdir)whence;
// 进行seek操作.
if (whence != AVSEEK_SIZE) {
//先把错误位置给
m_file.clear();
//////////////////////////////
switch(whence){
case SEEK_SET:
//基于文件开始位置进行seek跳转
m_file.seekg(offset,std::ios_base::beg);
// ret = offset;
break;
case SEEK_CUR:
//基于文件当前位置进行seek跳转
m_file.seekg(offset,std::ios_base::cur);
// ret=m_file.tellg();
break;
case SEEK_END:
//基于文件尾的位置进行seek跳转
m_file.seekg(offset,std::ios_base::end);
// ret=m_file.tellg();
break;
}
if (m_file.good())
ret = m_file.tellg();
else
ret = -;
}else{
//等于AVSEEK_SIZE,这个主要是用于获取文件大小
// The whence-parameter has one more option than fseek: AVSEEK_SIZE.
// When this option is passed to the seek function it should return the file size (if possible).
// If its not possible, the function may return and do nothing -1. In my implementation pStream->Seek(...) will fail with AVSEEK_SIZE and SeekFunc will return -1.
ret=m_nFileSize;
}
if (m_bIsMultithread)
m_mutex.Unlock();
return ret;
}
(原)关于ffmpeg使用custom io-context遇到的一些坑的更多相关文章
- [原] Android上使用native IO
首先, 官方google play对APK大小有限制: 50M.( https://support.google.com/googleplay/android-developer/answer/113 ...
- [原]how to view custom provider's events(collected without provider registered) by wpa
最近想使用etw作为高效的日志机制,也不想暴露机密信息(关键信息在msnifest文件中).也就是不能在客户机器上注册自己的provider,那需要manifest文件.这样采集回来的.etl文件如果 ...
- spring整合mybatis使用<context:property-placeholder>时的坑
背景 最近项目要上线,需要开发一个数据迁移程序.程序的主要功能就是将一个数据库里的数据,查询出来经过一系列处理后导入另一个数据库.考虑到开发的方便快捷.自然想到用spring和mybatis整合一下. ...
- 使用ffmpeg视频编码过程中踩的一个坑
今天说说使用ffmpeg在写视频编码程序中踩的一个坑,这个坑让我花了好多时间,回头想想,非常多时候一旦思维定势真的挺难突破的.以下是不对的编码结果: ...
- 使用ByteArrayOutputStream解决IO乱码问题的踩坑记录
经过:今天在用s3接口做ceph储存的时候,要实现一个io下载的接口.需要把InputStream转成byte[],一开始,是的写法是这样的: byte[] buf = new byte[(int) ...
- vue-socket.io使用教程与踩坑记录
全手打原创,转载请标明出处:https://www.cnblogs.com/dreamsqin/p/12018866.html,多谢,=.=~ (如果对你有帮助的话请帮我点个赞啦) 请先允许我狠狠吐个 ...
- FFmpeg内存IO模式(内存区作输入或输出)
本文为作者原创,转载请注明出处:https://www.cnblogs.com/leisure_chn/p/10318145.html 所谓内存IO,在FFmpeg中叫作"buffered ...
- ffmpeg的IO操作
ffmpeg 可以通过IO操作将数据读取和存储在文件或网络中 作为数据的读取和写入地址,数据被存放在file,http, ffmpeg 不仅可以编解常用的音视频格式,还可以将数据导入/导出到各种媒介中 ...
- ffmpeg最全的命令参数
Hyper fast Audio and Video encoderusage: ffmpeg [options] [[infile options] -i infile]... {[outfile ...
随机推荐
- 第一本docker书,,持续更新中
1.查看应用是否在docker中部署成功 需要确认curl已安装 whereis curl sudo apt-get -y install curl curl localhost:8081 如果成 ...
- BZOJ1439 : YY的问题
考虑容斥,枚举哪些不存在的边选中了,剩下的不管,则可以用组合数计算方案数. 时间复杂度$O(m2^m+nm)$. #include<cstdio> const int N=550,B=10 ...
- 如何查看linux版本信息
查看系统信息 [root@root]# hostnamectl Static hostname: root Icon name: computer-desktop Chassis: desktop M ...
- KeepAlived+MySQL互为主从
http://blog.csdn.net/socho/article/details/51804720 解决Master单点问题,两台mysql互为主备,双向replication.当一master挂 ...
- 11-22 JS中级复习
1.this js的关键字, 用途:指向某一个对象. 如何判断this指向 函数(方法)内 一种以函数的方式调用(不带.) this指向winodw 一种以方法的形式调用(函数名前面带.)this指向 ...
- java 上传图片 并压缩图片大小(转)
Thumbnailator 是一个优秀的图片处理的Google开源Java类库.处理效果远比Java API的好.从API提供现有的图像文件和图像对象的类中简化了处理过程,两三行代码就能够从现有图片生 ...
- angular清除select空格
<select class="form-control" id="policy_set_id" ng-model="add.poli ...
- CSS之优先级
css的优先级 所谓CSS优先级,即是指CSS样式在浏览器中被解析的先后顺序. 样式表中的特殊性描述了不同规则的相对权重,它的基本规则是: 1 内联样式表的权值最高 sty ...
- pygame-KidsCanCode系列jumpy-part10-角色动画(上)
上一节学习如何利用spritesheet加载图片,但是player仍然是一张静态的图片,比较枯燥,我们要让它动起来! Player类,先把各种状态的图片加载起来: # 加载各种状态的图片序列 def ...
- mysql -- this is incompatible with sql_mode=only_full_group_by
select @@GLOBAL.sql_mode; set @@GLOBAL.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ER ...