资源简介
media-ctl工具,实现Linux视频采集通道的配置,此版本适用于DaVinci平台,在DM3730平台上测试通过。
代码片段和文件信息
/*
* Media controller test application
*
* Copyright (C) 2010 Ideas on board SPRL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not write to the Free Software Foundation Inc.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “media.h“
#include “options.h“
#include “subdev.h“
#include “tools.h“
/* -----------------------------------------------------------------------------
* Printing
*/
static struct {
const char *name;
enum v4l2_mbus_pixelcode code;
} mbus_formats[] = {
{ “Y8“ V4L2_MBUS_FMT_Y8_1X8}
{ “YUYV“ V4L2_MBUS_FMT_YUYV8_1X16 }
//{ “UYVY“ V4L2_MBUS_FMT_UYVY8_1X16 }
{ “UYVY“ V4L2_MBUS_FMT_UYVY8_2X8 } //+chenbolin 20130122
{ “SGRBG10“ V4L2_MBUS_FMT_SGRBG10_1X10 }
{ “SGRBG10_DPCM8“ V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 }
};
static const char *pixelcode_to_string(enum v4l2_mbus_pixelcode code)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(mbus_formats); ++i) {
if (mbus_formats[i].code == code)
return mbus_formats[i].name;
}
return “unknown“;
}
static enum v4l2_mbus_pixelcode string_to_pixelcode(const char *string
unsigned int length)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(mbus_formats); ++i) {
if (strncmp(mbus_formats[i].name string length) == 0)
break;
}
if (i == ARRAY_SIZE(mbus_formats))
return (enum v4l2_mbus_pixelcode)-1;
return mbus_formats[i].code;
}
static void v4l2_subdev_print_format(struct media_entity *entity
unsigned int pad enum v4l2_subdev_format_whence which)
{
struct v4l2_mbus_framefmt format;
struct v4l2_rect rect;
int ret;
ret = v4l2_subdev_get_format(entity &format pad which);
if (ret != 0)
return;
printf(“[%s %ux%u“ pixelcode_to_string(format.code)
format.width format.height);
ret = v4l2_subdev_get_crop(entity &rect pad which);
if (ret == 0)
printf(“ (%u%u)/%ux%u“ rect.left rect.top
rect.width rect.height);
printf(“]“);
}
static const char *media_entity_type_to_string(unsigned type)
{
static const struct {
__u32 type;
const char *name;
} types[] = {
{ MEDIA_ENTITY_TYPE_DEVNODE “No
- 上一篇:media-ctl 工具
- 下一篇:嵌入式linux下移动图像监测小项目motion
评论
共有 条评论