bare-ffmpeg 1.0.0-26 → 1.0.0-27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/binding.cc CHANGED
@@ -1,3 +1,4 @@
1
+ #include <optional>
1
2
  #include <tuple>
2
3
  #include <vector>
3
4
 
@@ -16,6 +17,9 @@ extern "C" {
16
17
  #include <libavcodec/codec_par.h>
17
18
  #include <libavcodec/packet.h>
18
19
  #include <libavdevice/avdevice.h>
20
+ #include <libavfilter/avfilter.h>
21
+ #include <libavfilter/buffersink.h>
22
+ #include <libavfilter/buffersrc.h>
19
23
  #include <libavformat/avformat.h>
20
24
  #include <libavformat/avio.h>
21
25
  #include <libavutil/audio_fifo.h>
@@ -107,6 +111,22 @@ typedef struct {
107
111
  AVPacketSideData *handle;
108
112
  } bare_ffmpeg_side_data_t;
109
113
 
114
+ typedef struct {
115
+ const AVFilter *handle;
116
+ } bare_ffmpeg_filter_t;
117
+
118
+ typedef struct {
119
+ AVFilterContext *handle;
120
+ } bare_ffmpeg_filter_context_t;
121
+
122
+ typedef struct {
123
+ AVFilterGraph *handle;
124
+ } bare_ffmpeg_filter_graph_t;
125
+
126
+ typedef struct {
127
+ AVFilterInOut *handle;
128
+ } bare_ffmpeg_filter_inout_t;
129
+
110
130
  static uv_once_t bare_ffmpeg__init_guard = UV_ONCE_INIT;
111
131
 
112
132
  static inline bool
@@ -826,6 +846,155 @@ bare_ffmpeg_get_sample_format_name_by_id(js_env_t *env, js_receiver_t, uint32_t
826
846
  return av_get_sample_fmt_name(static_cast<enum AVSampleFormat>(id));
827
847
  }
828
848
 
849
+ static std::vector<int32_t>
850
+ bare_ffmpeg_codec_get_supported_config(
851
+ js_env_t *env,
852
+ js_receiver_t,
853
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_context_t, 1> context,
854
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_t, 1> codec,
855
+ int32_t cfg
856
+ ) {
857
+ int err;
858
+
859
+ int count = 0;
860
+ const void *list = nullptr;
861
+
862
+ err = avcodec_get_supported_config(context->handle, codec->handle, static_cast<AVCodecConfig>(cfg), 0, &list, &count);
863
+ if (err < 0) {
864
+ err = js_throw_error(env, NULL, av_err2str(err));
865
+ assert(err == 0);
866
+
867
+ throw js_pending_exception;
868
+ }
869
+
870
+ std::vector<int32_t> values;
871
+
872
+ if (count > 0 && list) {
873
+ const int32_t *int_list = static_cast<const int32_t *>(list);
874
+ for (int i = 0; i < count; i++) {
875
+ values.push_back(int_list[i]);
876
+ }
877
+ return values;
878
+ }
879
+
880
+ switch (static_cast<AVCodecConfig>(cfg)) {
881
+ case AV_CODEC_CONFIG_PIX_FORMAT:
882
+ for (int i = 0; i < AV_PIX_FMT_NB; i++) {
883
+ if (av_pix_fmt_desc_get(static_cast<AVPixelFormat>(i)) != nullptr) {
884
+ values.push_back(i);
885
+ }
886
+ }
887
+ break;
888
+ case AV_CODEC_CONFIG_SAMPLE_FORMAT:
889
+ for (int i = 0; i < AV_SAMPLE_FMT_NB; i++) {
890
+ values.push_back(i);
891
+ }
892
+ break;
893
+ case AV_CODEC_CONFIG_COLOR_RANGE:
894
+ values.push_back(AVCOL_RANGE_UNSPECIFIED);
895
+ values.push_back(AVCOL_RANGE_MPEG);
896
+ values.push_back(AVCOL_RANGE_JPEG);
897
+ break;
898
+ case AV_CODEC_CONFIG_COLOR_SPACE:
899
+ for (int i = 0; i < AVCOL_SPC_NB; i++) {
900
+ values.push_back(i);
901
+ }
902
+ break;
903
+ case AV_CODEC_CONFIG_SAMPLE_RATE:
904
+ values.push_back(0);
905
+ break;
906
+ default:
907
+ break;
908
+ }
909
+
910
+ return values;
911
+ }
912
+
913
+ static std::optional<js_arraybuffer_t>
914
+ bare_ffmpeg_codec_get_supported_frame_rates(
915
+ js_env_t *env,
916
+ js_receiver_t,
917
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_context_t, 1> context,
918
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_t, 1> codec
919
+ ) {
920
+ int err;
921
+
922
+ const AVCodecContext *ctx = context->handle;
923
+ const AVCodec *c = codec->handle;
924
+
925
+ int count = 0;
926
+ const void *list = nullptr;
927
+
928
+ err = avcodec_get_supported_config(ctx, c, AV_CODEC_CONFIG_FRAME_RATE, 0, &list, &count);
929
+ if (err < 0) {
930
+ err = js_throw_error(env, NULL, av_err2str(err));
931
+ assert(err == 0);
932
+
933
+ throw js_pending_exception;
934
+ }
935
+
936
+ if (!list || count == 0) {
937
+ return std::nullopt;
938
+ }
939
+
940
+ js_arraybuffer_t result;
941
+ int32_t *data;
942
+ err = js_create_arraybuffer(env, static_cast<size_t>(count * 2), data, result);
943
+ assert(err == 0);
944
+
945
+ const AVRational *rational_list = static_cast<const AVRational *>(list);
946
+ for (int i = 0; i < count; i++) {
947
+ data[i * 2] = rational_list[i].num;
948
+ data[i * 2 + 1] = rational_list[i].den;
949
+ }
950
+
951
+ return result;
952
+ }
953
+
954
+ static std::optional<std::vector<js_arraybuffer_t>>
955
+ bare_ffmpeg_codec_get_supported_channel_layouts(
956
+ js_env_t *env,
957
+ js_receiver_t,
958
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_context_t, 1> context,
959
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_t, 1> codec
960
+ ) {
961
+ int err;
962
+ std::vector<js_arraybuffer_t> result;
963
+
964
+ const AVCodecContext *ctx = context->handle;
965
+ const AVCodec *c = codec->handle;
966
+
967
+ int count = 0;
968
+ const void *list = nullptr;
969
+
970
+ err = avcodec_get_supported_config(ctx, c, AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0, &list, &count);
971
+ if (err < 0) {
972
+ err = js_throw_error(env, NULL, av_err2str(err));
973
+ assert(err == 0);
974
+
975
+ throw js_pending_exception;
976
+ }
977
+
978
+ if (!list || count == 0) {
979
+ return std::nullopt;
980
+ }
981
+
982
+ const AVChannelLayout *layout_list = static_cast<const AVChannelLayout *>(list);
983
+ for (int i = 0; i < count; i++) {
984
+ js_arraybuffer_t handle;
985
+ bare_ffmpeg_channel_layout_t *layout;
986
+ err = js_create_arraybuffer(env, layout, handle);
987
+ assert(err == 0);
988
+
989
+ err = av_channel_layout_copy(&layout->handle, &layout_list[i]);
990
+ assert(err >= 0);
991
+
992
+ result.push_back(handle);
993
+ }
994
+
995
+ return result;
996
+ }
997
+
829
998
  static js_arraybuffer_t
830
999
  bare_ffmpeg_codec_context_init(
831
1000
  js_env_t *env,
@@ -1187,6 +1356,24 @@ bare_ffmpeg_codec_context_set_gop_size(
1187
1356
  context->handle->gop_size = gop_size;
1188
1357
  }
1189
1358
 
1359
+ static int
1360
+ bare_ffmpeg_codec_context_get_frame_size(
1361
+ js_env_t *env,
1362
+ js_receiver_t,
1363
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_context_t, 1> context
1364
+ ) {
1365
+ return context->handle->frame_size;
1366
+ }
1367
+
1368
+ static int64_t
1369
+ bare_ffmpeg_codec_context_get_frame_num(
1370
+ js_env_t *env,
1371
+ js_receiver_t,
1372
+ js_arraybuffer_span_of_t<bare_ffmpeg_codec_context_t, 1> context
1373
+ ) {
1374
+ return context->handle->frame_num;
1375
+ }
1376
+
1190
1377
  static js_arraybuffer_t
1191
1378
  bare_ffmpeg_codec_context_get_framerate(
1192
1379
  js_env_t *env,
@@ -2200,71 +2387,60 @@ bare_ffmpeg_image_get_line_size(
2200
2387
  );
2201
2388
  }
2202
2389
 
2203
- static js_arraybuffer_t
2204
- bare_ffmpeg_samples_init(
2390
+ static int
2391
+ bare_ffmpeg_samples_buffer_size(
2205
2392
  js_env_t *env,
2206
2393
  js_receiver_t,
2207
2394
  int32_t sample_format,
2208
2395
  int32_t nb_channels,
2209
2396
  int32_t nb_samples,
2210
- int32_t align
2397
+ bool no_alignment
2211
2398
  ) {
2212
- int err;
2213
-
2214
2399
  auto len = av_samples_get_buffer_size(
2215
2400
  NULL,
2216
2401
  nb_channels,
2217
2402
  nb_samples,
2218
2403
  static_cast<AVSampleFormat>(sample_format),
2219
- align
2404
+ no_alignment
2220
2405
  );
2221
2406
 
2222
2407
  if (len < 0) {
2223
- err = js_throw_error(env, NULL, av_err2str(len));
2408
+ int err = js_throw_error(env, NULL, av_err2str(len));
2224
2409
  assert(err == 0);
2225
2410
 
2226
2411
  throw js_pending_exception;
2227
2412
  }
2228
2413
 
2229
- js_arraybuffer_t handle;
2230
- err = js_create_arraybuffer(env, static_cast<size_t>(len), handle);
2231
- assert(err == 0);
2232
-
2233
- return handle;
2414
+ return len;
2234
2415
  }
2235
2416
 
2236
2417
  static int
2237
2418
  bare_ffmpeg_samples_fill(
2238
2419
  js_env_t *env,
2239
2420
  js_receiver_t,
2240
- int32_t sample_format,
2241
- int32_t nb_channels,
2242
- int32_t nb_samples,
2243
- int32_t align,
2244
- js_arraybuffer_span_t data,
2421
+ js_arraybuffer_span_of_t<bare_ffmpeg_frame_t, 1> frame,
2422
+ js_arraybuffer_span_t target,
2245
2423
  uint64_t offset,
2246
- js_arraybuffer_span_of_t<bare_ffmpeg_frame_t, 1> frame
2424
+ bool no_alignment
2247
2425
  ) {
2248
- int err;
2249
-
2250
- auto len = av_samples_fill_arrays(
2426
+ auto res = av_samples_fill_arrays(
2251
2427
  frame->handle->data,
2252
2428
  frame->handle->linesize,
2253
- &data[static_cast<size_t>(offset)],
2254
- nb_channels,
2255
- nb_samples,
2256
- static_cast<AVSampleFormat>(sample_format),
2257
- align
2429
+ &target[offset],
2430
+ frame->handle->ch_layout.nb_channels,
2431
+ frame->handle->nb_samples,
2432
+ static_cast<AVSampleFormat>(frame->handle->format),
2433
+ no_alignment
2258
2434
  );
2259
2435
 
2260
- if (len < 0) {
2261
- err = js_throw_error(env, NULL, av_err2str(len));
2436
+ if (res < 0) {
2437
+ int err = js_throw_error(env, NULL, av_err2str(res));
2262
2438
  assert(err == 0);
2263
2439
 
2264
2440
  throw js_pending_exception;
2265
2441
  }
2266
2442
 
2267
- return len;
2443
+ return res;
2268
2444
  }
2269
2445
 
2270
2446
  static js_arraybuffer_t
@@ -2610,6 +2786,24 @@ bare_ffmpeg_packet_set_flags(
2610
2786
  packet->handle->flags = value;
2611
2787
  }
2612
2788
 
2789
+ static void
2790
+ bare_ffmpeg_packet_copy_props(
2791
+ js_env_t *env,
2792
+ js_receiver_t,
2793
+ js_arraybuffer_span_of_t<bare_ffmpeg_packet_t, 1> dst,
2794
+ js_arraybuffer_span_of_t<bare_ffmpeg_packet_t, 1> src
2795
+ ) {
2796
+ int err;
2797
+
2798
+ err = av_packet_copy_props(dst->handle, src->handle);
2799
+ if (err < 0) {
2800
+ err = js_throw_error(env, NULL, av_err2str(err));
2801
+ assert(err == 0);
2802
+
2803
+ throw js_pending_exception;
2804
+ }
2805
+ }
2806
+
2613
2807
  static int
2614
2808
  bare_ffmpeg_side_data_get_type(
2615
2809
  js_env_t *env,
@@ -2868,8 +3062,6 @@ bare_ffmpeg_resampler_convert_frames(
2868
3062
  throw js_pending_exception;
2869
3063
  }
2870
3064
 
2871
- out_frame->handle->nb_samples = result;
2872
-
2873
3065
  return result;
2874
3066
  }
2875
3067
 
@@ -3148,6 +3340,246 @@ bare_ffmpeg_rational_d2q(
3148
3340
  return result;
3149
3341
  }
3150
3342
 
3343
+ static js_arraybuffer_t
3344
+ bare_ffmpeg_filter_get_by_name(
3345
+ js_env_t *env,
3346
+ js_receiver_t,
3347
+ std::string name
3348
+ ) {
3349
+ int err;
3350
+
3351
+ js_arraybuffer_t handle;
3352
+ bare_ffmpeg_filter_t *filter;
3353
+ err = js_create_arraybuffer(env, filter, handle);
3354
+ assert(err == 0);
3355
+
3356
+ filter->handle = avfilter_get_by_name(name.c_str());
3357
+ if (filter->handle == nullptr) {
3358
+ err = js_throw_errorf(env, nullptr, "No Filter found for '%s' name", name.c_str());
3359
+ assert(err == 0);
3360
+
3361
+ throw js_pending_exception;
3362
+ }
3363
+
3364
+ return handle;
3365
+ }
3366
+
3367
+ static js_arraybuffer_t
3368
+ bare_ffmpeg_filter_context_init(
3369
+ js_env_t *env,
3370
+ js_receiver_t
3371
+ ) {
3372
+ js_arraybuffer_t handle;
3373
+ bare_ffmpeg_filter_context_t *filter_ctx;
3374
+ int err = js_create_arraybuffer(env, filter_ctx, handle);
3375
+ assert(err == 0);
3376
+
3377
+ return handle;
3378
+ }
3379
+
3380
+ static js_arraybuffer_t
3381
+ bare_ffmpeg_filter_graph_init(
3382
+ js_env_t *env,
3383
+ js_receiver_t
3384
+ ) {
3385
+ js_arraybuffer_t handle;
3386
+ bare_ffmpeg_filter_graph_t *filter_graph;
3387
+ int err = js_create_arraybuffer(env, filter_graph, handle);
3388
+ assert(err == 0);
3389
+
3390
+ filter_graph->handle = avfilter_graph_alloc();
3391
+ assert(filter_graph->handle != nullptr);
3392
+
3393
+ return handle;
3394
+ }
3395
+
3396
+ static void
3397
+ bare_ffmpeg_filter_graph_destroy(
3398
+ js_env_t *env,
3399
+ js_receiver_t,
3400
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_graph_t, 1> filter_graph
3401
+ ) {
3402
+ avfilter_graph_free(&filter_graph->handle);
3403
+ }
3404
+
3405
+ static void
3406
+ bare_ffmpeg_filter_graph_create_filter(
3407
+ js_env_t *env,
3408
+ js_receiver_t,
3409
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_graph_t, 1> graph,
3410
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_context_t, 1> filter_context,
3411
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_t, 1> filter,
3412
+ std::string name,
3413
+ std::optional<std::string> args
3414
+ ) {
3415
+ int err = avfilter_graph_create_filter(
3416
+ &filter_context->handle,
3417
+ filter->handle,
3418
+ name.c_str(),
3419
+ args.has_value() ? args.value().c_str() : nullptr,
3420
+ nullptr,
3421
+ graph->handle
3422
+ );
3423
+
3424
+ if (err < 0) {
3425
+ err = js_throw_error(env, nullptr, av_err2str(err));
3426
+ assert(err == 0);
3427
+
3428
+ throw js_pending_exception;
3429
+ }
3430
+ }
3431
+
3432
+ static void
3433
+ bare_ffmpeg_filter_graph_parse(
3434
+ js_env_t *env,
3435
+ js_receiver_t,
3436
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_graph_t, 1> graph,
3437
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> inputs,
3438
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> outputs,
3439
+ std::string filter_description
3440
+ ) {
3441
+ int err = avfilter_graph_parse(graph->handle, filter_description.c_str(), inputs->handle, outputs->handle, nullptr);
3442
+ if (err < 0) {
3443
+ err = js_throw_error(env, nullptr, av_err2str(err));
3444
+ assert(err == 0);
3445
+
3446
+ throw js_pending_exception;
3447
+ }
3448
+ }
3449
+
3450
+ static void
3451
+ bare_ffmpeg_filter_graph_configure(
3452
+ js_env_t *env,
3453
+ js_receiver_t,
3454
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_graph_t, 1> graph
3455
+ ) {
3456
+ int err = avfilter_graph_config(graph->handle, nullptr);
3457
+ if (err < 0) {
3458
+ err = js_throw_error(env, nullptr, av_err2str(err));
3459
+ assert(err == 0);
3460
+
3461
+ throw js_pending_exception;
3462
+ }
3463
+ }
3464
+
3465
+ static int
3466
+ bare_ffmpeg_filter_graph_push_frame(
3467
+ js_env_t *env,
3468
+ js_receiver_t,
3469
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_context_t, 1> ctx,
3470
+ js_arraybuffer_span_of_t<bare_ffmpeg_frame_t, 1> frame
3471
+ ) {
3472
+ return av_buffersrc_add_frame(ctx->handle, frame->handle);
3473
+ }
3474
+
3475
+ static int
3476
+ bare_ffmpeg_filter_graph_pull_frame(
3477
+ js_env_t *env,
3478
+ js_receiver_t,
3479
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_context_t, 1> ctx,
3480
+ js_arraybuffer_span_of_t<bare_ffmpeg_frame_t, 1> frame
3481
+ ) {
3482
+ return av_buffersink_get_frame(ctx->handle, frame->handle);
3483
+ }
3484
+
3485
+ static js_arraybuffer_t
3486
+ bare_ffmpeg_filter_inout_init(
3487
+ js_env_t *env,
3488
+ js_receiver_t
3489
+ ) {
3490
+ js_arraybuffer_t handle;
3491
+ bare_ffmpeg_filter_inout_t *filter_inout;
3492
+ int err = js_create_arraybuffer(env, filter_inout, handle);
3493
+ assert(err == 0);
3494
+
3495
+ filter_inout->handle = avfilter_inout_alloc();
3496
+ assert(filter_inout->handle);
3497
+
3498
+ return handle;
3499
+ }
3500
+
3501
+ static void
3502
+ bare_ffmpeg_filter_inout_destroy(
3503
+ js_env_t *env,
3504
+ js_receiver_t,
3505
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> filter_inout
3506
+ ) {
3507
+ avfilter_inout_free(&filter_inout->handle);
3508
+ }
3509
+
3510
+ static std::optional<std::string>
3511
+ bare_ffmpeg_filter_inout_get_name(
3512
+ js_env_t *env,
3513
+ js_receiver_t,
3514
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> filter_inout
3515
+ ) {
3516
+ if (!filter_inout->handle->name) return std::nullopt;
3517
+ return filter_inout->handle->name;
3518
+ }
3519
+
3520
+ static void
3521
+ bare_ffmpeg_filter_inout_set_name(
3522
+ js_env_t *env,
3523
+ js_receiver_t,
3524
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> filter_inout,
3525
+ std::string name
3526
+ ) {
3527
+ if (filter_inout->handle->name) {
3528
+ av_free(filter_inout->handle->name);
3529
+ }
3530
+ filter_inout->handle->name = av_strdup(name.c_str());
3531
+ }
3532
+
3533
+ static void
3534
+ bare_ffmpeg_filter_inout_set_filter_context(
3535
+ js_env_t *env,
3536
+ js_receiver_t,
3537
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> filter_inout,
3538
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_context_t, 1> filter_ctx
3539
+ ) {
3540
+ filter_inout->handle->filter_ctx = filter_ctx->handle;
3541
+ }
3542
+
3543
+ static int
3544
+ bare_ffmpeg_filter_inout_get_pad_idx(
3545
+ js_env_t *env,
3546
+ js_receiver_t,
3547
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> filter_inout
3548
+ ) {
3549
+ return filter_inout->handle->pad_idx;
3550
+ }
3551
+
3552
+ static void
3553
+ bare_ffmpeg_filter_inout_set_pad_idx(
3554
+ js_env_t *env,
3555
+ js_receiver_t,
3556
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> filter_inout,
3557
+ int pad_idx
3558
+ ) {
3559
+ filter_inout->handle->pad_idx = pad_idx;
3560
+ }
3561
+
3562
+ static void
3563
+ bare_ffmpeg_filter_inout_set_next(
3564
+ js_env_t *env,
3565
+ js_receiver_t,
3566
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> filter_inout,
3567
+ js_arraybuffer_span_of_t<bare_ffmpeg_filter_inout_t, 1> next
3568
+ ) {
3569
+ filter_inout->handle->next = next->handle;
3570
+ }
3571
+
3572
+ static int64_t
3573
+ bare_ffmpeg_rational_rescale_q(
3574
+ int64_t ts,
3575
+ int32_t bq_num,
3576
+ int32_t bq_den,
3577
+ int32_t cq_num,
3578
+ int32_t cq_den
3579
+ ) {
3580
+ return av_rescale_q(ts, {bq_num, bq_den}, {cq_num, cq_den});
3581
+ }
3582
+
3151
3583
  static js_value_t *
3152
3584
  bare_ffmpeg_exports(js_env_t *env, js_value_t *exports) {
3153
3585
  uv_once(&bare_ffmpeg__init_guard, bare_ffmpeg__on_init);
@@ -3196,6 +3628,9 @@ bare_ffmpeg_exports(js_env_t *env, js_value_t *exports) {
3196
3628
  V("findEncoderByID", bare_ffmpeg_find_encoder_by_id)
3197
3629
  V("getCodecNameByID", bare_ffmpeg_get_codec_name_by_id)
3198
3630
  V("getSampleFormatNameByID", bare_ffmpeg_get_sample_format_name_by_id)
3631
+ V("getSupportedConfig", bare_ffmpeg_codec_get_supported_config)
3632
+ V("getSupportedFrameRates", bare_ffmpeg_codec_get_supported_frame_rates)
3633
+ V("getSupportedChannelLayouts", bare_ffmpeg_codec_get_supported_channel_layouts)
3199
3634
 
3200
3635
  V("initCodecContext", bare_ffmpeg_codec_context_init)
3201
3636
  V("destroyCodecContext", bare_ffmpeg_codec_context_destroy)
@@ -3223,6 +3658,8 @@ bare_ffmpeg_exports(js_env_t *env, js_value_t *exports) {
3223
3658
  V("setCodecContextFramerate", bare_ffmpeg_codec_context_set_framerate)
3224
3659
  V("getCodecContextExtraData", bare_ffmpeg_codec_context_get_extra_data)
3225
3660
  V("setCodecContextExtraData", bare_ffmpeg_codec_context_set_extra_data)
3661
+ V("getCodecContextFrameSize", bare_ffmpeg_codec_context_get_frame_size)
3662
+ V("getCodecContextFrameNum", bare_ffmpeg_codec_context_get_frame_num)
3226
3663
 
3227
3664
  V("sendCodecContextPacket", bare_ffmpeg_codec_context_send_packet)
3228
3665
  V("receiveCodecContextPacket", bare_ffmpeg_codec_context_receive_packet)
@@ -3307,7 +3744,7 @@ bare_ffmpeg_exports(js_env_t *env, js_value_t *exports) {
3307
3744
  V("readImage", bare_ffmpeg_image_read)
3308
3745
  V("getImageLineSize", bare_ffmpeg_image_get_line_size)
3309
3746
 
3310
- V("initSamples", bare_ffmpeg_samples_init)
3747
+ V("samplesBufferSize", bare_ffmpeg_samples_buffer_size)
3311
3748
  V("fillSamples", bare_ffmpeg_samples_fill)
3312
3749
 
3313
3750
  V("initPacket", bare_ffmpeg_packet_init)
@@ -3333,6 +3770,7 @@ bare_ffmpeg_exports(js_env_t *env, js_value_t *exports) {
3333
3770
  V("setPacketDuration", bare_ffmpeg_packet_set_duration)
3334
3771
  V("getPacketFlags", bare_ffmpeg_packet_get_flags)
3335
3772
  V("setPacketFlags", bare_ffmpeg_packet_set_flags)
3773
+ V("copyPacketProps", bare_ffmpeg_packet_copy_props)
3336
3774
 
3337
3775
  V("getSideDataType", bare_ffmpeg_side_data_get_type)
3338
3776
  V("getSideDataName", bare_ffmpeg_side_data_get_name)
@@ -3370,6 +3808,28 @@ bare_ffmpeg_exports(js_env_t *env, js_value_t *exports) {
3370
3808
  V("getAudioFifoSpace", bare_ffmpeg_audio_fifo_space)
3371
3809
 
3372
3810
  V("rationalD2Q", bare_ffmpeg_rational_d2q)
3811
+ V("rationalRescaleQ", bare_ffmpeg_rational_rescale_q)
3812
+
3813
+ V("getFilterByName", bare_ffmpeg_filter_get_by_name)
3814
+
3815
+ V("initFilterContext", bare_ffmpeg_filter_context_init)
3816
+
3817
+ V("initFilterGraph", bare_ffmpeg_filter_graph_init)
3818
+ V("destroyFilterGraph", bare_ffmpeg_filter_graph_destroy)
3819
+ V("createFilterGraphFilter", bare_ffmpeg_filter_graph_create_filter)
3820
+ V("parseFilterGraph", bare_ffmpeg_filter_graph_parse)
3821
+ V("configureFilterGraph", bare_ffmpeg_filter_graph_configure)
3822
+ V("pushFilterGraphFrame", bare_ffmpeg_filter_graph_push_frame)
3823
+ V("pullFilterGraphFrame", bare_ffmpeg_filter_graph_pull_frame)
3824
+
3825
+ V("initFilterInout", bare_ffmpeg_filter_inout_init)
3826
+ V("destroyFilterInOut", bare_ffmpeg_filter_inout_destroy)
3827
+ V("getFilterInOutName", bare_ffmpeg_filter_inout_get_name)
3828
+ V("setFilterInOutName", bare_ffmpeg_filter_inout_set_name)
3829
+ V("setFilterInOutFilterContext", bare_ffmpeg_filter_inout_set_filter_context)
3830
+ V("getFilterInOutPadIdx", bare_ffmpeg_filter_inout_get_pad_idx)
3831
+ V("setFilterInOutPadIdx", bare_ffmpeg_filter_inout_set_pad_idx)
3832
+ V("setFilterInOutNext", bare_ffmpeg_filter_inout_set_next)
3373
3833
  #undef V
3374
3834
 
3375
3835
  #define V(name) \
@@ -3647,6 +4107,14 @@ bare_ffmpeg_exports(js_env_t *env, js_value_t *exports) {
3647
4107
  V(AV_PKT_DATA_RTCP_SR)
3648
4108
  V(AV_PKT_DATA_NB)
3649
4109
 
4110
+ V(AV_CODEC_CONFIG_PIX_FORMAT)
4111
+ V(AV_CODEC_CONFIG_FRAME_RATE)
4112
+ V(AV_CODEC_CONFIG_SAMPLE_RATE)
4113
+ V(AV_CODEC_CONFIG_SAMPLE_FORMAT)
4114
+ V(AV_CODEC_CONFIG_CHANNEL_LAYOUT)
4115
+ V(AV_CODEC_CONFIG_COLOR_RANGE)
4116
+ V(AV_CODEC_CONFIG_COLOR_SPACE)
4117
+
3650
4118
  #undef V
3651
4119
 
3652
4120
  return exports;
package/index.js CHANGED
@@ -10,6 +10,10 @@ const {
10
10
  InputFormatContext,
11
11
  OutputFormatContext
12
12
  } = require('./lib/format-context')
13
+ const Filter = require('./lib/filter')
14
+ const FilterContext = require('./lib/filter-context')
15
+ const FilterGraph = require('./lib/filter-graph')
16
+ const FilterInOut = require('./lib/filter-inout')
13
17
  const Frame = require('./lib/frame')
14
18
  const IOContext = require('./lib/io-context')
15
19
  const Image = require('./lib/image')
@@ -31,6 +35,10 @@ exports.CodecParameters = CodecParameters
31
35
  exports.Decoder = Decoder
32
36
  exports.Dictionary = Dictionary
33
37
  exports.Encoder = Encoder
38
+ exports.Filter = Filter
39
+ exports.FilterContext = FilterContext
40
+ exports.FilterGraph = FilterGraph
41
+ exports.FilterInOut = FilterInOut
34
42
  exports.Frame = Frame
35
43
  exports.IOContext = IOContext
36
44
  exports.Image = Image