代码拉取完成,页面将自动刷新
同步操作将从 吴堉民/rkisp_demo_lite 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* 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;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。