@scrypted/libav 1.0.172 → 1.0.173

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/libav",
3
- "version": "1.0.172",
3
+ "version": "1.0.173",
4
4
  "dependencies": {
5
5
  "detect-libc": "^2.0.3",
6
6
  "follow-redirects": "^1.15.9",
@@ -1,23 +0,0 @@
1
- {
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- "version": "0.2.0",
6
- "configurations": [
7
- {
8
- "name": "ts-node",
9
- "type": "node",
10
- "request": "launch",
11
- "args": [
12
- "${workspaceRoot}/test/read-receive-send-receive.ts"
13
- ],
14
- "preLaunchTask": "npm: build",
15
- "runtimeArgs": [
16
- "-r",
17
- "ts-node/register"
18
- ],
19
- "cwd": "${workspaceRoot}",
20
- "internalConsoleOptions": "openOnSessionStart"
21
- }
22
- ]
23
- }
@@ -1,32 +0,0 @@
1
- {
2
- "files.associations": {
3
- "*.yml": "yaml",
4
- "locale": "cpp",
5
- "regex": "cpp",
6
- "string": "cpp",
7
- "__locale": "cpp",
8
- "stdexcept": "cpp",
9
- "__config": "c",
10
- "string_view": "cpp",
11
- "typeinfo": "cpp",
12
- "variant": "cpp",
13
- "ios": "c",
14
- "avfilter.h": "c",
15
- "any": "cpp",
16
- "vector": "cpp",
17
- "array": "cpp",
18
- "__hash_table": "c",
19
- "atomic": "c",
20
- "bitset": "c",
21
- "iterator": "c",
22
- "memory": "c",
23
- "sstream": "c",
24
- "queue": "cpp",
25
- "stack": "cpp",
26
- "scale_eval.h": "c",
27
- "filters.h": "c",
28
- "ratio": "cpp",
29
- "unordered_map": "cpp",
30
- "__bit_reference": "cpp"
31
- }
32
- }
package/darwin.md DELETED
@@ -1,24 +0,0 @@
1
- Mimimum macOS configuration for RTSP, h264, h265, jpg, and videotoolbox.
2
-
3
- ```sh
4
- ./configure \
5
- --disable-everything \
6
- --enable-hwaccels \
7
- --enable-videotoolbox \
8
- --enable-decoder=h264 \
9
- --enable-decoder=hevc \
10
- --enable-demuxer=rtsp \
11
- --enable-muxer=mjpeg \
12
- --enable-encoder=mjpeg \
13
- --enable-parser=mjpeg \
14
- --enable-protocol=tcp \
15
- --enable-protocol=udp \
16
- --enable-filter=crop \
17
- --enable-filter=scale \
18
- --enable-filter=scale_vt \
19
- --enable-filter=format \
20
- --enable-filter=hwdownload \
21
- --enable-filter=hwupload \
22
- --enable-parser=h264 \
23
- --enable-parser=hevc
24
- ```
package/src/bsf.cpp DELETED
@@ -1,213 +0,0 @@
1
- #include "bsf.h"
2
- #include "packet.h"
3
- #include "formatcontext.h"
4
-
5
- Napi::FunctionReference AVBitstreamFilter::constructor;
6
-
7
- Napi::Object AVBitstreamFilter::Init(Napi::Env env, Napi::Object exports)
8
- {
9
- Napi::HandleScope scope(env);
10
-
11
- Napi::Function func = DefineClass(env, "AVBitstreamFilter", {
12
-
13
- InstanceMethod(Napi::Symbol::WellKnown(env, "dispose"), &AVBitstreamFilter::Destroy),
14
-
15
- InstanceMethod("destroy", &AVBitstreamFilter::Destroy),
16
-
17
- InstanceMethod("setOption", &AVBitstreamFilter::SetOption),
18
-
19
- InstanceMethod("sendPacket", &AVBitstreamFilter::SendPacket),
20
-
21
- InstanceMethod("copyParameters", &AVBitstreamFilter::CopyParameters),
22
-
23
- InstanceMethod("receivePacket", &AVBitstreamFilter::ReceivePacket)});
24
-
25
- constructor = Napi::Persistent(func);
26
- constructor.SuppressDestruct();
27
-
28
- exports.Set("AVBitstreamFilter", func);
29
-
30
- return exports;
31
- }
32
-
33
- AVBitstreamFilter::AVBitstreamFilter(const Napi::CallbackInfo &info)
34
- : Napi::ObjectWrap<AVBitstreamFilter>(info), bsfContext(nullptr)
35
- {
36
- bsfContext = nullptr;
37
-
38
- Napi::Env env = info.Env();
39
-
40
- if (info.Length() < 1 || !info[0].IsString())
41
- {
42
- Napi::TypeError::New(env, "String expected for argument 0: filter name").ThrowAsJavaScriptException();
43
- return;
44
- }
45
-
46
- std::string filterName = info[0].As<Napi::String>().Utf8Value();
47
-
48
- const AVBitStreamFilter *filter = av_bsf_get_by_name(filterName.c_str());
49
- if (!filter)
50
- {
51
- Napi::Error::New(env, "Bitstream filter not found").ThrowAsJavaScriptException();
52
- return;
53
- }
54
-
55
- int ret = av_bsf_alloc(filter, &bsfContext);
56
- if (ret < 0)
57
- {
58
- Napi::Error::New(env, AVErrorString(ret)).ThrowAsJavaScriptException();
59
- return;
60
- }
61
- }
62
-
63
- AVBitstreamFilter::~AVBitstreamFilter()
64
- {
65
- }
66
-
67
- Napi::Object AVBitstreamFilter::NewInstance(Napi::Env env, AVBSFContext *bsfContext)
68
- {
69
- Napi::EscapableHandleScope scope(env);
70
- Napi::Object obj = constructor.New({});
71
- AVBitstreamFilter *instance = Napi::ObjectWrap<AVBitstreamFilter>::Unwrap(obj);
72
- instance->bsfContext = bsfContext;
73
- return scope.Escape(napi_value(obj)).ToObject();
74
- }
75
-
76
- Napi::Value AVBitstreamFilter::SendPacket(const Napi::CallbackInfo &info)
77
- {
78
- if (info.Length() < 1 || !info[0].IsObject())
79
- {
80
- Napi::TypeError::New(info.Env(), "Packet object expected").ThrowAsJavaScriptException();
81
- return info.Env().Undefined();
82
- }
83
-
84
- AVPacketObject *packetObject = Napi::ObjectWrap<AVPacketObject>::Unwrap(info[0].As<Napi::Object>());
85
-
86
- int ret = av_bsf_send_packet(bsfContext, packetObject->packet);
87
- if (ret < 0)
88
- {
89
- Napi::Error::New(info.Env(), AVErrorString(ret)).ThrowAsJavaScriptException();
90
- return info.Env().Undefined();
91
- }
92
-
93
- return info.Env().Undefined();
94
- }
95
-
96
- Napi::Value AVBitstreamFilter::ReceivePacket(const Napi::CallbackInfo &info)
97
- {
98
- AVPacket *packet = av_packet_alloc();
99
- if (!packet)
100
- {
101
- Napi::Error::New(info.Env(), "Could not allocate packet").ThrowAsJavaScriptException();
102
- return info.Env().Undefined();
103
- }
104
-
105
- int ret = av_bsf_receive_packet(bsfContext, packet);
106
- if (ret == AVERROR(EAGAIN))
107
- {
108
- av_packet_free(&packet);
109
- return info.Env().Undefined();
110
- }
111
- if (ret < 0)
112
- {
113
- av_packet_free(&packet);
114
- Napi::Error::New(info.Env(), AVErrorString(ret)).ThrowAsJavaScriptException();
115
- return info.Env().Undefined();
116
- }
117
-
118
- Napi::Object packetObject = AVPacketObject::NewInstance(info.Env(), packet);
119
- return packetObject;
120
- }
121
-
122
- Napi::Value AVBitstreamFilter::SetOption(const Napi::CallbackInfo &info)
123
- {
124
- if (!bsfContext)
125
- {
126
- Napi::TypeError::New(info.Env(), "Bitstream Filter object is null").ThrowAsJavaScriptException();
127
- return info.Env().Undefined();
128
- }
129
-
130
- Napi::Env env = info.Env();
131
-
132
- if (info.Length() < 1 || !info[0].IsObject())
133
- {
134
- Napi::TypeError::New(env, "Object expected for argument 0: options").ThrowAsJavaScriptException();
135
- return info.Env().Undefined();
136
- }
137
-
138
- Napi::Object options = info[0].As<Napi::Object>();
139
-
140
- // convert this options to a AVDictionary
141
- AVDictionary *optionsDict = nullptr;
142
-
143
- Napi::Array keys = options.GetPropertyNames();
144
- for (unsigned int i = 0; i < keys.Length(); i++)
145
- {
146
- Napi::Value key = keys.Get(i);
147
- Napi::Value value = options.Get(key.ToString());
148
-
149
- if (value.IsString())
150
- {
151
- std::string keyStr = key.ToString();
152
- std::string valueStr = value.ToString();
153
-
154
- av_dict_set(&optionsDict, keyStr.c_str(), valueStr.c_str(), 0);
155
- }
156
- }
157
-
158
- int ret = av_opt_set_dict2(bsfContext, &optionsDict, AV_OPT_SEARCH_CHILDREN);
159
- if (ret < 0)
160
- {
161
- Napi::Error::New(env, AVErrorString(ret)).ThrowAsJavaScriptException();
162
- return info.Env().Undefined();
163
- }
164
-
165
- return info.Env().Undefined();
166
- }
167
-
168
- Napi::Value AVBitstreamFilter::Destroy(const Napi::CallbackInfo &info)
169
- {
170
- if (bsfContext)
171
- {
172
- av_bsf_free(&bsfContext);
173
- bsfContext = nullptr;
174
- }
175
- return info.Env().Undefined();
176
- }
177
-
178
- Napi::Value AVBitstreamFilter::CopyParameters(const Napi::CallbackInfo &info)
179
- {
180
- if (!bsfContext)
181
- {
182
- Napi::TypeError::New(info.Env(), "Bitstream Filter object is null").ThrowAsJavaScriptException();
183
- return info.Env().Undefined();
184
- }
185
-
186
- // get the AVFormatContext object and stream index
187
- if (info.Length() < 2 || !info[0].IsObject() || !info[1].IsNumber())
188
- {
189
- Napi::TypeError::New(info.Env(), "Object expected for argument 0: formatContext and Number expected for argument 1: streamIndex").ThrowAsJavaScriptException();
190
- return info.Env().Undefined();
191
- }
192
-
193
- AVFormatContextObject *formatContextObject = Napi::ObjectWrap<AVFormatContextObject>::Unwrap(info[0].As<Napi::Object>());
194
- int streamIndex = info[1].As<Napi::Number>().Int32Value();
195
-
196
- AVStream *stream = formatContextObject->fmt_ctx_->streams[streamIndex];
197
-
198
- int ret = avcodec_parameters_copy(bsfContext->par_in, stream->codecpar);
199
- if (ret < 0)
200
- {
201
- Napi::Error::New(info.Env(), AVErrorString(ret)).ThrowAsJavaScriptException();
202
- return info.Env().Undefined();
203
- }
204
-
205
- ret = av_bsf_init(bsfContext);
206
- if (ret < 0)
207
- {
208
- Napi::Error::New(info.Env(), AVErrorString(ret)).ThrowAsJavaScriptException();
209
- return info.Env().Undefined();
210
- }
211
-
212
- return info.Env().Undefined();
213
- }
package/src/bsf.h DELETED
@@ -1,35 +0,0 @@
1
- #pragma once
2
-
3
- #include <napi.h>
4
-
5
- extern "C"
6
- {
7
- #include <libavfilter/avfilter.h>
8
- #include <libavfilter/buffersrc.h>
9
- #include <libavfilter/buffersink.h>
10
- #include <libavutil/opt.h>
11
- #include <libavcodec/bsf.h>
12
- }
13
-
14
- #include "error.h"
15
-
16
- class AVBitstreamFilter : public Napi::ObjectWrap<AVBitstreamFilter>
17
- {
18
- public:
19
- static Napi::Object Init(Napi::Env env, Napi::Object exports);
20
-
21
- AVBitstreamFilter(const Napi::CallbackInfo &info);
22
- ~AVBitstreamFilter();
23
-
24
- static Napi::Object NewInstance(Napi::Env env, AVBSFContext *bsfContext);
25
- AVBSFContext *bsfContext;
26
-
27
- private:
28
- static Napi::FunctionReference constructor;
29
-
30
- Napi::Value Destroy(const Napi::CallbackInfo &info);
31
- Napi::Value SetOption(const Napi::CallbackInfo &info);
32
- Napi::Value SendPacket(const Napi::CallbackInfo &info);
33
- Napi::Value ReceivePacket(const Napi::CallbackInfo &info);
34
- Napi::Value CopyParameters(const Napi::CallbackInfo &info);
35
- };
@@ -1,13 +0,0 @@
1
- cd $(dirname $0)/../FFmpeg
2
-
3
- if [ ! -z "$FFMPEG_NO_REBUILD" ]
4
- then
5
- if [ -f ffmpeg ]
6
- then
7
- echo "FFmpeg already built, skipping build."
8
- exit 0
9
- fi
10
- fi
11
-
12
- MACOSX_DEPLOYMENT_TARGET=12.0 ./configure --enable-libopus --disable-xlib --disable-sdl2 --disable-libxcb --enable-opencl --enable-videotoolbox --enable-neon --enable-pthreads --cc=clang && MACOSX_DEPLOYMENT_TARGET=12.0 make -j32
13
- exit $?
@@ -1,52 +0,0 @@
1
- DEBIAN_FRONTEND=noninteractive
2
- cd $(dirname $0)/../FFmpeg
3
-
4
- function check_ffmpeg() {
5
- if [ ! -z "$FFMPEG_NO_REBUILD" ]
6
- then
7
- if [ -f ffmpeg ]
8
- then
9
- echo "FFmpeg already built, skipping build."
10
- exit 0
11
- fi
12
- fi
13
- }
14
-
15
- sudo apt -y update
16
- # yasm can be dropped
17
- sudo apt -y install libva-dev libdrm-dev yasm nasm cmake ocl-icd-opencl-dev
18
-
19
- ARCH=$(arch)
20
- if [ "$ARCH" = "x86_64" ]
21
- then
22
- pushd ../libvpl
23
- export VPL_INSTALL_DIR=`pwd`/../_vplinstall
24
- cmake -B _build -DCMAKE_INSTALL_PREFIX=$VPL_INSTALL_DIR -DBUILD_SHARED_LIBS=OFF
25
- cmake --build _build
26
- cmake --install _build
27
- export PKG_CONFIG_PATH=$PWD/../_vplinstall/lib/pkgconfig:$PKG_CONFIG_PATH
28
- popd
29
-
30
- pushd ../nv-codec-headers
31
- make install PREFIX=../_nvinstall
32
- export PKG_CONFIG_PATH=$PWD/../_nvinstall/lib/pkgconfig:$PKG_CONFIG_PATH
33
- popd
34
-
35
- check_ffmpeg
36
-
37
- echo "Building with NVIDIA GPU and Vulkan support"
38
- export PATH=/usr/local/cuda-12.4/bin:$PATH
39
- ./configure --enable-libvpl --enable-vaapi --enable-opencl --enable-libglslang --enable-cuda-llvm --enable-nvdec --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
40
- else
41
- check_ffmpeg
42
-
43
- ./configure --enable-vaapi --enable-opencl
44
- fi
45
-
46
- if [ "$?" != "0" ]
47
- then
48
- exit 1
49
- fi
50
-
51
- make -j32
52
- exit $?
@@ -1,41 +0,0 @@
1
- cd $(dirname $0)
2
-
3
- cd ../nv-codec-headers
4
- make install PREFIX=../_nvinstall
5
-
6
- cd ../libvpl
7
- export VPL_INSTALL_DIR=$PWD/../_vplinstall
8
- cmake -B _build -DCMAKE_INSTALL_PREFIX=$VPL_INSTALL_DIR -DBUILD_SHARED_LIBS=OFF -DUSE_MSVC_STATIC_RUNTIME=ON -DMINGW_LIBS="-ladvapi32 -lmsvcrt -lole32"
9
- cmake --build _build --config Release
10
- cmake --install _build --config Release
11
-
12
- cd ../opus
13
- export OPUS_INSTALL_DIR=$PWD/../_opusinstall
14
- cmake -B _build -DCMAKE_INSTALL_PREFIX=$OPUS_INSTALL_DIR -DBUILD_SHARED_LIBS=OFF -DUSE_MSVC_STATIC_RUNTIME=ON -DMINGW_LIBS="-ladvapi32 -lmsvcrt -lole32"
15
- cmake --build _build --config Release
16
- cmake --install _build --config Release
17
-
18
- cd ../FFmpeg
19
-
20
- if [ ! -z "$FFMPEG_NO_REBUILD" ]
21
- then
22
- if [ -f ffmpeg.exe ]
23
- then
24
- echo "FFmpeg already built, skipping build."
25
- exit 0
26
- fi
27
- fi
28
-
29
- # yasm can be dropped
30
- pacman --noconfirm -S yasm nasm pkg-config clang diffutils make
31
- export PKG_CONFIG_PATH=$PWD/../_opusinstall/lib/pkgconfig:$PWD/../_vplinstall/lib/pkgconfig:$PWD/../_nvinstall/lib/pkgconfig:$PWD/../src/pkgconfig
32
-
33
- # the --enable-nvdec is necessary for build sanity checking, the build will configure
34
- # successfully if nvidia stuff is missing, even though it is required for --enable-cuda-llvm
35
- # no open cl yet, need to do this https://github.com/m-ab-s/media-autobuild_suite/issues/1301#issuecomment-627800902
36
-
37
- # this version is the last that has HLSL and OGLCompiler which are still required by ffmpeg for now
38
- # https://sdk.lunarg.com/sdk/download/1.3.268.0/windows/VulkanSDK-1.3.268.0-Installer.exe
39
-
40
- ./configure --enable-libopus --enable-libvpl --enable-libglslang --enable-cuda-llvm --enable-nvdec --toolchain=msvc && make -j32
41
- exit $?
@@ -1,8 +0,0 @@
1
- cd /d "%~dp0"
2
-
3
- call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
4
-
5
- cd ..\src
6
- C:\msys64\msys2_shell.cmd -defterm -no-start -msys -use-full-path -here -c "bash build-ffmpeg-msys.sh"
7
-
8
- exit /b %ERRORLEVEL%