(原)关于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 ...
随机推荐
- npm install出错,npm ERR! code EINTEGRITY npm ERR! Verification failed while extracting url-parse@1.4.3
npm install时出现以下错误: npm ERR! code EINTEGRITY npm ERR! Verification failed while extracting url-parse ...
- 反射与内置方法str del
1.反射 用字符串来操作类或者对象的属性 class People:# country= 'china'# def __init__(self,name):# self.name= name## de ...
- windows上redis添加密码
命令: config get requirepass config set requirepass pwd redis-server.exe redis-windows.conf. auth pw ...
- phpExcel导入大数据量情况下内存溢出解决方案
PHPExcel版本:1.7.6+ 在不进行特殊设置的情况下,phpExcel将读取的单元格信息保存在内存中,我们可以通过 PHPExcel_Settings::setCacheStorageMeth ...
- Python基础-修改excel、redis、接口开发、组织代码
pymysql模块补充内容 1. 游标.description():显示表的字段属性 (什么是游标:游标用于交互式应用,就好比word里的光标一样,要修改某个地方,要先把光标移动到这里) 用好这个方法 ...
- PHP03
PHP03 1.提交地址: action.用户点击提交后,发送请求的地址.一般为了便于维护,最常见的是提交给当前文件,然后在当前文件判断是否为表单提交请求,表单的处理逻辑放在Html之前,为了避免写死 ...
- springmvc中select可以绑定enum中所有数据的方法
public enum States { AK("AK"), AL("AL"), AR("AR"), AZ("AZ"), ...
- nginx配置实例
user root root; worker_processes ; #error_log logs/error.log; #error_log logs/error.log notice; #err ...
- HashMap代码解析
hashmap (jdk 1.7)使用 “数组-链表” 方式进行存储,图形化表示如下: 即,前面是一个数组,后面跟一个链表,那么数据结构这个对应到HashMap的代码里面是什么样子的呢? 在HashM ...
- Docker 管理工具 Portainer部署
Docker 管理工具 Portainer部署 一.官网 官网:http://www.portainer.io 演示地址:http://demo.portainer.io 用户名:admin 密码:t ...