1 Star 0 Fork 7

sklink/rkisp_demo_lite

forked from 吴堉民/rkisp_demo_lite 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.c 2.57 KB
一键复制 编辑 原始数据 按行查看 历史
吴堉民 提交于 2020-11-22 18:51 +08:00 . first commit
/*
* Copyright (C) Yumin Wu <wuyuminst@163.com>
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL), available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include "rk_ispv4l2.h"
#if 0
#define DBG(...) do { fprintf(stderr, __VA_ARGS__); } while (0)
#else
#define DBG(...) do {} while (0)
#endif
#define DEV_NODE "/dev/video19"
#define OUT_FILE "/data/capture.yuv"
#define WIDTH 1920
#define HEIGHT 1080
static int i;
static int skipCnt = 30;
static int outputCnt = 3;
static int wCnt = 0;
static FILE *fp;
void demo_callback(int src_fd, const void *ptr, unsigned int size, int w, int h)
{
DBG("%s: w = %d, h = %d\n", __func__, w, h);
if(i > skipCnt) {
if(wCnt < outputCnt && fp) {
printf(">\n");
fwrite(ptr, size, 1, fp);
fflush(fp);
wCnt++;
}
} else {
i++;
}
}
int main(int argc, char **argv)
{
int ret;
printf("rk_ispv4l2: demo begin\n");
fp = fopen(OUT_FILE, "w+");
if(fp == NULL) {
printf("%s: open out_file error!\n", __func__);
exit(EXIT_FAILURE);
}
ret = rk_ispv4l2_init(DEV_NODE, demo_callback, WIDTH, HEIGHT);
if(ret) {
printf("%s: rk_ispv4l2_init failed\n", __func__);
exit(EXIT_FAILURE);
}
sleep(5);
if(fp)
fclose(fp);
rk_ispv4l2_exit();
printf("rk_ispv4l2: demo end\n");
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/sklink/rkisp_demo_lite.git
git@gitee.com:sklink/rkisp_demo_lite.git
sklink
rkisp_demo_lite
rkisp_demo_lite
master

搜索帮助