@voyagerx/libav.js 0.0.1

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.
@@ -0,0 +1,4874 @@
1
+ /*
2
+ * Copyright (C) 2021-2024 Yahweasel and contributors
3
+ *
4
+ * Permission to use, copy, modify, and/or distribute this software for any
5
+ * purpose with or without fee is hereby granted.
6
+ *
7
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14
+ */
15
+
16
+ declare namespace LibAV {
17
+ /**
18
+ * Things in libav.js with Worker transfer characteristics.
19
+ */
20
+ export interface LibAVTransferable {
21
+ /**
22
+ * The elements to pass as transfers when passing this object to/from
23
+ * workers.
24
+ */
25
+ libavjsTransfer?: Transferable[];
26
+ }
27
+
28
+ /**
29
+ * Frames, as taken/given by libav.js.
30
+ */
31
+ export interface Frame extends LibAVTransferable {
32
+ /**
33
+ * The actual frame data. For non-planar audio data, this is a typed array.
34
+ * For planar audio data, this is an array of typed arrays, one per plane.
35
+ * For video data, this is a single Uint8Array, and its layout is described
36
+ * by the layout field.
37
+ */
38
+ data: any;
39
+
40
+ /**
41
+ * Sample format or pixel format.
42
+ */
43
+ format: number;
44
+
45
+ /**
46
+ * Video only. Layout of each plane within the data array. `offset` is the
47
+ * base offset of the plane, and `stride` is what libav calls `linesize`.
48
+ * This layout format is from WebCodecs.
49
+ */
50
+ layout?: {offset: number, stride: number}[];
51
+
52
+ /**
53
+ * Presentation timestamp for this frame. Units depends on surrounding
54
+ * context. Will always be set by libav.js, but libav.js will accept frames
55
+ * from outside that do not have this set.
56
+ */
57
+ pts?: number, ptshi?: number;
58
+
59
+ /**
60
+ * Base for timestamps of this frame.
61
+ */
62
+ time_base_num?: number, time_base_den?: number;
63
+
64
+ /**
65
+ * Audio only. Channel layout. It is possible for only one of this and
66
+ * channels to be set.
67
+ */
68
+ channel_layout?: number;
69
+
70
+ /**
71
+ * Audio only. Number of channels. It is possible for only one of this and
72
+ * channel_layout to be set.
73
+ */
74
+ channels?: number;
75
+
76
+ /**
77
+ * Audio only. Number of samples in the frame.
78
+ */
79
+ nb_samples?: number;
80
+
81
+ /**
82
+ * Audio only. Sample rate.
83
+ */
84
+ sample_rate?: number;
85
+
86
+ /**
87
+ * Video only. Width of frame.
88
+ */
89
+ width?: number;
90
+
91
+ /**
92
+ * Video only. Height of frame.
93
+ */
94
+ height?: number;
95
+
96
+ /**
97
+ * Video only. Cropping rectangle of the frame.
98
+ */
99
+ crop?: {top: number, bottom: number, left: number, right: number};
100
+
101
+ /**
102
+ * Video only. Sample aspect ratio (pixel aspect ratio), as a numerator and
103
+ * denominator. 0 is interpreted as 1 (square pixels).
104
+ */
105
+ sample_aspect_ratio?: [number, number];
106
+
107
+ /**
108
+ * Is this a keyframe? (1=yes, 0=maybe)
109
+ */
110
+ key_frame?: number;
111
+
112
+ /**
113
+ * Picture type (libav-specific value)
114
+ */
115
+ pict_type?: number;
116
+ }
117
+
118
+ /**
119
+ * Packets, as taken/given by libav.js.
120
+ */
121
+ export interface Packet extends LibAVTransferable {
122
+ /**
123
+ * The actual data represented by this packet.
124
+ */
125
+ data: Uint8Array;
126
+
127
+ /**
128
+ * Presentation timestamp.
129
+ */
130
+ pts?: number, ptshi?: number;
131
+
132
+ /**
133
+ * Decoding timestamp.
134
+ */
135
+ dts?: number, dtshi?: number;
136
+
137
+ /**
138
+ * Base for timestamps of this packet.
139
+ */
140
+ time_base_num?: number, time_base_den?: number;
141
+
142
+ /**
143
+ * Index of this stream within a surrounding muxer/demuxer.
144
+ */
145
+ stream_index?: number;
146
+
147
+ /**
148
+ * Packet flags, as defined by ffmpeg.
149
+ */
150
+ flags?: number;
151
+
152
+ /**
153
+ * Duration of this packet. Rarely used.
154
+ */
155
+ duration?: number, durationhi?: number;
156
+
157
+ /**
158
+ * Side data. Codec-specific.
159
+ */
160
+ side_data?: any;
161
+ }
162
+
163
+ /**
164
+ * Stream information, as returned by ff_init_demuxer_file.
165
+ */
166
+ export interface Stream {
167
+ /**
168
+ * Pointer to the underlying AVStream.
169
+ */
170
+ ptr: number;
171
+
172
+ /**
173
+ * Index of this stream.
174
+ */
175
+ index: number;
176
+
177
+ /**
178
+ * Codec parameters.
179
+ */
180
+ codecpar: number;
181
+
182
+ /**
183
+ * Type of codec (audio or video, typically)
184
+ */
185
+ codec_type: number;
186
+
187
+ /**
188
+ * Codec identifier.
189
+ */
190
+ codec_id: number;
191
+
192
+ /**
193
+ * Base for timestamps of packets in this stream.
194
+ */
195
+ time_base_num: number, time_base_den: number;
196
+
197
+ /**
198
+ * Duration of this stream in time_base units.
199
+ */
200
+ duration_time_base: number;
201
+
202
+ /**
203
+ * Duration of this stream in seconds.
204
+ */
205
+ duration: number;
206
+
207
+
208
+ start_time: number;
209
+ start_timehi: number;
210
+
211
+ rotation: number;
212
+ }
213
+
214
+ /**
215
+ * Codec parameters, if copied out.
216
+ */
217
+ export interface CodecParameters {
218
+ /**
219
+ * General type of the encoded data.
220
+ */
221
+ codec_type: number;
222
+
223
+ /**
224
+ * Specific type of the encoded data (the codec used).
225
+ */
226
+ codec_id: number;
227
+
228
+ /**
229
+ * Additional information about the codec (corresponds to the AVI FOURCC).
230
+ */
231
+ codec_tag?: number;
232
+
233
+ /**
234
+ * Extra binary data needed for initializing the decoder, codec-dependent.
235
+ *
236
+ * Must be allocated with av_malloc() and will be freed by
237
+ * avcodec_parameters_free(). The allocated size of extradata must be at
238
+ * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
239
+ * bytes zeroed.
240
+ */
241
+ extradata?: Uint8Array;
242
+
243
+ /**
244
+ * - video: the pixel format, the value corresponds to enum AVPixelFormat.
245
+ * - audio: the sample format, the value corresponds to enum AVSampleFormat.
246
+ */
247
+ format: number;
248
+
249
+ /**
250
+ * Bitrate. Not always set.
251
+ */
252
+ bit_rate?: number;
253
+ bit_ratehi?: number;
254
+
255
+ /**
256
+ * Codec-specific bitstream restrictions that the stream conforms to.
257
+ */
258
+ profile?: number;
259
+ level?: number;
260
+
261
+ /**
262
+ * Video only. The dimensions of the video frame in pixels.
263
+ */
264
+ width?: number;
265
+ height?: number;
266
+
267
+ /**
268
+ * Video only. Additional colorspace characteristics.
269
+ */
270
+ color_range?: number;
271
+ color_primaries?: number;
272
+ color_trc?: number;
273
+ color_space?: number;
274
+ chroma_location?: number;
275
+
276
+ /**
277
+ * Audio only. The number of audio samples per second.
278
+ */
279
+ sample_rate?: number;
280
+
281
+ /**
282
+ * Audio only. The channel layout and number of channels.
283
+ */
284
+ channel_layoutmask?: number;
285
+ channels?: number;
286
+ }
287
+
288
+ /**
289
+ * Settings used to set up a filter.
290
+ */
291
+ export interface FilterIOSettings {
292
+ /**
293
+ * Type of filterchain, as an AVMEDIA_TYPE_*. If unset, defaults to
294
+ * AVMEDIA_TYPE_AUDIO.
295
+ */
296
+ type?: number;
297
+
298
+ /**
299
+ * The timebase for this filterchain. If unset, [1, frame_rate] or [1,
300
+ * sample_rate] will be used.
301
+ */
302
+ time_base?: [number, number];
303
+
304
+ /**
305
+ * Video only. Framerate of the input.
306
+ */
307
+ frame_rate?: number;
308
+
309
+ /**
310
+ * Audio only. Sample rate of the input.
311
+ */
312
+ sample_rate?: number;
313
+
314
+ /**
315
+ * Video only. Pixel format of the input.
316
+ */
317
+ pix_fmt?: number;
318
+
319
+ /**
320
+ * Audio only. Sample format of the input.
321
+ */
322
+ sample_fmt?: number;
323
+
324
+ /**
325
+ * Video only. Width of the input.
326
+ */
327
+ width?: number;
328
+
329
+ /**
330
+ * Video only. Height of the input.
331
+ */
332
+ height?: number;
333
+
334
+ /**
335
+ * Audio only. Channel layout of the input. Note that there is no
336
+ * "channels"; you must describe a layout.
337
+ */
338
+ channel_layout?: number;
339
+
340
+ /**
341
+ * Audio only, output only, optional. Size of an audio frame.
342
+ */
343
+ frame_size?: number;
344
+ }
345
+
346
+ /**
347
+ * Supported properties of an AVCodecContext, used by ff_init_encoder.
348
+ */
349
+ export interface AVCodecContextProps {
350
+ bit_rate?: number;
351
+ bit_ratehi?: number;
352
+ channel_layout?: number;
353
+ channel_layouthi?: number;
354
+ channels?: number;
355
+ frame_size?: number;
356
+ framerate_num?: number;
357
+ framerate_den?: number;
358
+ gop_size?: number;
359
+ height?: number;
360
+ keyint_min?: number;
361
+ level?: number;
362
+ pix_fmt?: number;
363
+ profile?: number;
364
+ rc_max_rate?: number;
365
+ rc_max_ratehi?: number;
366
+ rc_min_rate?: number;
367
+ rc_min_ratehi?: number;
368
+ sample_aspect_ratio_num?: number;
369
+ sample_aspect_ratio_den?: number;
370
+ sample_fmt?: number;
371
+ sample_rate?: number;
372
+ qmax?: number;
373
+ qmin?: number;
374
+ width?: number;
375
+ }
376
+
377
+ /**
378
+ * Static properties that are accessible both on the LibAV wrapper and on each
379
+ * libav instance.
380
+ */
381
+ export interface LibAVStatic {
382
+ /**
383
+ * Convert a pair of 32-bit integers representing a single 64-bit integer
384
+ * into a 64-bit float. 64-bit floats are only sufficient for 53 bits of
385
+ * precision, so for very large values, this is lossy.
386
+ * @param lo Low bits of the pair
387
+ * @param hi High bits of the pair
388
+ */
389
+ i64tof64(lo: number, hi: number): number;
390
+
391
+ /**
392
+ * Convert a 64-bit floating-point number into a pair of 32-bit integers
393
+ * representing a single 64-bit integer. The 64-bit float must actually
394
+ * contain an integer value for this result to be accurate.
395
+ * @param val Floating-point value to convert
396
+ * @returns [low bits, high bits]
397
+ */
398
+ f64toi64(val: number): [number, number];
399
+
400
+ /**
401
+ * Convert a pair of 32-bit integers representing a single 64-bit integer
402
+ * into a BigInt. Requires BigInt support, of course.
403
+ * @param lo Low bits of the pair
404
+ * @param hi High bits of the pair
405
+ */
406
+ i64ToBigInt(lo: number, hi: number): BigInt;
407
+
408
+ /**
409
+ * Convert a (64-bit) BigInt into a pair of 32-bit integers. Requires BigInt
410
+ * support, of course.
411
+ * @param val BigInt value to convert
412
+ * @returns [low bits, high bits]
413
+ */
414
+ bigIntToi64(val: BigInt): [number, number];
415
+
416
+ // Enumerations:
417
+ AV_OPT_SEARCH_CHILDREN: number;
418
+ AVMEDIA_TYPE_UNKNOWN: number;
419
+ AVMEDIA_TYPE_VIDEO: number;
420
+ AVMEDIA_TYPE_AUDIO: number;
421
+ AVMEDIA_TYPE_DATA: number;
422
+ AVMEDIA_TYPE_SUBTITLE: number;
423
+ AVMEDIA_TYPE_ATTACHMENT: number;
424
+ AV_SAMPLE_FMT_NONE: number;
425
+ AV_SAMPLE_FMT_U8: number;
426
+ AV_SAMPLE_FMT_S16: number;
427
+ AV_SAMPLE_FMT_S32: number;
428
+ AV_SAMPLE_FMT_FLT: number;
429
+ AV_SAMPLE_FMT_DBL: number;
430
+ AV_SAMPLE_FMT_U8P: number;
431
+ AV_SAMPLE_FMT_S16P: number;
432
+ AV_SAMPLE_FMT_S32P: number;
433
+ AV_SAMPLE_FMT_FLTP: number;
434
+ AV_SAMPLE_FMT_DBLP: number;
435
+ AV_SAMPLE_FMT_S64: number;
436
+ AV_SAMPLE_FMT_S64P: number;
437
+ AV_SAMPLE_FMT_NB: number;
438
+ AV_PIX_FMT_NONE: number;
439
+ AV_PIX_FMT_YUV420P: number;
440
+ AV_PIX_FMT_YUYV422: number;
441
+ AV_PIX_FMT_RGB24: number;
442
+ AV_PIX_FMT_BGR24: number;
443
+ AV_PIX_FMT_YUV422P: number;
444
+ AV_PIX_FMT_YUV444P: number;
445
+ AV_PIX_FMT_YUV410P: number;
446
+ AV_PIX_FMT_YUV411P: number;
447
+ AV_PIX_FMT_GRAY8: number;
448
+ AV_PIX_FMT_MONOWHITE: number;
449
+ AV_PIX_FMT_MONOBLACK: number;
450
+ AV_PIX_FMT_PAL8: number;
451
+ AV_PIX_FMT_YUVJ420P: number;
452
+ AV_PIX_FMT_YUVJ422P: number;
453
+ AV_PIX_FMT_YUVJ444P: number;
454
+ AV_PIX_FMT_UYVY422: number;
455
+ AV_PIX_FMT_UYYVYY411: number;
456
+ AV_PIX_FMT_BGR8: number;
457
+ AV_PIX_FMT_BGR4: number;
458
+ AV_PIX_FMT_BGR4_BYTE: number;
459
+ AV_PIX_FMT_RGB8: number;
460
+ AV_PIX_FMT_RGB4: number;
461
+ AV_PIX_FMT_RGB4_BYTE: number;
462
+ AV_PIX_FMT_NV12: number;
463
+ AV_PIX_FMT_NV21: number;
464
+ AV_PIX_FMT_ARGB: number;
465
+ AV_PIX_FMT_RGBA: number;
466
+ AV_PIX_FMT_ABGR: number;
467
+ AV_PIX_FMT_BGRA: number;
468
+ AV_PIX_FMT_GRAY16BE: number;
469
+ AV_PIX_FMT_GRAY16LE: number;
470
+ AV_PIX_FMT_YUV440P: number;
471
+ AV_PIX_FMT_YUVJ440P: number;
472
+ AV_PIX_FMT_YUVA420P: number;
473
+ AV_PIX_FMT_RGB48BE: number;
474
+ AV_PIX_FMT_RGB48LE: number;
475
+ AV_PIX_FMT_RGB565BE: number;
476
+ AV_PIX_FMT_RGB565LE: number;
477
+ AV_PIX_FMT_RGB555BE: number;
478
+ AV_PIX_FMT_RGB555LE: number;
479
+ AV_PIX_FMT_BGR565BE: number;
480
+ AV_PIX_FMT_BGR565LE: number;
481
+ AV_PIX_FMT_BGR555BE: number;
482
+ AV_PIX_FMT_BGR555LE: number;
483
+ AVIO_FLAG_READ: number;
484
+ AVIO_FLAG_WRITE: number;
485
+ AVIO_FLAG_READ_WRITE: number;
486
+ AVIO_FLAG_NONBLOCK: number;
487
+ AVIO_FLAG_DIRECT: number;
488
+ AVSEEK_FLAG_BACKWARD: number;
489
+ AVSEEK_FLAG_BYTE: number;
490
+ AVSEEK_FLAG_ANY: number;
491
+ AVSEEK_FLAG_FRAME: number;
492
+ AVDISCARD_NONE: number;
493
+ AVDISCARD_DEFAULT: number;
494
+ AVDISCARD_NONREF: number;
495
+ AVDISCARD_BIDIR: number;
496
+ AVDISCARD_NONINTRA: number;
497
+ AVDISCARD_NONKEY: number;
498
+ AVDISCARD_ALL: number;
499
+ AV_LOG_QUIET: number;
500
+ AV_LOG_PANIC: number;
501
+ AV_LOG_FATAL: number;
502
+ AV_LOG_ERROR: number;
503
+ AV_LOG_WARNING: number;
504
+ AV_LOG_INFO: number;
505
+ AV_LOG_VERBOSE: number;
506
+ AV_LOG_DEBUG: number;
507
+ AV_LOG_TRACE: number;
508
+ AV_PKT_FLAG_KEY: number;
509
+ AV_PKT_FLAG_CORRUPT: number;
510
+ AV_PKT_FLAG_DISCARD: number;
511
+ AV_PKT_FLAG_TRUSTED: number;
512
+ AV_PKT_FLAG_DISPOSABLE: number;
513
+ E2BIG: number;
514
+ EPERM: number;
515
+ EADDRINUSE: number;
516
+ EADDRNOTAVAIL: number;
517
+ EAFNOSUPPORT: number;
518
+ EAGAIN: number;
519
+ EALREADY: number;
520
+ EBADF: number;
521
+ EBADMSG: number;
522
+ EBUSY: number;
523
+ ECANCELED: number;
524
+ ECHILD: number;
525
+ ECONNABORTED: number;
526
+ ECONNREFUSED: number;
527
+ ECONNRESET: number;
528
+ EDEADLOCK: number;
529
+ EDESTADDRREQ: number;
530
+ EDOM: number;
531
+ EDQUOT: number;
532
+ EEXIST: number;
533
+ EFAULT: number;
534
+ EFBIG: number;
535
+ EHOSTUNREACH: number;
536
+ EIDRM: number;
537
+ EILSEQ: number;
538
+ EINPROGRESS: number;
539
+ EINTR: number;
540
+ EINVAL: number;
541
+ EIO: number;
542
+ EISCONN: number;
543
+ EISDIR: number;
544
+ ELOOP: number;
545
+ EMFILE: number;
546
+ EMLINK: number;
547
+ EMSGSIZE: number;
548
+ EMULTIHOP: number;
549
+ ENAMETOOLONG: number;
550
+ ENETDOWN: number;
551
+ ENETRESET: number;
552
+ ENETUNREACH: number;
553
+ ENFILE: number;
554
+ ENOBUFS: number;
555
+ ENODEV: number;
556
+ ENOENT: number;
557
+ AVERROR_EOF: number;
558
+ }
559
+
560
+ /**
561
+ * A LibAV instance, created by LibAV.LibAV (*not* the LibAV wrapper itself)
562
+ */
563
+ export interface LibAV extends LibAVStatic {
564
+ /**
565
+ * The operating mode of this libav.js instance. Each operating mode has
566
+ * different constraints.
567
+ */
568
+ libavjsMode: "direct" | "worker" | "threads";
569
+
570
+ /**
571
+ * If the operating mode is "worker", the worker itself.
572
+ */
573
+ worker?: Worker;
574
+
575
+ /**
576
+ * Return number of bytes per sample.
577
+ *
578
+ * @param sample_fmt the sample format
579
+ * @return number of bytes per sample or zero if unknown for the given
580
+ * sample format
581
+ */
582
+ av_get_bytes_per_sample(sample_fmt: number): Promise<number>;
583
+ /**
584
+ * Compare two timestamps each in its own time base.
585
+ *
586
+ * @return One of the following values:
587
+ * - -1 if `ts_a` is before `ts_b`
588
+ * - 1 if `ts_a` is after `ts_b`
589
+ * - 0 if they represent the same position
590
+ *
591
+ * @warning
592
+ * The result of the function is undefined if one of the timestamps is outside
593
+ * the `int64_t` range when represented in the other's timebase.
594
+ */
595
+ av_compare_ts_js(ts_a: number,tb_a: number,ts_b: number,tb_b: number,a4: number,a5: number,a6: number,a7: number): Promise<number>;
596
+ /**
597
+ * @defgroup opt_set_funcs Option setting functions
598
+ * @{
599
+ * Those functions set the field of obj with the given name to value.
600
+ *
601
+ * @param[in] obj A struct whose first element is a pointer to an AVClass.
602
+ * @param[in] name the name of the field to set
603
+ * @param[in] val The value to set. In case of av_opt_set() if the field is not
604
+ * of a string type, then the given string is parsed.
605
+ * SI postfixes and some named scalars are supported.
606
+ * If the field is of a numeric type, it has to be a numeric or named
607
+ * scalar. Behavior with more than one scalar and +- infix operators
608
+ * is undefined.
609
+ * If the field is of a flags type, it has to be a sequence of numeric
610
+ * scalars or named flags separated by '+' or '-'. Prefixing a flag
611
+ * with '+' causes it to be set without affecting the other flags;
612
+ * similarly, '-' unsets a flag.
613
+ * If the field is of a dictionary type, it has to be a ':' separated list of
614
+ * key=value parameters. Values containing ':' special characters must be
615
+ * escaped.
616
+ * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN
617
+ * is passed here, then the option may be set on a child of obj.
618
+ *
619
+ * @return 0 if the value has been set, or an AVERROR code in case of
620
+ * error:
621
+ * AVERROR_OPTION_NOT_FOUND if no matching option exists
622
+ * AVERROR(ERANGE) if the value is out of range
623
+ * AVERROR(EINVAL) if the value is not valid
624
+ */
625
+ av_opt_set(obj: number,name: string,val: string,search_flags: number): Promise<number>;
626
+ av_opt_set_int_list_js(a0: number,a1: string,a2: number,a3: number,a4: number,a5: number): Promise<number>;
627
+ /**
628
+ * Allocate an AVFrame and set its fields to default values. The resulting
629
+ * struct must be freed using av_frame_free().
630
+ *
631
+ * @return An AVFrame filled with default values or NULL on failure.
632
+ *
633
+ * @note this only allocates the AVFrame itself, not the data buffers. Those
634
+ * must be allocated through other means, e.g. with av_frame_get_buffer() or
635
+ * manually.
636
+ */
637
+ av_frame_alloc(): Promise<number>;
638
+ /**
639
+ * Create a new frame that references the same data as src.
640
+ *
641
+ * This is a shortcut for av_frame_alloc()+av_frame_ref().
642
+ *
643
+ * @return newly created AVFrame on success, NULL on error.
644
+ */
645
+ av_frame_clone(src: number,a1: number): Promise<number>;
646
+ /**
647
+ * Free the frame and any dynamically allocated objects in it,
648
+ * e.g. extended_data. If the frame is reference counted, it will be
649
+ * unreferenced first.
650
+ *
651
+ * @param frame frame to be freed. The pointer will be set to NULL.
652
+ */
653
+ av_frame_free(frame: number): Promise<void>;
654
+ /**
655
+ * Allocate new buffer(s) for audio or video data.
656
+ *
657
+ * The following fields must be set on frame before calling this function:
658
+ * - format (pixel format for video, sample format for audio)
659
+ * - width and height for video
660
+ * - nb_samples and ch_layout for audio
661
+ *
662
+ * This function will fill AVFrame.data and AVFrame.buf arrays and, if
663
+ * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
664
+ * For planar formats, one buffer will be allocated for each plane.
665
+ *
666
+ * @warning: if frame already has been allocated, calling this function will
667
+ * leak memory. In addition, undefined behavior can occur in certain
668
+ * cases.
669
+ *
670
+ * @param frame frame in which to store the new buffers.
671
+ * @param align Required buffer size alignment. If equal to 0, alignment will be
672
+ * chosen automatically for the current CPU. It is highly
673
+ * recommended to pass 0 here unless you know what you are doing.
674
+ *
675
+ * @return 0 on success, a negative AVERROR on error.
676
+ */
677
+ av_frame_get_buffer(frame: number,align: number): Promise<number>;
678
+ /**
679
+ * Ensure that the frame data is writable, avoiding data copy if possible.
680
+ *
681
+ * Do nothing if the frame is writable, allocate new buffers and copy the data
682
+ * if it is not. Non-refcounted frames behave as non-writable, i.e. a copy
683
+ * is always made.
684
+ *
685
+ * @return 0 on success, a negative AVERROR on error.
686
+ *
687
+ * @see av_frame_is_writable(), av_buffer_is_writable(),
688
+ * av_buffer_make_writable()
689
+ */
690
+ av_frame_make_writable(frame: number): Promise<number>;
691
+ /**
692
+ * Set up a new reference to the data described by the source frame.
693
+ *
694
+ * Copy frame properties from src to dst and create a new reference for each
695
+ * AVBufferRef from src.
696
+ *
697
+ * If src is not reference counted, new buffers are allocated and the data is
698
+ * copied.
699
+ *
700
+ * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
701
+ * or newly allocated with av_frame_alloc() before calling this
702
+ * function, or undefined behavior will occur.
703
+ *
704
+ * @return 0 on success, a negative AVERROR on error
705
+ */
706
+ av_frame_ref(dst: number,src: number): Promise<number>;
707
+ /**
708
+ * Unreference all the buffers referenced by frame and reset the frame fields.
709
+ */
710
+ av_frame_unref(frame: number): Promise<void>;
711
+ ff_frame_rescale_ts_js(a0: number,a1: number,a2: number,a3: number,a4: number): Promise<void>;
712
+ /**
713
+ * Get the current log level
714
+ *
715
+ * @see lavu_log_constants
716
+ *
717
+ * @return Current log level
718
+ */
719
+ av_log_get_level(): Promise<number>;
720
+ /**
721
+ * Set the log level
722
+ *
723
+ * @see lavu_log_constants
724
+ *
725
+ * @param level Logging level
726
+ */
727
+ av_log_set_level(level: number): Promise<void>;
728
+ /**
729
+ * Allocate an AVPacket and set its fields to default values. The resulting
730
+ * struct must be freed using av_packet_free().
731
+ *
732
+ * @return An AVPacket filled with default values or NULL on failure.
733
+ *
734
+ * @note this only allocates the AVPacket itself, not the data buffers. Those
735
+ * must be allocated through other means such as av_new_packet.
736
+ *
737
+ * @see av_new_packet
738
+ */
739
+ av_packet_alloc(): Promise<number>;
740
+ /**
741
+ * Create a new packet that references the same data as src.
742
+ *
743
+ * This is a shortcut for av_packet_alloc()+av_packet_ref().
744
+ *
745
+ * @return newly created AVPacket on success, NULL on error.
746
+ *
747
+ * @see av_packet_alloc
748
+ * @see av_packet_ref
749
+ */
750
+ av_packet_clone(src: number): Promise<number>;
751
+ /**
752
+ * Free the packet, if the packet is reference counted, it will be
753
+ * unreferenced first.
754
+ *
755
+ * @param pkt packet to be freed. The pointer will be set to NULL.
756
+ * @note passing NULL is a no-op.
757
+ */
758
+ av_packet_free(pkt: number): Promise<void>;
759
+ /**
760
+ * Allocate new information of a packet.
761
+ *
762
+ * @param pkt packet
763
+ * @param type side information type
764
+ * @param size side information size
765
+ * @return pointer to fresh allocated data or NULL otherwise
766
+ */
767
+ av_packet_new_side_data(pkt: number,type: number,size: number): Promise<number>;
768
+ /**
769
+ * Setup a new reference to the data described by a given packet
770
+ *
771
+ * If src is reference-counted, setup dst as a new reference to the
772
+ * buffer in src. Otherwise allocate a new buffer in dst and copy the
773
+ * data from src into it.
774
+ *
775
+ * All the other fields are copied from src.
776
+ *
777
+ * @see av_packet_unref
778
+ *
779
+ * @param dst Destination packet. Will be completely overwritten.
780
+ * @param src Source packet
781
+ *
782
+ * @return 0 on success, a negative AVERROR on error. On error, dst
783
+ * will be blank (as if returned by av_packet_alloc()).
784
+ */
785
+ av_packet_ref(dst: number,src: number): Promise<number>;
786
+ /**
787
+ * Convert valid timing fields (timestamps / durations) in a packet from one
788
+ * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
789
+ * ignored.
790
+ *
791
+ * @param pkt packet on which the conversion will be performed
792
+ * @param tb_src source timebase, in which the timing fields in pkt are
793
+ * expressed
794
+ * @param tb_dst destination timebase, to which the timing fields will be
795
+ * converted
796
+ */
797
+ av_packet_rescale_ts_js(pkt: number,tb_src: number,tb_dst: number,a3: number,a4: number): Promise<void>;
798
+ /**
799
+ * Wipe the packet.
800
+ *
801
+ * Unreference the buffer referenced by the packet and reset the
802
+ * remaining packet fields to their default values.
803
+ *
804
+ * @param pkt The packet to be unreferenced.
805
+ */
806
+ av_packet_unref(pkt: number): Promise<void>;
807
+ /**
808
+ * Duplicate a string.
809
+ *
810
+ * @param s String to be duplicated
811
+ * @return Pointer to a newly-allocated string containing a
812
+ * copy of `s` or `NULL` if the string cannot be allocated
813
+ * @see av_strndup()
814
+ */
815
+ av_strdup(s: string): Promise<number>;
816
+ /**
817
+ * Get a frame with filtered data from sink and put it in frame.
818
+ *
819
+ * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
820
+ * @param frame pointer to an allocated frame that will be filled with data.
821
+ * The data must be freed using av_frame_unref() / av_frame_free()
822
+ *
823
+ * @return
824
+ * - >= 0 if a frame was successfully returned.
825
+ * - AVERROR(EAGAIN) if no frames are available at this point; more
826
+ * input frames must be added to the filtergraph to get more output.
827
+ * - AVERROR_EOF if there will be no more output frames on this sink.
828
+ * - A different negative AVERROR code in other failure cases.
829
+ */
830
+ av_buffersink_get_frame(ctx: number,frame: number): Promise<number>;
831
+ av_buffersink_get_time_base_num(a0: number): Promise<number>;
832
+ av_buffersink_get_time_base_den(a0: number): Promise<number>;
833
+ /**
834
+ * Set the frame size for an audio buffer sink.
835
+ *
836
+ * All calls to av_buffersink_get_buffer_ref will return a buffer with
837
+ * exactly the specified number of samples, or AVERROR(EAGAIN) if there is
838
+ * not enough. The last buffer at EOF will be padded with 0.
839
+ */
840
+ av_buffersink_set_frame_size(ctx: number,frame_size: number): Promise<void>;
841
+ ff_buffersink_set_ch_layout(a0: number,a1: number,a2: number): Promise<number>;
842
+ /**
843
+ * Add a frame to the buffer source.
844
+ *
845
+ * By default, if the frame is reference-counted, this function will take
846
+ * ownership of the reference(s) and reset the frame. This can be controlled
847
+ * using the flags.
848
+ *
849
+ * If this function returns an error, the input frame is not touched.
850
+ *
851
+ * @param buffer_src pointer to a buffer source context
852
+ * @param frame a frame, or NULL to mark EOF
853
+ * @param flags a combination of AV_BUFFERSRC_FLAG_*
854
+ * @return >= 0 in case of success, a negative AVERROR code
855
+ * in case of failure
856
+ */
857
+ av_buffersrc_add_frame_flags(buffer_src: number,frame: number,flags: number): Promise<number>;
858
+ /**
859
+ * Free a filter context. This will also remove the filter from its
860
+ * filtergraph's list of filters.
861
+ *
862
+ * @param filter the filter to free
863
+ */
864
+ avfilter_free(filter: number): Promise<void>;
865
+ /**
866
+ * Get a filter definition matching the given name.
867
+ *
868
+ * @param name the filter name to find
869
+ * @return the filter definition, if any matching one is registered.
870
+ * NULL if none found.
871
+ */
872
+ avfilter_get_by_name(name: string): Promise<number>;
873
+ /**
874
+ * Allocate a filter graph.
875
+ *
876
+ * @return the allocated filter graph on success or NULL.
877
+ */
878
+ avfilter_graph_alloc(): Promise<number>;
879
+ /**
880
+ * Check validity and configure all the links and formats in the graph.
881
+ *
882
+ * @param graphctx the filter graph
883
+ * @param log_ctx context used for logging
884
+ * @return >= 0 in case of success, a negative AVERROR code otherwise
885
+ */
886
+ avfilter_graph_config(graphctx: number,log_ctx: number): Promise<number>;
887
+ /**
888
+ * Create and add a filter instance into an existing graph.
889
+ * The filter instance is created from the filter filt and inited
890
+ * with the parameter args. opaque is currently ignored.
891
+ *
892
+ * In case of success put in *filt_ctx the pointer to the created
893
+ * filter instance, otherwise set *filt_ctx to NULL.
894
+ *
895
+ * @param name the instance name to give to the created filter instance
896
+ * @param graph_ctx the filter graph
897
+ * @return a negative AVERROR error code in case of failure, a non
898
+ * negative value otherwise
899
+ */
900
+ avfilter_graph_create_filter_js(filt_ctx: number,filt: string,name: string,args: number,opaque: number): Promise<number>;
901
+ /**
902
+ * Free a graph, destroy its links, and set *graph to NULL.
903
+ * If *graph is NULL, do nothing.
904
+ */
905
+ avfilter_graph_free(graph: number): Promise<void>;
906
+ /**
907
+ * Add a graph described by a string to a graph.
908
+ *
909
+ * @note The caller must provide the lists of inputs and outputs,
910
+ * which therefore must be known before calling the function.
911
+ *
912
+ * @note The inputs parameter describes inputs of the already existing
913
+ * part of the graph; i.e. from the point of view of the newly created
914
+ * part, they are outputs. Similarly the outputs parameter describes
915
+ * outputs of the already existing filters, which are provided as
916
+ * inputs to the parsed filters.
917
+ *
918
+ * @param graph the filter graph where to link the parsed graph context
919
+ * @param filters string to be parsed
920
+ * @param inputs linked list to the inputs of the graph
921
+ * @param outputs linked list to the outputs of the graph
922
+ * @return zero on success, a negative AVERROR code on error
923
+ */
924
+ avfilter_graph_parse(graph: number,filters: string,inputs: number,outputs: number,log_ctx: number): Promise<number>;
925
+ /**
926
+ * Allocate a single AVFilterInOut entry.
927
+ * Must be freed with avfilter_inout_free().
928
+ * @return allocated AVFilterInOut on success, NULL on failure.
929
+ */
930
+ avfilter_inout_alloc(): Promise<number>;
931
+ /**
932
+ * Free the supplied list of AVFilterInOut and set *inout to NULL.
933
+ * If *inout is NULL, do nothing.
934
+ */
935
+ avfilter_inout_free(inout: number): Promise<void>;
936
+ /**
937
+ * Link two filters together.
938
+ *
939
+ * @param src the source filter
940
+ * @param srcpad index of the output pad on the source filter
941
+ * @param dst the destination filter
942
+ * @param dstpad index of the input pad on the destination filter
943
+ * @return zero on success
944
+ */
945
+ avfilter_link(src: number,srcpad: number,dst: number,dstpad: number): Promise<number>;
946
+ /**
947
+ * Allocate an AVCodecContext and set its fields to default values. The
948
+ * resulting struct should be freed with avcodec_free_context().
949
+ *
950
+ * @param codec if non-NULL, allocate private data and initialize defaults
951
+ * for the given codec. It is illegal to then call avcodec_open2()
952
+ * with a different codec.
953
+ * If NULL, then the codec-specific defaults won't be initialized,
954
+ * which may result in suboptimal default settings (this is
955
+ * important mainly for encoders, e.g. libx264).
956
+ *
957
+ * @return An AVCodecContext filled with default values or NULL on failure.
958
+ */
959
+ avcodec_alloc_context3(codec: number): Promise<number>;
960
+ /**
961
+ * Close a given AVCodecContext and free all the data associated with it
962
+ * (but not the AVCodecContext itself).
963
+ *
964
+ * Calling this function on an AVCodecContext that hasn't been opened will free
965
+ * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
966
+ * codec. Subsequent calls will do nothing.
967
+ *
968
+ * @deprecated Do not use this function. Use avcodec_free_context() to destroy a
969
+ * codec context (either open or closed). Opening and closing a codec context
970
+ * multiple times is not supported anymore -- use multiple codec contexts
971
+ * instead.
972
+ */
973
+ avcodec_close(avctx: number): Promise<number>;
974
+ /**
975
+ * @return descriptor for given codec ID or NULL if no descriptor exists.
976
+ */
977
+ avcodec_descriptor_get(id: number): Promise<number>;
978
+ /**
979
+ * @return codec descriptor with the given name or NULL if no such descriptor
980
+ * exists.
981
+ */
982
+ avcodec_descriptor_get_by_name(name: string): Promise<number>;
983
+ /**
984
+ * Iterate over all codec descriptors known to libavcodec.
985
+ *
986
+ * @param prev previous descriptor. NULL to get the first descriptor.
987
+ *
988
+ * @return next descriptor or NULL after the last descriptor
989
+ */
990
+ avcodec_descriptor_next(prev: number): Promise<number>;
991
+ /**
992
+ * Find a registered decoder with a matching codec ID.
993
+ *
994
+ * @param id AVCodecID of the requested decoder
995
+ * @return A decoder if one was found, NULL otherwise.
996
+ */
997
+ avcodec_find_decoder(id: number): Promise<number>;
998
+ /**
999
+ * Find a registered decoder with the specified name.
1000
+ *
1001
+ * @param name name of the requested decoder
1002
+ * @return A decoder if one was found, NULL otherwise.
1003
+ */
1004
+ avcodec_find_decoder_by_name(name: string): Promise<number>;
1005
+ /**
1006
+ * Find a registered encoder with a matching codec ID.
1007
+ *
1008
+ * @param id AVCodecID of the requested encoder
1009
+ * @return An encoder if one was found, NULL otherwise.
1010
+ */
1011
+ avcodec_find_encoder(id: number): Promise<number>;
1012
+ /**
1013
+ * Find a registered encoder with the specified name.
1014
+ *
1015
+ * @param name name of the requested encoder
1016
+ * @return An encoder if one was found, NULL otherwise.
1017
+ */
1018
+ avcodec_find_encoder_by_name(name: string): Promise<number>;
1019
+ /**
1020
+ * Free the codec context and everything associated with it and write NULL to
1021
+ * the provided pointer.
1022
+ */
1023
+ avcodec_free_context(avctx: number): Promise<void>;
1024
+ /**
1025
+ * Get the name of a codec.
1026
+ * @return a static string identifying the codec; never NULL
1027
+ */
1028
+ avcodec_get_name(id: number): Promise<string>;
1029
+ /**
1030
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
1031
+ * function the context has to be allocated with avcodec_alloc_context3().
1032
+ *
1033
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
1034
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
1035
+ * retrieving a codec.
1036
+ *
1037
+ * Depending on the codec, you might need to set options in the codec context
1038
+ * also for decoding (e.g. width, height, or the pixel or audio sample format in
1039
+ * the case the information is not available in the bitstream, as when decoding
1040
+ * raw audio or video).
1041
+ *
1042
+ * Options in the codec context can be set either by setting them in the options
1043
+ * AVDictionary, or by setting the values in the context itself, directly or by
1044
+ * using the av_opt_set() API before calling this function.
1045
+ *
1046
+ * Example:
1047
+ * @code
1048
+ * av_dict_set(&opts, "b", "2.5M", 0);
1049
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
1050
+ * if (!codec)
1051
+ * exit(1);
1052
+ *
1053
+ * context = avcodec_alloc_context3(codec);
1054
+ *
1055
+ * if (avcodec_open2(context, codec, opts) < 0)
1056
+ * exit(1);
1057
+ * @endcode
1058
+ *
1059
+ * In the case AVCodecParameters are available (e.g. when demuxing a stream
1060
+ * using libavformat, and accessing the AVStream contained in the demuxer), the
1061
+ * codec parameters can be copied to the codec context using
1062
+ * avcodec_parameters_to_context(), as in the following example:
1063
+ *
1064
+ * @code
1065
+ * AVStream *stream = ...;
1066
+ * context = avcodec_alloc_context3(codec);
1067
+ * if (avcodec_parameters_to_context(context, stream->codecpar) < 0)
1068
+ * exit(1);
1069
+ * if (avcodec_open2(context, codec, NULL) < 0)
1070
+ * exit(1);
1071
+ * @endcode
1072
+ *
1073
+ * @note Always call this function before using decoding routines (such as
1074
+ * @ref avcodec_receive_frame()).
1075
+ *
1076
+ * @param avctx The context to initialize.
1077
+ * @param codec The codec to open this context for. If a non-NULL codec has been
1078
+ * previously passed to avcodec_alloc_context3() or
1079
+ * for this context, then this parameter MUST be either NULL or
1080
+ * equal to the previously passed codec.
1081
+ * @param options A dictionary filled with AVCodecContext and codec-private
1082
+ * options, which are set on top of the options already set in
1083
+ * avctx, can be NULL. On return this object will be filled with
1084
+ * options that were not found in the avctx codec context.
1085
+ *
1086
+ * @return zero on success, a negative value on error
1087
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
1088
+ * av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context()
1089
+ */
1090
+ avcodec_open2(avctx: number,codec: number,options: number): Promise<number>;
1091
+ /**
1092
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
1093
+ * function the context has to be allocated with avcodec_alloc_context3().
1094
+ *
1095
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
1096
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
1097
+ * retrieving a codec.
1098
+ *
1099
+ * Depending on the codec, you might need to set options in the codec context
1100
+ * also for decoding (e.g. width, height, or the pixel or audio sample format in
1101
+ * the case the information is not available in the bitstream, as when decoding
1102
+ * raw audio or video).
1103
+ *
1104
+ * Options in the codec context can be set either by setting them in the options
1105
+ * AVDictionary, or by setting the values in the context itself, directly or by
1106
+ * using the av_opt_set() API before calling this function.
1107
+ *
1108
+ * Example:
1109
+ * @code
1110
+ * av_dict_set(&opts, "b", "2.5M", 0);
1111
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
1112
+ * if (!codec)
1113
+ * exit(1);
1114
+ *
1115
+ * context = avcodec_alloc_context3(codec);
1116
+ *
1117
+ * if (avcodec_open2(context, codec, opts) < 0)
1118
+ * exit(1);
1119
+ * @endcode
1120
+ *
1121
+ * In the case AVCodecParameters are available (e.g. when demuxing a stream
1122
+ * using libavformat, and accessing the AVStream contained in the demuxer), the
1123
+ * codec parameters can be copied to the codec context using
1124
+ * avcodec_parameters_to_context(), as in the following example:
1125
+ *
1126
+ * @code
1127
+ * AVStream *stream = ...;
1128
+ * context = avcodec_alloc_context3(codec);
1129
+ * if (avcodec_parameters_to_context(context, stream->codecpar) < 0)
1130
+ * exit(1);
1131
+ * if (avcodec_open2(context, codec, NULL) < 0)
1132
+ * exit(1);
1133
+ * @endcode
1134
+ *
1135
+ * @note Always call this function before using decoding routines (such as
1136
+ * @ref avcodec_receive_frame()).
1137
+ *
1138
+ * @param avctx The context to initialize.
1139
+ * @param codec The codec to open this context for. If a non-NULL codec has been
1140
+ * previously passed to avcodec_alloc_context3() or
1141
+ * for this context, then this parameter MUST be either NULL or
1142
+ * equal to the previously passed codec.
1143
+ * @param options A dictionary filled with AVCodecContext and codec-private
1144
+ * options, which are set on top of the options already set in
1145
+ * avctx, can be NULL. On return this object will be filled with
1146
+ * options that were not found in the avctx codec context.
1147
+ *
1148
+ * @return zero on success, a negative value on error
1149
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
1150
+ * av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context()
1151
+ */
1152
+ avcodec_open2_js(avctx: number,codec: number,options: number): Promise<number>;
1153
+ /**
1154
+ * Allocate a new AVCodecParameters and set its fields to default values
1155
+ * (unknown/invalid/0). The returned struct must be freed with
1156
+ * avcodec_parameters_free().
1157
+ */
1158
+ avcodec_parameters_alloc(): Promise<number>;
1159
+ /**
1160
+ * Copy the contents of src to dst. Any allocated fields in dst are freed and
1161
+ * replaced with newly allocated duplicates of the corresponding fields in src.
1162
+ *
1163
+ * @return >= 0 on success, a negative AVERROR code on failure.
1164
+ */
1165
+ avcodec_parameters_copy(dst: number,src: number): Promise<number>;
1166
+ /**
1167
+ * Free an AVCodecParameters instance and everything associated with it and
1168
+ * write NULL to the supplied pointer.
1169
+ */
1170
+ avcodec_parameters_free(par: number): Promise<void>;
1171
+ /**
1172
+ * Fill the parameters struct based on the values from the supplied codec
1173
+ * context. Any allocated fields in par are freed and replaced with duplicates
1174
+ * of the corresponding fields in codec.
1175
+ *
1176
+ * @return >= 0 on success, a negative AVERROR code on failure
1177
+ */
1178
+ avcodec_parameters_from_context(par: number,codec: number): Promise<number>;
1179
+ /**
1180
+ * Fill the codec context based on the values from the supplied codec
1181
+ * parameters. Any allocated fields in codec that have a corresponding field in
1182
+ * par are freed and replaced with duplicates of the corresponding field in par.
1183
+ * Fields in codec that do not have a counterpart in par are not touched.
1184
+ *
1185
+ * @return >= 0 on success, a negative AVERROR code on failure.
1186
+ */
1187
+ avcodec_parameters_to_context(codec: number,par: number): Promise<number>;
1188
+ /**
1189
+ * Return decoded output data from a decoder or encoder (when the
1190
+ * @ref AV_CODEC_FLAG_RECON_FRAME flag is used).
1191
+ *
1192
+ * @param avctx codec context
1193
+ * @param frame This will be set to a reference-counted video or audio
1194
+ * frame (depending on the decoder type) allocated by the
1195
+ * codec. Note that the function will always call
1196
+ * av_frame_unref(frame) before doing anything else.
1197
+ *
1198
+ * @retval 0 success, a frame was returned
1199
+ * @retval AVERROR(EAGAIN) output is not available in this state - user must
1200
+ * try to send new input
1201
+ * @retval AVERROR_EOF the codec has been fully flushed, and there will be
1202
+ * no more output frames
1203
+ * @retval AVERROR(EINVAL) codec not opened, or it is an encoder without the
1204
+ * @ref AV_CODEC_FLAG_RECON_FRAME flag enabled
1205
+ * @retval "other negative error code" legitimate decoding errors
1206
+ */
1207
+ avcodec_receive_frame(avctx: number,frame: number): Promise<number>;
1208
+ /**
1209
+ * Read encoded data from the encoder.
1210
+ *
1211
+ * @param avctx codec context
1212
+ * @param avpkt This will be set to a reference-counted packet allocated by the
1213
+ * encoder. Note that the function will always call
1214
+ * av_packet_unref(avpkt) before doing anything else.
1215
+ * @retval 0 success
1216
+ * @retval AVERROR(EAGAIN) output is not available in the current state - user must
1217
+ * try to send input
1218
+ * @retval AVERROR_EOF the encoder has been fully flushed, and there will be no
1219
+ * more output packets
1220
+ * @retval AVERROR(EINVAL) codec not opened, or it is a decoder
1221
+ * @retval "another negative error code" legitimate encoding errors
1222
+ */
1223
+ avcodec_receive_packet(avctx: number,avpkt: number): Promise<number>;
1224
+ /**
1225
+ * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
1226
+ * to retrieve buffered output packets.
1227
+ *
1228
+ * @param avctx codec context
1229
+ * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
1230
+ * Ownership of the frame remains with the caller, and the
1231
+ * encoder will not write to the frame. The encoder may create
1232
+ * a reference to the frame data (or copy it if the frame is
1233
+ * not reference-counted).
1234
+ * It can be NULL, in which case it is considered a flush
1235
+ * packet. This signals the end of the stream. If the encoder
1236
+ * still has packets buffered, it will return them after this
1237
+ * call. Once flushing mode has been entered, additional flush
1238
+ * packets are ignored, and sending frames will return
1239
+ * AVERROR_EOF.
1240
+ *
1241
+ * For audio:
1242
+ * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
1243
+ * can have any number of samples.
1244
+ * If it is not set, frame->nb_samples must be equal to
1245
+ * avctx->frame_size for all frames except the last.
1246
+ * The final frame may be smaller than avctx->frame_size.
1247
+ * @retval 0 success
1248
+ * @retval AVERROR(EAGAIN) input is not accepted in the current state - user must
1249
+ * read output with avcodec_receive_packet() (once all
1250
+ * output is read, the packet should be resent, and the
1251
+ * call will not fail with EAGAIN).
1252
+ * @retval AVERROR_EOF the encoder has been flushed, and no new frames can
1253
+ * be sent to it
1254
+ * @retval AVERROR(EINVAL) codec not opened, it is a decoder, or requires flush
1255
+ * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
1256
+ * @retval "another negative error code" legitimate encoding errors
1257
+ */
1258
+ avcodec_send_frame(avctx: number,frame: number): Promise<number>;
1259
+ /**
1260
+ * Supply raw packet data as input to a decoder.
1261
+ *
1262
+ * Internally, this call will copy relevant AVCodecContext fields, which can
1263
+ * influence decoding per-packet, and apply them when the packet is actually
1264
+ * decoded. (For example AVCodecContext.skip_frame, which might direct the
1265
+ * decoder to drop the frame contained by the packet sent with this function.)
1266
+ *
1267
+ * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
1268
+ * larger than the actual read bytes because some optimized bitstream
1269
+ * readers read 32 or 64 bits at once and could read over the end.
1270
+ *
1271
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
1272
+ * before packets may be fed to the decoder.
1273
+ *
1274
+ * @param avctx codec context
1275
+ * @param[in] avpkt The input AVPacket. Usually, this will be a single video
1276
+ * frame, or several complete audio frames.
1277
+ * Ownership of the packet remains with the caller, and the
1278
+ * decoder will not write to the packet. The decoder may create
1279
+ * a reference to the packet data (or copy it if the packet is
1280
+ * not reference-counted).
1281
+ * Unlike with older APIs, the packet is always fully consumed,
1282
+ * and if it contains multiple frames (e.g. some audio codecs),
1283
+ * will require you to call avcodec_receive_frame() multiple
1284
+ * times afterwards before you can send a new packet.
1285
+ * It can be NULL (or an AVPacket with data set to NULL and
1286
+ * size set to 0); in this case, it is considered a flush
1287
+ * packet, which signals the end of the stream. Sending the
1288
+ * first flush packet will return success. Subsequent ones are
1289
+ * unnecessary and will return AVERROR_EOF. If the decoder
1290
+ * still has frames buffered, it will return them after sending
1291
+ * a flush packet.
1292
+ *
1293
+ * @retval 0 success
1294
+ * @retval AVERROR(EAGAIN) input is not accepted in the current state - user
1295
+ * must read output with avcodec_receive_frame() (once
1296
+ * all output is read, the packet should be resent,
1297
+ * and the call will not fail with EAGAIN).
1298
+ * @retval AVERROR_EOF the decoder has been flushed, and no new packets can be
1299
+ * sent to it (also returned if more than 1 flush
1300
+ * packet is sent)
1301
+ * @retval AVERROR(EINVAL) codec not opened, it is an encoder, or requires flush
1302
+ * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
1303
+ * @retval "another negative error code" legitimate decoding errors
1304
+ */
1305
+ avcodec_send_packet(avctx: number,avpkt: number): Promise<number>;
1306
+ /**
1307
+ * Find AVInputFormat based on the short name of the input format.
1308
+ */
1309
+ av_find_input_format(short_name: string): Promise<number>;
1310
+ /**
1311
+ * Allocate an AVFormatContext.
1312
+ * avformat_free_context() can be used to free the context and everything
1313
+ * allocated by the framework within it.
1314
+ */
1315
+ avformat_alloc_context(): Promise<number>;
1316
+ /**
1317
+ * Allocate an AVFormatContext for an output format.
1318
+ * avformat_free_context() can be used to free the context and
1319
+ * everything allocated by the framework within it.
1320
+ *
1321
+ * @param ctx pointee is set to the created format context,
1322
+ * or to NULL in case of failure
1323
+ * @param oformat format to use for allocating the context, if NULL
1324
+ * format_name and filename are used instead
1325
+ * @param format_name the name of output format to use for allocating the
1326
+ * context, if NULL filename is used instead
1327
+ * @param filename the name of the filename to use for allocating the
1328
+ * context, may be NULL
1329
+ *
1330
+ * @return >= 0 in case of success, a negative AVERROR code in case of
1331
+ * failure
1332
+ */
1333
+ avformat_alloc_output_context2_js(ctx: number,oformat: string,format_name: string): Promise<number>;
1334
+ /**
1335
+ * Close an opened input AVFormatContext. Free it and all its contents
1336
+ * and set *s to NULL.
1337
+ */
1338
+ avformat_close_input(s: number): Promise<void>;
1339
+ /**
1340
+ * Read packets of a media file to get stream information. This
1341
+ * is useful for file formats with no headers such as MPEG. This
1342
+ * function also computes the real framerate in case of MPEG-2 repeat
1343
+ * frame mode.
1344
+ * The logical file position is not changed by this function;
1345
+ * examined packets may be buffered for later processing.
1346
+ *
1347
+ * @param ic media file handle
1348
+ * @param options If non-NULL, an ic.nb_streams long array of pointers to
1349
+ * dictionaries, where i-th member contains options for
1350
+ * codec corresponding to i-th stream.
1351
+ * On return each dictionary will be filled with options that were not found.
1352
+ * @return >=0 if OK, AVERROR_xxx on error
1353
+ *
1354
+ * @note this function isn't guaranteed to open all the codecs, so
1355
+ * options being non-empty at return is a perfectly normal behavior.
1356
+ *
1357
+ * @todo Let the user decide somehow what information is needed so that
1358
+ * we do not waste time getting stuff the user does not need.
1359
+ */
1360
+ avformat_find_stream_info(ic: number,options: number): Promise<number>;
1361
+ /**
1362
+ * Discard all internally buffered data. This can be useful when dealing with
1363
+ * discontinuities in the byte stream. Generally works only with formats that
1364
+ * can resync. This includes headerless formats like MPEG-TS/TS but should also
1365
+ * work with NUT, Ogg and in a limited way AVI for example.
1366
+ *
1367
+ * The set of streams, the detected duration, stream parameters and codecs do
1368
+ * not change when calling this function. If you want a complete reset, it's
1369
+ * better to open a new AVFormatContext.
1370
+ *
1371
+ * This does not flush the AVIOContext (s->pb). If necessary, call
1372
+ * avio_flush(s->pb) before calling this function.
1373
+ *
1374
+ * @param s media file handle
1375
+ * @return >=0 on success, error code otherwise
1376
+ */
1377
+ avformat_flush(s: number): Promise<number>;
1378
+ /**
1379
+ * Free an AVFormatContext and all its streams.
1380
+ * @param s context to free
1381
+ */
1382
+ avformat_free_context(s: number): Promise<void>;
1383
+ /**
1384
+ * Add a new stream to a media file.
1385
+ *
1386
+ * When demuxing, it is called by the demuxer in read_header(). If the
1387
+ * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
1388
+ * be called in read_packet().
1389
+ *
1390
+ * When muxing, should be called by the user before avformat_write_header().
1391
+ *
1392
+ * User is required to call avformat_free_context() to clean up the allocation
1393
+ * by avformat_new_stream().
1394
+ *
1395
+ * @param s media file handle
1396
+ * @param c unused, does nothing
1397
+ *
1398
+ * @return newly created stream or NULL on error.
1399
+ */
1400
+ avformat_new_stream(s: number,c: number): Promise<number>;
1401
+ /**
1402
+ * Open an input stream and read the header. The codecs are not opened.
1403
+ * The stream must be closed with avformat_close_input().
1404
+ *
1405
+ * @param ps Pointer to user-supplied AVFormatContext (allocated by
1406
+ * avformat_alloc_context). May be a pointer to NULL, in
1407
+ * which case an AVFormatContext is allocated by this
1408
+ * function and written into ps.
1409
+ * Note that a user-supplied AVFormatContext will be freed
1410
+ * on failure.
1411
+ * @param url URL of the stream to open.
1412
+ * @param fmt If non-NULL, this parameter forces a specific input format.
1413
+ * Otherwise the format is autodetected.
1414
+ * @param options A dictionary filled with AVFormatContext and demuxer-private
1415
+ * options.
1416
+ * On return this parameter will be destroyed and replaced with
1417
+ * a dict containing options that were not found. May be NULL.
1418
+ *
1419
+ * @return 0 on success, a negative AVERROR on failure.
1420
+ *
1421
+ * @note If you want to use custom IO, preallocate the format context and set its pb field.
1422
+ */
1423
+ avformat_open_input(ps: number,url: string,fmt: number,options: number): Promise<number>;
1424
+ /**
1425
+ * Open an input stream and read the header. The codecs are not opened.
1426
+ * The stream must be closed with avformat_close_input().
1427
+ *
1428
+ * @param ps Pointer to user-supplied AVFormatContext (allocated by
1429
+ * avformat_alloc_context). May be a pointer to NULL, in
1430
+ * which case an AVFormatContext is allocated by this
1431
+ * function and written into ps.
1432
+ * Note that a user-supplied AVFormatContext will be freed
1433
+ * on failure.
1434
+ * @param url URL of the stream to open.
1435
+ * @param fmt If non-NULL, this parameter forces a specific input format.
1436
+ * Otherwise the format is autodetected.
1437
+ * @param options A dictionary filled with AVFormatContext and demuxer-private
1438
+ * options.
1439
+ * On return this parameter will be destroyed and replaced with
1440
+ * a dict containing options that were not found. May be NULL.
1441
+ *
1442
+ * @return 0 on success, a negative AVERROR on failure.
1443
+ *
1444
+ * @note If you want to use custom IO, preallocate the format context and set its pb field.
1445
+ */
1446
+ avformat_open_input_js(ps: string,url: number,fmt: number): Promise<number>;
1447
+ /**
1448
+ * Allocate the stream private data and write the stream header to
1449
+ * an output media file.
1450
+ *
1451
+ * @param s Media file handle, must be allocated with
1452
+ * avformat_alloc_context().
1453
+ * Its \ref AVFormatContext.oformat "oformat" field must be set
1454
+ * to the desired output format;
1455
+ * Its \ref AVFormatContext.pb "pb" field must be set to an
1456
+ * already opened ::AVIOContext.
1457
+ * @param options An ::AVDictionary filled with AVFormatContext and
1458
+ * muxer-private options.
1459
+ * On return this parameter will be destroyed and replaced with
1460
+ * a dict containing options that were not found. May be NULL.
1461
+ *
1462
+ * @retval AVSTREAM_INIT_IN_WRITE_HEADER On success, if the codec had not already been
1463
+ * fully initialized in avformat_init_output().
1464
+ * @retval AVSTREAM_INIT_IN_INIT_OUTPUT On success, if the codec had already been fully
1465
+ * initialized in avformat_init_output().
1466
+ * @retval AVERROR A negative AVERROR on failure.
1467
+ *
1468
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output.
1469
+ */
1470
+ avformat_write_header(s: number,options: number): Promise<number>;
1471
+ avformat_get_rotation(a0: number): Promise<number>;
1472
+ /**
1473
+ * Create and initialize a AVIOContext for accessing the
1474
+ * resource indicated by url.
1475
+ * @note When the resource indicated by url has been opened in
1476
+ * read+write mode, the AVIOContext can be used only for writing.
1477
+ *
1478
+ * @param s Used to return the pointer to the created AVIOContext.
1479
+ * In case of failure the pointed to value is set to NULL.
1480
+ * @param url resource to access
1481
+ * @param flags flags which control how the resource indicated by url
1482
+ * is to be opened
1483
+ * @param int_cb an interrupt callback to be used at the protocols level
1484
+ * @param options A dictionary filled with protocol-private options. On return
1485
+ * this parameter will be destroyed and replaced with a dict containing options
1486
+ * that were not found. May be NULL.
1487
+ * @return >= 0 in case of success, a negative value corresponding to an
1488
+ * AVERROR code in case of failure
1489
+ */
1490
+ avio_open2_js(s: string,url: number,flags: number,int_cb: number): Promise<number>;
1491
+ /**
1492
+ * Close the resource accessed by the AVIOContext s and free it.
1493
+ * This function can only be used if s was opened by avio_open().
1494
+ *
1495
+ * The internal buffer is automatically flushed before closing the
1496
+ * resource.
1497
+ *
1498
+ * @return 0 on success, an AVERROR < 0 on error.
1499
+ * @see avio_closep
1500
+ */
1501
+ avio_close(s: number): Promise<number>;
1502
+ /**
1503
+ * Force flushing of buffered data.
1504
+ *
1505
+ * For write streams, force the buffered data to be immediately written to the output,
1506
+ * without to wait to fill the internal buffer.
1507
+ *
1508
+ * For read streams, discard all currently buffered data, and advance the
1509
+ * reported file position to that of the underlying stream. This does not
1510
+ * read new data, and does not perform any seeks.
1511
+ */
1512
+ avio_flush(s: number): Promise<void>;
1513
+ /**
1514
+ * Find the "best" stream in the file.
1515
+ * The best stream is determined according to various heuristics as the most
1516
+ * likely to be what the user expects.
1517
+ * If the decoder parameter is non-NULL, av_find_best_stream will find the
1518
+ * default decoder for the stream's codec; streams for which no decoder can
1519
+ * be found are ignored.
1520
+ *
1521
+ * @param ic media file handle
1522
+ * @param type stream type: video, audio, subtitles, etc.
1523
+ * @param wanted_stream_nb user-requested stream number,
1524
+ * or -1 for automatic selection
1525
+ * @param related_stream try to find a stream related (eg. in the same
1526
+ * program) to this one, or -1 if none
1527
+ * @param decoder_ret if non-NULL, returns the decoder for the
1528
+ * selected stream
1529
+ * @param flags flags; none are currently defined
1530
+ *
1531
+ * @return the non-negative stream number in case of success,
1532
+ * AVERROR_STREAM_NOT_FOUND if no stream with the requested type
1533
+ * could be found,
1534
+ * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder
1535
+ *
1536
+ * @note If av_find_best_stream returns successfully and decoder_ret is not
1537
+ * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec.
1538
+ */
1539
+ av_find_best_stream(ic: number,type: number,wanted_stream_nb: number,related_stream: number,decoder_ret: number,flags: number): Promise<number>;
1540
+ /**
1541
+ * Return the name of sample_fmt, or NULL if sample_fmt is not
1542
+ * recognized.
1543
+ */
1544
+ av_get_sample_fmt_name(sample_fmt: number): Promise<string>;
1545
+ /**
1546
+ * Increase packet size, correctly zeroing padding
1547
+ *
1548
+ * @param pkt packet
1549
+ * @param grow_by number of bytes by which to increase the size of the packet
1550
+ */
1551
+ av_grow_packet(pkt: number,grow_by: number): Promise<number>;
1552
+ /**
1553
+ * Write a packet to an output media file ensuring correct interleaving.
1554
+ *
1555
+ * This function will buffer the packets internally as needed to make sure the
1556
+ * packets in the output file are properly interleaved, usually ordered by
1557
+ * increasing dts. Callers doing their own interleaving should call
1558
+ * av_write_frame() instead of this function.
1559
+ *
1560
+ * Using this function instead of av_write_frame() can give muxers advance
1561
+ * knowledge of future packets, improving e.g. the behaviour of the mp4
1562
+ * muxer for VFR content in fragmenting mode.
1563
+ *
1564
+ * @param s media file handle
1565
+ * @param pkt The packet containing the data to be written.
1566
+ * <br>
1567
+ * If the packet is reference-counted, this function will take
1568
+ * ownership of this reference and unreference it later when it sees
1569
+ * fit. If the packet is not reference-counted, libavformat will
1570
+ * make a copy.
1571
+ * The returned packet will be blank (as if returned from
1572
+ * av_packet_alloc()), even on error.
1573
+ * <br>
1574
+ * This parameter can be NULL (at any time, not just at the end), to
1575
+ * flush the interleaving queues.
1576
+ * <br>
1577
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be
1578
+ * set to the index of the corresponding stream in @ref
1579
+ * AVFormatContext.streams "s->streams".
1580
+ * <br>
1581
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts")
1582
+ * must be set to correct values in the stream's timebase (unless the
1583
+ * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then
1584
+ * they can be set to AV_NOPTS_VALUE).
1585
+ * The dts for subsequent packets in one stream must be strictly
1586
+ * increasing (unless the output format is flagged with the
1587
+ * AVFMT_TS_NONSTRICT, then they merely have to be nondecreasing).
1588
+ * @ref AVPacket.duration "duration" should also be set if known.
1589
+ *
1590
+ * @return 0 on success, a negative AVERROR on error.
1591
+ *
1592
+ * @see av_write_frame(), AVFormatContext.max_interleave_delta
1593
+ */
1594
+ av_interleaved_write_frame(s: number,pkt: number): Promise<number>;
1595
+ /**
1596
+ * Create a writable reference for the data described by a given packet,
1597
+ * avoiding data copy if possible.
1598
+ *
1599
+ * @param pkt Packet whose data should be made writable.
1600
+ *
1601
+ * @return 0 on success, a negative AVERROR on failure. On failure, the
1602
+ * packet is unchanged.
1603
+ */
1604
+ av_packet_make_writable(pkt: number): Promise<number>;
1605
+ /**
1606
+ * @return a pixel format descriptor for provided pixel format or NULL if
1607
+ * this pixel format is unknown.
1608
+ */
1609
+ av_pix_fmt_desc_get(pix_fmt: number): Promise<number>;
1610
+ /**
1611
+ * Return the next frame of a stream.
1612
+ * This function returns what is stored in the file, and does not validate
1613
+ * that what is there are valid frames for the decoder. It will split what is
1614
+ * stored in the file into frames and return one for each call. It will not
1615
+ * omit invalid data between valid frames so as to give the decoder the maximum
1616
+ * information possible for decoding.
1617
+ *
1618
+ * On success, the returned packet is reference-counted (pkt->buf is set) and
1619
+ * valid indefinitely. The packet must be freed with av_packet_unref() when
1620
+ * it is no longer needed. For video, the packet contains exactly one frame.
1621
+ * For audio, it contains an integer number of frames if each frame has
1622
+ * a known fixed size (e.g. PCM or ADPCM data). If the audio frames have
1623
+ * a variable size (e.g. MPEG audio), then it contains one frame.
1624
+ *
1625
+ * pkt->pts, pkt->dts and pkt->duration are always set to correct
1626
+ * values in AVStream.time_base units (and guessed if the format cannot
1627
+ * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format
1628
+ * has B-frames, so it is better to rely on pkt->dts if you do not
1629
+ * decompress the payload.
1630
+ *
1631
+ * @return 0 if OK, < 0 on error or end of file. On error, pkt will be blank
1632
+ * (as if it came from av_packet_alloc()).
1633
+ *
1634
+ * @note pkt will be initialized, so it may be uninitialized, but it must not
1635
+ * contain data that needs to be freed.
1636
+ */
1637
+ av_read_frame(s: number,pkt: number): Promise<number>;
1638
+ /**
1639
+ * Reduce packet size, correctly zeroing padding
1640
+ *
1641
+ * @param pkt packet
1642
+ * @param size new size
1643
+ */
1644
+ av_shrink_packet(pkt: number,size: number): Promise<void>;
1645
+ /**
1646
+ * Write a packet to an output media file.
1647
+ *
1648
+ * This function passes the packet directly to the muxer, without any buffering
1649
+ * or reordering. The caller is responsible for correctly interleaving the
1650
+ * packets if the format requires it. Callers that want libavformat to handle
1651
+ * the interleaving should call av_interleaved_write_frame() instead of this
1652
+ * function.
1653
+ *
1654
+ * @param s media file handle
1655
+ * @param pkt The packet containing the data to be written. Note that unlike
1656
+ * av_interleaved_write_frame(), this function does not take
1657
+ * ownership of the packet passed to it (though some muxers may make
1658
+ * an internal reference to the input packet).
1659
+ * <br>
1660
+ * This parameter can be NULL (at any time, not just at the end), in
1661
+ * order to immediately flush data buffered within the muxer, for
1662
+ * muxers that buffer up data internally before writing it to the
1663
+ * output.
1664
+ * <br>
1665
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be
1666
+ * set to the index of the corresponding stream in @ref
1667
+ * AVFormatContext.streams "s->streams".
1668
+ * <br>
1669
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts")
1670
+ * must be set to correct values in the stream's timebase (unless the
1671
+ * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then
1672
+ * they can be set to AV_NOPTS_VALUE).
1673
+ * The dts for subsequent packets passed to this function must be strictly
1674
+ * increasing when compared in their respective timebases (unless the
1675
+ * output format is flagged with the AVFMT_TS_NONSTRICT, then they
1676
+ * merely have to be nondecreasing). @ref AVPacket.duration
1677
+ * "duration") should also be set if known.
1678
+ * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
1679
+ *
1680
+ * @see av_interleaved_write_frame()
1681
+ */
1682
+ av_write_frame(s: number,pkt: number): Promise<number>;
1683
+ /**
1684
+ * Write the stream trailer to an output media file and free the
1685
+ * file private data.
1686
+ *
1687
+ * May only be called after a successful call to avformat_write_header.
1688
+ *
1689
+ * @param s media file handle
1690
+ * @return 0 if OK, AVERROR_xxx on error
1691
+ */
1692
+ av_write_trailer(s: number): Promise<number>;
1693
+ /**
1694
+ * Copy entries from one AVDictionary struct into another.
1695
+ *
1696
+ * @note Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag
1697
+ *
1698
+ * @param dst Pointer to a pointer to a AVDictionary struct to copy into. If *dst is NULL,
1699
+ * this function will allocate a struct for you and put it in *dst
1700
+ * @param src Pointer to the source AVDictionary struct to copy items from.
1701
+ * @param flags Flags to use when setting entries in *dst
1702
+ *
1703
+ * @return 0 on success, negative AVERROR code on failure. If dst was allocated
1704
+ * by this function, callers should free the associated memory.
1705
+ */
1706
+ av_dict_copy_js(dst: number,src: number,flags: number): Promise<number>;
1707
+ /**
1708
+ * Free all the memory allocated for an AVDictionary struct
1709
+ * and all keys and values.
1710
+ */
1711
+ av_dict_free(m: number): Promise<void>;
1712
+ /**
1713
+ * Set the given entry in *pm, overwriting an existing entry.
1714
+ *
1715
+ * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
1716
+ * these arguments will be freed on error.
1717
+ *
1718
+ * @warning Adding a new entry to a dictionary invalidates all existing entries
1719
+ * previously returned with av_dict_get() or av_dict_iterate().
1720
+ *
1721
+ * @param pm Pointer to a pointer to a dictionary struct. If *pm is NULL
1722
+ * a dictionary struct is allocated and put in *pm.
1723
+ * @param key Entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
1724
+ * @param value Entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
1725
+ * Passing a NULL value will cause an existing entry to be deleted.
1726
+ *
1727
+ * @return >= 0 on success otherwise an error code <0
1728
+ */
1729
+ av_dict_set_js(pm: number,key: string,value: string,flags: number): Promise<number>;
1730
+ /**
1731
+ * Allocate and return an SwsContext. You need it to perform
1732
+ * scaling/conversion operations using sws_scale().
1733
+ *
1734
+ * @param srcW the width of the source image
1735
+ * @param srcH the height of the source image
1736
+ * @param srcFormat the source image format
1737
+ * @param dstW the width of the destination image
1738
+ * @param dstH the height of the destination image
1739
+ * @param dstFormat the destination image format
1740
+ * @param flags specify which algorithm and options to use for rescaling
1741
+ * @param param extra parameters to tune the used scaler
1742
+ * For SWS_BICUBIC param[0] and [1] tune the shape of the basis
1743
+ * function, param[0] tunes f(1) and param[1] f´(1)
1744
+ * For SWS_GAUSS param[0] tunes the exponent and thus cutoff
1745
+ * frequency
1746
+ * For SWS_LANCZOS param[0] tunes the width of the window function
1747
+ * @return a pointer to an allocated context, or NULL in case of error
1748
+ * @note this function is to be removed after a saner alternative is
1749
+ * written
1750
+ */
1751
+ sws_getContext(srcW: number,srcH: number,srcFormat: number,dstW: number,dstH: number,dstFormat: number,flags: number,srcFilter: number,dstFilter: number,param: number): Promise<number>;
1752
+ /**
1753
+ * Free the swscaler context swsContext.
1754
+ * If swsContext is NULL, then does nothing.
1755
+ */
1756
+ sws_freeContext(swsContext: number): Promise<void>;
1757
+ /**
1758
+ * Scale source data from src and write the output to dst.
1759
+ *
1760
+ * This is merely a convenience wrapper around
1761
+ * - sws_frame_start()
1762
+ * - sws_send_slice(0, src->height)
1763
+ * - sws_receive_slice(0, dst->height)
1764
+ * - sws_frame_end()
1765
+ *
1766
+ * @param c The scaling context
1767
+ * @param dst The destination frame. See documentation for sws_frame_start() for
1768
+ * more details.
1769
+ * @param src The source frame.
1770
+ *
1771
+ * @return 0 on success, a negative AVERROR code on failure
1772
+ */
1773
+ sws_scale_frame(c: number,dst: number,src: number): Promise<number>;
1774
+ AVPacketSideData_data(a0: number,a1: number): Promise<number>;
1775
+ AVPacketSideData_size(a0: number,a1: number): Promise<number>;
1776
+ AVPacketSideData_type(a0: number,a1: number): Promise<number>;
1777
+ AVPixFmtDescriptor_comp_depth(a0: number,a1: number): Promise<number>;
1778
+ ff_error(a0: number): Promise<string>;
1779
+ ff_nothing(): Promise<void>;
1780
+ calloc(a0: number,a1: number): Promise<number>;
1781
+ close(a0: number): Promise<number>;
1782
+ dup2(a0: number,a1: number): Promise<number>;
1783
+ free(a0: number): Promise<void>;
1784
+ malloc(a0: number): Promise<number>;
1785
+ mallinfo_uordblks(): Promise<number>;
1786
+ open(a0: string,a1: number,a2: number): Promise<number>;
1787
+ strerror(a0: number): Promise<string>;
1788
+ libavjs_with_swscale(): Promise<number>;
1789
+ libavjs_create_main_thread(): Promise<number>;
1790
+ ffmpeg_main(a0: number,a1: number): Promise<number>;
1791
+ ffprobe_main(a0: number,a1: number): Promise<number>;
1792
+ AVFrame_channel_layout(ptr: number): Promise<number>;
1793
+ AVFrame_channel_layout_s(ptr: number, val: number): Promise<void>;
1794
+ AVFrame_channel_layouthi(ptr: number): Promise<number>;
1795
+ AVFrame_channel_layouthi_s(ptr: number, val: number): Promise<void>;
1796
+ AVFrame_channels(ptr: number): Promise<number>;
1797
+ AVFrame_channels_s(ptr: number, val: number): Promise<void>;
1798
+ AVFrame_channel_layoutmask(ptr: number): Promise<number>;
1799
+ AVFrame_channel_layoutmask_s(ptr: number, val: number): Promise<void>;
1800
+ AVFrame_ch_layout_nb_channels(ptr: number): Promise<number>;
1801
+ AVFrame_ch_layout_nb_channels_s(ptr: number, val: number): Promise<void>;
1802
+ AVFrame_crop_bottom(ptr: number): Promise<number>;
1803
+ AVFrame_crop_bottom_s(ptr: number, val: number): Promise<void>;
1804
+ AVFrame_crop_left(ptr: number): Promise<number>;
1805
+ AVFrame_crop_left_s(ptr: number, val: number): Promise<void>;
1806
+ AVFrame_crop_right(ptr: number): Promise<number>;
1807
+ AVFrame_crop_right_s(ptr: number, val: number): Promise<void>;
1808
+ AVFrame_crop_top(ptr: number): Promise<number>;
1809
+ AVFrame_crop_top_s(ptr: number, val: number): Promise<void>;
1810
+ AVFrame_data_a(ptr: number, idx: number): Promise<number>;
1811
+ AVFrame_data_a_s(ptr: number, idx: number, val: number): Promise<void>;
1812
+ AVFrame_format(ptr: number): Promise<number>;
1813
+ AVFrame_format_s(ptr: number, val: number): Promise<void>;
1814
+ AVFrame_height(ptr: number): Promise<number>;
1815
+ AVFrame_height_s(ptr: number, val: number): Promise<void>;
1816
+ AVFrame_key_frame(ptr: number): Promise<number>;
1817
+ AVFrame_key_frame_s(ptr: number, val: number): Promise<void>;
1818
+ AVFrame_linesize_a(ptr: number, idx: number): Promise<number>;
1819
+ AVFrame_linesize_a_s(ptr: number, idx: number, val: number): Promise<void>;
1820
+ AVFrame_nb_samples(ptr: number): Promise<number>;
1821
+ AVFrame_nb_samples_s(ptr: number, val: number): Promise<void>;
1822
+ AVFrame_pict_type(ptr: number): Promise<number>;
1823
+ AVFrame_pict_type_s(ptr: number, val: number): Promise<void>;
1824
+ AVFrame_pts(ptr: number): Promise<number>;
1825
+ AVFrame_pts_s(ptr: number, val: number): Promise<void>;
1826
+ AVFrame_ptshi(ptr: number): Promise<number>;
1827
+ AVFrame_ptshi_s(ptr: number, val: number): Promise<void>;
1828
+ AVFrame_sample_aspect_ratio_num(ptr: number): Promise<number>;
1829
+ AVFrame_sample_aspect_ratio_num_s(ptr: number, val: number): Promise<void>;
1830
+ AVFrame_sample_aspect_ratio_den(ptr: number): Promise<number>;
1831
+ AVFrame_sample_aspect_ratio_den_s(ptr: number, val: number): Promise<void>;
1832
+ AVFrame_sample_aspect_ratio_s(ptr: number, num: number, den: number): Promise<void>;
1833
+ AVFrame_sample_rate(ptr: number): Promise<number>;
1834
+ AVFrame_sample_rate_s(ptr: number, val: number): Promise<void>;
1835
+ AVFrame_time_base_num(ptr: number): Promise<number>;
1836
+ AVFrame_time_base_num_s(ptr: number, val: number): Promise<void>;
1837
+ AVFrame_time_base_den(ptr: number): Promise<number>;
1838
+ AVFrame_time_base_den_s(ptr: number, val: number): Promise<void>;
1839
+ AVFrame_time_base_s(ptr: number, num: number, den: number): Promise<void>;
1840
+ AVFrame_width(ptr: number): Promise<number>;
1841
+ AVFrame_width_s(ptr: number, val: number): Promise<void>;
1842
+ AVPixFmtDescriptor_flags(ptr: number): Promise<number>;
1843
+ AVPixFmtDescriptor_flags_s(ptr: number, val: number): Promise<void>;
1844
+ AVPixFmtDescriptor_log2_chroma_h(ptr: number): Promise<number>;
1845
+ AVPixFmtDescriptor_log2_chroma_h_s(ptr: number, val: number): Promise<void>;
1846
+ AVPixFmtDescriptor_log2_chroma_w(ptr: number): Promise<number>;
1847
+ AVPixFmtDescriptor_log2_chroma_w_s(ptr: number, val: number): Promise<void>;
1848
+ AVPixFmtDescriptor_nb_components(ptr: number): Promise<number>;
1849
+ AVPixFmtDescriptor_nb_components_s(ptr: number, val: number): Promise<void>;
1850
+ AVCodec_name(ptr: number): Promise<string>;
1851
+ AVCodec_sample_fmts(ptr: number): Promise<number>;
1852
+ AVCodec_sample_fmts_s(ptr: number, val: number): Promise<void>;
1853
+ AVCodec_sample_fmts_a(ptr: number, idx: number): Promise<number>;
1854
+ AVCodec_sample_fmts_a_s(ptr: number, idx: number, val: number): Promise<void>;
1855
+ AVCodec_supported_samplerates(ptr: number): Promise<number>;
1856
+ AVCodec_supported_samplerates_s(ptr: number, val: number): Promise<void>;
1857
+ AVCodec_supported_samplerates_a(ptr: number, idx: number): Promise<number>;
1858
+ AVCodec_supported_samplerates_a_s(ptr: number, idx: number, val: number): Promise<void>;
1859
+ AVCodec_type(ptr: number): Promise<number>;
1860
+ AVCodec_type_s(ptr: number, val: number): Promise<void>;
1861
+ AVCodecContext_codec_id(ptr: number): Promise<number>;
1862
+ AVCodecContext_codec_id_s(ptr: number, val: number): Promise<void>;
1863
+ AVCodecContext_codec_type(ptr: number): Promise<number>;
1864
+ AVCodecContext_codec_type_s(ptr: number, val: number): Promise<void>;
1865
+ AVCodecContext_bit_rate(ptr: number): Promise<number>;
1866
+ AVCodecContext_bit_rate_s(ptr: number, val: number): Promise<void>;
1867
+ AVCodecContext_bit_ratehi(ptr: number): Promise<number>;
1868
+ AVCodecContext_bit_ratehi_s(ptr: number, val: number): Promise<void>;
1869
+ AVCodecContext_channel_layout(ptr: number): Promise<number>;
1870
+ AVCodecContext_channel_layout_s(ptr: number, val: number): Promise<void>;
1871
+ AVCodecContext_channel_layouthi(ptr: number): Promise<number>;
1872
+ AVCodecContext_channel_layouthi_s(ptr: number, val: number): Promise<void>;
1873
+ AVCodecContext_channels(ptr: number): Promise<number>;
1874
+ AVCodecContext_channels_s(ptr: number, val: number): Promise<void>;
1875
+ AVCodecContext_channel_layoutmask(ptr: number): Promise<number>;
1876
+ AVCodecContext_channel_layoutmask_s(ptr: number, val: number): Promise<void>;
1877
+ AVCodecContext_ch_layout_nb_channels(ptr: number): Promise<number>;
1878
+ AVCodecContext_ch_layout_nb_channels_s(ptr: number, val: number): Promise<void>;
1879
+ AVCodecContext_extradata(ptr: number): Promise<number>;
1880
+ AVCodecContext_extradata_s(ptr: number, val: number): Promise<void>;
1881
+ AVCodecContext_extradata_size(ptr: number): Promise<number>;
1882
+ AVCodecContext_extradata_size_s(ptr: number, val: number): Promise<void>;
1883
+ AVCodecContext_frame_size(ptr: number): Promise<number>;
1884
+ AVCodecContext_frame_size_s(ptr: number, val: number): Promise<void>;
1885
+ AVCodecContext_framerate_num(ptr: number): Promise<number>;
1886
+ AVCodecContext_framerate_num_s(ptr: number, val: number): Promise<void>;
1887
+ AVCodecContext_framerate_den(ptr: number): Promise<number>;
1888
+ AVCodecContext_framerate_den_s(ptr: number, val: number): Promise<void>;
1889
+ AVCodecContext_framerate_s(ptr: number, num: number, den: number): Promise<void>;
1890
+ AVCodecContext_gop_size(ptr: number): Promise<number>;
1891
+ AVCodecContext_gop_size_s(ptr: number, val: number): Promise<void>;
1892
+ AVCodecContext_height(ptr: number): Promise<number>;
1893
+ AVCodecContext_height_s(ptr: number, val: number): Promise<void>;
1894
+ AVCodecContext_keyint_min(ptr: number): Promise<number>;
1895
+ AVCodecContext_keyint_min_s(ptr: number, val: number): Promise<void>;
1896
+ AVCodecContext_level(ptr: number): Promise<number>;
1897
+ AVCodecContext_level_s(ptr: number, val: number): Promise<void>;
1898
+ AVCodecContext_max_b_frames(ptr: number): Promise<number>;
1899
+ AVCodecContext_max_b_frames_s(ptr: number, val: number): Promise<void>;
1900
+ AVCodecContext_pix_fmt(ptr: number): Promise<number>;
1901
+ AVCodecContext_pix_fmt_s(ptr: number, val: number): Promise<void>;
1902
+ AVCodecContext_profile(ptr: number): Promise<number>;
1903
+ AVCodecContext_profile_s(ptr: number, val: number): Promise<void>;
1904
+ AVCodecContext_rc_max_rate(ptr: number): Promise<number>;
1905
+ AVCodecContext_rc_max_rate_s(ptr: number, val: number): Promise<void>;
1906
+ AVCodecContext_rc_max_ratehi(ptr: number): Promise<number>;
1907
+ AVCodecContext_rc_max_ratehi_s(ptr: number, val: number): Promise<void>;
1908
+ AVCodecContext_rc_min_rate(ptr: number): Promise<number>;
1909
+ AVCodecContext_rc_min_rate_s(ptr: number, val: number): Promise<void>;
1910
+ AVCodecContext_rc_min_ratehi(ptr: number): Promise<number>;
1911
+ AVCodecContext_rc_min_ratehi_s(ptr: number, val: number): Promise<void>;
1912
+ AVCodecContext_sample_aspect_ratio_num(ptr: number): Promise<number>;
1913
+ AVCodecContext_sample_aspect_ratio_num_s(ptr: number, val: number): Promise<void>;
1914
+ AVCodecContext_sample_aspect_ratio_den(ptr: number): Promise<number>;
1915
+ AVCodecContext_sample_aspect_ratio_den_s(ptr: number, val: number): Promise<void>;
1916
+ AVCodecContext_sample_aspect_ratio_s(ptr: number, num: number, den: number): Promise<void>;
1917
+ AVCodecContext_sample_fmt(ptr: number): Promise<number>;
1918
+ AVCodecContext_sample_fmt_s(ptr: number, val: number): Promise<void>;
1919
+ AVCodecContext_sample_rate(ptr: number): Promise<number>;
1920
+ AVCodecContext_sample_rate_s(ptr: number, val: number): Promise<void>;
1921
+ AVCodecContext_time_base_num(ptr: number): Promise<number>;
1922
+ AVCodecContext_time_base_num_s(ptr: number, val: number): Promise<void>;
1923
+ AVCodecContext_time_base_den(ptr: number): Promise<number>;
1924
+ AVCodecContext_time_base_den_s(ptr: number, val: number): Promise<void>;
1925
+ AVCodecContext_time_base_s(ptr: number, num: number, den: number): Promise<void>;
1926
+ AVCodecContext_qmax(ptr: number): Promise<number>;
1927
+ AVCodecContext_qmax_s(ptr: number, val: number): Promise<void>;
1928
+ AVCodecContext_qmin(ptr: number): Promise<number>;
1929
+ AVCodecContext_qmin_s(ptr: number, val: number): Promise<void>;
1930
+ AVCodecContext_width(ptr: number): Promise<number>;
1931
+ AVCodecContext_width_s(ptr: number, val: number): Promise<void>;
1932
+ AVCodecDescriptor_id(ptr: number): Promise<number>;
1933
+ AVCodecDescriptor_id_s(ptr: number, val: number): Promise<void>;
1934
+ AVCodecDescriptor_long_name(ptr: number): Promise<number>;
1935
+ AVCodecDescriptor_long_name_s(ptr: number, val: number): Promise<void>;
1936
+ AVCodecDescriptor_mime_types_a(ptr: number, idx: number): Promise<number>;
1937
+ AVCodecDescriptor_mime_types_a_s(ptr: number, idx: number, val: number): Promise<void>;
1938
+ AVCodecDescriptor_name(ptr: number): Promise<number>;
1939
+ AVCodecDescriptor_name_s(ptr: number, val: number): Promise<void>;
1940
+ AVCodecDescriptor_props(ptr: number): Promise<number>;
1941
+ AVCodecDescriptor_props_s(ptr: number, val: number): Promise<void>;
1942
+ AVCodecDescriptor_type(ptr: number): Promise<number>;
1943
+ AVCodecDescriptor_type_s(ptr: number, val: number): Promise<void>;
1944
+ AVCodecParameters_bit_rate(ptr: number): Promise<number>;
1945
+ AVCodecParameters_bit_rate_s(ptr: number, val: number): Promise<void>;
1946
+ AVCodecParameters_channel_layoutmask(ptr: number): Promise<number>;
1947
+ AVCodecParameters_channel_layoutmask_s(ptr: number, val: number): Promise<void>;
1948
+ AVCodecParameters_channels(ptr: number): Promise<number>;
1949
+ AVCodecParameters_channels_s(ptr: number, val: number): Promise<void>;
1950
+ AVCodecParameters_ch_layout_nb_channels(ptr: number): Promise<number>;
1951
+ AVCodecParameters_ch_layout_nb_channels_s(ptr: number, val: number): Promise<void>;
1952
+ AVCodecParameters_chroma_location(ptr: number): Promise<number>;
1953
+ AVCodecParameters_chroma_location_s(ptr: number, val: number): Promise<void>;
1954
+ AVCodecParameters_codec_id(ptr: number): Promise<number>;
1955
+ AVCodecParameters_codec_id_s(ptr: number, val: number): Promise<void>;
1956
+ AVCodecParameters_codec_tag(ptr: number): Promise<number>;
1957
+ AVCodecParameters_codec_tag_s(ptr: number, val: number): Promise<void>;
1958
+ AVCodecParameters_codec_type(ptr: number): Promise<number>;
1959
+ AVCodecParameters_codec_type_s(ptr: number, val: number): Promise<void>;
1960
+ AVCodecParameters_color_primaries(ptr: number): Promise<number>;
1961
+ AVCodecParameters_color_primaries_s(ptr: number, val: number): Promise<void>;
1962
+ AVCodecParameters_color_range(ptr: number): Promise<number>;
1963
+ AVCodecParameters_color_range_s(ptr: number, val: number): Promise<void>;
1964
+ AVCodecParameters_color_space(ptr: number): Promise<number>;
1965
+ AVCodecParameters_color_space_s(ptr: number, val: number): Promise<void>;
1966
+ AVCodecParameters_color_trc(ptr: number): Promise<number>;
1967
+ AVCodecParameters_color_trc_s(ptr: number, val: number): Promise<void>;
1968
+ AVCodecParameters_extradata(ptr: number): Promise<number>;
1969
+ AVCodecParameters_extradata_s(ptr: number, val: number): Promise<void>;
1970
+ AVCodecParameters_extradata_size(ptr: number): Promise<number>;
1971
+ AVCodecParameters_extradata_size_s(ptr: number, val: number): Promise<void>;
1972
+ AVCodecParameters_format(ptr: number): Promise<number>;
1973
+ AVCodecParameters_format_s(ptr: number, val: number): Promise<void>;
1974
+ AVCodecParameters_framerate_num(ptr: number): Promise<number>;
1975
+ AVCodecParameters_framerate_num_s(ptr: number, val: number): Promise<void>;
1976
+ AVCodecParameters_framerate_den(ptr: number): Promise<number>;
1977
+ AVCodecParameters_framerate_den_s(ptr: number, val: number): Promise<void>;
1978
+ AVCodecParameters_framerate_s(ptr: number, num: number, den: number): Promise<void>;
1979
+ AVCodecParameters_height(ptr: number): Promise<number>;
1980
+ AVCodecParameters_height_s(ptr: number, val: number): Promise<void>;
1981
+ AVCodecParameters_level(ptr: number): Promise<number>;
1982
+ AVCodecParameters_level_s(ptr: number, val: number): Promise<void>;
1983
+ AVCodecParameters_profile(ptr: number): Promise<number>;
1984
+ AVCodecParameters_profile_s(ptr: number, val: number): Promise<void>;
1985
+ AVCodecParameters_sample_rate(ptr: number): Promise<number>;
1986
+ AVCodecParameters_sample_rate_s(ptr: number, val: number): Promise<void>;
1987
+ AVCodecParameters_width(ptr: number): Promise<number>;
1988
+ AVCodecParameters_width_s(ptr: number, val: number): Promise<void>;
1989
+ AVPacket_data(ptr: number): Promise<number>;
1990
+ AVPacket_data_s(ptr: number, val: number): Promise<void>;
1991
+ AVPacket_dts(ptr: number): Promise<number>;
1992
+ AVPacket_dts_s(ptr: number, val: number): Promise<void>;
1993
+ AVPacket_dtshi(ptr: number): Promise<number>;
1994
+ AVPacket_dtshi_s(ptr: number, val: number): Promise<void>;
1995
+ AVPacket_duration(ptr: number): Promise<number>;
1996
+ AVPacket_duration_s(ptr: number, val: number): Promise<void>;
1997
+ AVPacket_durationhi(ptr: number): Promise<number>;
1998
+ AVPacket_durationhi_s(ptr: number, val: number): Promise<void>;
1999
+ AVPacket_flags(ptr: number): Promise<number>;
2000
+ AVPacket_flags_s(ptr: number, val: number): Promise<void>;
2001
+ AVPacket_pos(ptr: number): Promise<number>;
2002
+ AVPacket_pos_s(ptr: number, val: number): Promise<void>;
2003
+ AVPacket_poshi(ptr: number): Promise<number>;
2004
+ AVPacket_poshi_s(ptr: number, val: number): Promise<void>;
2005
+ AVPacket_pts(ptr: number): Promise<number>;
2006
+ AVPacket_pts_s(ptr: number, val: number): Promise<void>;
2007
+ AVPacket_ptshi(ptr: number): Promise<number>;
2008
+ AVPacket_ptshi_s(ptr: number, val: number): Promise<void>;
2009
+ AVPacket_side_data(ptr: number): Promise<number>;
2010
+ AVPacket_side_data_s(ptr: number, val: number): Promise<void>;
2011
+ AVPacket_side_data_elems(ptr: number): Promise<number>;
2012
+ AVPacket_side_data_elems_s(ptr: number, val: number): Promise<void>;
2013
+ AVPacket_size(ptr: number): Promise<number>;
2014
+ AVPacket_size_s(ptr: number, val: number): Promise<void>;
2015
+ AVPacket_stream_index(ptr: number): Promise<number>;
2016
+ AVPacket_stream_index_s(ptr: number, val: number): Promise<void>;
2017
+ AVPacket_time_base_num(ptr: number): Promise<number>;
2018
+ AVPacket_time_base_num_s(ptr: number, val: number): Promise<void>;
2019
+ AVPacket_time_base_den(ptr: number): Promise<number>;
2020
+ AVPacket_time_base_den_s(ptr: number, val: number): Promise<void>;
2021
+ AVPacket_time_base_s(ptr: number, num: number, den: number): Promise<void>;
2022
+ AVFormatContext_duration(ptr: number): Promise<number>;
2023
+ AVFormatContext_duration_s(ptr: number, val: number): Promise<void>;
2024
+ AVFormatContext_durationhi(ptr: number): Promise<number>;
2025
+ AVFormatContext_durationhi_s(ptr: number, val: number): Promise<void>;
2026
+ AVFormatContext_flags(ptr: number): Promise<number>;
2027
+ AVFormatContext_flags_s(ptr: number, val: number): Promise<void>;
2028
+ AVFormatContext_nb_streams(ptr: number): Promise<number>;
2029
+ AVFormatContext_nb_streams_s(ptr: number, val: number): Promise<void>;
2030
+ AVFormatContext_oformat(ptr: number): Promise<number>;
2031
+ AVFormatContext_oformat_s(ptr: number, val: number): Promise<void>;
2032
+ AVFormatContext_pb(ptr: number): Promise<number>;
2033
+ AVFormatContext_pb_s(ptr: number, val: number): Promise<void>;
2034
+ AVFormatContext_start_time(ptr: number): Promise<number>;
2035
+ AVFormatContext_start_time_s(ptr: number, val: number): Promise<void>;
2036
+ AVFormatContext_start_timehi(ptr: number): Promise<number>;
2037
+ AVFormatContext_start_timehi_s(ptr: number, val: number): Promise<void>;
2038
+ AVFormatContext_streams_a(ptr: number, idx: number): Promise<number>;
2039
+ AVFormatContext_streams_a_s(ptr: number, idx: number, val: number): Promise<void>;
2040
+ AVStream_codecpar(ptr: number): Promise<number>;
2041
+ AVStream_codecpar_s(ptr: number, val: number): Promise<void>;
2042
+ AVStream_discard(ptr: number): Promise<number>;
2043
+ AVStream_discard_s(ptr: number, val: number): Promise<void>;
2044
+ AVStream_duration(ptr: number): Promise<number>;
2045
+ AVStream_duration_s(ptr: number, val: number): Promise<void>;
2046
+ AVStream_durationhi(ptr: number): Promise<number>;
2047
+ AVStream_durationhi_s(ptr: number, val: number): Promise<void>;
2048
+ AVStream_start_time(ptr: number): Promise<number>;
2049
+ AVStream_start_time_s(ptr: number, val: number): Promise<void>;
2050
+ AVStream_start_timehi(ptr: number): Promise<number>;
2051
+ AVStream_start_timehi_s(ptr: number, val: number): Promise<void>;
2052
+ AVStream_time_base_num(ptr: number): Promise<number>;
2053
+ AVStream_time_base_num_s(ptr: number, val: number): Promise<void>;
2054
+ AVStream_time_base_den(ptr: number): Promise<number>;
2055
+ AVStream_time_base_den_s(ptr: number, val: number): Promise<void>;
2056
+ AVStream_time_base_s(ptr: number, num: number, den: number): Promise<void>;
2057
+ AVFilterInOut_filter_ctx(ptr: number): Promise<number>;
2058
+ AVFilterInOut_filter_ctx_s(ptr: number, val: number): Promise<void>;
2059
+ AVFilterInOut_name(ptr: number): Promise<number>;
2060
+ AVFilterInOut_name_s(ptr: number, val: number): Promise<void>;
2061
+ AVFilterInOut_next(ptr: number): Promise<number>;
2062
+ AVFilterInOut_next_s(ptr: number, val: number): Promise<void>;
2063
+ AVFilterInOut_pad_idx(ptr: number): Promise<number>;
2064
+ AVFilterInOut_pad_idx_s(ptr: number, val: number): Promise<void>;
2065
+ av_frame_free_js(ptr: number): Promise<void>;
2066
+ av_packet_free_js(ptr: number): Promise<void>;
2067
+ avformat_close_input_js(ptr: number): Promise<void>;
2068
+ avcodec_free_context_js(ptr: number): Promise<void>;
2069
+ avcodec_parameters_free_js(ptr: number): Promise<void>;
2070
+ avfilter_graph_free_js(ptr: number): Promise<void>;
2071
+ avfilter_inout_free_js(ptr: number): Promise<void>;
2072
+ av_dict_free_js(ptr: number): Promise<void>;
2073
+ copyin_u8(ptr: number, arr: Uint8Array): Promise<void>;
2074
+ copyout_u8(ptr: number, len: number): Promise<Uint8Array>;
2075
+ copyin_s16(ptr: number, arr: Int16Array): Promise<void>;
2076
+ copyout_s16(ptr: number, len: number): Promise<Int16Array>;
2077
+ copyin_s32(ptr: number, arr: Int32Array): Promise<void>;
2078
+ copyout_s32(ptr: number, len: number): Promise<Int32Array>;
2079
+ copyin_f32(ptr: number, arr: Float32Array): Promise<void>;
2080
+ copyout_f32(ptr: number, len: number): Promise<Float32Array>;
2081
+
2082
+ /**
2083
+ * Read a complete file from the in-memory filesystem.
2084
+ * @param name Filename to read
2085
+ */
2086
+ readFile(name: string): Promise<Uint8Array>;
2087
+ /**
2088
+ * Write a complete file to the in-memory filesystem.
2089
+ * @param name Filename to write
2090
+ * @param content Content to write to the file
2091
+ */
2092
+ writeFile(name: string, content: Uint8Array): Promise<Uint8Array>;
2093
+ /**
2094
+ * Delete a file in the in-memory filesystem.
2095
+ * @param name Filename to delete
2096
+ */
2097
+ unlink(name: string): Promise<void>;
2098
+ /**
2099
+ * Unmount a mounted filesystem.
2100
+ * @param mountpoint Path where the filesystem is mounted
2101
+ */
2102
+ unmount(mountpoint: string): Promise<void>;
2103
+ /**
2104
+ * Make a lazy file. Direct link to createLazyFile.
2105
+ */
2106
+ createLazyFile(
2107
+ parent: string, name: string, url: string, canRead: boolean,
2108
+ canWrite: boolean
2109
+ ): Promise<void>;
2110
+ /**
2111
+ * Make a reader device.
2112
+ * @param name Filename to create.
2113
+ * @param mode Unix permissions (pointless since this is an in-memory
2114
+ * filesystem)
2115
+ */
2116
+ mkreaderdev(name: string, mode?: number): Promise<void>;
2117
+ /**
2118
+ * Make a block reader "device". Technically a file that we then hijack to have
2119
+ * our behavior.
2120
+ * @param name Filename to create.
2121
+ * @param size Size of the device to present.
2122
+ */
2123
+ mkblockreaderdev(name: string, size: number): Promise<void>;
2124
+ /**
2125
+ * Make a readahead device. This reads a File (or other Blob) and attempts to
2126
+ * read ahead of whatever libav actually asked for. Note that this overrides
2127
+ * onblockread, so if you want to support both kinds of files, make sure you set
2128
+ * onblockread before calling this.
2129
+ * @param name Filename to create.
2130
+ * @param file Blob or file to read.
2131
+ */
2132
+ mkreadaheadfile(name: string, file: Blob): Promise<void>;
2133
+ /**
2134
+ * Unlink a readahead file. Also gets rid of the File reference.
2135
+ * @param name Filename to unlink.
2136
+ */
2137
+ unlinkreadaheadfile(name: string): Promise<void>;
2138
+ /**
2139
+ * Make a writer device.
2140
+ * @param name Filename to create
2141
+ * @param mode Unix permissions
2142
+ */
2143
+ mkwriterdev(name: string, mode?: number): Promise<void>;
2144
+ /**
2145
+ * Make a stream writer device. The same as a writer device but does not allow
2146
+ * seeking.
2147
+ * @param name Filename to create
2148
+ * @param mode Unix permissions
2149
+ */
2150
+ mkstreamwriterdev(name: string, mode?: number): Promise<void>;
2151
+ /**
2152
+ * Mount a writer *filesystem*. All files created in this filesystem will be
2153
+ * redirected as writers. The directory will be created for you if it doesn't
2154
+ * already exist, but it may already exist.
2155
+ * @param mountpoint Directory to mount as a writer filesystem
2156
+ */
2157
+ mountwriterfs(mountpoint: string): Promise<void>;
2158
+ /**
2159
+ * Make a workerfs file. Returns the filename that it's mounted to.
2160
+ * @param name Filename to use.
2161
+ * @param blob Blob to load at that file.
2162
+ */
2163
+ mkworkerfsfile(name: string, blob: Blob): Promise<string>;
2164
+ /**
2165
+ * Unmount (unmake) a workerfs file. Give the *original name you provided*, not
2166
+ * the name mkworkerfsfile returned.
2167
+ * @param name Filename to unmount.
2168
+ */
2169
+ unlinkworkerfsfile(name: string): Promise<void>;
2170
+ /**
2171
+ * Make a FileSystemFileHandle device. This writes via a FileSystemFileHandle,
2172
+ * synchronously if possible. Note that this overrides onwrite, so if you want
2173
+ * to support both kinds of files, make sure you set onwrite before calling
2174
+ * this.
2175
+ * @param name Filename to create.
2176
+ * @param fsfh FileSystemFileHandle corresponding to this filename.
2177
+ */
2178
+ mkfsfhfile(name: string, fsfh: FileSystemFileHandle): Promise<void>;
2179
+ /**
2180
+ * Unlink a FileSystemFileHandle file. Also closes the file handle.
2181
+ * @param name Filename to unlink.
2182
+ */
2183
+ unlinkfsfhfile(name: string): Promise<void>;
2184
+ /**
2185
+ * Send some data to a reader device. To indicate EOF, send null. To indicate an
2186
+ * error, send EOF and include an error code in the options.
2187
+ * @param name Filename of the reader device.
2188
+ * @param data Data to send.
2189
+ * @param opts Optional send options, such as an error code.
2190
+ */
2191
+ ff_reader_dev_send(
2192
+ name: string, data: Uint8Array | null,
2193
+ opts?: {
2194
+ errorCode?: number,
2195
+ error?: any // any other error, used internally
2196
+ }
2197
+ ): Promise<void>;
2198
+ /**
2199
+ * Send some data to a block reader device. To indicate EOF, send null (but note
2200
+ * that block read devices have a fixed size, and will automatically send EOF
2201
+ * for reads outside of that size, so you should not normally need to send EOF).
2202
+ * To indicate an error, send EOF and include an error code in the options.
2203
+ * @param name Filename of the reader device.
2204
+ * @param pos Position of the data in the file.
2205
+ * @param data Data to send.
2206
+ * @param opts Optional send options, such as an error code.
2207
+ */
2208
+ ff_block_reader_dev_send(
2209
+ name: string, pos: number, data: Uint8Array | null,
2210
+ opts?: {
2211
+ errorCode?: number,
2212
+ error?: any // any other error, used internally
2213
+ }
2214
+ ): Promise<void>;
2215
+ /**
2216
+ * @deprecated
2217
+ * DEPRECATED. Use the onread callback.
2218
+ * Metafunction to determine whether any device has any waiters. This can be
2219
+ * used to determine whether more data needs to be sent before a previous step
2220
+ * will be fully resolved.
2221
+ * @param name Optional name of file to check for waiters
2222
+ */
2223
+ ff_reader_dev_waiting(name?: string): Promise<boolean>;
2224
+ /**
2225
+ * Metafunction to initialize an encoder with all the bells and whistles.
2226
+ * Returns [AVCodec, AVCodecContext, AVFrame, AVPacket, frame_size]
2227
+ * @param name libav name of the codec
2228
+ * @param opts Encoder options
2229
+ */
2230
+ ff_init_encoder(
2231
+ name: string, opts?: {
2232
+ ctx?: AVCodecContextProps,
2233
+ time_base?: [number, number],
2234
+ options?: Record<string, string>
2235
+ }
2236
+ ): Promise<[number, number, number, number, number]>;
2237
+ /**
2238
+ * Metafunction to initialize a decoder with all the bells and whistles.
2239
+ * Similar to ff_init_encoder but doesn't need to initialize the frame.
2240
+ * Returns [AVCodec, AVCodecContext, AVPacket, AVFrame]
2241
+ * @param name libav decoder identifier or name
2242
+ * @param config Decoder configuration. Can just be a number for codec
2243
+ * parameters, or can be multiple configuration options.
2244
+ */
2245
+ ff_init_decoder(
2246
+ name: string | number, config?: number | {
2247
+ codecpar?: number | CodecParameters,
2248
+ time_base?: [number, number]
2249
+ }
2250
+ ): Promise<[number, number, number, number]>;
2251
+ /**
2252
+ * Free everything allocated by ff_init_encoder.
2253
+ * @param c AVCodecContext
2254
+ * @param frame AVFrame
2255
+ * @param pkt AVPacket
2256
+ */
2257
+ ff_free_encoder(
2258
+ c: number, frame: number, pkt: number
2259
+ ): Promise<void>;
2260
+ /**
2261
+ * Free everything allocated by ff_init_decoder
2262
+ * @param c AVCodecContext
2263
+ * @param pkt AVPacket
2264
+ * @param frame AVFrame
2265
+ */
2266
+ ff_free_decoder(
2267
+ c: number, pkt: number, frame: number
2268
+ ): Promise<void>;
2269
+ /**
2270
+ * Encode some number of frames at once. Done in one go to avoid excess message
2271
+ * passing.
2272
+ * @param ctx AVCodecContext
2273
+ * @param frame AVFrame
2274
+ * @param pkt AVPacket
2275
+ * @param inFrames Array of frames in libav.js format
2276
+ * @param config Encoding options. May be "true" to indicate end of stream.
2277
+ */
2278
+ ff_encode_multi(
2279
+ ctx: number, frame: number, pkt: number, inFrames: (Frame | number)[],
2280
+ config?: boolean | {
2281
+ fin?: boolean,
2282
+ copyoutPacket?: "default"
2283
+ }
2284
+ ): Promise<Packet[]>
2285
+ ff_encode_multi(
2286
+ ctx: number, frame: number, pkt: number, inFrames: (Frame | number)[],
2287
+ config: {
2288
+ fin?: boolean,
2289
+ copyoutPacket: "ptr"
2290
+ }
2291
+ ): Promise<number[]>;
2292
+ /**
2293
+ * Decode some number of packets at once. Done in one go to avoid excess
2294
+ * message passing.
2295
+ * @param ctx AVCodecContext
2296
+ * @param pkt AVPacket
2297
+ * @param frame AVFrame
2298
+ * @param inPackets Incoming packets to decode
2299
+ * @param config Decoding options. May be "true" to indicate end of stream.
2300
+ */
2301
+ ff_decode_multi(
2302
+ ctx: number, pkt: number, frame: number, inPackets: (Packet | number)[],
2303
+ config?: boolean | {
2304
+ fin?: boolean,
2305
+ ignoreErrors?: boolean,
2306
+ copyoutFrame?: "default" | "video" | "video_packed"
2307
+ }
2308
+ ): Promise<Frame[]>
2309
+ ff_decode_multi(
2310
+ ctx: number, pkt: number, frame: number, inPackets: (Packet | number)[],
2311
+ config: {
2312
+ fin?: boolean,
2313
+ ignoreErrors?: boolean,
2314
+ copyoutFrame: "ptr"
2315
+ }
2316
+ ): Promise<number[]>
2317
+ ff_decode_multi(
2318
+ ctx: number, pkt: number, frame: number, inPackets: (Packet | number)[],
2319
+ config: {
2320
+ fin?: boolean,
2321
+ ignoreErrors?: boolean,
2322
+ copyoutFrame: "ImageData"
2323
+ }
2324
+ ): Promise<ImageData[]>;
2325
+ /**
2326
+ * Initialize a muxer format, format context and some number of streams.
2327
+ * Returns [AVFormatContext, AVOutputFormat, AVIOContext, AVStream[]]
2328
+ * @param opts Muxer options
2329
+ * @param stramCtxs Context info for each stream to mux
2330
+ */
2331
+ ff_init_muxer(
2332
+ opts: {
2333
+ oformat?: number, // format pointer
2334
+ format_name?: string, // libav name
2335
+ filename?: string,
2336
+ device?: boolean, // Create a writer device
2337
+ open?: boolean, // Open the file for writing
2338
+ codecpars?: boolean // Streams is in terms of codecpars, not codecctx
2339
+ },
2340
+ streamCtxs: [number, number, number][] // AVCodecContext | AVCodecParameters, time_base_num, time_base_den
2341
+ ): Promise<[number, number, number, number[]]>;
2342
+ /**
2343
+ * Free up a muxer format and/or file
2344
+ * @param oc AVFormatContext
2345
+ * @param pb AVIOContext
2346
+ */
2347
+ ff_free_muxer(oc: number, pb: number): Promise<void>;
2348
+ /**
2349
+ * Initialize a demuxer from a file and format context, and get the list of
2350
+ * codecs/types.
2351
+ * Returns [AVFormatContext, Stream[]]
2352
+ * @param filename Filename to open
2353
+ * @param fmt Format to use (optional)
2354
+ */
2355
+ ff_init_demuxer_file(
2356
+ filename: string, fmt?: string
2357
+ ): Promise<[number, Stream[]]>;
2358
+ /**
2359
+ * Write some number of packets at once.
2360
+ * @param oc AVFormatContext
2361
+ * @param pkt AVPacket
2362
+ * @param inPackets Packets to write
2363
+ * @param interleave Set to false to *not* use the interleaved writer.
2364
+ * Interleaving is the default.
2365
+ */
2366
+ ff_write_multi(
2367
+ oc: number, pkt: number, inPackets: (Packet | number)[], interleave?: boolean
2368
+ ): Promise<void>;
2369
+ /**
2370
+ * Read many packets at once. If you don't set any limits, this function will
2371
+ * block (asynchronously) until the whole file is read, so make sure you set
2372
+ * some limits if you want to read a bit at a time. Returns a pair [result,
2373
+ * packets], where the result indicates whether an error was encountered, an
2374
+ * EOF, or simply limits (EAGAIN), and packets is a dictionary indexed by the
2375
+ * stream number in which each element is an array of packets from that stream.
2376
+ * @param fmt_ctx AVFormatContext
2377
+ * @param pkt AVPacket
2378
+ * @param opts Other options
2379
+ */
2380
+ ff_read_frame_multi(
2381
+ fmt_ctx: number, pkt: number, opts?: {
2382
+ index?: number, // INPUT stream index
2383
+ limit?: number, // OUTPUT limit, in bytes
2384
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
2385
+ copyoutPacket?: "default" // Version of ff_copyout_packet to use
2386
+ }
2387
+ ): Promise<[number, Record<number, Packet[]>]>
2388
+ ff_read_frame_multi(
2389
+ fmt_ctx: number, pkt: number, opts: {
2390
+ index?: number, // INPUT stream index
2391
+ limit?: number, // OUTPUT limit, in bytes
2392
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
2393
+ copyoutPacket: "ptr" // Version of ff_copyout_packet to use
2394
+ }
2395
+ ): Promise<[number, Record<number, number[]>]>;
2396
+ /**
2397
+ * @deprecated
2398
+ * DEPRECATED. Use `ff_read_frame_multi`.
2399
+ * Read many packets at once. This older API is now deprecated. The devfile
2400
+ * parameter is unused and unsupported. Dev files should be used via the normal
2401
+ * `ff_reader_dev_waiting` API, rather than counting on device file limits, as
2402
+ * this function used to.
2403
+ * @param fmt_ctx AVFormatContext
2404
+ * @param pkt AVPacket
2405
+ * @param devfile Unused
2406
+ * @param opts Other options
2407
+ */
2408
+ ff_read_multi(
2409
+ fmt_ctx: number, pkt: number, devfile?: string | null, opts?: {
2410
+ limit?: number, // OUTPUT limit, in bytes
2411
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
2412
+ copyoutPacket?: "default" // Version of ff_copyout_packet to use
2413
+ }
2414
+ ): Promise<[number, Record<number, Packet[]>]>
2415
+ ff_read_multi(
2416
+ fmt_ctx: number, pkt: number, devfile: string | null, opts: {
2417
+ limit?: number, // OUTPUT limit, in bytes
2418
+ devLimit?: number, // INPUT limit, in bytes (don't read if less than this much data is available)
2419
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
2420
+ copyoutPacket: "ptr" // Version of ff_copyout_packet to use
2421
+ }
2422
+ ): Promise<[number, Record<number, number[]>]>;
2423
+ /**
2424
+ * Initialize a filter graph. No equivalent free since you just need to free
2425
+ * the graph itself (av_filter_graph_free) and everything under it will be
2426
+ * freed automatically.
2427
+ * Returns [AVFilterGraph, AVFilterContext, AVFilterContext], where the second
2428
+ * and third are the input and output buffer source/sink. For multiple
2429
+ * inputs/outputs, the second and third will be arrays, as appropriate.
2430
+ * @param filters_descr Filtergraph description
2431
+ * @param input Input settings, or array of input settings for multiple inputs
2432
+ * @param output Output settings, or array of output settings for multiple
2433
+ * outputs
2434
+ */
2435
+ ff_init_filter_graph(
2436
+ filters_descr: string,
2437
+ input: FilterIOSettings,
2438
+ output: FilterIOSettings
2439
+ ): Promise<[number, number, number]>;
2440
+ ff_init_filter_graph(
2441
+ filters_descr: string,
2442
+ input: FilterIOSettings[],
2443
+ output: FilterIOSettings
2444
+ ): Promise<[number, number[], number]>;
2445
+ ff_init_filter_graph(
2446
+ filters_descr: string,
2447
+ input: FilterIOSettings,
2448
+ output: FilterIOSettings[]
2449
+ ): Promise<[number, number, number[]]>;
2450
+ ff_init_filter_graph(
2451
+ filters_descr: string,
2452
+ input: FilterIOSettings[],
2453
+ output: FilterIOSettings[]
2454
+ ): Promise<[number, number[], number[]]>;
2455
+ /**
2456
+ * Filter some number of frames, possibly corresponding to multiple sources.
2457
+ * @param srcs AVFilterContext(s), input
2458
+ * @param buffersink_ctx AVFilterContext, output
2459
+ * @param framePtr AVFrame
2460
+ * @param inFrames Input frames, either as an array of frames or with frames
2461
+ * per input
2462
+ * @param config Options. May be "true" to indicate end of stream.
2463
+ */
2464
+ ff_filter_multi(
2465
+ srcs: number, buffersink_ctx: number, framePtr: number,
2466
+ inFrames: (Frame | number)[], config?: boolean | {
2467
+ fin?: boolean,
2468
+ copyoutFrame?: "default" | "video" | "video_packed"
2469
+ }
2470
+ ): Promise<Frame[]>;
2471
+ ff_filter_multi(
2472
+ srcs: number[], buffersink_ctx: number, framePtr: number,
2473
+ inFrames: (Frame | number)[][], config?: boolean[] | {
2474
+ fin?: boolean,
2475
+ copyoutFrame?: "default" | "video" | "video_packed"
2476
+ }[]
2477
+ ): Promise<Frame[]>
2478
+ ff_filter_multi(
2479
+ srcs: number, buffersink_ctx: number, framePtr: number,
2480
+ inFrames: (Frame | number)[], config: {
2481
+ fin?: boolean,
2482
+ copyoutFrame: "ptr"
2483
+ }
2484
+ ): Promise<number[]>;
2485
+ ff_filter_multi(
2486
+ srcs: number[], buffersink_ctx: number, framePtr: number,
2487
+ inFrames: (Frame | number)[][], config: {
2488
+ fin?: boolean,
2489
+ copyoutFrame: "ptr"
2490
+ }[]
2491
+ ): Promise<number[]>
2492
+ ff_filter_multi(
2493
+ srcs: number, buffersink_ctx: number, framePtr: number,
2494
+ inFrames: (Frame | number)[], config: {
2495
+ fin?: boolean,
2496
+ copyoutFrame: "ImageData"
2497
+ }
2498
+ ): Promise<ImageData[]>;
2499
+ ff_filter_multi(
2500
+ srcs: number[], buffersink_ctx: number, framePtr: number,
2501
+ inFrames: (Frame | number)[][], config: {
2502
+ fin?: boolean,
2503
+ copyoutFrame: "ImageData"
2504
+ }[]
2505
+ ): Promise<ImageData[]>;
2506
+ /**
2507
+ * Decode and filter frames. Just a combination of ff_decode_multi and
2508
+ * ff_filter_multi that's all done on the libav.js side.
2509
+ * @param ctx AVCodecContext
2510
+ * @param buffersrc_ctx AVFilterContext, input
2511
+ * @param buffersink_ctx AVFilterContext, output
2512
+ * @param pkt AVPacket
2513
+ * @param frame AVFrame
2514
+ * @param inPackets Incoming packets to decode and filter
2515
+ * @param config Decoding and filtering options. May be "true" to indicate end
2516
+ * of stream.
2517
+ */
2518
+ ff_decode_filter_multi(
2519
+ ctx: number, buffersrc_ctx: number, buffersink_ctx: number, pkt: number,
2520
+ frame: number, inPackets: (Packet | number)[],
2521
+ config?: boolean | {
2522
+ fin?: boolean,
2523
+ ignoreErrors?: boolean,
2524
+ copyoutFrame?: "default" | "video" | "video_packed"
2525
+ }
2526
+ ): Promise<Frame[]>
2527
+ ff_decode_filter_multi(
2528
+ ctx: number, buffersrc_ctx: number, buffersink_ctx: number, pkt: number,
2529
+ frame: number, inPackets: (Packet | number)[],
2530
+ config: {
2531
+ fin?: boolean,
2532
+ ignoreErrors?: boolean,
2533
+ copyoutFrame: "ptr"
2534
+ }
2535
+ ): Promise<number[]>
2536
+ ff_decode_filter_multi(
2537
+ ctx: number, buffersrc_ctx: number, buffersink_ctx: number, pkt: number,
2538
+ frame: number, inPackets: (Packet | number)[],
2539
+ config: {
2540
+ fin?: boolean,
2541
+ ignoreErrors?: boolean,
2542
+ copyoutFrame: "ImageData"
2543
+ }
2544
+ ): Promise<ImageData[]>;
2545
+ /**
2546
+ * Copy out a frame.
2547
+ * @param frame AVFrame
2548
+ */
2549
+ ff_copyout_frame(frame: number): Promise<Frame>;
2550
+ /**
2551
+ * Copy out a video frame. `ff_copyout_frame` will copy out a video frame if a
2552
+ * video frame is found, but this may be faster if you know it's a video frame.
2553
+ * @param frame AVFrame
2554
+ */
2555
+ ff_copyout_frame_video(frame: number): Promise<Frame>;
2556
+ /**
2557
+ * Get the size of a packed video frame in its native format.
2558
+ * @param frame AVFrame
2559
+ */
2560
+ ff_frame_video_packed_size(frame: number): Promise<Frame>;
2561
+ /**
2562
+ * Copy out a video frame, as a single packed Uint8Array.
2563
+ * @param frame AVFrame
2564
+ */
2565
+ ff_copyout_frame_video_packed(frame: number): Promise<Frame>;
2566
+ /**
2567
+ * Copy out a video frame as an ImageData. The video frame *must* be RGBA for
2568
+ * this to work as expected (though some ImageData will be returned for any
2569
+ * frame).
2570
+ * @param frame AVFrame
2571
+ */
2572
+ ff_copyout_frame_video_imagedata(
2573
+ frame: number
2574
+ ): Promise<ImageData>;
2575
+ /**
2576
+ * Copy in a frame.
2577
+ * @param framePtr AVFrame
2578
+ * @param frame Frame to copy in, as either a Frame or an AVFrame pointer
2579
+ */
2580
+ ff_copyin_frame(framePtr: number, frame: Frame | number): Promise<void>;
2581
+ /**
2582
+ * Copy out a packet.
2583
+ * @param pkt AVPacket
2584
+ */
2585
+ ff_copyout_packet(pkt: number): Promise<Packet>;
2586
+ /**
2587
+ * Copy "out" a packet by just copying its data into a new AVPacket.
2588
+ * @param pkt AVPacket
2589
+ */
2590
+ ff_copyout_packet_ptr(pkt: number): Promise<number>;
2591
+ /**
2592
+ * Copy in a packet.
2593
+ * @param pktPtr AVPacket
2594
+ * @param packet Packet to copy in, as either a Packet or an AVPacket pointer
2595
+ */
2596
+ ff_copyin_packet(pktPtr: number, packet: Packet | number): Promise<void>;
2597
+ /**
2598
+ * Copy out codec parameters.
2599
+ * @param codecpar AVCodecParameters
2600
+ */
2601
+ ff_copyout_codecpar(codecpar: number): Promise<CodecParameters>;
2602
+ /**
2603
+ * Copy in codec parameters.
2604
+ * @param codecparPtr AVCodecParameters
2605
+ * @param codecpar Codec parameters to copy in.
2606
+ */
2607
+ ff_copyin_codecpar(codecparPtr: number, codecpar: CodecParameters): Promise<void>;
2608
+ /**
2609
+ * Allocate and copy in a 32-bit int list.
2610
+ * @param list List of numbers to copy in
2611
+ */
2612
+ ff_malloc_int32_list(list: number[]): Promise<number>;
2613
+ /**
2614
+ * Allocate and copy in a 64-bit int list.
2615
+ * @param list List of numbers to copy in
2616
+ */
2617
+ ff_malloc_int64_list(list: number[]): Promise<number>;
2618
+ /**
2619
+ * Allocate and copy in a string array. The resulting array will be
2620
+ * NULL-terminated.
2621
+ * @param arr Array of strings to copy in.
2622
+ */
2623
+ ff_malloc_string_array(arr: string[]): Promise<number>;
2624
+ /**
2625
+ * Free a string array allocated by ff_malloc_string_array.
2626
+ * @param ptr Pointer to the array to free.
2627
+ */
2628
+ ff_free_string_array(ptr: number): Promise<void>;
2629
+ /**
2630
+ * Frontend to the ffmpeg CLI (if it's compiled in). Pass arguments as strings,
2631
+ * or you may intermix arrays of strings for multiple arguments.
2632
+ *
2633
+ * NOTE: ffmpeg 6.0 and later require threads for the ffmpeg CLI. libav.js
2634
+ * *does* support the ffmpeg CLI on unthreaded environments, but to do so, it
2635
+ * uses an earlier version of the CLI, from 5.1.3. The libraries are still
2636
+ * modern, and if running libav.js in threaded mode, the ffmpeg CLI is modern as
2637
+ * well. As time passes, these two versions will drift apart, so make sure you
2638
+ * know whether you're running in threaded mode or not!
2639
+ */
2640
+ ffmpeg(...args: (string | string[])[]): Promise<number>;
2641
+ /**
2642
+ * Frontend to the ffprobe CLI (if it's compiled in). Pass arguments as strings,
2643
+ * or you may intermix arrays of strings for multiple arguments.
2644
+ */
2645
+ ffprobe(...args: (string | string[])[]): Promise<number>;
2646
+
2647
+
2648
+ // Declarations for things that use int64, so will be communicated incorrectly
2649
+
2650
+ /**
2651
+ * Seek to timestamp ts, bounded by min_ts and max_ts. All 64-bit ints are
2652
+ * in the form of low and high bits.
2653
+ */
2654
+ avformat_seek_file(
2655
+ s: number, stream_index: number, min_tslo: number, min_tshi: number,
2656
+ tslo: number, tshi: number, max_tslo: number, max_tshi: number,
2657
+ flags: number
2658
+ ): Promise<number>;
2659
+
2660
+ /**
2661
+ * Seek to *at the earliest* the given timestamp.
2662
+ */
2663
+ avformat_seek_file_min(
2664
+ s: number, stream_index: number, tslo: number, tshi: number,
2665
+ flags: number
2666
+ ): Promise<number>;
2667
+
2668
+ /**
2669
+ * Seek to *at the latest* the given timestamp.
2670
+ */
2671
+ avformat_seek_file_max(
2672
+ s: number, stream_index: number, tslo: number, tshi: number,
2673
+ flags: number
2674
+ ): Promise<number>;
2675
+
2676
+ /**
2677
+ * Seek to as close to this timestamp as the format allows.
2678
+ */
2679
+ avformat_seek_file_approx(
2680
+ s: number, stream_index: number, tslo: number, tshi: number,
2681
+ flags: number
2682
+ ): Promise<number>;
2683
+
2684
+ /**
2685
+ * Seek to the keyframe at timestamp 'timestamp' in 'stream_index'.
2686
+ */
2687
+ av_seek_frame(
2688
+ s: number, stream_index: number,
2689
+ timestamplo: number, timestamphi: number,
2690
+ flags: number
2691
+ ): Promise<number>;
2692
+
2693
+ /**
2694
+ * Get the depth of this component of this pixel format.
2695
+ */
2696
+ AVPixFmtDescriptor_comp_depth(fmt: number, comp: number): Promise<number>;
2697
+
2698
+
2699
+ /**
2700
+ * Callback when writes occur. Set by the user.
2701
+ */
2702
+ onwrite?: (filename: string, position: number, buffer: Uint8Array | Int8Array) => void;
2703
+
2704
+ /**
2705
+ * Callback for stream reader devices. Set by the user.
2706
+ */
2707
+ onread?: (filename: string, pos: number, length: number) => void;
2708
+
2709
+ /**
2710
+ * Callback for block reader devices. Set by the user.
2711
+ */
2712
+ onblockread?: (filename: string, pos: number, length: number) => void;
2713
+
2714
+ /**
2715
+ * Terminate the worker associated with this libav.js instance, rendering
2716
+ * it inoperable and freeing its memory.
2717
+ */
2718
+ terminate(): void;
2719
+ }
2720
+
2721
+ /**
2722
+ * Synchronous functions, available on non-worker libav.js instances.
2723
+ */
2724
+ export interface LibAVSync {
2725
+ /**
2726
+ * Return number of bytes per sample.
2727
+ *
2728
+ * @param sample_fmt the sample format
2729
+ * @return number of bytes per sample or zero if unknown for the given
2730
+ * sample format
2731
+ */
2732
+ av_get_bytes_per_sample_sync(sample_fmt: number): number;
2733
+ /**
2734
+ * Compare two timestamps each in its own time base.
2735
+ *
2736
+ * @return One of the following values:
2737
+ * - -1 if `ts_a` is before `ts_b`
2738
+ * - 1 if `ts_a` is after `ts_b`
2739
+ * - 0 if they represent the same position
2740
+ *
2741
+ * @warning
2742
+ * The result of the function is undefined if one of the timestamps is outside
2743
+ * the `int64_t` range when represented in the other's timebase.
2744
+ */
2745
+ av_compare_ts_js_sync(ts_a: number,tb_a: number,ts_b: number,tb_b: number,a4: number,a5: number,a6: number,a7: number): number;
2746
+ /**
2747
+ * @defgroup opt_set_funcs Option setting functions
2748
+ * @{
2749
+ * Those functions set the field of obj with the given name to value.
2750
+ *
2751
+ * @param[in] obj A struct whose first element is a pointer to an AVClass.
2752
+ * @param[in] name the name of the field to set
2753
+ * @param[in] val The value to set. In case of av_opt_set() if the field is not
2754
+ * of a string type, then the given string is parsed.
2755
+ * SI postfixes and some named scalars are supported.
2756
+ * If the field is of a numeric type, it has to be a numeric or named
2757
+ * scalar. Behavior with more than one scalar and +- infix operators
2758
+ * is undefined.
2759
+ * If the field is of a flags type, it has to be a sequence of numeric
2760
+ * scalars or named flags separated by '+' or '-'. Prefixing a flag
2761
+ * with '+' causes it to be set without affecting the other flags;
2762
+ * similarly, '-' unsets a flag.
2763
+ * If the field is of a dictionary type, it has to be a ':' separated list of
2764
+ * key=value parameters. Values containing ':' special characters must be
2765
+ * escaped.
2766
+ * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN
2767
+ * is passed here, then the option may be set on a child of obj.
2768
+ *
2769
+ * @return 0 if the value has been set, or an AVERROR code in case of
2770
+ * error:
2771
+ * AVERROR_OPTION_NOT_FOUND if no matching option exists
2772
+ * AVERROR(ERANGE) if the value is out of range
2773
+ * AVERROR(EINVAL) if the value is not valid
2774
+ */
2775
+ av_opt_set_sync(obj: number,name: string,val: string,search_flags: number): number;
2776
+ av_opt_set_int_list_js_sync(a0: number,a1: string,a2: number,a3: number,a4: number,a5: number): number;
2777
+ /**
2778
+ * Allocate an AVFrame and set its fields to default values. The resulting
2779
+ * struct must be freed using av_frame_free().
2780
+ *
2781
+ * @return An AVFrame filled with default values or NULL on failure.
2782
+ *
2783
+ * @note this only allocates the AVFrame itself, not the data buffers. Those
2784
+ * must be allocated through other means, e.g. with av_frame_get_buffer() or
2785
+ * manually.
2786
+ */
2787
+ av_frame_alloc_sync(): number;
2788
+ /**
2789
+ * Create a new frame that references the same data as src.
2790
+ *
2791
+ * This is a shortcut for av_frame_alloc()+av_frame_ref().
2792
+ *
2793
+ * @return newly created AVFrame on success, NULL on error.
2794
+ */
2795
+ av_frame_clone_sync(src: number,a1: number): number;
2796
+ /**
2797
+ * Free the frame and any dynamically allocated objects in it,
2798
+ * e.g. extended_data. If the frame is reference counted, it will be
2799
+ * unreferenced first.
2800
+ *
2801
+ * @param frame frame to be freed. The pointer will be set to NULL.
2802
+ */
2803
+ av_frame_free_sync(frame: number): void;
2804
+ /**
2805
+ * Allocate new buffer(s) for audio or video data.
2806
+ *
2807
+ * The following fields must be set on frame before calling this function:
2808
+ * - format (pixel format for video, sample format for audio)
2809
+ * - width and height for video
2810
+ * - nb_samples and ch_layout for audio
2811
+ *
2812
+ * This function will fill AVFrame.data and AVFrame.buf arrays and, if
2813
+ * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
2814
+ * For planar formats, one buffer will be allocated for each plane.
2815
+ *
2816
+ * @warning: if frame already has been allocated, calling this function will
2817
+ * leak memory. In addition, undefined behavior can occur in certain
2818
+ * cases.
2819
+ *
2820
+ * @param frame frame in which to store the new buffers.
2821
+ * @param align Required buffer size alignment. If equal to 0, alignment will be
2822
+ * chosen automatically for the current CPU. It is highly
2823
+ * recommended to pass 0 here unless you know what you are doing.
2824
+ *
2825
+ * @return 0 on success, a negative AVERROR on error.
2826
+ */
2827
+ av_frame_get_buffer_sync(frame: number,align: number): number;
2828
+ /**
2829
+ * Ensure that the frame data is writable, avoiding data copy if possible.
2830
+ *
2831
+ * Do nothing if the frame is writable, allocate new buffers and copy the data
2832
+ * if it is not. Non-refcounted frames behave as non-writable, i.e. a copy
2833
+ * is always made.
2834
+ *
2835
+ * @return 0 on success, a negative AVERROR on error.
2836
+ *
2837
+ * @see av_frame_is_writable(), av_buffer_is_writable(),
2838
+ * av_buffer_make_writable()
2839
+ */
2840
+ av_frame_make_writable_sync(frame: number): number;
2841
+ /**
2842
+ * Set up a new reference to the data described by the source frame.
2843
+ *
2844
+ * Copy frame properties from src to dst and create a new reference for each
2845
+ * AVBufferRef from src.
2846
+ *
2847
+ * If src is not reference counted, new buffers are allocated and the data is
2848
+ * copied.
2849
+ *
2850
+ * @warning: dst MUST have been either unreferenced with av_frame_unref(dst),
2851
+ * or newly allocated with av_frame_alloc() before calling this
2852
+ * function, or undefined behavior will occur.
2853
+ *
2854
+ * @return 0 on success, a negative AVERROR on error
2855
+ */
2856
+ av_frame_ref_sync(dst: number,src: number): number;
2857
+ /**
2858
+ * Unreference all the buffers referenced by frame and reset the frame fields.
2859
+ */
2860
+ av_frame_unref_sync(frame: number): void;
2861
+ ff_frame_rescale_ts_js_sync(a0: number,a1: number,a2: number,a3: number,a4: number): void;
2862
+ /**
2863
+ * Get the current log level
2864
+ *
2865
+ * @see lavu_log_constants
2866
+ *
2867
+ * @return Current log level
2868
+ */
2869
+ av_log_get_level_sync(): number;
2870
+ /**
2871
+ * Set the log level
2872
+ *
2873
+ * @see lavu_log_constants
2874
+ *
2875
+ * @param level Logging level
2876
+ */
2877
+ av_log_set_level_sync(level: number): void;
2878
+ /**
2879
+ * Allocate an AVPacket and set its fields to default values. The resulting
2880
+ * struct must be freed using av_packet_free().
2881
+ *
2882
+ * @return An AVPacket filled with default values or NULL on failure.
2883
+ *
2884
+ * @note this only allocates the AVPacket itself, not the data buffers. Those
2885
+ * must be allocated through other means such as av_new_packet.
2886
+ *
2887
+ * @see av_new_packet
2888
+ */
2889
+ av_packet_alloc_sync(): number;
2890
+ /**
2891
+ * Create a new packet that references the same data as src.
2892
+ *
2893
+ * This is a shortcut for av_packet_alloc()+av_packet_ref().
2894
+ *
2895
+ * @return newly created AVPacket on success, NULL on error.
2896
+ *
2897
+ * @see av_packet_alloc
2898
+ * @see av_packet_ref
2899
+ */
2900
+ av_packet_clone_sync(src: number): number;
2901
+ /**
2902
+ * Free the packet, if the packet is reference counted, it will be
2903
+ * unreferenced first.
2904
+ *
2905
+ * @param pkt packet to be freed. The pointer will be set to NULL.
2906
+ * @note passing NULL is a no-op.
2907
+ */
2908
+ av_packet_free_sync(pkt: number): void;
2909
+ /**
2910
+ * Allocate new information of a packet.
2911
+ *
2912
+ * @param pkt packet
2913
+ * @param type side information type
2914
+ * @param size side information size
2915
+ * @return pointer to fresh allocated data or NULL otherwise
2916
+ */
2917
+ av_packet_new_side_data_sync(pkt: number,type: number,size: number): number;
2918
+ /**
2919
+ * Setup a new reference to the data described by a given packet
2920
+ *
2921
+ * If src is reference-counted, setup dst as a new reference to the
2922
+ * buffer in src. Otherwise allocate a new buffer in dst and copy the
2923
+ * data from src into it.
2924
+ *
2925
+ * All the other fields are copied from src.
2926
+ *
2927
+ * @see av_packet_unref
2928
+ *
2929
+ * @param dst Destination packet. Will be completely overwritten.
2930
+ * @param src Source packet
2931
+ *
2932
+ * @return 0 on success, a negative AVERROR on error. On error, dst
2933
+ * will be blank (as if returned by av_packet_alloc()).
2934
+ */
2935
+ av_packet_ref_sync(dst: number,src: number): number;
2936
+ /**
2937
+ * Convert valid timing fields (timestamps / durations) in a packet from one
2938
+ * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
2939
+ * ignored.
2940
+ *
2941
+ * @param pkt packet on which the conversion will be performed
2942
+ * @param tb_src source timebase, in which the timing fields in pkt are
2943
+ * expressed
2944
+ * @param tb_dst destination timebase, to which the timing fields will be
2945
+ * converted
2946
+ */
2947
+ av_packet_rescale_ts_js_sync(pkt: number,tb_src: number,tb_dst: number,a3: number,a4: number): void;
2948
+ /**
2949
+ * Wipe the packet.
2950
+ *
2951
+ * Unreference the buffer referenced by the packet and reset the
2952
+ * remaining packet fields to their default values.
2953
+ *
2954
+ * @param pkt The packet to be unreferenced.
2955
+ */
2956
+ av_packet_unref_sync(pkt: number): void;
2957
+ /**
2958
+ * Duplicate a string.
2959
+ *
2960
+ * @param s String to be duplicated
2961
+ * @return Pointer to a newly-allocated string containing a
2962
+ * copy of `s` or `NULL` if the string cannot be allocated
2963
+ * @see av_strndup()
2964
+ */
2965
+ av_strdup_sync(s: string): number;
2966
+ /**
2967
+ * Get a frame with filtered data from sink and put it in frame.
2968
+ *
2969
+ * @param ctx pointer to a context of a buffersink or abuffersink AVFilter.
2970
+ * @param frame pointer to an allocated frame that will be filled with data.
2971
+ * The data must be freed using av_frame_unref() / av_frame_free()
2972
+ *
2973
+ * @return
2974
+ * - >= 0 if a frame was successfully returned.
2975
+ * - AVERROR(EAGAIN) if no frames are available at this point; more
2976
+ * input frames must be added to the filtergraph to get more output.
2977
+ * - AVERROR_EOF if there will be no more output frames on this sink.
2978
+ * - A different negative AVERROR code in other failure cases.
2979
+ */
2980
+ av_buffersink_get_frame_sync(ctx: number,frame: number): number;
2981
+ av_buffersink_get_time_base_num_sync(a0: number): number;
2982
+ av_buffersink_get_time_base_den_sync(a0: number): number;
2983
+ /**
2984
+ * Set the frame size for an audio buffer sink.
2985
+ *
2986
+ * All calls to av_buffersink_get_buffer_ref will return a buffer with
2987
+ * exactly the specified number of samples, or AVERROR(EAGAIN) if there is
2988
+ * not enough. The last buffer at EOF will be padded with 0.
2989
+ */
2990
+ av_buffersink_set_frame_size_sync(ctx: number,frame_size: number): void;
2991
+ ff_buffersink_set_ch_layout_sync(a0: number,a1: number,a2: number): number;
2992
+ /**
2993
+ * Add a frame to the buffer source.
2994
+ *
2995
+ * By default, if the frame is reference-counted, this function will take
2996
+ * ownership of the reference(s) and reset the frame. This can be controlled
2997
+ * using the flags.
2998
+ *
2999
+ * If this function returns an error, the input frame is not touched.
3000
+ *
3001
+ * @param buffer_src pointer to a buffer source context
3002
+ * @param frame a frame, or NULL to mark EOF
3003
+ * @param flags a combination of AV_BUFFERSRC_FLAG_*
3004
+ * @return >= 0 in case of success, a negative AVERROR code
3005
+ * in case of failure
3006
+ */
3007
+ av_buffersrc_add_frame_flags_sync(buffer_src: number,frame: number,flags: number): number;
3008
+ /**
3009
+ * Free a filter context. This will also remove the filter from its
3010
+ * filtergraph's list of filters.
3011
+ *
3012
+ * @param filter the filter to free
3013
+ */
3014
+ avfilter_free_sync(filter: number): void;
3015
+ /**
3016
+ * Get a filter definition matching the given name.
3017
+ *
3018
+ * @param name the filter name to find
3019
+ * @return the filter definition, if any matching one is registered.
3020
+ * NULL if none found.
3021
+ */
3022
+ avfilter_get_by_name_sync(name: string): number;
3023
+ /**
3024
+ * Allocate a filter graph.
3025
+ *
3026
+ * @return the allocated filter graph on success or NULL.
3027
+ */
3028
+ avfilter_graph_alloc_sync(): number;
3029
+ /**
3030
+ * Check validity and configure all the links and formats in the graph.
3031
+ *
3032
+ * @param graphctx the filter graph
3033
+ * @param log_ctx context used for logging
3034
+ * @return >= 0 in case of success, a negative AVERROR code otherwise
3035
+ */
3036
+ avfilter_graph_config_sync(graphctx: number,log_ctx: number): number;
3037
+ /**
3038
+ * Create and add a filter instance into an existing graph.
3039
+ * The filter instance is created from the filter filt and inited
3040
+ * with the parameter args. opaque is currently ignored.
3041
+ *
3042
+ * In case of success put in *filt_ctx the pointer to the created
3043
+ * filter instance, otherwise set *filt_ctx to NULL.
3044
+ *
3045
+ * @param name the instance name to give to the created filter instance
3046
+ * @param graph_ctx the filter graph
3047
+ * @return a negative AVERROR error code in case of failure, a non
3048
+ * negative value otherwise
3049
+ */
3050
+ avfilter_graph_create_filter_js_sync(filt_ctx: number,filt: string,name: string,args: number,opaque: number): number;
3051
+ /**
3052
+ * Free a graph, destroy its links, and set *graph to NULL.
3053
+ * If *graph is NULL, do nothing.
3054
+ */
3055
+ avfilter_graph_free_sync(graph: number): void;
3056
+ /**
3057
+ * Add a graph described by a string to a graph.
3058
+ *
3059
+ * @note The caller must provide the lists of inputs and outputs,
3060
+ * which therefore must be known before calling the function.
3061
+ *
3062
+ * @note The inputs parameter describes inputs of the already existing
3063
+ * part of the graph; i.e. from the point of view of the newly created
3064
+ * part, they are outputs. Similarly the outputs parameter describes
3065
+ * outputs of the already existing filters, which are provided as
3066
+ * inputs to the parsed filters.
3067
+ *
3068
+ * @param graph the filter graph where to link the parsed graph context
3069
+ * @param filters string to be parsed
3070
+ * @param inputs linked list to the inputs of the graph
3071
+ * @param outputs linked list to the outputs of the graph
3072
+ * @return zero on success, a negative AVERROR code on error
3073
+ */
3074
+ avfilter_graph_parse_sync(graph: number,filters: string,inputs: number,outputs: number,log_ctx: number): number;
3075
+ /**
3076
+ * Allocate a single AVFilterInOut entry.
3077
+ * Must be freed with avfilter_inout_free().
3078
+ * @return allocated AVFilterInOut on success, NULL on failure.
3079
+ */
3080
+ avfilter_inout_alloc_sync(): number;
3081
+ /**
3082
+ * Free the supplied list of AVFilterInOut and set *inout to NULL.
3083
+ * If *inout is NULL, do nothing.
3084
+ */
3085
+ avfilter_inout_free_sync(inout: number): void;
3086
+ /**
3087
+ * Link two filters together.
3088
+ *
3089
+ * @param src the source filter
3090
+ * @param srcpad index of the output pad on the source filter
3091
+ * @param dst the destination filter
3092
+ * @param dstpad index of the input pad on the destination filter
3093
+ * @return zero on success
3094
+ */
3095
+ avfilter_link_sync(src: number,srcpad: number,dst: number,dstpad: number): number;
3096
+ /**
3097
+ * Allocate an AVCodecContext and set its fields to default values. The
3098
+ * resulting struct should be freed with avcodec_free_context().
3099
+ *
3100
+ * @param codec if non-NULL, allocate private data and initialize defaults
3101
+ * for the given codec. It is illegal to then call avcodec_open2()
3102
+ * with a different codec.
3103
+ * If NULL, then the codec-specific defaults won't be initialized,
3104
+ * which may result in suboptimal default settings (this is
3105
+ * important mainly for encoders, e.g. libx264).
3106
+ *
3107
+ * @return An AVCodecContext filled with default values or NULL on failure.
3108
+ */
3109
+ avcodec_alloc_context3_sync(codec: number): number;
3110
+ /**
3111
+ * Close a given AVCodecContext and free all the data associated with it
3112
+ * (but not the AVCodecContext itself).
3113
+ *
3114
+ * Calling this function on an AVCodecContext that hasn't been opened will free
3115
+ * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
3116
+ * codec. Subsequent calls will do nothing.
3117
+ *
3118
+ * @deprecated Do not use this function. Use avcodec_free_context() to destroy a
3119
+ * codec context (either open or closed). Opening and closing a codec context
3120
+ * multiple times is not supported anymore -- use multiple codec contexts
3121
+ * instead.
3122
+ */
3123
+ avcodec_close_sync(avctx: number): number;
3124
+ /**
3125
+ * @return descriptor for given codec ID or NULL if no descriptor exists.
3126
+ */
3127
+ avcodec_descriptor_get_sync(id: number): number;
3128
+ /**
3129
+ * @return codec descriptor with the given name or NULL if no such descriptor
3130
+ * exists.
3131
+ */
3132
+ avcodec_descriptor_get_by_name_sync(name: string): number;
3133
+ /**
3134
+ * Iterate over all codec descriptors known to libavcodec.
3135
+ *
3136
+ * @param prev previous descriptor. NULL to get the first descriptor.
3137
+ *
3138
+ * @return next descriptor or NULL after the last descriptor
3139
+ */
3140
+ avcodec_descriptor_next_sync(prev: number): number;
3141
+ /**
3142
+ * Find a registered decoder with a matching codec ID.
3143
+ *
3144
+ * @param id AVCodecID of the requested decoder
3145
+ * @return A decoder if one was found, NULL otherwise.
3146
+ */
3147
+ avcodec_find_decoder_sync(id: number): number;
3148
+ /**
3149
+ * Find a registered decoder with the specified name.
3150
+ *
3151
+ * @param name name of the requested decoder
3152
+ * @return A decoder if one was found, NULL otherwise.
3153
+ */
3154
+ avcodec_find_decoder_by_name_sync(name: string): number;
3155
+ /**
3156
+ * Find a registered encoder with a matching codec ID.
3157
+ *
3158
+ * @param id AVCodecID of the requested encoder
3159
+ * @return An encoder if one was found, NULL otherwise.
3160
+ */
3161
+ avcodec_find_encoder_sync(id: number): number;
3162
+ /**
3163
+ * Find a registered encoder with the specified name.
3164
+ *
3165
+ * @param name name of the requested encoder
3166
+ * @return An encoder if one was found, NULL otherwise.
3167
+ */
3168
+ avcodec_find_encoder_by_name_sync(name: string): number;
3169
+ /**
3170
+ * Free the codec context and everything associated with it and write NULL to
3171
+ * the provided pointer.
3172
+ */
3173
+ avcodec_free_context_sync(avctx: number): void;
3174
+ /**
3175
+ * Get the name of a codec.
3176
+ * @return a static string identifying the codec; never NULL
3177
+ */
3178
+ avcodec_get_name_sync(id: number): string;
3179
+ /**
3180
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
3181
+ * function the context has to be allocated with avcodec_alloc_context3().
3182
+ *
3183
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
3184
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
3185
+ * retrieving a codec.
3186
+ *
3187
+ * Depending on the codec, you might need to set options in the codec context
3188
+ * also for decoding (e.g. width, height, or the pixel or audio sample format in
3189
+ * the case the information is not available in the bitstream, as when decoding
3190
+ * raw audio or video).
3191
+ *
3192
+ * Options in the codec context can be set either by setting them in the options
3193
+ * AVDictionary, or by setting the values in the context itself, directly or by
3194
+ * using the av_opt_set() API before calling this function.
3195
+ *
3196
+ * Example:
3197
+ * @code
3198
+ * av_dict_set(&opts, "b", "2.5M", 0);
3199
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
3200
+ * if (!codec)
3201
+ * exit(1);
3202
+ *
3203
+ * context = avcodec_alloc_context3(codec);
3204
+ *
3205
+ * if (avcodec_open2(context, codec, opts) < 0)
3206
+ * exit(1);
3207
+ * @endcode
3208
+ *
3209
+ * In the case AVCodecParameters are available (e.g. when demuxing a stream
3210
+ * using libavformat, and accessing the AVStream contained in the demuxer), the
3211
+ * codec parameters can be copied to the codec context using
3212
+ * avcodec_parameters_to_context(), as in the following example:
3213
+ *
3214
+ * @code
3215
+ * AVStream *stream = ...;
3216
+ * context = avcodec_alloc_context3(codec);
3217
+ * if (avcodec_parameters_to_context(context, stream->codecpar) < 0)
3218
+ * exit(1);
3219
+ * if (avcodec_open2(context, codec, NULL) < 0)
3220
+ * exit(1);
3221
+ * @endcode
3222
+ *
3223
+ * @note Always call this function before using decoding routines (such as
3224
+ * @ref avcodec_receive_frame()).
3225
+ *
3226
+ * @param avctx The context to initialize.
3227
+ * @param codec The codec to open this context for. If a non-NULL codec has been
3228
+ * previously passed to avcodec_alloc_context3() or
3229
+ * for this context, then this parameter MUST be either NULL or
3230
+ * equal to the previously passed codec.
3231
+ * @param options A dictionary filled with AVCodecContext and codec-private
3232
+ * options, which are set on top of the options already set in
3233
+ * avctx, can be NULL. On return this object will be filled with
3234
+ * options that were not found in the avctx codec context.
3235
+ *
3236
+ * @return zero on success, a negative value on error
3237
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
3238
+ * av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context()
3239
+ */
3240
+ avcodec_open2_sync(avctx: number,codec: number,options: number): number;
3241
+ /**
3242
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
3243
+ * function the context has to be allocated with avcodec_alloc_context3().
3244
+ *
3245
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
3246
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
3247
+ * retrieving a codec.
3248
+ *
3249
+ * Depending on the codec, you might need to set options in the codec context
3250
+ * also for decoding (e.g. width, height, or the pixel or audio sample format in
3251
+ * the case the information is not available in the bitstream, as when decoding
3252
+ * raw audio or video).
3253
+ *
3254
+ * Options in the codec context can be set either by setting them in the options
3255
+ * AVDictionary, or by setting the values in the context itself, directly or by
3256
+ * using the av_opt_set() API before calling this function.
3257
+ *
3258
+ * Example:
3259
+ * @code
3260
+ * av_dict_set(&opts, "b", "2.5M", 0);
3261
+ * codec = avcodec_find_decoder(AV_CODEC_ID_H264);
3262
+ * if (!codec)
3263
+ * exit(1);
3264
+ *
3265
+ * context = avcodec_alloc_context3(codec);
3266
+ *
3267
+ * if (avcodec_open2(context, codec, opts) < 0)
3268
+ * exit(1);
3269
+ * @endcode
3270
+ *
3271
+ * In the case AVCodecParameters are available (e.g. when demuxing a stream
3272
+ * using libavformat, and accessing the AVStream contained in the demuxer), the
3273
+ * codec parameters can be copied to the codec context using
3274
+ * avcodec_parameters_to_context(), as in the following example:
3275
+ *
3276
+ * @code
3277
+ * AVStream *stream = ...;
3278
+ * context = avcodec_alloc_context3(codec);
3279
+ * if (avcodec_parameters_to_context(context, stream->codecpar) < 0)
3280
+ * exit(1);
3281
+ * if (avcodec_open2(context, codec, NULL) < 0)
3282
+ * exit(1);
3283
+ * @endcode
3284
+ *
3285
+ * @note Always call this function before using decoding routines (such as
3286
+ * @ref avcodec_receive_frame()).
3287
+ *
3288
+ * @param avctx The context to initialize.
3289
+ * @param codec The codec to open this context for. If a non-NULL codec has been
3290
+ * previously passed to avcodec_alloc_context3() or
3291
+ * for this context, then this parameter MUST be either NULL or
3292
+ * equal to the previously passed codec.
3293
+ * @param options A dictionary filled with AVCodecContext and codec-private
3294
+ * options, which are set on top of the options already set in
3295
+ * avctx, can be NULL. On return this object will be filled with
3296
+ * options that were not found in the avctx codec context.
3297
+ *
3298
+ * @return zero on success, a negative value on error
3299
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(),
3300
+ * av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context()
3301
+ */
3302
+ avcodec_open2_js_sync(avctx: number,codec: number,options: number): number;
3303
+ /**
3304
+ * Allocate a new AVCodecParameters and set its fields to default values
3305
+ * (unknown/invalid/0). The returned struct must be freed with
3306
+ * avcodec_parameters_free().
3307
+ */
3308
+ avcodec_parameters_alloc_sync(): number;
3309
+ /**
3310
+ * Copy the contents of src to dst. Any allocated fields in dst are freed and
3311
+ * replaced with newly allocated duplicates of the corresponding fields in src.
3312
+ *
3313
+ * @return >= 0 on success, a negative AVERROR code on failure.
3314
+ */
3315
+ avcodec_parameters_copy_sync(dst: number,src: number): number;
3316
+ /**
3317
+ * Free an AVCodecParameters instance and everything associated with it and
3318
+ * write NULL to the supplied pointer.
3319
+ */
3320
+ avcodec_parameters_free_sync(par: number): void;
3321
+ /**
3322
+ * Fill the parameters struct based on the values from the supplied codec
3323
+ * context. Any allocated fields in par are freed and replaced with duplicates
3324
+ * of the corresponding fields in codec.
3325
+ *
3326
+ * @return >= 0 on success, a negative AVERROR code on failure
3327
+ */
3328
+ avcodec_parameters_from_context_sync(par: number,codec: number): number;
3329
+ /**
3330
+ * Fill the codec context based on the values from the supplied codec
3331
+ * parameters. Any allocated fields in codec that have a corresponding field in
3332
+ * par are freed and replaced with duplicates of the corresponding field in par.
3333
+ * Fields in codec that do not have a counterpart in par are not touched.
3334
+ *
3335
+ * @return >= 0 on success, a negative AVERROR code on failure.
3336
+ */
3337
+ avcodec_parameters_to_context_sync(codec: number,par: number): number;
3338
+ /**
3339
+ * Return decoded output data from a decoder or encoder (when the
3340
+ * @ref AV_CODEC_FLAG_RECON_FRAME flag is used).
3341
+ *
3342
+ * @param avctx codec context
3343
+ * @param frame This will be set to a reference-counted video or audio
3344
+ * frame (depending on the decoder type) allocated by the
3345
+ * codec. Note that the function will always call
3346
+ * av_frame_unref(frame) before doing anything else.
3347
+ *
3348
+ * @retval 0 success, a frame was returned
3349
+ * @retval AVERROR(EAGAIN) output is not available in this state - user must
3350
+ * try to send new input
3351
+ * @retval AVERROR_EOF the codec has been fully flushed, and there will be
3352
+ * no more output frames
3353
+ * @retval AVERROR(EINVAL) codec not opened, or it is an encoder without the
3354
+ * @ref AV_CODEC_FLAG_RECON_FRAME flag enabled
3355
+ * @retval "other negative error code" legitimate decoding errors
3356
+ */
3357
+ avcodec_receive_frame_sync(avctx: number,frame: number): number;
3358
+ /**
3359
+ * Read encoded data from the encoder.
3360
+ *
3361
+ * @param avctx codec context
3362
+ * @param avpkt This will be set to a reference-counted packet allocated by the
3363
+ * encoder. Note that the function will always call
3364
+ * av_packet_unref(avpkt) before doing anything else.
3365
+ * @retval 0 success
3366
+ * @retval AVERROR(EAGAIN) output is not available in the current state - user must
3367
+ * try to send input
3368
+ * @retval AVERROR_EOF the encoder has been fully flushed, and there will be no
3369
+ * more output packets
3370
+ * @retval AVERROR(EINVAL) codec not opened, or it is a decoder
3371
+ * @retval "another negative error code" legitimate encoding errors
3372
+ */
3373
+ avcodec_receive_packet_sync(avctx: number,avpkt: number): number;
3374
+ /**
3375
+ * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet()
3376
+ * to retrieve buffered output packets.
3377
+ *
3378
+ * @param avctx codec context
3379
+ * @param[in] frame AVFrame containing the raw audio or video frame to be encoded.
3380
+ * Ownership of the frame remains with the caller, and the
3381
+ * encoder will not write to the frame. The encoder may create
3382
+ * a reference to the frame data (or copy it if the frame is
3383
+ * not reference-counted).
3384
+ * It can be NULL, in which case it is considered a flush
3385
+ * packet. This signals the end of the stream. If the encoder
3386
+ * still has packets buffered, it will return them after this
3387
+ * call. Once flushing mode has been entered, additional flush
3388
+ * packets are ignored, and sending frames will return
3389
+ * AVERROR_EOF.
3390
+ *
3391
+ * For audio:
3392
+ * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame
3393
+ * can have any number of samples.
3394
+ * If it is not set, frame->nb_samples must be equal to
3395
+ * avctx->frame_size for all frames except the last.
3396
+ * The final frame may be smaller than avctx->frame_size.
3397
+ * @retval 0 success
3398
+ * @retval AVERROR(EAGAIN) input is not accepted in the current state - user must
3399
+ * read output with avcodec_receive_packet() (once all
3400
+ * output is read, the packet should be resent, and the
3401
+ * call will not fail with EAGAIN).
3402
+ * @retval AVERROR_EOF the encoder has been flushed, and no new frames can
3403
+ * be sent to it
3404
+ * @retval AVERROR(EINVAL) codec not opened, it is a decoder, or requires flush
3405
+ * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
3406
+ * @retval "another negative error code" legitimate encoding errors
3407
+ */
3408
+ avcodec_send_frame_sync(avctx: number,frame: number): number;
3409
+ /**
3410
+ * Supply raw packet data as input to a decoder.
3411
+ *
3412
+ * Internally, this call will copy relevant AVCodecContext fields, which can
3413
+ * influence decoding per-packet, and apply them when the packet is actually
3414
+ * decoded. (For example AVCodecContext.skip_frame, which might direct the
3415
+ * decoder to drop the frame contained by the packet sent with this function.)
3416
+ *
3417
+ * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE
3418
+ * larger than the actual read bytes because some optimized bitstream
3419
+ * readers read 32 or 64 bits at once and could read over the end.
3420
+ *
3421
+ * @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
3422
+ * before packets may be fed to the decoder.
3423
+ *
3424
+ * @param avctx codec context
3425
+ * @param[in] avpkt The input AVPacket. Usually, this will be a single video
3426
+ * frame, or several complete audio frames.
3427
+ * Ownership of the packet remains with the caller, and the
3428
+ * decoder will not write to the packet. The decoder may create
3429
+ * a reference to the packet data (or copy it if the packet is
3430
+ * not reference-counted).
3431
+ * Unlike with older APIs, the packet is always fully consumed,
3432
+ * and if it contains multiple frames (e.g. some audio codecs),
3433
+ * will require you to call avcodec_receive_frame() multiple
3434
+ * times afterwards before you can send a new packet.
3435
+ * It can be NULL (or an AVPacket with data set to NULL and
3436
+ * size set to 0); in this case, it is considered a flush
3437
+ * packet, which signals the end of the stream. Sending the
3438
+ * first flush packet will return success. Subsequent ones are
3439
+ * unnecessary and will return AVERROR_EOF. If the decoder
3440
+ * still has frames buffered, it will return them after sending
3441
+ * a flush packet.
3442
+ *
3443
+ * @retval 0 success
3444
+ * @retval AVERROR(EAGAIN) input is not accepted in the current state - user
3445
+ * must read output with avcodec_receive_frame() (once
3446
+ * all output is read, the packet should be resent,
3447
+ * and the call will not fail with EAGAIN).
3448
+ * @retval AVERROR_EOF the decoder has been flushed, and no new packets can be
3449
+ * sent to it (also returned if more than 1 flush
3450
+ * packet is sent)
3451
+ * @retval AVERROR(EINVAL) codec not opened, it is an encoder, or requires flush
3452
+ * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar
3453
+ * @retval "another negative error code" legitimate decoding errors
3454
+ */
3455
+ avcodec_send_packet_sync(avctx: number,avpkt: number): number;
3456
+ /**
3457
+ * Find AVInputFormat based on the short name of the input format.
3458
+ */
3459
+ av_find_input_format_sync(short_name: string): number;
3460
+ /**
3461
+ * Allocate an AVFormatContext.
3462
+ * avformat_free_context() can be used to free the context and everything
3463
+ * allocated by the framework within it.
3464
+ */
3465
+ avformat_alloc_context_sync(): number;
3466
+ /**
3467
+ * Allocate an AVFormatContext for an output format.
3468
+ * avformat_free_context() can be used to free the context and
3469
+ * everything allocated by the framework within it.
3470
+ *
3471
+ * @param ctx pointee is set to the created format context,
3472
+ * or to NULL in case of failure
3473
+ * @param oformat format to use for allocating the context, if NULL
3474
+ * format_name and filename are used instead
3475
+ * @param format_name the name of output format to use for allocating the
3476
+ * context, if NULL filename is used instead
3477
+ * @param filename the name of the filename to use for allocating the
3478
+ * context, may be NULL
3479
+ *
3480
+ * @return >= 0 in case of success, a negative AVERROR code in case of
3481
+ * failure
3482
+ */
3483
+ avformat_alloc_output_context2_js_sync(ctx: number,oformat: string,format_name: string): number;
3484
+ /**
3485
+ * Close an opened input AVFormatContext. Free it and all its contents
3486
+ * and set *s to NULL.
3487
+ */
3488
+ avformat_close_input_sync(s: number): void;
3489
+ /**
3490
+ * Read packets of a media file to get stream information. This
3491
+ * is useful for file formats with no headers such as MPEG. This
3492
+ * function also computes the real framerate in case of MPEG-2 repeat
3493
+ * frame mode.
3494
+ * The logical file position is not changed by this function;
3495
+ * examined packets may be buffered for later processing.
3496
+ *
3497
+ * @param ic media file handle
3498
+ * @param options If non-NULL, an ic.nb_streams long array of pointers to
3499
+ * dictionaries, where i-th member contains options for
3500
+ * codec corresponding to i-th stream.
3501
+ * On return each dictionary will be filled with options that were not found.
3502
+ * @return >=0 if OK, AVERROR_xxx on error
3503
+ *
3504
+ * @note this function isn't guaranteed to open all the codecs, so
3505
+ * options being non-empty at return is a perfectly normal behavior.
3506
+ *
3507
+ * @todo Let the user decide somehow what information is needed so that
3508
+ * we do not waste time getting stuff the user does not need.
3509
+ */
3510
+ avformat_find_stream_info_sync(ic: number,options: number): number | Promise<number>;
3511
+ /**
3512
+ * Discard all internally buffered data. This can be useful when dealing with
3513
+ * discontinuities in the byte stream. Generally works only with formats that
3514
+ * can resync. This includes headerless formats like MPEG-TS/TS but should also
3515
+ * work with NUT, Ogg and in a limited way AVI for example.
3516
+ *
3517
+ * The set of streams, the detected duration, stream parameters and codecs do
3518
+ * not change when calling this function. If you want a complete reset, it's
3519
+ * better to open a new AVFormatContext.
3520
+ *
3521
+ * This does not flush the AVIOContext (s->pb). If necessary, call
3522
+ * avio_flush(s->pb) before calling this function.
3523
+ *
3524
+ * @param s media file handle
3525
+ * @return >=0 on success, error code otherwise
3526
+ */
3527
+ avformat_flush_sync(s: number): number;
3528
+ /**
3529
+ * Free an AVFormatContext and all its streams.
3530
+ * @param s context to free
3531
+ */
3532
+ avformat_free_context_sync(s: number): void;
3533
+ /**
3534
+ * Add a new stream to a media file.
3535
+ *
3536
+ * When demuxing, it is called by the demuxer in read_header(). If the
3537
+ * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also
3538
+ * be called in read_packet().
3539
+ *
3540
+ * When muxing, should be called by the user before avformat_write_header().
3541
+ *
3542
+ * User is required to call avformat_free_context() to clean up the allocation
3543
+ * by avformat_new_stream().
3544
+ *
3545
+ * @param s media file handle
3546
+ * @param c unused, does nothing
3547
+ *
3548
+ * @return newly created stream or NULL on error.
3549
+ */
3550
+ avformat_new_stream_sync(s: number,c: number): number;
3551
+ /**
3552
+ * Open an input stream and read the header. The codecs are not opened.
3553
+ * The stream must be closed with avformat_close_input().
3554
+ *
3555
+ * @param ps Pointer to user-supplied AVFormatContext (allocated by
3556
+ * avformat_alloc_context). May be a pointer to NULL, in
3557
+ * which case an AVFormatContext is allocated by this
3558
+ * function and written into ps.
3559
+ * Note that a user-supplied AVFormatContext will be freed
3560
+ * on failure.
3561
+ * @param url URL of the stream to open.
3562
+ * @param fmt If non-NULL, this parameter forces a specific input format.
3563
+ * Otherwise the format is autodetected.
3564
+ * @param options A dictionary filled with AVFormatContext and demuxer-private
3565
+ * options.
3566
+ * On return this parameter will be destroyed and replaced with
3567
+ * a dict containing options that were not found. May be NULL.
3568
+ *
3569
+ * @return 0 on success, a negative AVERROR on failure.
3570
+ *
3571
+ * @note If you want to use custom IO, preallocate the format context and set its pb field.
3572
+ */
3573
+ avformat_open_input_sync(ps: number,url: string,fmt: number,options: number): number | Promise<number>;
3574
+ /**
3575
+ * Open an input stream and read the header. The codecs are not opened.
3576
+ * The stream must be closed with avformat_close_input().
3577
+ *
3578
+ * @param ps Pointer to user-supplied AVFormatContext (allocated by
3579
+ * avformat_alloc_context). May be a pointer to NULL, in
3580
+ * which case an AVFormatContext is allocated by this
3581
+ * function and written into ps.
3582
+ * Note that a user-supplied AVFormatContext will be freed
3583
+ * on failure.
3584
+ * @param url URL of the stream to open.
3585
+ * @param fmt If non-NULL, this parameter forces a specific input format.
3586
+ * Otherwise the format is autodetected.
3587
+ * @param options A dictionary filled with AVFormatContext and demuxer-private
3588
+ * options.
3589
+ * On return this parameter will be destroyed and replaced with
3590
+ * a dict containing options that were not found. May be NULL.
3591
+ *
3592
+ * @return 0 on success, a negative AVERROR on failure.
3593
+ *
3594
+ * @note If you want to use custom IO, preallocate the format context and set its pb field.
3595
+ */
3596
+ avformat_open_input_js_sync(ps: string,url: number,fmt: number): number | Promise<number>;
3597
+ /**
3598
+ * Allocate the stream private data and write the stream header to
3599
+ * an output media file.
3600
+ *
3601
+ * @param s Media file handle, must be allocated with
3602
+ * avformat_alloc_context().
3603
+ * Its \ref AVFormatContext.oformat "oformat" field must be set
3604
+ * to the desired output format;
3605
+ * Its \ref AVFormatContext.pb "pb" field must be set to an
3606
+ * already opened ::AVIOContext.
3607
+ * @param options An ::AVDictionary filled with AVFormatContext and
3608
+ * muxer-private options.
3609
+ * On return this parameter will be destroyed and replaced with
3610
+ * a dict containing options that were not found. May be NULL.
3611
+ *
3612
+ * @retval AVSTREAM_INIT_IN_WRITE_HEADER On success, if the codec had not already been
3613
+ * fully initialized in avformat_init_output().
3614
+ * @retval AVSTREAM_INIT_IN_INIT_OUTPUT On success, if the codec had already been fully
3615
+ * initialized in avformat_init_output().
3616
+ * @retval AVERROR A negative AVERROR on failure.
3617
+ *
3618
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output.
3619
+ */
3620
+ avformat_write_header_sync(s: number,options: number): number;
3621
+ avformat_get_rotation_sync(a0: number): number;
3622
+ /**
3623
+ * Create and initialize a AVIOContext for accessing the
3624
+ * resource indicated by url.
3625
+ * @note When the resource indicated by url has been opened in
3626
+ * read+write mode, the AVIOContext can be used only for writing.
3627
+ *
3628
+ * @param s Used to return the pointer to the created AVIOContext.
3629
+ * In case of failure the pointed to value is set to NULL.
3630
+ * @param url resource to access
3631
+ * @param flags flags which control how the resource indicated by url
3632
+ * is to be opened
3633
+ * @param int_cb an interrupt callback to be used at the protocols level
3634
+ * @param options A dictionary filled with protocol-private options. On return
3635
+ * this parameter will be destroyed and replaced with a dict containing options
3636
+ * that were not found. May be NULL.
3637
+ * @return >= 0 in case of success, a negative value corresponding to an
3638
+ * AVERROR code in case of failure
3639
+ */
3640
+ avio_open2_js_sync(s: string,url: number,flags: number,int_cb: number): number;
3641
+ /**
3642
+ * Close the resource accessed by the AVIOContext s and free it.
3643
+ * This function can only be used if s was opened by avio_open().
3644
+ *
3645
+ * The internal buffer is automatically flushed before closing the
3646
+ * resource.
3647
+ *
3648
+ * @return 0 on success, an AVERROR < 0 on error.
3649
+ * @see avio_closep
3650
+ */
3651
+ avio_close_sync(s: number): number;
3652
+ /**
3653
+ * Force flushing of buffered data.
3654
+ *
3655
+ * For write streams, force the buffered data to be immediately written to the output,
3656
+ * without to wait to fill the internal buffer.
3657
+ *
3658
+ * For read streams, discard all currently buffered data, and advance the
3659
+ * reported file position to that of the underlying stream. This does not
3660
+ * read new data, and does not perform any seeks.
3661
+ */
3662
+ avio_flush_sync(s: number): void;
3663
+ /**
3664
+ * Find the "best" stream in the file.
3665
+ * The best stream is determined according to various heuristics as the most
3666
+ * likely to be what the user expects.
3667
+ * If the decoder parameter is non-NULL, av_find_best_stream will find the
3668
+ * default decoder for the stream's codec; streams for which no decoder can
3669
+ * be found are ignored.
3670
+ *
3671
+ * @param ic media file handle
3672
+ * @param type stream type: video, audio, subtitles, etc.
3673
+ * @param wanted_stream_nb user-requested stream number,
3674
+ * or -1 for automatic selection
3675
+ * @param related_stream try to find a stream related (eg. in the same
3676
+ * program) to this one, or -1 if none
3677
+ * @param decoder_ret if non-NULL, returns the decoder for the
3678
+ * selected stream
3679
+ * @param flags flags; none are currently defined
3680
+ *
3681
+ * @return the non-negative stream number in case of success,
3682
+ * AVERROR_STREAM_NOT_FOUND if no stream with the requested type
3683
+ * could be found,
3684
+ * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder
3685
+ *
3686
+ * @note If av_find_best_stream returns successfully and decoder_ret is not
3687
+ * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec.
3688
+ */
3689
+ av_find_best_stream_sync(ic: number,type: number,wanted_stream_nb: number,related_stream: number,decoder_ret: number,flags: number): number;
3690
+ /**
3691
+ * Return the name of sample_fmt, or NULL if sample_fmt is not
3692
+ * recognized.
3693
+ */
3694
+ av_get_sample_fmt_name_sync(sample_fmt: number): string;
3695
+ /**
3696
+ * Increase packet size, correctly zeroing padding
3697
+ *
3698
+ * @param pkt packet
3699
+ * @param grow_by number of bytes by which to increase the size of the packet
3700
+ */
3701
+ av_grow_packet_sync(pkt: number,grow_by: number): number;
3702
+ /**
3703
+ * Write a packet to an output media file ensuring correct interleaving.
3704
+ *
3705
+ * This function will buffer the packets internally as needed to make sure the
3706
+ * packets in the output file are properly interleaved, usually ordered by
3707
+ * increasing dts. Callers doing their own interleaving should call
3708
+ * av_write_frame() instead of this function.
3709
+ *
3710
+ * Using this function instead of av_write_frame() can give muxers advance
3711
+ * knowledge of future packets, improving e.g. the behaviour of the mp4
3712
+ * muxer for VFR content in fragmenting mode.
3713
+ *
3714
+ * @param s media file handle
3715
+ * @param pkt The packet containing the data to be written.
3716
+ * <br>
3717
+ * If the packet is reference-counted, this function will take
3718
+ * ownership of this reference and unreference it later when it sees
3719
+ * fit. If the packet is not reference-counted, libavformat will
3720
+ * make a copy.
3721
+ * The returned packet will be blank (as if returned from
3722
+ * av_packet_alloc()), even on error.
3723
+ * <br>
3724
+ * This parameter can be NULL (at any time, not just at the end), to
3725
+ * flush the interleaving queues.
3726
+ * <br>
3727
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be
3728
+ * set to the index of the corresponding stream in @ref
3729
+ * AVFormatContext.streams "s->streams".
3730
+ * <br>
3731
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts")
3732
+ * must be set to correct values in the stream's timebase (unless the
3733
+ * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then
3734
+ * they can be set to AV_NOPTS_VALUE).
3735
+ * The dts for subsequent packets in one stream must be strictly
3736
+ * increasing (unless the output format is flagged with the
3737
+ * AVFMT_TS_NONSTRICT, then they merely have to be nondecreasing).
3738
+ * @ref AVPacket.duration "duration" should also be set if known.
3739
+ *
3740
+ * @return 0 on success, a negative AVERROR on error.
3741
+ *
3742
+ * @see av_write_frame(), AVFormatContext.max_interleave_delta
3743
+ */
3744
+ av_interleaved_write_frame_sync(s: number,pkt: number): number;
3745
+ /**
3746
+ * Create a writable reference for the data described by a given packet,
3747
+ * avoiding data copy if possible.
3748
+ *
3749
+ * @param pkt Packet whose data should be made writable.
3750
+ *
3751
+ * @return 0 on success, a negative AVERROR on failure. On failure, the
3752
+ * packet is unchanged.
3753
+ */
3754
+ av_packet_make_writable_sync(pkt: number): number;
3755
+ /**
3756
+ * @return a pixel format descriptor for provided pixel format or NULL if
3757
+ * this pixel format is unknown.
3758
+ */
3759
+ av_pix_fmt_desc_get_sync(pix_fmt: number): number;
3760
+ /**
3761
+ * Return the next frame of a stream.
3762
+ * This function returns what is stored in the file, and does not validate
3763
+ * that what is there are valid frames for the decoder. It will split what is
3764
+ * stored in the file into frames and return one for each call. It will not
3765
+ * omit invalid data between valid frames so as to give the decoder the maximum
3766
+ * information possible for decoding.
3767
+ *
3768
+ * On success, the returned packet is reference-counted (pkt->buf is set) and
3769
+ * valid indefinitely. The packet must be freed with av_packet_unref() when
3770
+ * it is no longer needed. For video, the packet contains exactly one frame.
3771
+ * For audio, it contains an integer number of frames if each frame has
3772
+ * a known fixed size (e.g. PCM or ADPCM data). If the audio frames have
3773
+ * a variable size (e.g. MPEG audio), then it contains one frame.
3774
+ *
3775
+ * pkt->pts, pkt->dts and pkt->duration are always set to correct
3776
+ * values in AVStream.time_base units (and guessed if the format cannot
3777
+ * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format
3778
+ * has B-frames, so it is better to rely on pkt->dts if you do not
3779
+ * decompress the payload.
3780
+ *
3781
+ * @return 0 if OK, < 0 on error or end of file. On error, pkt will be blank
3782
+ * (as if it came from av_packet_alloc()).
3783
+ *
3784
+ * @note pkt will be initialized, so it may be uninitialized, but it must not
3785
+ * contain data that needs to be freed.
3786
+ */
3787
+ av_read_frame_sync(s: number,pkt: number): number | Promise<number>;
3788
+ /**
3789
+ * Reduce packet size, correctly zeroing padding
3790
+ *
3791
+ * @param pkt packet
3792
+ * @param size new size
3793
+ */
3794
+ av_shrink_packet_sync(pkt: number,size: number): void;
3795
+ /**
3796
+ * Write a packet to an output media file.
3797
+ *
3798
+ * This function passes the packet directly to the muxer, without any buffering
3799
+ * or reordering. The caller is responsible for correctly interleaving the
3800
+ * packets if the format requires it. Callers that want libavformat to handle
3801
+ * the interleaving should call av_interleaved_write_frame() instead of this
3802
+ * function.
3803
+ *
3804
+ * @param s media file handle
3805
+ * @param pkt The packet containing the data to be written. Note that unlike
3806
+ * av_interleaved_write_frame(), this function does not take
3807
+ * ownership of the packet passed to it (though some muxers may make
3808
+ * an internal reference to the input packet).
3809
+ * <br>
3810
+ * This parameter can be NULL (at any time, not just at the end), in
3811
+ * order to immediately flush data buffered within the muxer, for
3812
+ * muxers that buffer up data internally before writing it to the
3813
+ * output.
3814
+ * <br>
3815
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be
3816
+ * set to the index of the corresponding stream in @ref
3817
+ * AVFormatContext.streams "s->streams".
3818
+ * <br>
3819
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts")
3820
+ * must be set to correct values in the stream's timebase (unless the
3821
+ * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then
3822
+ * they can be set to AV_NOPTS_VALUE).
3823
+ * The dts for subsequent packets passed to this function must be strictly
3824
+ * increasing when compared in their respective timebases (unless the
3825
+ * output format is flagged with the AVFMT_TS_NONSTRICT, then they
3826
+ * merely have to be nondecreasing). @ref AVPacket.duration
3827
+ * "duration") should also be set if known.
3828
+ * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
3829
+ *
3830
+ * @see av_interleaved_write_frame()
3831
+ */
3832
+ av_write_frame_sync(s: number,pkt: number): number;
3833
+ /**
3834
+ * Write the stream trailer to an output media file and free the
3835
+ * file private data.
3836
+ *
3837
+ * May only be called after a successful call to avformat_write_header.
3838
+ *
3839
+ * @param s media file handle
3840
+ * @return 0 if OK, AVERROR_xxx on error
3841
+ */
3842
+ av_write_trailer_sync(s: number): number;
3843
+ /**
3844
+ * Copy entries from one AVDictionary struct into another.
3845
+ *
3846
+ * @note Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag
3847
+ *
3848
+ * @param dst Pointer to a pointer to a AVDictionary struct to copy into. If *dst is NULL,
3849
+ * this function will allocate a struct for you and put it in *dst
3850
+ * @param src Pointer to the source AVDictionary struct to copy items from.
3851
+ * @param flags Flags to use when setting entries in *dst
3852
+ *
3853
+ * @return 0 on success, negative AVERROR code on failure. If dst was allocated
3854
+ * by this function, callers should free the associated memory.
3855
+ */
3856
+ av_dict_copy_js_sync(dst: number,src: number,flags: number): number;
3857
+ /**
3858
+ * Free all the memory allocated for an AVDictionary struct
3859
+ * and all keys and values.
3860
+ */
3861
+ av_dict_free_sync(m: number): void;
3862
+ /**
3863
+ * Set the given entry in *pm, overwriting an existing entry.
3864
+ *
3865
+ * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set,
3866
+ * these arguments will be freed on error.
3867
+ *
3868
+ * @warning Adding a new entry to a dictionary invalidates all existing entries
3869
+ * previously returned with av_dict_get() or av_dict_iterate().
3870
+ *
3871
+ * @param pm Pointer to a pointer to a dictionary struct. If *pm is NULL
3872
+ * a dictionary struct is allocated and put in *pm.
3873
+ * @param key Entry key to add to *pm (will either be av_strduped or added as a new key depending on flags)
3874
+ * @param value Entry value to add to *pm (will be av_strduped or added as a new key depending on flags).
3875
+ * Passing a NULL value will cause an existing entry to be deleted.
3876
+ *
3877
+ * @return >= 0 on success otherwise an error code <0
3878
+ */
3879
+ av_dict_set_js_sync(pm: number,key: string,value: string,flags: number): number;
3880
+ /**
3881
+ * Allocate and return an SwsContext. You need it to perform
3882
+ * scaling/conversion operations using sws_scale().
3883
+ *
3884
+ * @param srcW the width of the source image
3885
+ * @param srcH the height of the source image
3886
+ * @param srcFormat the source image format
3887
+ * @param dstW the width of the destination image
3888
+ * @param dstH the height of the destination image
3889
+ * @param dstFormat the destination image format
3890
+ * @param flags specify which algorithm and options to use for rescaling
3891
+ * @param param extra parameters to tune the used scaler
3892
+ * For SWS_BICUBIC param[0] and [1] tune the shape of the basis
3893
+ * function, param[0] tunes f(1) and param[1] f´(1)
3894
+ * For SWS_GAUSS param[0] tunes the exponent and thus cutoff
3895
+ * frequency
3896
+ * For SWS_LANCZOS param[0] tunes the width of the window function
3897
+ * @return a pointer to an allocated context, or NULL in case of error
3898
+ * @note this function is to be removed after a saner alternative is
3899
+ * written
3900
+ */
3901
+ sws_getContext_sync(srcW: number,srcH: number,srcFormat: number,dstW: number,dstH: number,dstFormat: number,flags: number,srcFilter: number,dstFilter: number,param: number): number;
3902
+ /**
3903
+ * Free the swscaler context swsContext.
3904
+ * If swsContext is NULL, then does nothing.
3905
+ */
3906
+ sws_freeContext_sync(swsContext: number): void;
3907
+ /**
3908
+ * Scale source data from src and write the output to dst.
3909
+ *
3910
+ * This is merely a convenience wrapper around
3911
+ * - sws_frame_start()
3912
+ * - sws_send_slice(0, src->height)
3913
+ * - sws_receive_slice(0, dst->height)
3914
+ * - sws_frame_end()
3915
+ *
3916
+ * @param c The scaling context
3917
+ * @param dst The destination frame. See documentation for sws_frame_start() for
3918
+ * more details.
3919
+ * @param src The source frame.
3920
+ *
3921
+ * @return 0 on success, a negative AVERROR code on failure
3922
+ */
3923
+ sws_scale_frame_sync(c: number,dst: number,src: number): number;
3924
+ AVPacketSideData_data_sync(a0: number,a1: number): number;
3925
+ AVPacketSideData_size_sync(a0: number,a1: number): number;
3926
+ AVPacketSideData_type_sync(a0: number,a1: number): number;
3927
+ AVPixFmtDescriptor_comp_depth_sync(a0: number,a1: number): number;
3928
+ ff_error_sync(a0: number): string;
3929
+ ff_nothing_sync(): void | Promise<void>;
3930
+ calloc_sync(a0: number,a1: number): number;
3931
+ close_sync(a0: number): number;
3932
+ dup2_sync(a0: number,a1: number): number;
3933
+ free_sync(a0: number): void;
3934
+ malloc_sync(a0: number): number;
3935
+ mallinfo_uordblks_sync(): number;
3936
+ open_sync(a0: string,a1: number,a2: number): number;
3937
+ strerror_sync(a0: number): string;
3938
+ libavjs_with_swscale_sync(): number;
3939
+ libavjs_create_main_thread_sync(): number;
3940
+ ffmpeg_main_sync(a0: number,a1: number): number | Promise<number>;
3941
+ ffprobe_main_sync(a0: number,a1: number): number | Promise<number>;
3942
+ AVFrame_channel_layout_sync(ptr: number): number;
3943
+ AVFrame_channel_layout_s_sync(ptr: number, val: number): void;
3944
+ AVFrame_channel_layouthi_sync(ptr: number): number;
3945
+ AVFrame_channel_layouthi_s_sync(ptr: number, val: number): void;
3946
+ AVFrame_channels_sync(ptr: number): number;
3947
+ AVFrame_channels_s_sync(ptr: number, val: number): void;
3948
+ AVFrame_channel_layoutmask_sync(ptr: number): number;
3949
+ AVFrame_channel_layoutmask_s_sync(ptr: number, val: number): void;
3950
+ AVFrame_ch_layout_nb_channels_sync(ptr: number): number;
3951
+ AVFrame_ch_layout_nb_channels_s_sync(ptr: number, val: number): void;
3952
+ AVFrame_crop_bottom_sync(ptr: number): number;
3953
+ AVFrame_crop_bottom_s_sync(ptr: number, val: number): void;
3954
+ AVFrame_crop_left_sync(ptr: number): number;
3955
+ AVFrame_crop_left_s_sync(ptr: number, val: number): void;
3956
+ AVFrame_crop_right_sync(ptr: number): number;
3957
+ AVFrame_crop_right_s_sync(ptr: number, val: number): void;
3958
+ AVFrame_crop_top_sync(ptr: number): number;
3959
+ AVFrame_crop_top_s_sync(ptr: number, val: number): void;
3960
+ AVFrame_data_a_sync(ptr: number, idx: number): number;
3961
+ AVFrame_data_a_s_sync(ptr: number, idx: number, val: number): void;
3962
+ AVFrame_format_sync(ptr: number): number;
3963
+ AVFrame_format_s_sync(ptr: number, val: number): void;
3964
+ AVFrame_height_sync(ptr: number): number;
3965
+ AVFrame_height_s_sync(ptr: number, val: number): void;
3966
+ AVFrame_key_frame_sync(ptr: number): number;
3967
+ AVFrame_key_frame_s_sync(ptr: number, val: number): void;
3968
+ AVFrame_linesize_a_sync(ptr: number, idx: number): number;
3969
+ AVFrame_linesize_a_s_sync(ptr: number, idx: number, val: number): void;
3970
+ AVFrame_nb_samples_sync(ptr: number): number;
3971
+ AVFrame_nb_samples_s_sync(ptr: number, val: number): void;
3972
+ AVFrame_pict_type_sync(ptr: number): number;
3973
+ AVFrame_pict_type_s_sync(ptr: number, val: number): void;
3974
+ AVFrame_pts_sync(ptr: number): number;
3975
+ AVFrame_pts_s_sync(ptr: number, val: number): void;
3976
+ AVFrame_ptshi_sync(ptr: number): number;
3977
+ AVFrame_ptshi_s_sync(ptr: number, val: number): void;
3978
+ AVFrame_sample_aspect_ratio_num_sync(ptr: number): number;
3979
+ AVFrame_sample_aspect_ratio_num_s_sync(ptr: number, val: number): void;
3980
+ AVFrame_sample_aspect_ratio_den_sync(ptr: number): number;
3981
+ AVFrame_sample_aspect_ratio_den_s_sync(ptr: number, val: number): void;
3982
+ AVFrame_sample_aspect_ratio_s_sync(ptr: number, num: number, den: number): void;
3983
+ AVFrame_sample_rate_sync(ptr: number): number;
3984
+ AVFrame_sample_rate_s_sync(ptr: number, val: number): void;
3985
+ AVFrame_time_base_num_sync(ptr: number): number;
3986
+ AVFrame_time_base_num_s_sync(ptr: number, val: number): void;
3987
+ AVFrame_time_base_den_sync(ptr: number): number;
3988
+ AVFrame_time_base_den_s_sync(ptr: number, val: number): void;
3989
+ AVFrame_time_base_s_sync(ptr: number, num: number, den: number): void;
3990
+ AVFrame_width_sync(ptr: number): number;
3991
+ AVFrame_width_s_sync(ptr: number, val: number): void;
3992
+ AVPixFmtDescriptor_flags_sync(ptr: number): number;
3993
+ AVPixFmtDescriptor_flags_s_sync(ptr: number, val: number): void;
3994
+ AVPixFmtDescriptor_log2_chroma_h_sync(ptr: number): number;
3995
+ AVPixFmtDescriptor_log2_chroma_h_s_sync(ptr: number, val: number): void;
3996
+ AVPixFmtDescriptor_log2_chroma_w_sync(ptr: number): number;
3997
+ AVPixFmtDescriptor_log2_chroma_w_s_sync(ptr: number, val: number): void;
3998
+ AVPixFmtDescriptor_nb_components_sync(ptr: number): number;
3999
+ AVPixFmtDescriptor_nb_components_s_sync(ptr: number, val: number): void;
4000
+ AVCodec_name_sync(ptr: number): string;
4001
+ AVCodec_sample_fmts_sync(ptr: number): number;
4002
+ AVCodec_sample_fmts_s_sync(ptr: number, val: number): void;
4003
+ AVCodec_sample_fmts_a_sync(ptr: number, idx: number): number;
4004
+ AVCodec_sample_fmts_a_s_sync(ptr: number, idx: number, val: number): void;
4005
+ AVCodec_supported_samplerates_sync(ptr: number): number;
4006
+ AVCodec_supported_samplerates_s_sync(ptr: number, val: number): void;
4007
+ AVCodec_supported_samplerates_a_sync(ptr: number, idx: number): number;
4008
+ AVCodec_supported_samplerates_a_s_sync(ptr: number, idx: number, val: number): void;
4009
+ AVCodec_type_sync(ptr: number): number;
4010
+ AVCodec_type_s_sync(ptr: number, val: number): void;
4011
+ AVCodecContext_codec_id_sync(ptr: number): number;
4012
+ AVCodecContext_codec_id_s_sync(ptr: number, val: number): void;
4013
+ AVCodecContext_codec_type_sync(ptr: number): number;
4014
+ AVCodecContext_codec_type_s_sync(ptr: number, val: number): void;
4015
+ AVCodecContext_bit_rate_sync(ptr: number): number;
4016
+ AVCodecContext_bit_rate_s_sync(ptr: number, val: number): void;
4017
+ AVCodecContext_bit_ratehi_sync(ptr: number): number;
4018
+ AVCodecContext_bit_ratehi_s_sync(ptr: number, val: number): void;
4019
+ AVCodecContext_channel_layout_sync(ptr: number): number;
4020
+ AVCodecContext_channel_layout_s_sync(ptr: number, val: number): void;
4021
+ AVCodecContext_channel_layouthi_sync(ptr: number): number;
4022
+ AVCodecContext_channel_layouthi_s_sync(ptr: number, val: number): void;
4023
+ AVCodecContext_channels_sync(ptr: number): number;
4024
+ AVCodecContext_channels_s_sync(ptr: number, val: number): void;
4025
+ AVCodecContext_channel_layoutmask_sync(ptr: number): number;
4026
+ AVCodecContext_channel_layoutmask_s_sync(ptr: number, val: number): void;
4027
+ AVCodecContext_ch_layout_nb_channels_sync(ptr: number): number;
4028
+ AVCodecContext_ch_layout_nb_channels_s_sync(ptr: number, val: number): void;
4029
+ AVCodecContext_extradata_sync(ptr: number): number;
4030
+ AVCodecContext_extradata_s_sync(ptr: number, val: number): void;
4031
+ AVCodecContext_extradata_size_sync(ptr: number): number;
4032
+ AVCodecContext_extradata_size_s_sync(ptr: number, val: number): void;
4033
+ AVCodecContext_frame_size_sync(ptr: number): number;
4034
+ AVCodecContext_frame_size_s_sync(ptr: number, val: number): void;
4035
+ AVCodecContext_framerate_num_sync(ptr: number): number;
4036
+ AVCodecContext_framerate_num_s_sync(ptr: number, val: number): void;
4037
+ AVCodecContext_framerate_den_sync(ptr: number): number;
4038
+ AVCodecContext_framerate_den_s_sync(ptr: number, val: number): void;
4039
+ AVCodecContext_framerate_s_sync(ptr: number, num: number, den: number): void;
4040
+ AVCodecContext_gop_size_sync(ptr: number): number;
4041
+ AVCodecContext_gop_size_s_sync(ptr: number, val: number): void;
4042
+ AVCodecContext_height_sync(ptr: number): number;
4043
+ AVCodecContext_height_s_sync(ptr: number, val: number): void;
4044
+ AVCodecContext_keyint_min_sync(ptr: number): number;
4045
+ AVCodecContext_keyint_min_s_sync(ptr: number, val: number): void;
4046
+ AVCodecContext_level_sync(ptr: number): number;
4047
+ AVCodecContext_level_s_sync(ptr: number, val: number): void;
4048
+ AVCodecContext_max_b_frames_sync(ptr: number): number;
4049
+ AVCodecContext_max_b_frames_s_sync(ptr: number, val: number): void;
4050
+ AVCodecContext_pix_fmt_sync(ptr: number): number;
4051
+ AVCodecContext_pix_fmt_s_sync(ptr: number, val: number): void;
4052
+ AVCodecContext_profile_sync(ptr: number): number;
4053
+ AVCodecContext_profile_s_sync(ptr: number, val: number): void;
4054
+ AVCodecContext_rc_max_rate_sync(ptr: number): number;
4055
+ AVCodecContext_rc_max_rate_s_sync(ptr: number, val: number): void;
4056
+ AVCodecContext_rc_max_ratehi_sync(ptr: number): number;
4057
+ AVCodecContext_rc_max_ratehi_s_sync(ptr: number, val: number): void;
4058
+ AVCodecContext_rc_min_rate_sync(ptr: number): number;
4059
+ AVCodecContext_rc_min_rate_s_sync(ptr: number, val: number): void;
4060
+ AVCodecContext_rc_min_ratehi_sync(ptr: number): number;
4061
+ AVCodecContext_rc_min_ratehi_s_sync(ptr: number, val: number): void;
4062
+ AVCodecContext_sample_aspect_ratio_num_sync(ptr: number): number;
4063
+ AVCodecContext_sample_aspect_ratio_num_s_sync(ptr: number, val: number): void;
4064
+ AVCodecContext_sample_aspect_ratio_den_sync(ptr: number): number;
4065
+ AVCodecContext_sample_aspect_ratio_den_s_sync(ptr: number, val: number): void;
4066
+ AVCodecContext_sample_aspect_ratio_s_sync(ptr: number, num: number, den: number): void;
4067
+ AVCodecContext_sample_fmt_sync(ptr: number): number;
4068
+ AVCodecContext_sample_fmt_s_sync(ptr: number, val: number): void;
4069
+ AVCodecContext_sample_rate_sync(ptr: number): number;
4070
+ AVCodecContext_sample_rate_s_sync(ptr: number, val: number): void;
4071
+ AVCodecContext_time_base_num_sync(ptr: number): number;
4072
+ AVCodecContext_time_base_num_s_sync(ptr: number, val: number): void;
4073
+ AVCodecContext_time_base_den_sync(ptr: number): number;
4074
+ AVCodecContext_time_base_den_s_sync(ptr: number, val: number): void;
4075
+ AVCodecContext_time_base_s_sync(ptr: number, num: number, den: number): void;
4076
+ AVCodecContext_qmax_sync(ptr: number): number;
4077
+ AVCodecContext_qmax_s_sync(ptr: number, val: number): void;
4078
+ AVCodecContext_qmin_sync(ptr: number): number;
4079
+ AVCodecContext_qmin_s_sync(ptr: number, val: number): void;
4080
+ AVCodecContext_width_sync(ptr: number): number;
4081
+ AVCodecContext_width_s_sync(ptr: number, val: number): void;
4082
+ AVCodecDescriptor_id_sync(ptr: number): number;
4083
+ AVCodecDescriptor_id_s_sync(ptr: number, val: number): void;
4084
+ AVCodecDescriptor_long_name_sync(ptr: number): number;
4085
+ AVCodecDescriptor_long_name_s_sync(ptr: number, val: number): void;
4086
+ AVCodecDescriptor_mime_types_a_sync(ptr: number, idx: number): number;
4087
+ AVCodecDescriptor_mime_types_a_s_sync(ptr: number, idx: number, val: number): void;
4088
+ AVCodecDescriptor_name_sync(ptr: number): number;
4089
+ AVCodecDescriptor_name_s_sync(ptr: number, val: number): void;
4090
+ AVCodecDescriptor_props_sync(ptr: number): number;
4091
+ AVCodecDescriptor_props_s_sync(ptr: number, val: number): void;
4092
+ AVCodecDescriptor_type_sync(ptr: number): number;
4093
+ AVCodecDescriptor_type_s_sync(ptr: number, val: number): void;
4094
+ AVCodecParameters_bit_rate_sync(ptr: number): number;
4095
+ AVCodecParameters_bit_rate_s_sync(ptr: number, val: number): void;
4096
+ AVCodecParameters_channel_layoutmask_sync(ptr: number): number;
4097
+ AVCodecParameters_channel_layoutmask_s_sync(ptr: number, val: number): void;
4098
+ AVCodecParameters_channels_sync(ptr: number): number;
4099
+ AVCodecParameters_channels_s_sync(ptr: number, val: number): void;
4100
+ AVCodecParameters_ch_layout_nb_channels_sync(ptr: number): number;
4101
+ AVCodecParameters_ch_layout_nb_channels_s_sync(ptr: number, val: number): void;
4102
+ AVCodecParameters_chroma_location_sync(ptr: number): number;
4103
+ AVCodecParameters_chroma_location_s_sync(ptr: number, val: number): void;
4104
+ AVCodecParameters_codec_id_sync(ptr: number): number;
4105
+ AVCodecParameters_codec_id_s_sync(ptr: number, val: number): void;
4106
+ AVCodecParameters_codec_tag_sync(ptr: number): number;
4107
+ AVCodecParameters_codec_tag_s_sync(ptr: number, val: number): void;
4108
+ AVCodecParameters_codec_type_sync(ptr: number): number;
4109
+ AVCodecParameters_codec_type_s_sync(ptr: number, val: number): void;
4110
+ AVCodecParameters_color_primaries_sync(ptr: number): number;
4111
+ AVCodecParameters_color_primaries_s_sync(ptr: number, val: number): void;
4112
+ AVCodecParameters_color_range_sync(ptr: number): number;
4113
+ AVCodecParameters_color_range_s_sync(ptr: number, val: number): void;
4114
+ AVCodecParameters_color_space_sync(ptr: number): number;
4115
+ AVCodecParameters_color_space_s_sync(ptr: number, val: number): void;
4116
+ AVCodecParameters_color_trc_sync(ptr: number): number;
4117
+ AVCodecParameters_color_trc_s_sync(ptr: number, val: number): void;
4118
+ AVCodecParameters_extradata_sync(ptr: number): number;
4119
+ AVCodecParameters_extradata_s_sync(ptr: number, val: number): void;
4120
+ AVCodecParameters_extradata_size_sync(ptr: number): number;
4121
+ AVCodecParameters_extradata_size_s_sync(ptr: number, val: number): void;
4122
+ AVCodecParameters_format_sync(ptr: number): number;
4123
+ AVCodecParameters_format_s_sync(ptr: number, val: number): void;
4124
+ AVCodecParameters_framerate_num_sync(ptr: number): number;
4125
+ AVCodecParameters_framerate_num_s_sync(ptr: number, val: number): void;
4126
+ AVCodecParameters_framerate_den_sync(ptr: number): number;
4127
+ AVCodecParameters_framerate_den_s_sync(ptr: number, val: number): void;
4128
+ AVCodecParameters_framerate_s_sync(ptr: number, num: number, den: number): void;
4129
+ AVCodecParameters_height_sync(ptr: number): number;
4130
+ AVCodecParameters_height_s_sync(ptr: number, val: number): void;
4131
+ AVCodecParameters_level_sync(ptr: number): number;
4132
+ AVCodecParameters_level_s_sync(ptr: number, val: number): void;
4133
+ AVCodecParameters_profile_sync(ptr: number): number;
4134
+ AVCodecParameters_profile_s_sync(ptr: number, val: number): void;
4135
+ AVCodecParameters_sample_rate_sync(ptr: number): number;
4136
+ AVCodecParameters_sample_rate_s_sync(ptr: number, val: number): void;
4137
+ AVCodecParameters_width_sync(ptr: number): number;
4138
+ AVCodecParameters_width_s_sync(ptr: number, val: number): void;
4139
+ AVPacket_data_sync(ptr: number): number;
4140
+ AVPacket_data_s_sync(ptr: number, val: number): void;
4141
+ AVPacket_dts_sync(ptr: number): number;
4142
+ AVPacket_dts_s_sync(ptr: number, val: number): void;
4143
+ AVPacket_dtshi_sync(ptr: number): number;
4144
+ AVPacket_dtshi_s_sync(ptr: number, val: number): void;
4145
+ AVPacket_duration_sync(ptr: number): number;
4146
+ AVPacket_duration_s_sync(ptr: number, val: number): void;
4147
+ AVPacket_durationhi_sync(ptr: number): number;
4148
+ AVPacket_durationhi_s_sync(ptr: number, val: number): void;
4149
+ AVPacket_flags_sync(ptr: number): number;
4150
+ AVPacket_flags_s_sync(ptr: number, val: number): void;
4151
+ AVPacket_pos_sync(ptr: number): number;
4152
+ AVPacket_pos_s_sync(ptr: number, val: number): void;
4153
+ AVPacket_poshi_sync(ptr: number): number;
4154
+ AVPacket_poshi_s_sync(ptr: number, val: number): void;
4155
+ AVPacket_pts_sync(ptr: number): number;
4156
+ AVPacket_pts_s_sync(ptr: number, val: number): void;
4157
+ AVPacket_ptshi_sync(ptr: number): number;
4158
+ AVPacket_ptshi_s_sync(ptr: number, val: number): void;
4159
+ AVPacket_side_data_sync(ptr: number): number;
4160
+ AVPacket_side_data_s_sync(ptr: number, val: number): void;
4161
+ AVPacket_side_data_elems_sync(ptr: number): number;
4162
+ AVPacket_side_data_elems_s_sync(ptr: number, val: number): void;
4163
+ AVPacket_size_sync(ptr: number): number;
4164
+ AVPacket_size_s_sync(ptr: number, val: number): void;
4165
+ AVPacket_stream_index_sync(ptr: number): number;
4166
+ AVPacket_stream_index_s_sync(ptr: number, val: number): void;
4167
+ AVPacket_time_base_num_sync(ptr: number): number;
4168
+ AVPacket_time_base_num_s_sync(ptr: number, val: number): void;
4169
+ AVPacket_time_base_den_sync(ptr: number): number;
4170
+ AVPacket_time_base_den_s_sync(ptr: number, val: number): void;
4171
+ AVPacket_time_base_s_sync(ptr: number, num: number, den: number): void;
4172
+ AVFormatContext_duration_sync(ptr: number): number;
4173
+ AVFormatContext_duration_s_sync(ptr: number, val: number): void;
4174
+ AVFormatContext_durationhi_sync(ptr: number): number;
4175
+ AVFormatContext_durationhi_s_sync(ptr: number, val: number): void;
4176
+ AVFormatContext_flags_sync(ptr: number): number;
4177
+ AVFormatContext_flags_s_sync(ptr: number, val: number): void;
4178
+ AVFormatContext_nb_streams_sync(ptr: number): number;
4179
+ AVFormatContext_nb_streams_s_sync(ptr: number, val: number): void;
4180
+ AVFormatContext_oformat_sync(ptr: number): number;
4181
+ AVFormatContext_oformat_s_sync(ptr: number, val: number): void;
4182
+ AVFormatContext_pb_sync(ptr: number): number;
4183
+ AVFormatContext_pb_s_sync(ptr: number, val: number): void;
4184
+ AVFormatContext_start_time_sync(ptr: number): number;
4185
+ AVFormatContext_start_time_s_sync(ptr: number, val: number): void;
4186
+ AVFormatContext_start_timehi_sync(ptr: number): number;
4187
+ AVFormatContext_start_timehi_s_sync(ptr: number, val: number): void;
4188
+ AVFormatContext_streams_a_sync(ptr: number, idx: number): number;
4189
+ AVFormatContext_streams_a_s_sync(ptr: number, idx: number, val: number): void;
4190
+ AVStream_codecpar_sync(ptr: number): number;
4191
+ AVStream_codecpar_s_sync(ptr: number, val: number): void;
4192
+ AVStream_discard_sync(ptr: number): number;
4193
+ AVStream_discard_s_sync(ptr: number, val: number): void;
4194
+ AVStream_duration_sync(ptr: number): number;
4195
+ AVStream_duration_s_sync(ptr: number, val: number): void;
4196
+ AVStream_durationhi_sync(ptr: number): number;
4197
+ AVStream_durationhi_s_sync(ptr: number, val: number): void;
4198
+ AVStream_start_time_sync(ptr: number): number;
4199
+ AVStream_start_time_s_sync(ptr: number, val: number): void;
4200
+ AVStream_start_timehi_sync(ptr: number): number;
4201
+ AVStream_start_timehi_s_sync(ptr: number, val: number): void;
4202
+ AVStream_time_base_num_sync(ptr: number): number;
4203
+ AVStream_time_base_num_s_sync(ptr: number, val: number): void;
4204
+ AVStream_time_base_den_sync(ptr: number): number;
4205
+ AVStream_time_base_den_s_sync(ptr: number, val: number): void;
4206
+ AVStream_time_base_s_sync(ptr: number, num: number, den: number): void;
4207
+ AVFilterInOut_filter_ctx_sync(ptr: number): number;
4208
+ AVFilterInOut_filter_ctx_s_sync(ptr: number, val: number): void;
4209
+ AVFilterInOut_name_sync(ptr: number): number;
4210
+ AVFilterInOut_name_s_sync(ptr: number, val: number): void;
4211
+ AVFilterInOut_next_sync(ptr: number): number;
4212
+ AVFilterInOut_next_s_sync(ptr: number, val: number): void;
4213
+ AVFilterInOut_pad_idx_sync(ptr: number): number;
4214
+ AVFilterInOut_pad_idx_s_sync(ptr: number, val: number): void;
4215
+ av_frame_free_js_sync(ptr: number): void;
4216
+ av_packet_free_js_sync(ptr: number): void;
4217
+ avformat_close_input_js_sync(ptr: number): void;
4218
+ avcodec_free_context_js_sync(ptr: number): void;
4219
+ avcodec_parameters_free_js_sync(ptr: number): void;
4220
+ avfilter_graph_free_js_sync(ptr: number): void;
4221
+ avfilter_inout_free_js_sync(ptr: number): void;
4222
+ av_dict_free_js_sync(ptr: number): void;
4223
+ copyin_u8_sync(ptr: number, arr: Uint8Array): void;
4224
+ copyout_u8_sync(ptr: number, len: number): Uint8Array;
4225
+ copyin_s16_sync(ptr: number, arr: Int16Array): void;
4226
+ copyout_s16_sync(ptr: number, len: number): Int16Array;
4227
+ copyin_s32_sync(ptr: number, arr: Int32Array): void;
4228
+ copyout_s32_sync(ptr: number, len: number): Int32Array;
4229
+ copyin_f32_sync(ptr: number, arr: Float32Array): void;
4230
+ copyout_f32_sync(ptr: number, len: number): Float32Array;
4231
+
4232
+ /**
4233
+ * Read a complete file from the in-memory filesystem.
4234
+ * @param name Filename to read
4235
+ */
4236
+ readFile_sync(name: string): Uint8Array;
4237
+ /**
4238
+ * Write a complete file to the in-memory filesystem.
4239
+ * @param name Filename to write
4240
+ * @param content Content to write to the file
4241
+ */
4242
+ writeFile_sync(name: string, content: Uint8Array): Uint8Array;
4243
+ /**
4244
+ * Delete a file in the in-memory filesystem.
4245
+ * @param name Filename to delete
4246
+ */
4247
+ unlink_sync(name: string): void;
4248
+ /**
4249
+ * Unmount a mounted filesystem.
4250
+ * @param mountpoint Path where the filesystem is mounted
4251
+ */
4252
+ unmount_sync(mountpoint: string): void;
4253
+ /**
4254
+ * Make a lazy file. Direct link to createLazyFile.
4255
+ */
4256
+ createLazyFile_sync(
4257
+ parent: string, name: string, url: string, canRead: boolean,
4258
+ canWrite: boolean
4259
+ ): void;
4260
+ /**
4261
+ * Make a reader device.
4262
+ * @param name Filename to create.
4263
+ * @param mode Unix permissions (pointless since this is an in-memory
4264
+ * filesystem)
4265
+ */
4266
+ mkreaderdev_sync(name: string, mode?: number): void;
4267
+ /**
4268
+ * Make a block reader "device". Technically a file that we then hijack to have
4269
+ * our behavior.
4270
+ * @param name Filename to create.
4271
+ * @param size Size of the device to present.
4272
+ */
4273
+ mkblockreaderdev_sync(name: string, size: number): void;
4274
+ /**
4275
+ * Make a readahead device. This reads a File (or other Blob) and attempts to
4276
+ * read ahead of whatever libav actually asked for. Note that this overrides
4277
+ * onblockread, so if you want to support both kinds of files, make sure you set
4278
+ * onblockread before calling this.
4279
+ * @param name Filename to create.
4280
+ * @param file Blob or file to read.
4281
+ */
4282
+ mkreadaheadfile_sync(name: string, file: Blob): void;
4283
+ /**
4284
+ * Unlink a readahead file. Also gets rid of the File reference.
4285
+ * @param name Filename to unlink.
4286
+ */
4287
+ unlinkreadaheadfile_sync(name: string): void;
4288
+ /**
4289
+ * Make a writer device.
4290
+ * @param name Filename to create
4291
+ * @param mode Unix permissions
4292
+ */
4293
+ mkwriterdev_sync(name: string, mode?: number): void;
4294
+ /**
4295
+ * Make a stream writer device. The same as a writer device but does not allow
4296
+ * seeking.
4297
+ * @param name Filename to create
4298
+ * @param mode Unix permissions
4299
+ */
4300
+ mkstreamwriterdev_sync(name: string, mode?: number): void;
4301
+ /**
4302
+ * Mount a writer *filesystem*. All files created in this filesystem will be
4303
+ * redirected as writers. The directory will be created for you if it doesn't
4304
+ * already exist, but it may already exist.
4305
+ * @param mountpoint Directory to mount as a writer filesystem
4306
+ */
4307
+ mountwriterfs_sync(mountpoint: string): void;
4308
+ /**
4309
+ * Make a workerfs file. Returns the filename that it's mounted to.
4310
+ * @param name Filename to use.
4311
+ * @param blob Blob to load at that file.
4312
+ */
4313
+ mkworkerfsfile_sync(name: string, blob: Blob): string;
4314
+ /**
4315
+ * Unmount (unmake) a workerfs file. Give the *original name you provided*, not
4316
+ * the name mkworkerfsfile returned.
4317
+ * @param name Filename to unmount.
4318
+ */
4319
+ unlinkworkerfsfile_sync(name: string): void;
4320
+ /**
4321
+ * Make a FileSystemFileHandle device. This writes via a FileSystemFileHandle,
4322
+ * synchronously if possible. Note that this overrides onwrite, so if you want
4323
+ * to support both kinds of files, make sure you set onwrite before calling
4324
+ * this.
4325
+ * @param name Filename to create.
4326
+ * @param fsfh FileSystemFileHandle corresponding to this filename.
4327
+ */
4328
+ mkfsfhfile(name: string, fsfh: FileSystemFileHandle): Promise<void>;
4329
+ /**
4330
+ * Unlink a FileSystemFileHandle file. Also closes the file handle.
4331
+ * @param name Filename to unlink.
4332
+ */
4333
+ unlinkfsfhfile(name: string): Promise<void>;
4334
+ /**
4335
+ * Send some data to a reader device. To indicate EOF, send null. To indicate an
4336
+ * error, send EOF and include an error code in the options.
4337
+ * @param name Filename of the reader device.
4338
+ * @param data Data to send.
4339
+ * @param opts Optional send options, such as an error code.
4340
+ */
4341
+ ff_reader_dev_send_sync(
4342
+ name: string, data: Uint8Array | null,
4343
+ opts?: {
4344
+ errorCode?: number,
4345
+ error?: any // any other error, used internally
4346
+ }
4347
+ ): void;
4348
+ /**
4349
+ * Send some data to a block reader device. To indicate EOF, send null (but note
4350
+ * that block read devices have a fixed size, and will automatically send EOF
4351
+ * for reads outside of that size, so you should not normally need to send EOF).
4352
+ * To indicate an error, send EOF and include an error code in the options.
4353
+ * @param name Filename of the reader device.
4354
+ * @param pos Position of the data in the file.
4355
+ * @param data Data to send.
4356
+ * @param opts Optional send options, such as an error code.
4357
+ */
4358
+ ff_block_reader_dev_send_sync(
4359
+ name: string, pos: number, data: Uint8Array | null,
4360
+ opts?: {
4361
+ errorCode?: number,
4362
+ error?: any // any other error, used internally
4363
+ }
4364
+ ): void;
4365
+ /**
4366
+ * @deprecated
4367
+ * DEPRECATED. Use the onread callback.
4368
+ * Metafunction to determine whether any device has any waiters. This can be
4369
+ * used to determine whether more data needs to be sent before a previous step
4370
+ * will be fully resolved.
4371
+ * @param name Optional name of file to check for waiters
4372
+ */
4373
+ ff_reader_dev_waiting_sync(name?: string): boolean;
4374
+ /**
4375
+ * Metafunction to initialize an encoder with all the bells and whistles.
4376
+ * Returns [AVCodec, AVCodecContext, AVFrame, AVPacket, frame_size]
4377
+ * @param name libav name of the codec
4378
+ * @param opts Encoder options
4379
+ */
4380
+ ff_init_encoder_sync(
4381
+ name: string, opts?: {
4382
+ ctx?: AVCodecContextProps,
4383
+ time_base?: [number, number],
4384
+ options?: Record<string, string>
4385
+ }
4386
+ ): [number, number, number, number, number];
4387
+ /**
4388
+ * Metafunction to initialize a decoder with all the bells and whistles.
4389
+ * Similar to ff_init_encoder but doesn't need to initialize the frame.
4390
+ * Returns [AVCodec, AVCodecContext, AVPacket, AVFrame]
4391
+ * @param name libav decoder identifier or name
4392
+ * @param config Decoder configuration. Can just be a number for codec
4393
+ * parameters, or can be multiple configuration options.
4394
+ */
4395
+ ff_init_decoder_sync(
4396
+ name: string | number, config?: number | {
4397
+ codecpar?: number | CodecParameters,
4398
+ time_base?: [number, number]
4399
+ }
4400
+ ): [number, number, number, number];
4401
+ /**
4402
+ * Free everything allocated by ff_init_encoder.
4403
+ * @param c AVCodecContext
4404
+ * @param frame AVFrame
4405
+ * @param pkt AVPacket
4406
+ */
4407
+ ff_free_encoder_sync(
4408
+ c: number, frame: number, pkt: number
4409
+ ): void;
4410
+ /**
4411
+ * Free everything allocated by ff_init_decoder
4412
+ * @param c AVCodecContext
4413
+ * @param pkt AVPacket
4414
+ * @param frame AVFrame
4415
+ */
4416
+ ff_free_decoder_sync(
4417
+ c: number, pkt: number, frame: number
4418
+ ): void;
4419
+ /**
4420
+ * Encode some number of frames at once. Done in one go to avoid excess message
4421
+ * passing.
4422
+ * @param ctx AVCodecContext
4423
+ * @param frame AVFrame
4424
+ * @param pkt AVPacket
4425
+ * @param inFrames Array of frames in libav.js format
4426
+ * @param config Encoding options. May be "true" to indicate end of stream.
4427
+ */
4428
+ ff_encode_multi_sync(
4429
+ ctx: number, frame: number, pkt: number, inFrames: (Frame | number)[],
4430
+ config?: boolean | {
4431
+ fin?: boolean,
4432
+ copyoutPacket?: "default"
4433
+ }
4434
+ ): Packet[]
4435
+ ff_encode_multi_sync(
4436
+ ctx: number, frame: number, pkt: number, inFrames: (Frame | number)[],
4437
+ config: {
4438
+ fin?: boolean,
4439
+ copyoutPacket: "ptr"
4440
+ }
4441
+ ): number[];
4442
+ /**
4443
+ * Decode some number of packets at once. Done in one go to avoid excess
4444
+ * message passing.
4445
+ * @param ctx AVCodecContext
4446
+ * @param pkt AVPacket
4447
+ * @param frame AVFrame
4448
+ * @param inPackets Incoming packets to decode
4449
+ * @param config Decoding options. May be "true" to indicate end of stream.
4450
+ */
4451
+ ff_decode_multi_sync(
4452
+ ctx: number, pkt: number, frame: number, inPackets: (Packet | number)[],
4453
+ config?: boolean | {
4454
+ fin?: boolean,
4455
+ ignoreErrors?: boolean,
4456
+ copyoutFrame?: "default" | "video" | "video_packed"
4457
+ }
4458
+ ): Frame[]
4459
+ ff_decode_multi_sync(
4460
+ ctx: number, pkt: number, frame: number, inPackets: (Packet | number)[],
4461
+ config: {
4462
+ fin?: boolean,
4463
+ ignoreErrors?: boolean,
4464
+ copyoutFrame: "ptr"
4465
+ }
4466
+ ): number[]
4467
+ ff_decode_multi_sync(
4468
+ ctx: number, pkt: number, frame: number, inPackets: (Packet | number)[],
4469
+ config: {
4470
+ fin?: boolean,
4471
+ ignoreErrors?: boolean,
4472
+ copyoutFrame: "ImageData"
4473
+ }
4474
+ ): ImageData[];
4475
+ /**
4476
+ * Initialize a muxer format, format context and some number of streams.
4477
+ * Returns [AVFormatContext, AVOutputFormat, AVIOContext, AVStream[]]
4478
+ * @param opts Muxer options
4479
+ * @param stramCtxs Context info for each stream to mux
4480
+ */
4481
+ ff_init_muxer_sync(
4482
+ opts: {
4483
+ oformat?: number, // format pointer
4484
+ format_name?: string, // libav name
4485
+ filename?: string,
4486
+ device?: boolean, // Create a writer device
4487
+ open?: boolean, // Open the file for writing
4488
+ codecpars?: boolean // Streams is in terms of codecpars, not codecctx
4489
+ },
4490
+ streamCtxs: [number, number, number][] // AVCodecContext | AVCodecParameters, time_base_num, time_base_den
4491
+ ): [number, number, number, number[]];
4492
+ /**
4493
+ * Free up a muxer format and/or file
4494
+ * @param oc AVFormatContext
4495
+ * @param pb AVIOContext
4496
+ */
4497
+ ff_free_muxer_sync(oc: number, pb: number): void;
4498
+ /**
4499
+ * Initialize a demuxer from a file and format context, and get the list of
4500
+ * codecs/types.
4501
+ * Returns [AVFormatContext, Stream[]]
4502
+ * @param filename Filename to open
4503
+ * @param fmt Format to use (optional)
4504
+ */
4505
+ ff_init_demuxer_file_sync(
4506
+ filename: string, fmt?: string
4507
+ ): [number, Stream[]] | Promise<[number, Stream[]]>;
4508
+ /**
4509
+ * Write some number of packets at once.
4510
+ * @param oc AVFormatContext
4511
+ * @param pkt AVPacket
4512
+ * @param inPackets Packets to write
4513
+ * @param interleave Set to false to *not* use the interleaved writer.
4514
+ * Interleaving is the default.
4515
+ */
4516
+ ff_write_multi_sync(
4517
+ oc: number, pkt: number, inPackets: (Packet | number)[], interleave?: boolean
4518
+ ): void;
4519
+ /**
4520
+ * Read many packets at once. If you don't set any limits, this function will
4521
+ * block (asynchronously) until the whole file is read, so make sure you set
4522
+ * some limits if you want to read a bit at a time. Returns a pair [result,
4523
+ * packets], where the result indicates whether an error was encountered, an
4524
+ * EOF, or simply limits (EAGAIN), and packets is a dictionary indexed by the
4525
+ * stream number in which each element is an array of packets from that stream.
4526
+ * @param fmt_ctx AVFormatContext
4527
+ * @param pkt AVPacket
4528
+ * @param opts Other options
4529
+ */
4530
+ ff_read_frame_multi_sync(
4531
+ fmt_ctx: number, pkt: number, opts?: {
4532
+ index?: number, // INPUT stream index
4533
+ limit?: number, // OUTPUT limit, in bytes
4534
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
4535
+ copyoutPacket?: "default" // Version of ff_copyout_packet to use
4536
+ }
4537
+ ): [number, Record<number, Packet[]>] | Promise<[number, Record<number, Packet[]>]>
4538
+ ff_read_frame_multi_sync(
4539
+ fmt_ctx: number, pkt: number, opts: {
4540
+ index?: number, // INPUT stream index
4541
+ limit?: number, // OUTPUT limit, in bytes
4542
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
4543
+ copyoutPacket: "ptr" // Version of ff_copyout_packet to use
4544
+ }
4545
+ ): [number, Record<number, number[]>] | Promise<[number, Record<number, number[]>]>;
4546
+ /**
4547
+ * @deprecated
4548
+ * DEPRECATED. Use `ff_read_frame_multi`.
4549
+ * Read many packets at once. This older API is now deprecated. The devfile
4550
+ * parameter is unused and unsupported. Dev files should be used via the normal
4551
+ * `ff_reader_dev_waiting` API, rather than counting on device file limits, as
4552
+ * this function used to.
4553
+ * @param fmt_ctx AVFormatContext
4554
+ * @param pkt AVPacket
4555
+ * @param devfile Unused
4556
+ * @param opts Other options
4557
+ */
4558
+ ff_read_multi_sync(
4559
+ fmt_ctx: number, pkt: number, devfile?: string | null, opts?: {
4560
+ limit?: number, // OUTPUT limit, in bytes
4561
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
4562
+ copyoutPacket?: "default" // Version of ff_copyout_packet to use
4563
+ }
4564
+ ): [number, Record<number, Packet[]>] | Promise<[number, Record<number, Packet[]>]>
4565
+ ff_read_multi_sync(
4566
+ fmt_ctx: number, pkt: number, devfile: string | null, opts: {
4567
+ limit?: number, // OUTPUT limit, in bytes
4568
+ devLimit?: number, // INPUT limit, in bytes (don't read if less than this much data is available)
4569
+ unify?: boolean, // If true, unify the packets into a single stream (called 0), so that the output is in the same order as the input
4570
+ copyoutPacket: "ptr" // Version of ff_copyout_packet to use
4571
+ }
4572
+ ): [number, Record<number, number[]>] | Promise<[number, Record<number, number[]>]>;
4573
+ /**
4574
+ * Initialize a filter graph. No equivalent free since you just need to free
4575
+ * the graph itself (av_filter_graph_free) and everything under it will be
4576
+ * freed automatically.
4577
+ * Returns [AVFilterGraph, AVFilterContext, AVFilterContext], where the second
4578
+ * and third are the input and output buffer source/sink. For multiple
4579
+ * inputs/outputs, the second and third will be arrays, as appropriate.
4580
+ * @param filters_descr Filtergraph description
4581
+ * @param input Input settings, or array of input settings for multiple inputs
4582
+ * @param output Output settings, or array of output settings for multiple
4583
+ * outputs
4584
+ */
4585
+ ff_init_filter_graph_sync(
4586
+ filters_descr: string,
4587
+ input: FilterIOSettings,
4588
+ output: FilterIOSettings
4589
+ ): [number, number, number];
4590
+ ff_init_filter_graph_sync(
4591
+ filters_descr: string,
4592
+ input: FilterIOSettings[],
4593
+ output: FilterIOSettings
4594
+ ): [number, number[], number];
4595
+ ff_init_filter_graph_sync(
4596
+ filters_descr: string,
4597
+ input: FilterIOSettings,
4598
+ output: FilterIOSettings[]
4599
+ ): [number, number, number[]];
4600
+ ff_init_filter_graph_sync(
4601
+ filters_descr: string,
4602
+ input: FilterIOSettings[],
4603
+ output: FilterIOSettings[]
4604
+ ): [number, number[], number[]];
4605
+ /**
4606
+ * Filter some number of frames, possibly corresponding to multiple sources.
4607
+ * @param srcs AVFilterContext(s), input
4608
+ * @param buffersink_ctx AVFilterContext, output
4609
+ * @param framePtr AVFrame
4610
+ * @param inFrames Input frames, either as an array of frames or with frames
4611
+ * per input
4612
+ * @param config Options. May be "true" to indicate end of stream.
4613
+ */
4614
+ ff_filter_multi_sync(
4615
+ srcs: number, buffersink_ctx: number, framePtr: number,
4616
+ inFrames: (Frame | number)[], config?: boolean | {
4617
+ fin?: boolean,
4618
+ copyoutFrame?: "default" | "video" | "video_packed"
4619
+ }
4620
+ ): Frame[];
4621
+ ff_filter_multi_sync(
4622
+ srcs: number[], buffersink_ctx: number, framePtr: number,
4623
+ inFrames: (Frame | number)[][], config?: boolean[] | {
4624
+ fin?: boolean,
4625
+ copyoutFrame?: "default" | "video" | "video_packed"
4626
+ }[]
4627
+ ): Frame[]
4628
+ ff_filter_multi_sync(
4629
+ srcs: number, buffersink_ctx: number, framePtr: number,
4630
+ inFrames: (Frame | number)[], config: {
4631
+ fin?: boolean,
4632
+ copyoutFrame: "ptr"
4633
+ }
4634
+ ): number[];
4635
+ ff_filter_multi_sync(
4636
+ srcs: number[], buffersink_ctx: number, framePtr: number,
4637
+ inFrames: (Frame | number)[][], config: {
4638
+ fin?: boolean,
4639
+ copyoutFrame: "ptr"
4640
+ }[]
4641
+ ): number[]
4642
+ ff_filter_multi_sync(
4643
+ srcs: number, buffersink_ctx: number, framePtr: number,
4644
+ inFrames: (Frame | number)[], config: {
4645
+ fin?: boolean,
4646
+ copyoutFrame: "ImageData"
4647
+ }
4648
+ ): ImageData[];
4649
+ ff_filter_multi_sync(
4650
+ srcs: number[], buffersink_ctx: number, framePtr: number,
4651
+ inFrames: (Frame | number)[][], config: {
4652
+ fin?: boolean,
4653
+ copyoutFrame: "ImageData"
4654
+ }[]
4655
+ ): ImageData[];
4656
+ /**
4657
+ * Decode and filter frames. Just a combination of ff_decode_multi and
4658
+ * ff_filter_multi that's all done on the libav.js side.
4659
+ * @param ctx AVCodecContext
4660
+ * @param buffersrc_ctx AVFilterContext, input
4661
+ * @param buffersink_ctx AVFilterContext, output
4662
+ * @param pkt AVPacket
4663
+ * @param frame AVFrame
4664
+ * @param inPackets Incoming packets to decode and filter
4665
+ * @param config Decoding and filtering options. May be "true" to indicate end
4666
+ * of stream.
4667
+ */
4668
+ ff_decode_filter_multi_sync(
4669
+ ctx: number, buffersrc_ctx: number, buffersink_ctx: number, pkt: number,
4670
+ frame: number, inPackets: (Packet | number)[],
4671
+ config?: boolean | {
4672
+ fin?: boolean,
4673
+ ignoreErrors?: boolean,
4674
+ copyoutFrame?: "default" | "video" | "video_packed"
4675
+ }
4676
+ ): Frame[]
4677
+ ff_decode_filter_multi_sync(
4678
+ ctx: number, buffersrc_ctx: number, buffersink_ctx: number, pkt: number,
4679
+ frame: number, inPackets: (Packet | number)[],
4680
+ config: {
4681
+ fin?: boolean,
4682
+ ignoreErrors?: boolean,
4683
+ copyoutFrame: "ptr"
4684
+ }
4685
+ ): number[]
4686
+ ff_decode_filter_multi_sync(
4687
+ ctx: number, buffersrc_ctx: number, buffersink_ctx: number, pkt: number,
4688
+ frame: number, inPackets: (Packet | number)[],
4689
+ config: {
4690
+ fin?: boolean,
4691
+ ignoreErrors?: boolean,
4692
+ copyoutFrame: "ImageData"
4693
+ }
4694
+ ): ImageData[];
4695
+ /**
4696
+ * Copy out a frame.
4697
+ * @param frame AVFrame
4698
+ */
4699
+ ff_copyout_frame_sync(frame: number): Frame;
4700
+ /**
4701
+ * Copy out a video frame. `ff_copyout_frame` will copy out a video frame if a
4702
+ * video frame is found, but this may be faster if you know it's a video frame.
4703
+ * @param frame AVFrame
4704
+ */
4705
+ ff_copyout_frame_video_sync(frame: number): Frame;
4706
+ /**
4707
+ * Get the size of a packed video frame in its native format.
4708
+ * @param frame AVFrame
4709
+ */
4710
+ ff_frame_video_packed_size_sync(frame: number): Frame;
4711
+ /**
4712
+ * Copy out a video frame, as a single packed Uint8Array.
4713
+ * @param frame AVFrame
4714
+ */
4715
+ ff_copyout_frame_video_packed_sync(frame: number): Frame;
4716
+ /**
4717
+ * Copy out a video frame as an ImageData. The video frame *must* be RGBA for
4718
+ * this to work as expected (though some ImageData will be returned for any
4719
+ * frame).
4720
+ * @param frame AVFrame
4721
+ */
4722
+ ff_copyout_frame_video_imagedata_sync(
4723
+ frame: number
4724
+ ): ImageData;
4725
+ /**
4726
+ * Copy in a frame.
4727
+ * @param framePtr AVFrame
4728
+ * @param frame Frame to copy in, as either a Frame or an AVFrame pointer
4729
+ */
4730
+ ff_copyin_frame_sync(framePtr: number, frame: Frame | number): void;
4731
+ /**
4732
+ * Copy out a packet.
4733
+ * @param pkt AVPacket
4734
+ */
4735
+ ff_copyout_packet_sync(pkt: number): Packet;
4736
+ /**
4737
+ * Copy "out" a packet by just copying its data into a new AVPacket.
4738
+ * @param pkt AVPacket
4739
+ */
4740
+ ff_copyout_packet_ptr_sync(pkt: number): number;
4741
+ /**
4742
+ * Copy in a packet.
4743
+ * @param pktPtr AVPacket
4744
+ * @param packet Packet to copy in, as either a Packet or an AVPacket pointer
4745
+ */
4746
+ ff_copyin_packet_sync(pktPtr: number, packet: Packet | number): void;
4747
+ /**
4748
+ * Copy out codec parameters.
4749
+ * @param codecpar AVCodecParameters
4750
+ */
4751
+ ff_copyout_codecpar_sync(codecpar: number): CodecParameters;
4752
+ /**
4753
+ * Copy in codec parameters.
4754
+ * @param codecparPtr AVCodecParameters
4755
+ * @param codecpar Codec parameters to copy in.
4756
+ */
4757
+ ff_copyin_codecpar_sync(codecparPtr: number, codecpar: CodecParameters): void;
4758
+ /**
4759
+ * Allocate and copy in a 32-bit int list.
4760
+ * @param list List of numbers to copy in
4761
+ */
4762
+ ff_malloc_int32_list_sync(list: number[]): number;
4763
+ /**
4764
+ * Allocate and copy in a 64-bit int list.
4765
+ * @param list List of numbers to copy in
4766
+ */
4767
+ ff_malloc_int64_list_sync(list: number[]): number;
4768
+ /**
4769
+ * Allocate and copy in a string array. The resulting array will be
4770
+ * NULL-terminated.
4771
+ * @param arr Array of strings to copy in.
4772
+ */
4773
+ ff_malloc_string_array_sync(arr: string[]): number;
4774
+ /**
4775
+ * Free a string array allocated by ff_malloc_string_array.
4776
+ * @param ptr Pointer to the array to free.
4777
+ */
4778
+ ff_free_string_array_sync(ptr: number): void;
4779
+ /**
4780
+ * Frontend to the ffmpeg CLI (if it's compiled in). Pass arguments as strings,
4781
+ * or you may intermix arrays of strings for multiple arguments.
4782
+ *
4783
+ * NOTE: ffmpeg 6.0 and later require threads for the ffmpeg CLI. libav.js
4784
+ * *does* support the ffmpeg CLI on unthreaded environments, but to do so, it
4785
+ * uses an earlier version of the CLI, from 5.1.3. The libraries are still
4786
+ * modern, and if running libav.js in threaded mode, the ffmpeg CLI is modern as
4787
+ * well. As time passes, these two versions will drift apart, so make sure you
4788
+ * know whether you're running in threaded mode or not!
4789
+ */
4790
+ ffmpeg_sync(...args: (string | string[])[]): number | Promise<number>;
4791
+ /**
4792
+ * Frontend to the ffprobe CLI (if it's compiled in). Pass arguments as strings,
4793
+ * or you may intermix arrays of strings for multiple arguments.
4794
+ */
4795
+ ffprobe_sync(...args: (string | string[])[]): number | Promise<number>;
4796
+
4797
+ }
4798
+
4799
+ /**
4800
+ * Options to create a libav.js instance.
4801
+ */
4802
+ export interface LibAVOpts {
4803
+ /**
4804
+ * Don't create a worker.
4805
+ */
4806
+ noworker?: boolean;
4807
+
4808
+ /**
4809
+ * Don't use WebAssembly.
4810
+ */
4811
+ nowasm?: boolean;
4812
+
4813
+ /**
4814
+ * Use threads. If threads ever become reliable, this flag will disappear,
4815
+ * and you will need to use nothreads.
4816
+ */
4817
+ yesthreads?: boolean;
4818
+
4819
+ /**
4820
+ * Don't use threads. The default.
4821
+ */
4822
+ nothreads?: boolean;
4823
+
4824
+ /**
4825
+ * Don't use ES6 modules for loading, even if libav.js was compiled as an
4826
+ * ES6 module.
4827
+ */
4828
+ noes6?: boolean;
4829
+
4830
+ /**
4831
+ * URL base from which to load workers and modules.
4832
+ */
4833
+ base?: string;
4834
+
4835
+ /**
4836
+ * URL from which to load the module factory.
4837
+ */
4838
+ toImport?: string;
4839
+
4840
+ /**
4841
+ * The module factory to use itself.
4842
+ */
4843
+ factory?: any;
4844
+
4845
+ /**
4846
+ * The variant to load (instead of whichever variant was compiled)
4847
+ */
4848
+ variant?: string;
4849
+
4850
+ /**
4851
+ * The full URL from which to load the .wasm file.
4852
+ */
4853
+ wasmurl?: string;
4854
+ }
4855
+
4856
+ /**
4857
+ * The main wrapper for libav.js, typically named "LibAV".
4858
+ */
4859
+ export interface LibAVWrapper extends LibAVOpts, LibAVStatic {
4860
+ /**
4861
+ * Create a LibAV instance.
4862
+ * @param opts Options
4863
+ */
4864
+ LibAV(opts?: LibAVOpts & {noworker?: false}): Promise<LibAV>;
4865
+ LibAV(opts: LibAVOpts & {noworker: true}): Promise<LibAV & LibAVSync>;
4866
+ LibAV(opts: LibAVOpts): Promise<LibAV | LibAV & LibAVSync>;
4867
+ }
4868
+ }
4869
+
4870
+ /**
4871
+ * The actual export is the namespace (for types) and a wrapper (for data).
4872
+ */
4873
+ declare const LibAV: LibAV.LibAVWrapper;
4874
+ export = LibAV;