From 72f0c4affa40aa92fd4c9b9688c711b6c94c6a62 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Wed, 3 Feb 2021 15:22:08 +0000 Subject: [PATCH 01/16] Fix definition for metadata property --- types/Stream.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/Stream.d.ts b/types/Stream.d.ts index b6ac725..feb8da0 100644 --- a/types/Stream.d.ts +++ b/types/Stream.d.ts @@ -104,7 +104,7 @@ export interface Stream { */ sample_aspect_ratio: Array - metadata: Array + metadata: { [key: string]: string } /** * Average framerate * From f383adf13bdc92c8f7f3758c6abfc4dacebb6069 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Wed, 3 Feb 2021 15:25:10 +0000 Subject: [PATCH 02/16] Remove unneeded import --- types/Muxer.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/Muxer.d.ts b/types/Muxer.d.ts index 81cec39..fed21bf 100644 --- a/types/Muxer.d.ts +++ b/types/Muxer.d.ts @@ -1,6 +1,5 @@ import { Packet } from "./Packet" import { Frame } from "./Frame" -import { Stream } from "./Stream" import { OutputFormat, FormatContext } from "./FormatContext" export interface Muxer extends Omit Date: Wed, 3 Feb 2021 15:26:19 +0000 Subject: [PATCH 03/16] Stop input and output links sorting by name --- src/filter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/filter.cc b/src/filter.cc index c9bc01b..2edcc24 100644 --- a/src/filter.cc +++ b/src/filter.cc @@ -1453,8 +1453,8 @@ napi_value filterer(napi_env env, napi_callback_info info) { struct filterCarrier : carrier { filtContexts *srcCtxs = nullptr; filtContexts *sinkCtxs = nullptr; - std::map > srcFrames; - std::map > dstFrames; + std::unordered_map > srcFrames; + std::unordered_map > dstFrames; std::vector frameRefs; ~filterCarrier() {} }; From d79139d554db7d92fcdb2d80fec03cccbce9b1a1 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Wed, 3 Feb 2021 15:28:40 +0000 Subject: [PATCH 04/16] Ensure decoder is created from codec_id if available --- src/decode.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/decode.cc b/src/decode.cc index 9ff6d14..fb4540f 100644 --- a/src/decode.cc +++ b/src/decode.cc @@ -81,6 +81,7 @@ napi_value decoder(napi_env env, napi_callback_info info) { NAPI_THROW_ERROR("Stream index is out of bounds for the given format."); } params = format->streams[streamIdx]->codecpar; + codecID = params->codec_id; codecName = (char*) avcodec_get_name(params->codec_id); codecNameLen = strlen(codecName); goto create; @@ -98,6 +99,7 @@ napi_value decoder(napi_env env, napi_callback_info info) { } status = napi_get_value_external(env, jsParams, (void**) ¶ms); CHECK_STATUS; + codecID = params->codec_id; codecName = (char*) avcodec_get_name(params->codec_id); codecNameLen = strlen(codecName); goto create; From 01e431c873a5b823af33e8bf67c542049148c81e Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Wed, 3 Feb 2021 15:29:41 +0000 Subject: [PATCH 05/16] v0.6.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7459b71..3795c53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "beamcoder", - "version": "0.6.10", + "version": "0.6.11", "description": "Node.js native bindings to FFmpeg.", "main": "index.js", "types": "index.d.ts", From 9016768df81f8c0bbf303f78be3fbf39ac4eb010 Mon Sep 17 00:00:00 2001 From: Richard Cartwright Date: Thu, 15 Apr 2021 08:38:37 +0100 Subject: [PATCH 06/16] chore: upgrade dependencies to FFmpeg 4.4 - fixes broken build --- .vscode/settings.json | 3 ++- binding.gyp | 34 +++++++++++++++++----------------- install_ffmpeg.js | 4 ++-- package-lock.json | 2 +- src/codec.cc | 28 ++++++++++++++-------------- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e05a089..91f65f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -53,5 +53,6 @@ "xtr1common": "cpp", "xtree": "cpp", "xutility": "cpp" - } + }, + "cmake.configureOnOpen": false } \ No newline at end of file diff --git a/binding.gyp b/binding.gyp index b342fc5..63ea90e 100644 --- a/binding.gyp +++ b/binding.gyp @@ -45,30 +45,30 @@ } }, "include_dirs" : [ - "ffmpeg/ffmpeg-4.3-win64-shared/include" + "ffmpeg/ffmpeg-4.4-win64-shared/include" ], "libraries": [ - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/avcodec", - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/avdevice", - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/avfilter", - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/avformat", - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/avutil", - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/postproc", - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/swresample", - "-l../ffmpeg/ffmpeg-4.3-win64-shared/lib/swscale" + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avcodec", + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avdevice", + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avfilter", + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avformat", + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avutil", + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/postproc", + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/swresample", + "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/swscale" ], "copies": [ { "destination": "build/Release/", "files": [ - "ffmpeg/ffmpeg-4.3-win64-shared/bin/avcodec-58.dll", - "ffmpeg/ffmpeg-4.3-win64-shared/bin/avdevice-58.dll", - "ffmpeg/ffmpeg-4.3-win64-shared/bin/avfilter-7.dll", - "ffmpeg/ffmpeg-4.3-win64-shared/bin/avformat-58.dll", - "ffmpeg/ffmpeg-4.3-win64-shared/bin/avutil-56.dll", - "ffmpeg/ffmpeg-4.3-win64-shared/bin/postproc-55.dll", - "ffmpeg/ffmpeg-4.3-win64-shared/bin/swresample-3.dll", - "ffmpeg/ffmpeg-4.3-win64-shared/bin/swscale-5.dll" + "ffmpeg/ffmpeg-4.4-win64-shared/bin/avcodec-58.dll", + "ffmpeg/ffmpeg-4.4-win64-shared/bin/avdevice-58.dll", + "ffmpeg/ffmpeg-4.4-win64-shared/bin/avfilter-7.dll", + "ffmpeg/ffmpeg-4.4-win64-shared/bin/avformat-58.dll", + "ffmpeg/ffmpeg-4.4-win64-shared/bin/avutil-56.dll", + "ffmpeg/ffmpeg-4.4-win64-shared/bin/postproc-55.dll", + "ffmpeg/ffmpeg-4.4-win64-shared/bin/swresample-3.dll", + "ffmpeg/ffmpeg-4.4-win64-shared/bin/swscale-5.dll" ] } ] diff --git a/install_ffmpeg.js b/install_ffmpeg.js index 5ef062d..2750e49 100644 --- a/install_ffmpeg.js +++ b/install_ffmpeg.js @@ -100,14 +100,14 @@ async function win32() { else throw e; }); - const ffmpegFilename = 'ffmpeg-4.3-win64-shared'; + const ffmpegFilename = 'ffmpeg-4.4-win64-shared'; await access(`ffmpeg/${ffmpegFilename}`, fs.constants.R_OK).catch(async () => { const html = await getHTML('https://github.com/BtbN/FFmpeg-Builds/wiki/Latest', 'latest autobuilds'); const htmlStr = html.toString('utf-8'); const autoPos = htmlStr.indexOf('

', autoPos); const autoStr = htmlStr.substring(autoPos, endPos); - const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-4.3'); + const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-4.4'); const startStr = '

debug & FF_DEBUG_BUGS); CHECK_STATUS; #if FF_API_DEBUG_MV - status = beam_set_bool(env, result, "VIS_QP", codec->debug & FF_DEBUG_VIS_QP); - CHECK_STATUS; - status = beam_set_bool(env, result, "VIS_MB_TYPE", codec->debug & FF_DEBUG_VIS_MB_TYPE); - CHECK_STATUS; + // status = beam_set_bool(env, result, "VIS_QP", codec->debug & FF_DEBUG_VIS_QP); + // CHECK_STATUS; + // status = beam_set_bool(env, result, "VIS_MB_TYPE", codec->debug & FF_DEBUG_VIS_MB_TYPE); + // CHECK_STATUS; #endif status = beam_set_bool(env, result, "BUFFERS", codec->debug & FF_DEBUG_BUFFERS); CHECK_STATUS; @@ -4964,16 +4964,16 @@ napi_value setCodecCtxDebug(napi_env env, napi_callback_info info) { codec->debug | FF_DEBUG_BUGS : codec->debug & ~FF_DEBUG_BUGS; } #if FF_API_DEBUG_MV - status = beam_get_bool(env, args[0], "VIS_QP", &present, &flag); - CHECK_STATUS; - if (present) { codec->debug = (flag) ? - codec->debug | FF_DEBUG_VIS_QP : - codec->debug & ~FF_DEBUG_VIS_QP; } - status = beam_get_bool(env, args[0], "VIS_MB_TYPE", &present, &flag); - CHECK_STATUS; - if (present) { codec->debug = (flag) ? - codec->debug | FF_DEBUG_VIS_MB_TYPE : - codec->debug & ~FF_DEBUG_VIS_MB_TYPE; } + // status = beam_get_bool(env, args[0], "VIS_QP", &present, &flag); + // CHECK_STATUS; + // if (present) { codec->debug = (flag) ? + // codec->debug | FF_DEBUG_VIS_QP : + // codec->debug & ~FF_DEBUG_VIS_QP; } + // status = beam_get_bool(env, args[0], "VIS_MB_TYPE", &present, &flag); + // CHECK_STATUS; + // if (present) { codec->debug = (flag) ? + // codec->debug | FF_DEBUG_VIS_MB_TYPE : + // codec->debug & ~FF_DEBUG_VIS_MB_TYPE; } #endif status = beam_get_bool(env, args[0], "BUFFERS", &present, &flag); CHECK_STATUS; From 1ea5dca14fb6eb7da49ba4b60d07831ee4dd4c82 Mon Sep 17 00:00:00 2001 From: Richard Cartwright Date: Thu, 15 Apr 2021 08:38:56 +0100 Subject: [PATCH 07/16] chore: version bump for publish --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3795c53..2b926b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "beamcoder", - "version": "0.6.11", + "version": "0.6.12", "description": "Node.js native bindings to FFmpeg.", "main": "index.js", "types": "index.d.ts", From e9fea00d511db61f6056192909883f574ed62660 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Thu, 15 Apr 2021 15:00:32 +0100 Subject: [PATCH 08/16] Improved handling of FFmpeg minor version changes --- .vscode/c_cpp_properties.json | 4 +- README.md | 3 +- binding.gyp | 34 +- install_ffmpeg.js | 8 +- package-lock.json | 807 +++++++++++++++++++--------------- package.json | 6 +- src/codec.cc | 71 +-- 7 files changed, 474 insertions(+), 459 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 5d6fbd8..08f9378 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -9,8 +9,8 @@ "C:/Program Files (x86)/Windows Kits/8.1/Include/shared", "C:/Program Files (x86)/Windows Kits/8.1/Include/winrt", "${workspaceFolder}/**", - "${workspaceFolder}/ffmpeg/ffmpeg-4.3.1-win64-shared/include/**", - "${env:USERPROFILE}/AppData/Local/node-gyp/Cache/12.18.2/include/node" + "${workspaceFolder}/ffmpeg/ffmpeg-4.x-win64-shared/include/**", + "${env:USERPROFILE}/AppData/Local/node-gyp/Cache/12.21.0/include/node" ], "defines": [ "_DEBUG", diff --git a/README.md b/README.md index f1eb0bb..f898b09 100644 --- a/README.md +++ b/README.md @@ -92,8 +92,7 @@ This will install all necessary dependencies, download the FFmpeg shared and dev Note that if you want to use a local version of FFmpeg then, before the install, symbolic link or copy appropriate folders to: - ./node_modules/beamcoder/ffmpeg/ffmpeg-4.1-win64-shared - ./node_modules/beamcoder/ffmpeg/ffmpeg-4.1-win64-dev + ./node_modules/beamcoder/ffmpeg/ffmpeg-4.x-win64-shared To ensure that sufficient threads are available to process several requests in parallel, set the `UV_THREADPOOL_SIZE` environment variable, e.g.: diff --git a/binding.gyp b/binding.gyp index 63ea90e..ff1e5f8 100644 --- a/binding.gyp +++ b/binding.gyp @@ -45,30 +45,30 @@ } }, "include_dirs" : [ - "ffmpeg/ffmpeg-4.4-win64-shared/include" + "ffmpeg/ffmpeg-4.x-win64-shared/include" ], "libraries": [ - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avcodec", - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avdevice", - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avfilter", - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avformat", - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avutil", - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/postproc", - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/swresample", - "-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/swscale" + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avcodec", + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avdevice", + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avfilter", + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avformat", + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avutil", + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/postproc", + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/swresample", + "-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/swscale" ], "copies": [ { "destination": "build/Release/", "files": [ - "ffmpeg/ffmpeg-4.4-win64-shared/bin/avcodec-58.dll", - "ffmpeg/ffmpeg-4.4-win64-shared/bin/avdevice-58.dll", - "ffmpeg/ffmpeg-4.4-win64-shared/bin/avfilter-7.dll", - "ffmpeg/ffmpeg-4.4-win64-shared/bin/avformat-58.dll", - "ffmpeg/ffmpeg-4.4-win64-shared/bin/avutil-56.dll", - "ffmpeg/ffmpeg-4.4-win64-shared/bin/postproc-55.dll", - "ffmpeg/ffmpeg-4.4-win64-shared/bin/swresample-3.dll", - "ffmpeg/ffmpeg-4.4-win64-shared/bin/swscale-5.dll" + "ffmpeg/ffmpeg-4.x-win64-shared/bin/avcodec-58.dll", + "ffmpeg/ffmpeg-4.x-win64-shared/bin/avdevice-58.dll", + "ffmpeg/ffmpeg-4.x-win64-shared/bin/avfilter-7.dll", + "ffmpeg/ffmpeg-4.x-win64-shared/bin/avformat-58.dll", + "ffmpeg/ffmpeg-4.x-win64-shared/bin/avutil-56.dll", + "ffmpeg/ffmpeg-4.x-win64-shared/bin/postproc-55.dll", + "ffmpeg/ffmpeg-4.x-win64-shared/bin/swresample-3.dll", + "ffmpeg/ffmpeg-4.x-win64-shared/bin/swscale-5.dll" ] } ] diff --git a/install_ffmpeg.js b/install_ffmpeg.js index 2750e49..ef51271 100644 --- a/install_ffmpeg.js +++ b/install_ffmpeg.js @@ -100,14 +100,16 @@ async function win32() { else throw e; }); - const ffmpegFilename = 'ffmpeg-4.4-win64-shared'; + const ffmpegFilename = 'ffmpeg-4.x-win64-shared'; await access(`ffmpeg/${ffmpegFilename}`, fs.constants.R_OK).catch(async () => { const html = await getHTML('https://github.com/BtbN/FFmpeg-Builds/wiki/Latest', 'latest autobuilds'); const htmlStr = html.toString('utf-8'); const autoPos = htmlStr.indexOf('

', autoPos); const autoStr = htmlStr.substring(autoPos, endPos); - const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-4.4'); + const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-4.'); + if (sharedEndPos === -1) + throw new Error('Failed to find latest v4.x autobuild from "https://github.com/BtbN/FFmpeg-Builds/wiki/Latest"'); const startStr = '

debug & FF_DEBUG_BUGS); CHECK_STATUS; - #if FF_API_DEBUG_MV - // status = beam_set_bool(env, result, "VIS_QP", codec->debug & FF_DEBUG_VIS_QP); - // CHECK_STATUS; - // status = beam_set_bool(env, result, "VIS_MB_TYPE", codec->debug & FF_DEBUG_VIS_MB_TYPE); - // CHECK_STATUS; - #endif status = beam_set_bool(env, result, "BUFFERS", codec->debug & FF_DEBUG_BUFFERS); CHECK_STATUS; status = beam_set_bool(env, result, "THREADS", codec->debug & FF_DEBUG_THREADS); @@ -4963,18 +4957,6 @@ napi_value setCodecCtxDebug(napi_env env, napi_callback_info info) { if (present) { codec->debug = (flag) ? codec->debug | FF_DEBUG_BUGS : codec->debug & ~FF_DEBUG_BUGS; } -#if FF_API_DEBUG_MV - // status = beam_get_bool(env, args[0], "VIS_QP", &present, &flag); - // CHECK_STATUS; - // if (present) { codec->debug = (flag) ? - // codec->debug | FF_DEBUG_VIS_QP : - // codec->debug & ~FF_DEBUG_VIS_QP; } - // status = beam_get_bool(env, args[0], "VIS_MB_TYPE", &present, &flag); - // CHECK_STATUS; - // if (present) { codec->debug = (flag) ? - // codec->debug | FF_DEBUG_VIS_MB_TYPE : - // codec->debug & ~FF_DEBUG_VIS_MB_TYPE; } -#endif status = beam_get_bool(env, args[0], "BUFFERS", &present, &flag); CHECK_STATUS; if (present) { codec->debug = (flag) ? @@ -5471,47 +5453,6 @@ napi_value getCodecCtxActThreadType(napi_env env, napi_callback_info info) { return result; } -napi_value getCodecCtxThreadSafeCBs(napi_env env, napi_callback_info info) { - napi_status status; - napi_value result; - AVCodecContext* codec; - - size_t argc = 0; - status = napi_get_cb_info(env, info, &argc, nullptr, nullptr, (void**) &codec); - CHECK_STATUS; - status = napi_create_int32(env, codec->thread_safe_callbacks, &result); - CHECK_STATUS; - - return result; -} - -napi_value setCodecCtxThreadSafeCBs(napi_env env, napi_callback_info info) { - napi_status status; - napi_value result; - napi_valuetype type; - AVCodecContext* codec; - - size_t argc = 1; - napi_value args[1]; - status = napi_get_cb_info(env, info, &argc, args, nullptr, (void**) &codec); - CHECK_STATUS; - if (argc < 1) { - NAPI_THROW_ERROR("A value is required to set the thread_safe_callbacks property."); - } - status = napi_typeof(env, args[0], &type); - CHECK_STATUS; - if (type != napi_number) { - NAPI_THROW_ERROR("A number is required to set the thread_safe_callbacks property."); - } - - status = napi_get_value_int32(env, args[0], &codec->thread_safe_callbacks); - CHECK_STATUS; - - status = napi_get_undefined(env, &result); - CHECK_STATUS; - return result; -} - napi_value getCodecCtxNsseWeight(napi_env env, napi_callback_info info) { napi_status status; napi_value result; @@ -7221,8 +7162,6 @@ napi_status fromAVCodecContext(napi_env env, AVCodecContext* codec, { "active_thread_type", nullptr, nullptr, getCodecCtxActThreadType, failBoth, nullptr, napi_enumerable, codec}, // TODO find a way of exposing a custom getBuffer? - { "thread_safe_callbacks", nullptr, nullptr, getCodecCtxThreadSafeCBs, setCodecCtxThreadSafeCBs, nullptr, - (napi_property_attributes) (napi_writable | napi_enumerable), codec}, { "nsse_weight", nullptr, nullptr, encoding ? getCodecCtxNsseWeight : nullptr, encoding ? setCodecCtxNsseWeight : failDecoding, nullptr, @@ -7230,10 +7169,10 @@ napi_status fromAVCodecContext(napi_env env, AVCodecContext* codec, { "profile", nullptr, nullptr, getCodecCtxProfile, encoding ? setCodecCtxProfile : failDecoding, nullptr, encoding ? (napi_property_attributes) (napi_writable | napi_enumerable) : napi_enumerable, codec}, - // 110 { "level", nullptr, nullptr, getCodecCtxLevel, encoding ? setCodecCtxLevel : failDecoding, nullptr, encoding ? (napi_property_attributes) (napi_writable | napi_enumerable) : napi_enumerable, codec}, + // 110 { "skip_loop_filter", nullptr, nullptr, encoding ? nullptr : getCodecCtxSkipLpFilter, encoding ? failEncoding : setCodecCtxSkipLpFilter, nullptr, @@ -7267,11 +7206,11 @@ napi_status fromAVCodecContext(napi_env env, AVCodecContext* codec, encoding ? napi_default : napi_enumerable, codec}, // TODO not exposing lowres ... it's on its way out // not exposing PTS correct stats - "not intended to be used by user apps" - // 120 { "sub_charenc", nullptr, nullptr, encoding ? nullptr : getCodecCtxSubCharenc, encoding ? failEncoding : setCodecCtxSubCharenc, nullptr, encoding ? napi_default : (napi_property_attributes) (napi_writable | napi_enumerable), codec}, + // 120 { "sub_charenc_mode", nullptr, nullptr, encoding ? nullptr : getCodecCtxSubCharencMode, failBoth, nullptr, encoding ? napi_default : napi_enumerable, codec}, @@ -7302,11 +7241,11 @@ napi_status fromAVCodecContext(napi_env env, AVCodecContext* codec, getCodecHWFramesCtx, encoding ? setCodecHWFramesCtx : failDecoding, nullptr, encoding ? (napi_property_attributes) (napi_writable | napi_enumerable) : napi_enumerable, codec}, - // 130 { "sub_text_format", nullptr, nullptr, encoding ? nullptr : getCodecCtxSubTextFmt, encoding ? failEncoding : setCodecCtxSubTextFmt, nullptr, encoding ? napi_default : (napi_property_attributes) (napi_writable | napi_enumerable), codec}, + // 130 { "trailing_padding", nullptr, nullptr, getCodecCtxTrailPad, setCodecCtxTrailPad, nullptr, (napi_property_attributes) (napi_writable | napi_enumerable), codec}, { "max_pixels", nullptr, nullptr, getCodecCtxMaxPixels, setCodecCtxMaxPixels, nullptr, @@ -7330,15 +7269,15 @@ napi_status fromAVCodecContext(napi_env env, AVCodecContext* codec, encoding ? flushEnc : flushDec, nullptr, nullptr, nullptr, napi_enumerable, codec}, { "extractParams", nullptr, extractParams, nullptr, nullptr, nullptr, napi_enumerable, nullptr}, { "useParams", nullptr, useParams, nullptr, nullptr, nullptr, napi_enumerable, nullptr}, - // 140 // Hidden values - to allow Object.assign to work { "params", nullptr, nullptr, nullptr, nop, undef, // Set for muxing napi_writable, nullptr}, + // 140 { "stream_index", nullptr, nullptr, nullptr, nop, undef, napi_writable, nullptr }, { "demuxer", nullptr, nullptr, nullptr, nop, undef, napi_writable, nullptr}, { "_CodecContext", nullptr, nullptr, nullptr, nullptr, extCodec, napi_default, nullptr } }; - status = napi_define_properties(env, jsCodec, 144, desc); + status = napi_define_properties(env, jsCodec, 143, desc); PASS_STATUS; *result = jsCodec; From 4817866bf40f31fb91c31895a65b9d1780410919 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Mon, 14 Jun 2021 16:07:00 +0100 Subject: [PATCH 09/16] Remove redundant setter leading to channel layout warning message --- package-lock.json | 134 ++++++++++++++++++++-------------------------- package.json | 4 +- src/filter.cc | 8 +-- 3 files changed, 60 insertions(+), 86 deletions(-) diff --git a/package-lock.json b/package-lock.json index 14f619f..1918874 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "beamcoder", - "version": "0.6.13", + "version": "0.6.14", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -14,18 +14,18 @@ } }, "@babel/helper-validator-identifier": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", - "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz", + "integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==", "dev": true }, "@babel/highlight": { - "version": "7.13.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", - "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", + "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.12.11", + "@babel/helper-validator-identifier": "^7.14.5", "chalk": "^2.0.0", "js-tokens": "^4.0.0" }, @@ -40,35 +40,30 @@ "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true } } }, "@eslint/eslintrc": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", - "integrity": "sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog==", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", + "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==", "dev": true, "requires": { "ajv": "^6.12.4", "debug": "^4.1.1", "espree": "^7.3.0", - "globals": "^12.1.0", + "globals": "^13.9.0", "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - } } }, "acorn": { @@ -187,9 +182,9 @@ "dev": true }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -407,34 +402,36 @@ } }, "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, "eslint": { - "version": "7.24.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.24.0.tgz", - "integrity": "sha512-k9gaHeHiFmGCDQ2rEfvULlSLruz6tgfA8DEn+rY9/oYPFFTlz55mM/Q/Rij1b2Y42jwZiK3lXvNTw6w6TXzcKQ==", + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz", + "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.0", + "@eslint/eslintrc": "^0.4.2", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.0.1", "doctrine": "^3.0.0", "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", "esquery": "^1.4.0", "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", + "glob-parent": "^5.1.2", "globals": "^13.6.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", @@ -443,7 +440,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.21", + "lodash.merge": "^4.6.2", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -452,7 +449,7 @@ "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^6.0.4", + "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" } @@ -485,9 +482,9 @@ } }, "eslint-visitor-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz", - "integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true }, "espree": { @@ -677,20 +674,12 @@ } }, "globals": { - "version": "13.8.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.8.0.tgz", - "integrity": "sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q==", + "version": "13.9.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", + "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", "dev": true, "requires": { "type-fest": "^0.20.2" - }, - "dependencies": { - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - } } }, "has": { @@ -948,22 +937,16 @@ "type-check": "~0.4.0" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, - "lodash.flatten": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, "lodash.truncate": { @@ -1126,9 +1109,9 @@ } }, "regexpp": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", - "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, "require-from-string": { @@ -1325,26 +1308,23 @@ } }, "table": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.1.0.tgz", - "integrity": "sha512-T4G5KMmqIk6X87gLKWyU5exPpTjLjY5KyrFWaIjv3SvgaIUGXV7UEzGEnZJdTA38/yUS6f9PlKezQ0bYXG3iIQ==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", + "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", "dev": true, "requires": { "ajv": "^8.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", "lodash.clonedeep": "^4.5.0", - "lodash.flatten": "^4.4.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", - "string-width": "^4.2.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" }, "dependencies": { "ajv": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.1.0.tgz", - "integrity": "sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ==", + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz", + "integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -1408,9 +1388,9 @@ } }, "type-fest": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, "unbox-primitive": { diff --git a/package.json b/package.json index f67dc03..4ce6add 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "beamcoder", - "version": "0.6.13", + "version": "0.6.14", "description": "Node.js native bindings to FFmpeg.", "main": "index.js", "types": "index.d.ts", @@ -38,7 +38,7 @@ "segfault-handler": "^1.3.0" }, "devDependencies": { - "eslint": "^7.24.0", + "eslint": "^7.28.0", "tape": "^5.2.2" }, "gypfile": true diff --git a/src/filter.cc b/src/filter.cc index 2edcc24..c055eee 100644 --- a/src/filter.cc +++ b/src/filter.cc @@ -992,13 +992,7 @@ void filtererExecute(napi_env env, void* data) { } p = c->outParams[i].find("channel_layouts"); if (p != c->outParams[i].end()) { - const int64_t out_channel_layout = av_get_channel_layout(p->second.c_str()); - int out_channel_counts[] = { av_get_channel_layout_nb_channels(out_channel_layout), -1 }; - ret = av_opt_set_int_list(sinkCtx, "channel_counts", out_channel_counts, -1, - AV_OPT_SEARCH_CHILDREN); - if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot set output channel count\n"); } - - const int64_t out_channel_layouts[] = { out_channel_layout, -1 }; + const int64_t out_channel_layouts[] = { (int64_t)av_get_channel_layout(p->second.c_str()), -1 }; ret = av_opt_set_int_list(sinkCtx, "channel_layouts", out_channel_layouts, -1, AV_OPT_SEARCH_CHILDREN); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot set output channel layout\n"); } From d5cde6d77a0a19cd304cbbdc62a746a79984c56d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 21:42:16 +0000 Subject: [PATCH 10/16] Bump path-parse from 1.0.6 to 1.0.7 Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1918874..218e6c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1075,9 +1075,9 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "prelude-ls": { From b98c158c37a5fa18d86737a8766f77fd8bb9a05e Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Mon, 1 Nov 2021 14:44:34 +0000 Subject: [PATCH 11/16] Add support for hardware accelerated decoding --- scratch/decode_avci.js | 24 ++++++----- src/codec.cc | 19 ++++++--- src/decode.cc | 92 ++++++++++++++++++++++++++++++++++++++++-- src/frame.cc | 41 +++++++++++++++---- src/hwcontext.cc | 2 +- 5 files changed, 150 insertions(+), 28 deletions(-) diff --git a/scratch/decode_avci.js b/scratch/decode_avci.js index 939c713..3c341e5 100644 --- a/scratch/decode_avci.js +++ b/scratch/decode_avci.js @@ -22,25 +22,29 @@ const beamcoder = require('../index.js'); async function run() { - let demuxer = await beamcoder.demuxer('../media/dpp/AS11_DPP_HD_EXAMPLE_1.mxf'); - console.log(JSON.stringify(demuxer, null, 2)); + // let demuxer = await beamcoder.demuxer('../media/dpp/AS11_DPP_HD_EXAMPLE_1.mxf'); + // console.log(JSON.stringify(demuxer, null, 2)); + let demuxer = await beamcoder.demuxer('M:/dpp/AS11_4K_8.mxf'); + // let demuxer = await beamcoder.demuxer('M:/dpp/AS11.mxf'); demuxer.streams.forEach(s => s.discard = (0 == s.index) ? 'default' : 'all'); - let decoder = beamcoder.decoder({ name: 'h264' }); - //console.log(JSON.stringify(decoder, null, 2)); + // let decoder = beamcoder.decoder({ name: 'h264', thread_count: 4, thread_type: { FRAME: false, SLICE: true } }); + let decoder = beamcoder.decoder({ name: 'h264', thread_count: 1, hwaccel: 'auto' }); + // console.dir(decoder, { getters: true, depth: 3 }); let packet = {}; - for ( let x = 0 ; x < 200 && packet != null; x++ ) { - let packet = await demuxer.read(); - if (packet.stream_index === 0) { + for ( let x = 0 ; x < 2000 && packet != null; x++ ) { + packet = await demuxer.read(); + if (packet && packet.stream_index === 0) { //console.log(JSON.stringify(packet, null, 2)); let frames = await decoder.decode(packet); - console.log(JSON.stringify(frames.frames[0], null, 2)); + // console.log(JSON.stringify(frames.frames[0], null, 2)); + if (frames.frames[0]) { + console.log(frames.frames[0].data); + } console.log(x, frames.total_time); } } let frames = await decoder.flush(); console.log('flush', frames.total_time, frames.length); - console.log(await demuxer.seek({ pos: 79389000 })); - console.log(await demuxer.read()); } run(); diff --git a/src/codec.cc b/src/codec.cc index 6fde190..95df3e0 100644 --- a/src/codec.cc +++ b/src/codec.cc @@ -5391,9 +5391,9 @@ napi_value getCodecCtxThreadType(napi_env env, napi_callback_info info) { status = napi_create_object(env, &result); CHECK_STATUS; - status = beam_set_bool(env, result, "FRAME", codec->thread_type & FF_THREAD_FRAME); + status = beam_set_bool(env, result, "FRAME", (codec->thread_type & FF_THREAD_FRAME) == FF_THREAD_FRAME); CHECK_STATUS; - status = beam_set_bool(env, result, "SLICE", codec->thread_type & FF_THREAD_SLICE); + status = beam_set_bool(env, result, "SLICE", (codec->thread_type & FF_THREAD_SLICE) == FF_THREAD_SLICE); CHECK_STATUS; return result; @@ -5445,9 +5445,9 @@ napi_value getCodecCtxActThreadType(napi_env env, napi_callback_info info) { status = napi_create_object(env, &result); CHECK_STATUS; - status = beam_set_bool(env, result, "FRAME", codec->active_thread_type & FF_THREAD_FRAME); + status = beam_set_bool(env, result, "FRAME", (codec->active_thread_type & FF_THREAD_FRAME) == FF_THREAD_FRAME); CHECK_STATUS; - status = beam_set_bool(env, result, "SLICE", codec->active_thread_type & FF_THREAD_SLICE); + status = beam_set_bool(env, result, "SLICE", (codec->active_thread_type & FF_THREAD_SLICE) == FF_THREAD_SLICE); CHECK_STATUS; return result; @@ -5945,15 +5945,22 @@ napi_value getCodecCtxSwPixFmt(napi_env env, napi_callback_info info) { napi_status status; napi_value result; AVCodecContext* codec; + AVBufferRef* hwFramesContextRef; + AVHWFramesContext* hwFramesContext = nullptr; + AVPixelFormat sw_pix_fmt; const char* pixFmtName; size_t argc = 0; status = napi_get_cb_info(env, info, &argc, nullptr, nullptr, (void**) &codec); CHECK_STATUS; - pixFmtName = av_get_pix_fmt_name(codec->sw_pix_fmt); + hwFramesContextRef = codec->hw_frames_ctx; + if (hwFramesContextRef) + hwFramesContext = (AVHWFramesContext*)hwFramesContextRef->data; + sw_pix_fmt = hwFramesContext ? hwFramesContext->sw_format : codec->sw_pix_fmt; + pixFmtName = av_get_pix_fmt_name(sw_pix_fmt); if (pixFmtName != nullptr) { - status = napi_create_string_utf8(env, (char*) pixFmtName, NAPI_AUTO_LENGTH, &result); + status = napi_create_string_utf8(env, pixFmtName, NAPI_AUTO_LENGTH, &result); CHECK_STATUS; } else { status = napi_get_null(env, &result); diff --git a/src/decode.cc b/src/decode.cc index fb4540f..466659f 100644 --- a/src/decode.cc +++ b/src/decode.cc @@ -21,11 +21,62 @@ #include "decode.h" +char* req_hw_type = nullptr; +AVPixelFormat req_hw_pix_fmt = AV_PIX_FMT_NONE; + +AVPixelFormat get_format(AVCodecContext *s, const AVPixelFormat *pix_fmts) +{ + AVPixelFormat result = AV_PIX_FMT_NONE; + const AVPixelFormat *p; + int i, err; + + if (0 == strcmp("auto", req_hw_type)) { + for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); + const AVCodecHWConfig *config = NULL; + + if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) + break; + + for (i = 0;; i++) { + config = avcodec_get_hw_config(s->codec, i); + if (!config) + break; + if (!(config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)) + continue; + if (config->pix_fmt == *p) + break; + } + + if (config) { + err = av_hwdevice_ctx_create(&s->hw_device_ctx, config->device_type, NULL, NULL, 0); + if (err < 0) { + char errstr[128]; + av_make_error_string(errstr, 128, err); + printf("Error in get_format \'auto\' av_hwdevice_ctx_create: %s\n", errstr); + } + break; + } + } + result = *p; + } else { + err = av_hwdevice_ctx_create(&s->hw_device_ctx, av_hwdevice_find_type_by_name(req_hw_type), NULL, NULL, 0); + if (err < 0) { + char errstr[128]; + av_make_error_string(errstr, 128, err); + printf("Error in get_format \'%s\' av_hwdevice_ctx_create: %s\n", req_hw_type, errstr); + } + result = req_hw_pix_fmt; + } + + return result; +} + napi_value decoder(napi_env env, napi_callback_info info) { napi_status status; napi_value result, value, formatJS, formatExt, global, jsObject, assign, jsParams; napi_valuetype type; - bool isArray, hasName, hasID, hasFormat, hasStream, hasParams; + bool isArray, hasName, hasID, hasFormat, hasStream, hasParams, hasHWaccel; AVCodecContext* decoder = nullptr; AVFormatContext* format = nullptr; const AVCodec* codec = nullptr; @@ -34,6 +85,7 @@ napi_value decoder(napi_env env, napi_callback_info info) { AVCodecParameters* params = nullptr; char* codecName = nullptr; size_t codecNameLen = 0; + size_t hwTypeLen = 0; int32_t codecID = -1; size_t argc = 1; @@ -148,6 +200,24 @@ napi_value decoder(napi_env env, napi_callback_info info) { } } + status = napi_has_named_property(env, args[0], "hwaccel", &hasHWaccel); + CHECK_STATUS; + if (hasHWaccel) { + status = napi_get_named_property(env, args[0], "hwaccel", &value); + CHECK_STATUS; + hwTypeLen = 64; + req_hw_type = (char*) malloc(sizeof(char) * (hwTypeLen + 1)); + status = napi_get_value_string_utf8(env, value, req_hw_type, + 64, &hwTypeLen); + CHECK_STATUS; + req_hw_pix_fmt = av_get_pix_fmt(req_hw_type); + + if (0 != strcmp("auto", req_hw_type) && req_hw_pix_fmt == AV_PIX_FMT_NONE) + printf("Decoder hwaccel name \'%s\' not recognised\n", req_hw_type); + else + decoder->get_format = get_format; + } + status = fromAVCodecContext(env, decoder, &result, false); const napi_value fargs[2] = { result, args[0] }; CHECK_BAIL; @@ -182,6 +252,7 @@ void decodeExecute(napi_env env, void* data) { decodeCarrier* c = (decodeCarrier*) data; int ret = 0; AVFrame* frame = nullptr; + AVFrame *sw_frame = nullptr; HR_TIME_POINT decodeStart = NOW; for ( auto it = c->packets.cbegin() ; it != c->packets.cend() ; it++ ) { @@ -219,15 +290,30 @@ void decodeExecute(napi_env env, void* data) { } } // loop through input packets + AVPixelFormat frame_hw_pix_fmt = AV_PIX_FMT_NONE; + if (c->decoder->hw_frames_ctx) + frame_hw_pix_fmt = ((AVHWFramesContext*)c->decoder->hw_frames_ctx->data)->format; + + frame = av_frame_alloc(); + sw_frame = av_frame_alloc(); do { - frame = av_frame_alloc(); ret = avcodec_receive_frame(c->decoder, frame); if (ret == 0) { - c->frames.push_back(frame); + if (frame->format == frame_hw_pix_fmt) { + if ((ret = av_hwframe_transfer_data(sw_frame, frame, 0)) < 0) { + printf("Error transferring hw data to system memory\n"); + } + c->frames.push_back(sw_frame); + av_frame_free(&frame); + } else + c->frames.push_back(frame); + frame = av_frame_alloc(); + sw_frame = av_frame_alloc(); } } while (ret == 0); av_frame_free(&frame); + av_frame_free(&sw_frame); c->totalTime = microTime(decodeStart); }; diff --git a/src/frame.cc b/src/frame.cc index da40cd2..1380016 100644 --- a/src/frame.cc +++ b/src/frame.cc @@ -1051,21 +1051,46 @@ napi_value getFrameData(napi_env env, napi_callback_info info) { napi_status status; napi_value array, element; frameData* f; - AVBufferRef* hintRef; + uint8_t* data; + AVBufferRef* ref; + size_t size; + int curElem; status = napi_get_cb_info(env, info, 0, nullptr, nullptr, (void**) &f); CHECK_STATUS; status = napi_create_array(env, &array); CHECK_STATUS; - for ( int x = 0 ; x < AV_NUM_DATA_POINTERS ; x++ ) { - // printf("Buffer %i is %p\n", x, f->frame->buf[x]); - if (f->frame->buf[x] == nullptr) continue; - hintRef = av_buffer_ref(f->frame->buf[x]); - status = napi_create_external_buffer(env, hintRef->size, hintRef->data, - frameBufferFinalizer, hintRef, &element); + + data = f->frame->data[0]; + ref = av_buffer_ref(f->frame->buf[0]); + size = ref->size; + curElem = 0; + // work through frame bufs checking whether allocation refcounts are shared + for ( int x = 1 ; x < AV_NUM_DATA_POINTERS ; x++ ) { + // printf("Buffer %i is %p\n", x, f->frame->data[x]); + if (f->frame->data[x] == nullptr) continue; + size_t bufSize = size; + if (f->frame->buf[x] == nullptr) + bufSize = f->frame->data[x] - f->frame->data[x-1]; + status = napi_create_external_buffer(env, bufSize, data, frameBufferFinalizer, ref, &element); CHECK_STATUS; - status = napi_set_element(env, array, x, element); + status = napi_set_element(env, array, curElem, element); + CHECK_STATUS; + data = f->frame->data[x]; + if (f->frame->buf[x]) { + ref = av_buffer_ref(f->frame->buf[x]); + size = ref->size; + } else { + ref = nullptr; + size -= f->frame->data[x] - f->frame->data[x-1]; + } + curElem++; + } + if (data) { + status = napi_create_external_buffer(env, size, data, frameBufferFinalizer, ref, &element); + CHECK_STATUS; + status = napi_set_element(env, array, curElem, element); CHECK_STATUS; } diff --git a/src/hwcontext.cc b/src/hwcontext.cc index 850dada..c739dd6 100644 --- a/src/hwcontext.cc +++ b/src/hwcontext.cc @@ -208,7 +208,7 @@ napi_value getHWFramesCtxSwPixFmt(napi_env env, napi_callback_info info) { status = napi_get_cb_info(env, info, 0, nullptr, nullptr, (void**) &frames_context); CHECK_STATUS; - AVPixelFormat pixFmt = frames_context->format; + AVPixelFormat pixFmt = frames_context->sw_format; status = napi_create_string_utf8(env, av_get_pix_fmt_name(pixFmt), NAPI_AUTO_LENGTH, &result); CHECK_STATUS; From 17a36d8d7106562039d12e4df6a533355270a6d1 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Mon, 1 Nov 2021 15:03:42 +0000 Subject: [PATCH 12/16] Fix zero size frame, update version --- package-lock.json | 713 +++++++++++++++++++--------------------------- package.json | 6 +- src/frame.cc | 4 +- 3 files changed, 297 insertions(+), 426 deletions(-) diff --git a/package-lock.json b/package-lock.json index 218e6c6..f333b44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,81 +1,65 @@ { "name": "beamcoder", - "version": "0.6.14", + "version": "0.6.15", "lockfileVersion": 1, "requires": true, "dependencies": { - "@babel/code-frame": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", - "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz", - "integrity": "sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg==", - "dev": true - }, - "@babel/highlight": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", - "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", + "@eslint/eslintrc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.3.tgz", + "integrity": "sha512-DHI1wDPoKCBPoLZA3qDR91+3te/wDSc1YhKg3jR8NxKKRJq2hwHwcWv31cSwSYvIBrmbENoYMWcenW8uproQqg==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.14.5", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.0.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" }, "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true } } }, - "@eslint/eslintrc": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", - "integrity": "sha512-8nmGq/4ycLpIwzvhI4tNDmQztZ8sp+hI7cyG8i1nQDhkAbRzHpXPidRAHlNvCZQpJTKw5ItIpMw9RSToGF00mg==", + "@humanwhocodes/config-array": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.6.0.tgz", + "integrity": "sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==", "dev": true, "requires": { - "ajv": "^6.12.4", + "@humanwhocodes/object-schema": "^1.2.0", "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" + "minimatch": "^3.0.4" } }, + "@humanwhocodes/object-schema": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", + "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "dev": true + }, "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", + "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", "dev": true }, "acorn-jsx": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz", - "integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true }, "ajv": { @@ -97,18 +81,18 @@ "dev": true }, "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true }, "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "color-convert": "^1.9.0" + "color-convert": "^2.0.1" } }, "argparse": { @@ -120,26 +104,11 @@ "sprintf-js": "~1.0.2" } }, - "array-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", - "dev": true - }, - "astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true - }, "available-typed-arrays": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", - "integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==", - "dev": true, - "requires": { - "array-filter": "^1.0.0" - } + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true }, "balanced-match": { "version": "1.0.2", @@ -182,69 +151,28 @@ "dev": true }, "chalk": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", - "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { - "color-name": "1.1.3" + "color-name": "~1.1.4" } }, "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "concat-map": { @@ -265,9 +193,9 @@ } }, "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", "dev": true, "requires": { "ms": "2.1.2" @@ -297,9 +225,9 @@ } }, "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, "define-properties": { @@ -335,12 +263,6 @@ "minimatch": "^3.0.4" } }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, "enquirer": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", @@ -351,27 +273,31 @@ } }, "es-abstract": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", - "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", "dev": true, "requires": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.2", - "is-string": "^1.0.5", - "object-inspect": "^1.9.0", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", "string.prototype.trimend": "^1.0.4", "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.0" + "unbox-primitive": "^1.0.1" } }, "es-get-iterator": { @@ -408,36 +334,36 @@ "dev": true }, "eslint": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.28.0.tgz", - "integrity": "sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.1.0.tgz", + "integrity": "sha512-JZvNneArGSUsluHWJ8g8MMs3CfIEzwaLx9KyH4tZ2i+R2/rPWzL8c0zg3rHdwYVpN/1sB9gqnjHwz9HoeJpGHw==", "dev": true, "requires": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.2", + "@eslint/eslintrc": "^1.0.3", + "@humanwhocodes/config-array": "^0.6.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", - "debug": "^4.0.1", + "debug": "^4.3.2", "doctrine": "^3.0.0", "enquirer": "^2.3.5", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", + "eslint-scope": "^6.0.0", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0", "esquery": "^1.4.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", + "glob-parent": "^6.0.1", "globals": "^13.6.0", "ignore": "^4.0.6", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", + "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", @@ -445,65 +371,56 @@ "natural-compare": "^1.4.0", "optionator": "^0.9.1", "progress": "^2.0.0", - "regexpp": "^3.1.0", + "regexpp": "^3.2.0", "semver": "^7.2.1", "strip-ansi": "^6.0.0", "strip-json-comments": "^3.1.0", - "table": "^6.0.9", "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" } }, "eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz", + "integrity": "sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA==", "dev": true, "requires": { "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "estraverse": "^5.2.0" } }, "eslint-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", - "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^2.0.0" }, "dependencies": { "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true } } }, "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz", + "integrity": "sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==", "dev": true }, "espree": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", - "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.0.0.tgz", + "integrity": "sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ==", "dev": true, "requires": { - "acorn": "^7.4.0", + "acorn": "^8.5.0", "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } + "eslint-visitor-keys": "^3.0.0" } }, "esprima": { @@ -519,14 +436,6 @@ "dev": true, "requires": { "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } } }, "esrecurse": { @@ -536,20 +445,12 @@ "dev": true, "requires": { "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true - } } }, "estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true }, "esutils": { @@ -601,9 +502,9 @@ } }, "flatted": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", - "integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", + "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", "dev": true }, "for-each": { @@ -650,10 +551,26 @@ "has-symbols": "^1.0.1" } }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -665,18 +582,18 @@ } }, "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, "requires": { - "is-glob": "^4.0.1" + "is-glob": "^4.0.3" } }, "globals": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.9.0.tgz", - "integrity": "sha512-74/FduwI/JaIrr1H8e71UbDE+5x7pIPs1C2rrwC52SszOo043CsWOZEMW7o2Y58xwm9b+0RBKDxY5n2sUpEFxA==", + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -697,10 +614,19 @@ "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", "dev": true }, + "has-dynamic-import": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.0.tgz", + "integrity": "sha512-GYPi/aZmACJVrVfEhP1rNUFmtCuK+SQ96mn8Bs7mXiGZRAJiI4VjaMmjj4uuvW8qaF085uWJvyJk9UNYUIYn0A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "has-symbols": { @@ -709,6 +635,15 @@ "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", "dev": true }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -747,50 +682,69 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, "is-arguments": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.0.tgz", - "integrity": "sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "dev": true, "requires": { - "call-bind": "^1.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" } }, "is-bigint": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz", - "integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==", - "dev": true + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } }, "is-boolean-object": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.0.tgz", - "integrity": "sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", "dev": true, "requires": { - "call-bind": "^1.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" } }, "is-callable": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", - "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", "dev": true }, "is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", "dev": true, "requires": { "has": "^1.0.3" } }, "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-extglob": { "version": "2.1.1", @@ -798,16 +752,10 @@ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "requires": { "is-extglob": "^2.1.1" @@ -826,19 +774,22 @@ "dev": true }, "is-number-object": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", - "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", - "dev": true + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } }, "is-regex": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", - "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, "requires": { "call-bind": "^1.0.2", - "has-symbols": "^1.0.1" + "has-tostringtag": "^1.0.0" } }, "is-set": { @@ -847,32 +798,41 @@ "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", "dev": true }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", "dev": true }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dev": true, "requires": { - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.2" } }, "is-typed-array": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.5.tgz", - "integrity": "sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug==", + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", + "integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", "dev": true, "requires": { - "available-typed-arrays": "^1.0.2", + "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.0-next.2", + "es-abstract": "^1.18.5", "foreach": "^2.0.5", - "has-symbols": "^1.0.1" + "has-tostringtag": "^1.0.0" } }, "is-weakmap": { @@ -881,6 +841,15 @@ "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", "dev": true }, + "is-weakref": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", + "integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0" + } + }, "is-weakset": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.1.tgz", @@ -899,20 +868,21 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "argparse": "^2.0.1" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + } } }, "json-schema-traverse": { @@ -937,24 +907,12 @@ "type-check": "~0.4.0" } }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", - "dev": true - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -997,9 +955,9 @@ "dev": true }, "object-inspect": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", - "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.11.0.tgz", + "integrity": "sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==", "dev": true }, "object-is": { @@ -1114,12 +1072,6 @@ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true - }, "resolve": { "version": "2.0.0-next.3", "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.3.tgz", @@ -1198,69 +1150,21 @@ "object-inspect": "^1.9.0" } }, - "slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } - } - }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, "string.prototype.trim": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz", - "integrity": "sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.5.tgz", + "integrity": "sha512-Lnh17webJVsD6ECeovpVN17RlAKjmz4rF9S+8Y45CkMc/ufVpTkU3vZIyIC7sllQ1FCvObZnnCdNs/HXTUOTlg==", "dev": true, "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.2" + "es-abstract": "^1.19.1" } }, "string.prototype.trimend": { @@ -1284,12 +1188,12 @@ } }, "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, "requires": { - "ansi-regex": "^5.0.0" + "ansi-regex": "^5.0.1" } }, "strip-json-comments": { @@ -1299,52 +1203,18 @@ "dev": true }, "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { - "has-flag": "^3.0.0" - } - }, - "table": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", - "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", - "dev": true, - "requires": { - "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ajv": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.0.tgz", - "integrity": "sha512-cnUG4NSBiM4YFBxgZIj/In3/6KX+rQ2l2YPRVcvAMQGWEPKuXoPIhxzwqh31jA3IPbI4qEOp/5ILI4ynioXsGQ==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - } + "has-flag": "^4.0.0" } }, "tape": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/tape/-/tape-5.2.2.tgz", - "integrity": "sha512-grXrzPC1ly2kyTMKdqxh5GiLpb0BpNctCuecTB0psHX4Gu0nc+uxWR4xKjTh/4CfQlH4zhvTM2/EXmHXp6v/uA==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.3.1.tgz", + "integrity": "sha512-Mj3h+/dgfI2xct4kTpzqZaRxhhglXcMg//xGTbB0AQisfiOYa6ZBNQIgv46xi1MqbgthuNLSS1SAySDZsb7MMA==", "dev": true, "requires": { "call-bind": "^1.0.2", @@ -1352,12 +1222,14 @@ "defined": "^1.0.0", "dotignore": "^0.1.2", "for-each": "^0.3.3", - "glob": "^7.1.6", + "get-package-type": "^0.1.0", + "glob": "^7.1.7", "has": "^1.0.3", + "has-dynamic-import": "^2.0.0", "inherits": "^2.0.4", - "is-regex": "^1.1.2", + "is-regex": "^1.1.4", "minimist": "^1.2.5", - "object-inspect": "^1.9.0", + "object-inspect": "^1.11.0", "object-is": "^1.1.5", "object.assign": "^4.1.2", "resolve": "^2.0.0-next.3", @@ -1455,18 +1327,17 @@ } }, "which-typed-array": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.4.tgz", - "integrity": "sha512-49E0SpUe90cjpoc7BOJwyPHRqSAd12c10Qm2amdEZrJPCY2NDxaW01zHITrem+rnETY3dwrbH3UUrUwagfCYDA==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.7.tgz", + "integrity": "sha512-vjxaB4nfDqwKI0ws7wZpxIlde1XrLX5uB0ZjpfshgmapJMD7jJWhZI+yToJTqaFByF0eNBcYxbjmCzoRP7CfEw==", "dev": true, "requires": { - "available-typed-arrays": "^1.0.2", - "call-bind": "^1.0.0", - "es-abstract": "^1.18.0-next.1", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-abstract": "^1.18.5", "foreach": "^2.0.5", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.1", - "is-typed-array": "^1.1.3" + "has-tostringtag": "^1.0.0", + "is-typed-array": "^1.1.7" } }, "word-wrap": { diff --git a/package.json b/package.json index 4ce6add..f72f8fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "beamcoder", - "version": "0.6.14", + "version": "0.6.15", "description": "Node.js native bindings to FFmpeg.", "main": "index.js", "types": "index.d.ts", @@ -38,8 +38,8 @@ "segfault-handler": "^1.3.0" }, "devDependencies": { - "eslint": "^7.28.0", - "tape": "^5.2.2" + "eslint": "^8.1.0", + "tape": "^5.3.1" }, "gypfile": true } diff --git a/src/frame.cc b/src/frame.cc index 1380016..baf9d4b 100644 --- a/src/frame.cc +++ b/src/frame.cc @@ -1063,8 +1063,8 @@ napi_value getFrameData(napi_env env, napi_callback_info info) { CHECK_STATUS; data = f->frame->data[0]; - ref = av_buffer_ref(f->frame->buf[0]); - size = ref->size; + ref = f->frame->buf[0] ? av_buffer_ref(f->frame->buf[0]) : nullptr; + size = ref ? ref->size : 0; curElem = 0; // work through frame bufs checking whether allocation refcounts are shared for ( int x = 1 ; x < AV_NUM_DATA_POINTERS ; x++ ) { From 5f29e9d3aa25142bd1d3a5f97a594933a751080a Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Mon, 1 Nov 2021 16:43:37 +0000 Subject: [PATCH 13/16] Update CircleCI test image --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3aa0f18..fabf433 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,7 @@ jobs: CIRCLE_TEST_REPORTS: /tmp/circleci-test-results UV_THREADPOOL_SIZE: 16 docker: - - image: streampunkmedia/testbeam:10-4.1 + - image: streampunkmedia/testbeam:16-4.4 steps: - checkout - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS From 995464148bf24fc256f428ae454d96e4c6823a27 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Mon, 1 Nov 2021 16:55:07 +0000 Subject: [PATCH 14/16] Update cache tag --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fabf433..ef8c1d3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,15 +16,15 @@ jobs: - restore_cache: keys: # This branch if available - - v1-dep-{{ .Branch }}- + - v2-dep-{{ .Branch }}- # Default branch if not - - v1-dep-master- + - v2-dep-master- # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly - - v1-dep- + - v2-dep- - run: npm install tap-xunit - run: npm install --unsafe-perm - save_cache: - key: v1-dep-{{ .Branch }}-{{ epoch }} + key: v2-dep-{{ .Branch }}-{{ epoch }} paths: - ./node_modules - run: echo 'export PATH="~/Streampunk/beamcoder/node_modules/.bin:$PATH"' >> $BASH_ENV From 11b7c0664026621c5af24cde9ec305afc4c0ae8a Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Mon, 1 Nov 2021 17:00:25 +0000 Subject: [PATCH 15/16] Build info for CircleCI test image --- .circleci/test_image/Dockerfile | 13 +++++++++++++ .circleci/test_image/build.md | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .circleci/test_image/Dockerfile create mode 100644 .circleci/test_image/build.md diff --git a/.circleci/test_image/Dockerfile b/.circleci/test_image/Dockerfile new file mode 100644 index 0000000..a693f50 --- /dev/null +++ b/.circleci/test_image/Dockerfile @@ -0,0 +1,13 @@ +FROM cimg/node:16.13 + +# install FFmpeg +RUN sudo apt-get update \ + && sudo apt-get install software-properties-common \ + && sudo add-apt-repository ppa:savoury1/ffmpeg4 \ + && sudo apt-get update \ + && sudo apt-get upgrade && sudo apt-get dist-upgrade \ + && sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev + +# delete all the apt list files since they're big and get stale quickly +RUN sudo rm -rf /var/lib/apt/lists/* +# this forces "apt-get update" in dependent images, which is also good diff --git a/.circleci/test_image/build.md b/.circleci/test_image/build.md new file mode 100644 index 0000000..0add2ab --- /dev/null +++ b/.circleci/test_image/build.md @@ -0,0 +1,13 @@ +# Instructions for building the CircleCI docker image for testing + +- install docker desktop +- cd to this directory +- docker build -t streampunkmedia/testbeam:x-y.z . +- run container locally to check build +- push to Docker Hub +- update config.yml to pull new version tag +- push to git to trigger new build and test + +(x: NodeAPI base version, y.z: FFmpeg build number) + +See https://circleci.com/developer/images/image/cimg/node for CircleCI docker image tags From 5504d7bb578363c34f436426fcef5f4e96f409a0 Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Thu, 4 Nov 2021 18:18:38 +0000 Subject: [PATCH 16/16] Simplify decoder hwaccel flag --- scratch/decode_avci.js | 2 +- src/decode.cc | 72 +++++++++++++++--------------------------- 2 files changed, 26 insertions(+), 48 deletions(-) diff --git a/scratch/decode_avci.js b/scratch/decode_avci.js index 3c341e5..1a6365b 100644 --- a/scratch/decode_avci.js +++ b/scratch/decode_avci.js @@ -28,7 +28,7 @@ async function run() { // let demuxer = await beamcoder.demuxer('M:/dpp/AS11.mxf'); demuxer.streams.forEach(s => s.discard = (0 == s.index) ? 'default' : 'all'); // let decoder = beamcoder.decoder({ name: 'h264', thread_count: 4, thread_type: { FRAME: false, SLICE: true } }); - let decoder = beamcoder.decoder({ name: 'h264', thread_count: 1, hwaccel: 'auto' }); + let decoder = beamcoder.decoder({ name: 'h264', thread_count: 1, hwaccel: true }); // console.dir(decoder, { getters: true, depth: 3 }); let packet = {}; for ( let x = 0 ; x < 2000 && packet != null; x++ ) { diff --git a/src/decode.cc b/src/decode.cc index 466659f..b196ddb 100644 --- a/src/decode.cc +++ b/src/decode.cc @@ -21,55 +21,40 @@ #include "decode.h" -char* req_hw_type = nullptr; -AVPixelFormat req_hw_pix_fmt = AV_PIX_FMT_NONE; - AVPixelFormat get_format(AVCodecContext *s, const AVPixelFormat *pix_fmts) { - AVPixelFormat result = AV_PIX_FMT_NONE; const AVPixelFormat *p; int i, err; - if (0 == strcmp("auto", req_hw_type)) { - for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) { - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); - const AVCodecHWConfig *config = NULL; - - if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) - break; + for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); + const AVCodecHWConfig *config = NULL; - for (i = 0;; i++) { - config = avcodec_get_hw_config(s->codec, i); - if (!config) - break; - if (!(config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)) - continue; - if (config->pix_fmt == *p) - break; - } + if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) + break; - if (config) { - err = av_hwdevice_ctx_create(&s->hw_device_ctx, config->device_type, NULL, NULL, 0); - if (err < 0) { - char errstr[128]; - av_make_error_string(errstr, 128, err); - printf("Error in get_format \'auto\' av_hwdevice_ctx_create: %s\n", errstr); - } + for (i = 0;; i++) { + config = avcodec_get_hw_config(s->codec, i); + if (!config) + break; + if (!(config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX)) + continue; + if (config->pix_fmt == *p) break; - } } - result = *p; - } else { - err = av_hwdevice_ctx_create(&s->hw_device_ctx, av_hwdevice_find_type_by_name(req_hw_type), NULL, NULL, 0); - if (err < 0) { - char errstr[128]; - av_make_error_string(errstr, 128, err); - printf("Error in get_format \'%s\' av_hwdevice_ctx_create: %s\n", req_hw_type, errstr); + + if (config) { + err = av_hwdevice_ctx_create(&s->hw_device_ctx, config->device_type, NULL, NULL, 0); + if (err < 0) { + char errstr[128]; + av_make_error_string(errstr, 128, err); + printf("Error in get_format av_hwdevice_ctx_create: %s\n", errstr); + } + break; } - result = req_hw_pix_fmt; } - return result; + return *p; } napi_value decoder(napi_env env, napi_callback_info info) { @@ -85,8 +70,8 @@ napi_value decoder(napi_env env, napi_callback_info info) { AVCodecParameters* params = nullptr; char* codecName = nullptr; size_t codecNameLen = 0; - size_t hwTypeLen = 0; int32_t codecID = -1; + bool hwaccel = false; size_t argc = 1; napi_value args[1]; @@ -205,16 +190,9 @@ napi_value decoder(napi_env env, napi_callback_info info) { if (hasHWaccel) { status = napi_get_named_property(env, args[0], "hwaccel", &value); CHECK_STATUS; - hwTypeLen = 64; - req_hw_type = (char*) malloc(sizeof(char) * (hwTypeLen + 1)); - status = napi_get_value_string_utf8(env, value, req_hw_type, - 64, &hwTypeLen); + status = napi_get_value_bool(env, value, &hwaccel); CHECK_STATUS; - req_hw_pix_fmt = av_get_pix_fmt(req_hw_type); - - if (0 != strcmp("auto", req_hw_type) && req_hw_pix_fmt == AV_PIX_FMT_NONE) - printf("Decoder hwaccel name \'%s\' not recognised\n", req_hw_type); - else + if (hwaccel) decoder->get_format = get_format; }