@foxglove/extension 2.39.2 → 2.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxglove/extension",
3
- "version": "2.39.2",
3
+ "version": "2.40.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Foxglove Technologies",
@@ -80,6 +80,55 @@ export namespace Experimental {
80
80
  source: string;
81
81
  };
82
82
 
83
+ /**
84
+ * The arguments you pass to {@link ExtensionContext.registerVideoDecoder}
85
+ * when you want to register a custom video decoder.
86
+ *
87
+ * @category Video decoders
88
+ */
89
+ export type RegisterVideoDecoderArgs = {
90
+ /**
91
+ * Builder function that creates decoder instances, provided as a string. The function receives
92
+ * callbacks for output frames and errors, and returns a decoder backend instance.
93
+ *
94
+ * See {@link VideoFrameDecoderBuilder} for the function signature of the builder function,
95
+ *
96
+ * IMPORTANT: The factory must be serializable (no imports or external closures). Extensions
97
+ * must embed or otherwise manage any external resources (e.g., WASM or script assets) required
98
+ * by the decoder.
99
+ */
100
+ decoderBuilderSource: string;
101
+
102
+ /** Human-readable name for display in the app interface. */
103
+ displayName: string;
104
+
105
+ /**
106
+ * Unique identifier for this decoder.
107
+ *
108
+ * Must be stable across extension versions and unique across all extensions. Recommended
109
+ * format: "org.example.decoder-name" or similar namespaced format.
110
+ */
111
+ id: string;
112
+ };
113
+
114
+ /**
115
+ * Abstract video decoder interface that both native VideoDecoder and custom decoders can
116
+ * implement.
117
+ *
118
+ * @category Video decoders
119
+ */
120
+ export type VideoFrameDecoder = Pick<
121
+ VideoDecoder,
122
+ "close" | "configure" | "decode" | "reset" | "state"
123
+ >;
124
+
125
+ /**
126
+ * Factory function that creates decoder instances
127
+ *
128
+ * @category Video decoders
129
+ */
130
+ export type VideoFrameDecoderBuilder = (init: VideoDecoderInit) => VideoFrameDecoder;
131
+
83
132
  export interface ExtensionContext extends BaseExtensionContext {
84
133
  /**
85
134
  * Register a data loader to add support for additional file formats.
@@ -147,6 +196,14 @@ export namespace Experimental {
147
196
  * @param source
148
197
  */
149
198
  registerUserScriptUtility(args: RegisterUserScriptUtilityArgs): void;
199
+
200
+ /**
201
+ * Register a custom video decoder backend.
202
+ *
203
+ * This allows extensions to provide custom video decoders for codecs that may not be supported
204
+ * by the native WebCodecs API.
205
+ */
206
+ registerVideoDecoder(args: RegisterVideoDecoderArgs): void;
150
207
  }
151
208
 
152
209
  export interface ExtensionModule {