From 09a6ae09fc9a147f7d460c3b8ecbc08e972ff147 Mon Sep 17 00:00:00 2001 From: fgwt202412 <191263616+fgwt202412@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:42:39 -0500 Subject: [PATCH] FG-2933: Add CompressedAudio schema --- .../exportTypeScriptSchemas.test.ts.snap | 26 +++++++++ internal/schemas.ts | 26 +++++++++ package.json | 2 +- ros_foxglove_msgs/ros1/CompressedAudio.msg | 17 ++++++ ros_foxglove_msgs/ros2/CompressedAudio.msg | 17 ++++++ schemas/README.md | 56 +++++++++++++++++++ schemas/flatbuffer/CompressedAudio.fbs | 23 ++++++++ schemas/jsonschema/CompressedAudio.json | 33 +++++++++++ schemas/jsonschema/index.ts | 34 +++++++++++ schemas/omgidl/foxglove/CompressedAudio.idl | 23 ++++++++ schemas/proto/foxglove/CompressedAudio.proto | 23 ++++++++ schemas/ros1/CompressedAudio.msg | 17 ++++++ schemas/ros2/CompressedAudio.msg | 17 ++++++ schemas/typescript/CompressedAudio.ts | 24 ++++++++ schemas/typescript/index.ts | 1 + 15 files changed, 338 insertions(+), 1 deletion(-) create mode 100644 ros_foxglove_msgs/ros1/CompressedAudio.msg create mode 100644 ros_foxglove_msgs/ros2/CompressedAudio.msg create mode 100644 schemas/flatbuffer/CompressedAudio.fbs create mode 100644 schemas/jsonschema/CompressedAudio.json create mode 100644 schemas/omgidl/foxglove/CompressedAudio.idl create mode 100644 schemas/proto/foxglove/CompressedAudio.proto create mode 100644 schemas/ros1/CompressedAudio.msg create mode 100644 schemas/ros2/CompressedAudio.msg create mode 100644 schemas/typescript/CompressedAudio.ts diff --git a/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap b/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap index 7ee534d..b0076b7 100644 --- a/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap +++ b/internal/__snapshots__/exportTypeScriptSchemas.test.ts.snap @@ -236,6 +236,31 @@ export type CompressedVideo = { */ format: string; }; +", + "CompressedAudio" => "// Generated by https://github.com/foxglove/schemas +// Options: {} + +import { Time } from "./Time"; + +/** A single frame of a compressed audio bitstream */ +export type CompressedAudio = { + /** Timestamp of audio frame */ + timestamp: Time; + + /** + * Compressed audio frame data. + * + * TK + */ + data: Uint8Array; + + /** + * Audio format. + * + * Supported values: \`opus\`. + */ + format: string; +}; ", "CylinderPrimitive" => "// Generated by https://github.com/foxglove/schemas // Options: {} @@ -1104,6 +1129,7 @@ export enum PositionCovarianceType { export * from "./CameraCalibration"; export * from "./CircleAnnotation"; export * from "./Color"; +export * from "./CompressedAudio"; export * from "./CompressedImage"; export * from "./CompressedVideo"; export * from "./CubePrimitive"; diff --git a/internal/schemas.ts b/internal/schemas.ts index 1bf5e5c..19c7e1b 100644 --- a/internal/schemas.ts +++ b/internal/schemas.ts @@ -843,6 +843,31 @@ Specifically, the requirements for different \`format\` values are: ], }; +const CompressedAudio: FoxgloveMessageSchema = { + type: "message", + name: "CompressedAudio", + description: "A single frame of a compressed audio bitstream", + fields: [ + { + name: "timestamp", + type: { type: "primitive", name: "time" }, + description: "Timestamp of audio frame", + }, + { + name: "data", + type: { type: "primitive", name: "bytes" }, + description: `Compressed audio frame data. + +TK`, + }, + { + name: "format", + type: { type: "primitive", name: "string" }, + description: "Audio format.\n\nSupported values: `opus`.", + }, + ], +}; + const RawImage: FoxgloveMessageSchema = { type: "message", name: "RawImage", @@ -1482,6 +1507,7 @@ export const foxgloveMessageSchemas = { Color, CompressedImage, CompressedVideo, + CompressedAudio, CylinderPrimitive, CubePrimitive, FrameTransform, diff --git a/package.json b/package.json index 787aedb..4992a43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@foxglove/schemas", - "version": "1.6.6", + "version": "1.6.7", "description": "Foxglove-defined message schemas for ROS, Protobuf, FlatBuffers, OMG IDL, and JSON", "license": "MIT", "repository": { diff --git a/ros_foxglove_msgs/ros1/CompressedAudio.msg b/ros_foxglove_msgs/ros1/CompressedAudio.msg new file mode 100644 index 0000000..90da460 --- /dev/null +++ b/ros_foxglove_msgs/ros1/CompressedAudio.msg @@ -0,0 +1,17 @@ +# foxglove_msgs/CompressedAudio +# A single frame of a compressed audio bitstream + +# Generated by https://github.com/foxglove/schemas + +# Timestamp of audio frame +time timestamp + +# Compressed audio frame data. +# +# TK +uint8[] data + +# Audio format. +# +# Supported values: `opus`. +string format diff --git a/ros_foxglove_msgs/ros2/CompressedAudio.msg b/ros_foxglove_msgs/ros2/CompressedAudio.msg new file mode 100644 index 0000000..7afd869 --- /dev/null +++ b/ros_foxglove_msgs/ros2/CompressedAudio.msg @@ -0,0 +1,17 @@ +# foxglove_msgs/msg/CompressedAudio +# A single frame of a compressed audio bitstream + +# Generated by https://github.com/foxglove/schemas + +# Timestamp of audio frame +builtin_interfaces/Time timestamp + +# Compressed audio frame data. +# +# TK +uint8[] data + +# Audio format. +# +# Supported values: `opus`. +string format diff --git a/schemas/README.md b/schemas/README.md index 3dfd5a6..97f188b 100644 --- a/schemas/README.md +++ b/schemas/README.md @@ -16,6 +16,7 @@ All schemas are generated from [schemas.ts](/internal/schemas.ts). - [CameraCalibration](#cameracalibration) - [CircleAnnotation](#circleannotation) - [Color](#color) +- [CompressedAudio](#compressedaudio) - [CompressedImage](#compressedimage) - [CompressedVideo](#compressedvideo) - [CubePrimitive](#cubeprimitive) @@ -550,6 +551,61 @@ Alpha value between 0 and 1 +## CompressedAudio + +A single frame of a compressed audio bitstream + + + + + + + + + + + + + + + + + + + + + + +
fieldtypedescription
timestamp + +time + + + +Timestamp of audio frame + +
data + +bytes + + + +Compressed audio frame data. + +TK + +
format + +string + + + +Audio format. + +Supported values: `opus`. + +
+ ## CompressedImage A compressed image diff --git a/schemas/flatbuffer/CompressedAudio.fbs b/schemas/flatbuffer/CompressedAudio.fbs new file mode 100644 index 0000000..48f8462 --- /dev/null +++ b/schemas/flatbuffer/CompressedAudio.fbs @@ -0,0 +1,23 @@ +// Generated by https://github.com/foxglove/schemas + +include "Time.fbs"; + +namespace foxglove; + +/// A single frame of a compressed audio bitstream +table CompressedAudio { + /// Timestamp of audio frame + timestamp:Time (id: 0); + + /// Compressed audio frame data. + /// + /// TK + data:[uint8] (id: 1); + + /// Audio format. + /// + /// Supported values: `opus`. + format:string (id: 2); +} + +root_type CompressedAudio; diff --git a/schemas/jsonschema/CompressedAudio.json b/schemas/jsonschema/CompressedAudio.json new file mode 100644 index 0000000..763393c --- /dev/null +++ b/schemas/jsonschema/CompressedAudio.json @@ -0,0 +1,33 @@ +{ + "title": "foxglove.CompressedAudio", + "description": "A single frame of a compressed audio bitstream", + "$comment": "Generated by https://github.com/foxglove/schemas", + "type": "object", + "properties": { + "timestamp": { + "type": "object", + "title": "time", + "properties": { + "sec": { + "type": "integer", + "minimum": 0 + }, + "nsec": { + "type": "integer", + "minimum": 0, + "maximum": 999999999 + } + }, + "description": "Timestamp of audio frame" + }, + "data": { + "type": "string", + "contentEncoding": "base64", + "description": "Compressed audio frame data.\n\nTK" + }, + "format": { + "type": "string", + "description": "Audio format.\n\nSupported values: `opus`." + } + } +} diff --git a/schemas/jsonschema/index.ts b/schemas/jsonschema/index.ts index 22da45f..7143fdb 100644 --- a/schemas/jsonschema/index.ts +++ b/schemas/jsonschema/index.ts @@ -369,6 +369,40 @@ export const CompressedVideo = { } }; +export const CompressedAudio = { + "title": "foxglove.CompressedAudio", + "description": "A single frame of a compressed audio bitstream", + "$comment": "Generated by https://github.com/foxglove/schemas", + "type": "object", + "properties": { + "timestamp": { + "type": "object", + "title": "time", + "properties": { + "sec": { + "type": "integer", + "minimum": 0 + }, + "nsec": { + "type": "integer", + "minimum": 0, + "maximum": 999999999 + } + }, + "description": "Timestamp of audio frame" + }, + "data": { + "type": "string", + "contentEncoding": "base64", + "description": "Compressed audio frame data.\n\nTK" + }, + "format": { + "type": "string", + "description": "Audio format.\n\nSupported values: `opus`." + } + } +}; + export const CylinderPrimitive = { "title": "foxglove.CylinderPrimitive", "description": "A primitive representing a cylinder, elliptic cylinder, or truncated cone", diff --git a/schemas/omgidl/foxglove/CompressedAudio.idl b/schemas/omgidl/foxglove/CompressedAudio.idl new file mode 100644 index 0000000..45042d6 --- /dev/null +++ b/schemas/omgidl/foxglove/CompressedAudio.idl @@ -0,0 +1,23 @@ +// Generated by https://github.com/foxglove/schemas + +#include "foxglove/Time.idl" + +module foxglove { + +// A single frame of a compressed audio bitstream +struct CompressedAudio { + // Timestamp of audio frame + Time timestamp; + + // Compressed audio frame data. + // + // TK + sequence data; + + // Audio format. + // + // Supported values: `opus`. + string format; +}; + +}; diff --git a/schemas/proto/foxglove/CompressedAudio.proto b/schemas/proto/foxglove/CompressedAudio.proto new file mode 100644 index 0000000..7f26ae8 --- /dev/null +++ b/schemas/proto/foxglove/CompressedAudio.proto @@ -0,0 +1,23 @@ +// Generated by https://github.com/foxglove/schemas + +syntax = "proto3"; + +import "google/protobuf/timestamp.proto"; + +package foxglove; + +// A single frame of a compressed audio bitstream +message CompressedAudio { + // Timestamp of audio frame + google.protobuf.Timestamp timestamp = 1; + + // Compressed audio frame data. + // + // TK + bytes data = 2; + + // Audio format. + // + // Supported values: `opus`. + string format = 3; +} diff --git a/schemas/ros1/CompressedAudio.msg b/schemas/ros1/CompressedAudio.msg new file mode 100644 index 0000000..90da460 --- /dev/null +++ b/schemas/ros1/CompressedAudio.msg @@ -0,0 +1,17 @@ +# foxglove_msgs/CompressedAudio +# A single frame of a compressed audio bitstream + +# Generated by https://github.com/foxglove/schemas + +# Timestamp of audio frame +time timestamp + +# Compressed audio frame data. +# +# TK +uint8[] data + +# Audio format. +# +# Supported values: `opus`. +string format diff --git a/schemas/ros2/CompressedAudio.msg b/schemas/ros2/CompressedAudio.msg new file mode 100644 index 0000000..7afd869 --- /dev/null +++ b/schemas/ros2/CompressedAudio.msg @@ -0,0 +1,17 @@ +# foxglove_msgs/msg/CompressedAudio +# A single frame of a compressed audio bitstream + +# Generated by https://github.com/foxglove/schemas + +# Timestamp of audio frame +builtin_interfaces/Time timestamp + +# Compressed audio frame data. +# +# TK +uint8[] data + +# Audio format. +# +# Supported values: `opus`. +string format diff --git a/schemas/typescript/CompressedAudio.ts b/schemas/typescript/CompressedAudio.ts new file mode 100644 index 0000000..b689379 --- /dev/null +++ b/schemas/typescript/CompressedAudio.ts @@ -0,0 +1,24 @@ +// Generated by https://github.com/foxglove/schemas +// Options: {} + +import { Time } from "./Time"; + +/** A single frame of a compressed audio bitstream */ +export type CompressedAudio = { + /** Timestamp of audio frame */ + timestamp: Time; + + /** + * Compressed audio frame data. + * + * TK + */ + data: Uint8Array; + + /** + * Audio format. + * + * Supported values: `opus`. + */ + format: string; +}; diff --git a/schemas/typescript/index.ts b/schemas/typescript/index.ts index 17d8755..3d03544 100644 --- a/schemas/typescript/index.ts +++ b/schemas/typescript/index.ts @@ -2,6 +2,7 @@ export * from "./ArrowPrimitive"; export * from "./CameraCalibration"; export * from "./CircleAnnotation"; export * from "./Color"; +export * from "./CompressedAudio"; export * from "./CompressedImage"; export * from "./CompressedVideo"; export * from "./CubePrimitive";