之前已经实现了摄像头读取数据的模块(video)和数据转换模块(convert)。后面的图像缩放、合并和显示用了数码相框中的源码。
现在要做的是将所有的代码整合起来,即写出main函数。
main函数中要做的事情:
首先是一系列的初始化
然后又一个while(1)循环:
2.1 读入摄像头数据
2.2 转换视频数据格式:转换为RGB数据
2.3 缩放图像大小:如果图像分辨率大于LCD的分辨率,则缩放
2.4 合并图像数据:合并进framebuffer中
2.5 把framebuffer中的数据刷到LCD上,显示
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <config.h>
//三大模块:显示、视频数据读取和转换模块
#include <disp_manager.h>
#include <video_manager.h>
#include <convert_manager.h>
#include <render.h>
#include <string.h>#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>/* video2lcd </dev/video0,1,...> */
int main(int argc,