# Mojom Interface Definition Language (IDL)
This document is a subset of the [Mojo documentation](/mojo/README.md).
[TOC]
## Overview
Mojom is the IDL for Mojo interfaces. Given a `.mojom` file, the
[bindings
generator](https://cs.chromium.org/chromium/src/mojo/public/tools/bindings/) can
output bindings for any supported language: **C++**, **JavaScript**, or
**Java**.
For a trivial example consider the following hypothetical Mojom file we write to
`//services/widget/public/mojom/frobinator.mojom`:
```
module widget.mojom;
interface Frobinator {
Frobinate();
};
```
This defines a single [interface](#Interfaces) named `Frobinator` in a
[module](#Modules) named `widget.mojom` (and thus fully qualified in Mojom as
`widget.mojom.Frobinator`.) Note that many interfaces and/or other types of
definitions (structs, enums, *etc.*) may be included in a single Mojom file.
If we add a corresponding GN target to
`//services/widget/public/mojom/BUILD.gn`:
```
import("mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
sources = [
"frobinator.mojom",
]
}
```
and then build this target:
```
ninja -C out/r services/widget/public/mojom
```
we'll find several generated sources in our output directory:
```
out/r/gen/services/widget/public/mojom/frobinator.mojom.cc
out/r/gen/services/widget/public/mojom/frobinator.mojom.h
out/r/gen/services/widget/public/mojom/frobinator.mojom-shared.h
etc...
```
Each of these generated source modules includes a set of definitions
representing the Mojom contents in C++. You can also build or depend on suffixed
target names to get bindings for other languages. For example,
```
ninja -C out/r services/widget/public/mojom:mojom_js
ninja -C out/r services/widget/public/mojom:mojom_java
```
would generate JavaScript and Java bindings respectively, in the same generated
output directory.
For more details regarding the generated
outputs please see
[documentation for individual target languages](#Generated-Code-For-Target-Languages).
## Mojom Syntax
Mojom IDL allows developers to define **structs**, **unions**, **interfaces**,
**constants**, and **enums**, all within the context of a **module**. These
definitions are used to generate code in the supported target languages at build
time.
Mojom files may **import** other Mojom files in order to reference their
definitions.
### Primitive Types
Mojom supports a few basic data types which may be composed into structs or used
for message parameters.
| Type | Description
|-------------------------------|-------------------------------------------------------|
| `bool` | Boolean type (`true` or `false`.)
| `int8`, `uint8` | Signed or unsigned 8-bit integer.
| `int16`, `uint16` | Signed or unsigned 16-bit integer.
| `int32`, `uint32` | Signed or unsigned 32-bit integer.
| `int64`, `uint64` | Signed or unsigned 64-bit integer.
| `float`, `double` | 32- or 64-bit floating point number.
| `string` | UTF-8 encoded string.
| `array<T>` | Array of any Mojom type *T*; for example, `array<uint8>` or `array<array<string>>`.
| `array<T, N>` | Fixed-length array of any Mojom type *T*. The parameter *N* must be an integral constant.
| `map<S, T>` | Associated array maping values of type *S* to values of type *T*. *S* may be a `string`, `enum`, or numeric type.
| `handle` | Generic Mojo handle. May be any type of handle, including a wrapped native platform handle.
| `handle<message_pipe>` | Generic message pipe handle.
| `handle<shared_buffer>` | Shared buffer handle.
| `handle<data_pipe_producer>` | Data pipe producer handle.
| `handle<data_pipe_consumer>` | Data pipe consumer handle.
| `handle<platform>` | A native platform/OS handle.
| *`pending_remote<InterfaceType>`* | Any user-defined Mojom interface type. This is sugar for a strongly-typed message pipe handle which should eventually be used to make outgoing calls on the interface.
| *`pending_receiver<InterfaceType>`* | A pending receiver for any user-defined Mojom interface type. This is sugar for a more strongly-typed message pipe handle which is expected to receive request messages and should therefore eventually be bound to an implementation of the interface.
| *`pending_associated_remote<InterfaceType>`* | An associated interface handle. See [Associated Interfaces](#Associated-Interfaces)
| *`pending_associated_receiver<InterfaceType>`* | A pending associated receiver. See [Associated Interfaces](#Associated-Interfaces)
| *T*? | An optional (nullable) value. Primitive numeric types (integers, floats, booleans, and enums) are not nullable. All other types are nullable.
### Modules
Every Mojom file may optionally specify a single **module** to which it belongs.
This is used strictly for aggregating all defined symbols therein within a
common Mojom namespace. The specific impact this has on generated bindings code
varies for each target language. For example, if the following Mojom is used to
generate bindings:
```
module business.stuff;
interface MoneyGenerator {
GenerateMoney();
};
```
Generated C++ bindings will define a class interface `MoneyGenerator` in the
`business::stuff` namespace, while Java bindings will define an interface
`MoneyGenerator` in the `org.chromium.business.stuff` package. JavaScript
bindings at this time are unaffected by module declarations.
**NOTE:** By convention in the Chromium codebase, **all** Mojom files should
declare a module name with at least (and preferably exactly) one top-level name
as well as an inner `mojom` module suffix. *e.g.*, `chrome.mojom`,
`business.mojom`, *etc.*
This convention makes it easy to tell which symbols are generated by Mojom when
reading non-Mojom code, and it also avoids namespace collisions in the fairly
common scenario where you have a real C++ or Java `Foo` along with a
corresponding Mojom `Foo` for its serialized representation.
### Imports
If your Mojom references definitions from other Mojom files, you must **import**
those files. Import syntax is as follows:
```
import "services/widget/public/mojom/frobinator.mojom";
```
Import paths are always relative to the top-level directory.
Note that circular imports are **not** supported.
### Structs
Structs are defined using the **struct** keyword, and they provide a way to
group related fields together:
``` cpp
struct StringPair {
string first;
string second;
};
```
Struct fields may be comprised of any of the types listed above in the
[Primitive Types](#Primitive-Types) section.
Default values may be specified as long as they are constant:
``` cpp
struct Request {
int32 id = -1;
string details;
};
```
What follows is a fairly
comprehensive example using the supported field types:
``` cpp
struct StringPair {
string first;
string second;
};
enum AnEnum {
YES,
NO
};
interface SampleInterface {
DoStuff();
};
struct AllTheThings {
// Note that these types can never be marked nullable!
bool boolean_value;
int8 signed_8bit_value = 42;
uint8 unsigned_8bit_value;
int16 signed_16bit_value;
uint16 unsigned_16bit_value;
int32 signed_32bit_value;
uint32 unsigned_32bit_value;
int64 signed_64bit_value;
uint64 unsigned_64bit_value;
float float_value_32bit;
double float_value_64bit;
AnEnum enum_value = AnEnum.YES;
// Strings may be nullable.
string? maybe_a_string_maybe_not;
// Structs may contain other structs. These may also be nullable.
StringPair some_strings;
StringPair? maybe_some_more_strings;
// In fact structs can also be nested, though in pr
没有合适的资源?快使用搜索试试~ 我知道了~
(源码)基于libcamera的相机控制与图像处理系统.zip
共1102个文件
svg:282个
cpp:273个
h:241个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 140 浏览量
2024-11-25
03:46:00
上传
评论
收藏 1.95MB ZIP 举报
温馨提示
# 基于libcamera的相机控制与图像处理系统 ## 项目简介 本项目是一个基于libcamera库的相机控制与图像处理系统,旨在为Linux、Android和ChromeOS等操作系统提供复杂的相机支持。libcamera是一个开源的相机支持库,能够处理相机的硬件图像处理操作,并提供现代相机支持给基于Linux的系统。 ## 项目的主要特性和功能 ### 1. 相机管理与控制 相机设备管理通过libcamera库管理多个相机设备,支持相机的添加和移除。 相机配置提供相机配置接口,支持设置相机的曝光时间、增益、白平衡等参数。 相机状态管理管理相机的状态,包括启动、停止、配置等操作。 ### 2. 图像处理与格式转换 图像格式支持支持多种图像格式,包括YUV、RGB、Raw Bayer等,并提供格式转换功能。 图像处理算法内置多种图像处理算法,如自动曝光控制(AGC)、自动白平衡(AWB)、镜头阴影校正(LSC)等。
资源推荐
资源详情
资源评论
收起资源包目录
(源码)基于libcamera的相机控制与图像处理系统.zip (1102个子文件)
meson.build 6KB
meson.build 6KB
meson.build 6KB
meson.build 3KB
meson.build 3KB
meson.build 3KB
meson.build 3KB
meson.build 2KB
meson.build 2KB
meson.build 2KB
meson.build 2KB
meson.build 2KB
meson.build 2KB
meson.build 2KB
meson.build 2KB
meson.build 1KB
meson.build 1KB
meson.build 1KB
meson.build 1KB
meson.build 1019B
meson.build 1014B
meson.build 950B
meson.build 938B
meson.build 906B
meson.build 811B
meson.build 792B
meson.build 790B
meson.build 681B
meson.build 659B
meson.build 653B
meson.build 629B
meson.build 607B
meson.build 583B
meson.build 583B
meson.build 563B
meson.build 519B
meson.build 517B
meson.build 510B
meson.build 489B
meson.build 461B
meson.build 445B
meson.build 437B
meson.build 433B
meson.build 429B
meson.build 427B
meson.build 417B
meson.build 415B
meson.build 410B
meson.build 382B
meson.build 372B
meson.build 259B
meson.build 225B
meson.build 221B
meson.build 212B
meson.build 211B
meson.build 211B
meson.build 169B
meson.build 161B
meson.build 161B
meson.build 148B
meson.build 142B
meson.build 141B
meson.build 127B
meson.build 115B
meson.build 113B
meson.build 102B
meson.build 93B
meson.build 89B
meson.build 78B
meson.build 72B
meson.build 69B
meson.build 21B
camera_metadata_tag_info.c 109KB
camera_metadata.c 44KB
ipu3-pack.c 4KB
ipu3-unpack.c 3KB
theme.conf 110B
vimc.conf 95B
raspberrypi.cpp 69KB
v4l2_videodevice.cpp 65KB
camera_capabilities.cpp 53KB
camera_device.cpp 50KB
raspberrypi.cpp 48KB
simple.cpp 48KB
ipu3.cpp 46KB
camera.cpp 43KB
formats.cpp 34KB
options.cpp 34KB
controls.cpp 33KB
rkisp1.cpp 31KB
agc.cpp 30KB
log.cpp 30KB
v4l2_device.cpp 30KB
camera_sensor.cpp 29KB
v4l2_subdevice.cpp 29KB
color_space.cpp 28KB
alsc.cpp 27KB
pipeline_handler.cpp 27KB
geometry.cpp 26KB
utils.cpp 25KB
共 1102 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
t0_54coder
- 粉丝: 2573
- 资源: 5614
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- java保险理赔系统源码带本地搭建教程数据库 MySQL源码类型 WebForm
- Star-CCM+ 汽车的 CFD 分析
- 按层次遍历二叉树(python实现)
- 【java毕业设计】光影视频源码(springboot+vue+mysql+说明文档+LW).zip
- 【java毕业设计】毕业设计成绩管理系统的设计与实现源码(springboot+vue+mysql+说明文档+LW).zip
- 【java毕业设计】在线课程管理系统的设计与实现源码(springboot+vue+mysql+说明文档+LW).zip
- C++ Primer Plus第6版.pdf
- 【在线商城系统】需求分析-系统设计-源码开发
- Springboot 集成Beetl模板
- 【java毕业设计】房屋交易平台的设计与实现源码(springboot+vue+mysql+说明文档+LW).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功