资源简介
项目基于CodeBlocks (mingw)构建,编译得到一个命令行程序,使用方法如下所示(很简单吧,实际效果经过验证相当不错):
mjpeg [-f fps] [-o output.avi] [-s input.mp3] input1.jpg [input2.jpg ...]
代码片段和文件信息
/*
* jpeg.c - MJPEG creator tool (https://github.com/nanoant/mjpeg)
*
* Copyright (c) 2011 Adam Strzelecki
*
* Permission is hereby granted free of charge to any person obtaining
* a copy of this software and associated documentation files (the
* “Software“) to deal in the Software without restriction including
* without limitation the rights to use copy modify merge publish
* distribute sublicense and/or sell copies of the Software and to
* permit persons to whom the Software is furnished to do so subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND
* EXPRESS OR IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM DAMAGES OR OTHER LIABILITY WHETHER IN AN ACTION
* OF CONTRACT TORT OR OTHERWISE ARISING FROM OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include
#include
#include
#define JPEG_MARKER_MASK 0xFF00
#define JPEG_HEAD_MARKER 0xFFD8
#define JPEG_APP0_MARKER 0xFFE0
static uint16_t jpeg_markers[] = {
0xFFC0 0xFFC1 0xFFC2 0xFFC3
0xFFC5 0xFFC6 0xFFC7
0xFFC9 0xFFCA 0xFFCB
0xFFCD 0xFFCE 0xFFCF
};
typedef struct {
uint16_t marker;
uint16_t size;
} __attribute__((packed)) JPEG_CHUNK;
typedef struct {
uint8_t unknown;
uint16_t height;
uint16_t width;
} __attribute__((packed)) JPEG_SIZE;
int jpeg_size(const char *path int *width int *height)
{
JPEG_CHUNK chunk;
JPEG_SIZE size;
int ret = 0 i;
FILE *in = fopen(path “rb“);
if(!in) return 0;
if(fread(&chunk.marker 1 sizeof(chunk.marker) in) == sizeof(chunk.marker)) {
chunk.marker = ntohs(chunk.marker);
if(chunk.marker == JPEG_HEAD_MARKER) {
while(!ret) {
if(fread(&chunk 1 sizeof(chunk) in) != sizeof(chunk)) break;
chunk.marker = ntohs(chunk.marker);
chunk.size = ntohs(chunk.size);
if((chunk.marker & JPEG_MARKER_MASK) != JPEG_MARKER_MASK) break;
for(i = 0; i < sizeof(jpeg_markers) / sizeof(*jpeg_markers); i++) {
if(chunk.marker == jpeg_markers[i]) {
if(fread(&size 1 sizeof(size) in) != sizeof(size)) {
ret = 0; break;
}
if(width) *width = ntohs(size.width);
if(height) *height = ntohs(size.height);
ret = 1;
break;
}
}
fseek(in chunk.size - sizeof(chunk.size) SEEK_CUR);
}
}
}
fclose(in);
return ret;
}
- 上一篇:EX4_TO_MQ4_2019.rar
- 下一篇:汇编打字游戏课程设计
相关资源
- 研华采集卡驱动 DAQNavi_SDK_Drivers_4.1.
- u=42331341031682387629和fm=26和gp=0.jpg
- u=40738214643431246218和fm=26和gp=0.jpg
- AVI解析工具视频解析工具
- v4l2 QT MJPEG格式 视频采集+屏幕显示+图
- jpg转bin工具
- DELPHI写的JPG,BMP图片压缩程序源码
- edjpgcom 图片合成工具
- avid media composer 资料
- unoconv-0.5-1.el6.rf.noarch.rpmunoconv命令插件
- aview的安装包
- VC GDI+ 窗口截图内存BMP转JPG压缩、JP
- 读取以及写入Jpg图片内的Exif信息
- JPG图片伪装器,任意文件伪装为图片
- JPG、PNG、GIF等图像格式转换为SVG矢量
- DCM转jpg的库
- avilib将JPEG数据封装成AVI视频
- Behavior Designer Samples_2019-10-16
- 编程素材 系统常用动画 GIF及AVI格式
- edjpgcom|图片中插入一句话
- Latex转换工具JPGBMP GIF TIF PNG 转化成e
- BehaviorDesignerTutorials.unitypackage
- VC中GDI方法在Picture控件中显示PNG、b
- Navicat Premlum For MAC 注册机(破解工具
- navicat premium 破解注册机
- LJ-Navigator 2 .txt
- JPG图片文件捆绑工具
- 解析Navicat导出链接密码.zip
- mjpg-streamer视频流服务器移植手册绝对
- System.Windows.Forms.DataVisualization.dll 3
评论
共有 条评论