- May 23, 2021
MySQL增加、删除、修改列
日常开发中,总是免不了对表结构的增改删,这里记录针对表列的一些常用MySQL操作的语句。
- Nov 24, 2020
Chromium中的FFMpeg glue
使用ffmpeg打开音视频文件,解封状,即做Demuxer时,需要用到函数
avformat_open_input
,该函数有两种使用方式。 第一种是传入文件名,由该API创建AVFormatContext
,如下:int main() { AVFormatContext* format_context = nullptr; if (avformat_open_input(&format_context, argv[1], NULL, NULL) != 0) { return -1; } return 0; }
另一种是提供自定义的字节流IO,即提供
AVIOContext
结构,下面的例子来源chromium的media模块。 先看一下创建AVIOContext的avio_alloc_context
函数声明。AVIOContext *avio_alloc_context( unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t (*seek)(void *opaque, int64_t offset, int whence));`
可以看到需要提供
read
,write
,seek
这三个操作,opaque
是自定义的数据。其中write
不是必须的,一般解封装也不需要写入。在chromium里面,定义了FFmpegURLProtocol
接口来抽象各种输入。 ```cpp class MEDIA_EXPORT FFmpegURLProtocol { public: // Read the given amount of bytes into data, returns the number of bytes read // if successful, kReadError otherwise. virtual int Read(int size, uint8_t* data) = 0; - Apr 12, 2020
使用Docker安装Mongo
跟安装MySQL的形式差不多,先创建数据存储Volume,之后使用
docker pull mongo
直接拉取镜像再运行。 指定初始化的帐号密码,存储路径,对外端口等 - Aug 5, 2019
通过ssh端口转发访问数据库
某天收到需求,要求导出线上环境的数据库中的数据。线上数据库配置了IP白名单,只能通过白名单上的机器访问。其中有一台公共跳板机可以访问,只是该跳板机没有mysql,又不允许安装。
- Jun 6, 2019
使用Docker安装Redis
比起在Docker中安装MySQL,安装Redis方便很多,因为使用Redis一般是用为缓存,就减少了使用Volume保存数据的麻烦。
Posts