Skip to content

Commit fb66ce0

Browse files
committed
almost working
blocked by h4tr3d/avcpp#45 must upgrade avcpp on conancenter
0 parents  commit fb66ce0

14 files changed

+659
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
build

.vscode/c_cpp_properties.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"includePath": [
6+
"/home/mmom/.conan/data/ffmpeg/5.0/_/_/package/24aac96ce681e649b6a93e17addc8bb474c4b97a/include/",
7+
"/home/mmom/.conan/data/avcpp/2.1.0/_/_/package/8e6934f87fdb992c8b0786614989421fefc90871/include",
8+
"/usr/include/node",
9+
"${workspaceFolder}/node_modules/node-addon-api",
10+
"${workspaceFolder}/node_modules/nobind/include"
11+
],
12+
"compilerPath": "/usr/bin/g++",
13+
"cStandard": "c17",
14+
"cppStandard": "c++17"
15+
}
16+
],
17+
"version": 4
18+
}

.vscode/launch.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "(gdb) Launch transcode.js",
5+
"type": "cppdbg",
6+
"request": "launch",
7+
"program": "/usr/bin/node",
8+
"args": [
9+
"transcode.js",
10+
"/home/mmom/sokol-ro/Videos/Final/Paragliding/paragliding_flight_335.mp4",
11+
"out.mp4"
12+
],
13+
"stopAtEntry": false,
14+
"cwd": "${workspaceFolder}/test",
15+
"environment": [],
16+
"externalConsole": false,
17+
"MIMode": "gdb",
18+
"setupCommands": [
19+
{
20+
"description": "Enable pretty-printing for gdb",
21+
"text": "-enable-pretty-printing",
22+
"ignoreFailures": true
23+
},
24+
{
25+
"description": "Set Disassembly Flavor to Intel",
26+
"text": "-gdb-set disassembly-flavor intel",
27+
"ignoreFailures": true
28+
}
29+
]
30+
}
31+
32+
]
33+
}

.vscode/tasks.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "shell",
6+
"label": "conan_includes",
7+
"command": "node -p \"JSON.parse(fs.readFileSync('build/conanbuildinfo.json')).dependencies.map((dep) => dep.include_paths).flat().map((path) => '-I' + path).join(' ')\"",
8+
"windows": {
9+
"command": ""
10+
},
11+
"options": {
12+
"cwd": "${workspaceFolder}"
13+
}
14+
}
15+
]
16+
}

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ffmpeg (w/avcpp) bindings for Node.js
2+
3+
Access to video encoding and decoding APIs from Node.js
4+
5+
# Projects goals
6+
7+
* Explore the limits of `nobind`'s design limitations for implementing medium-sized C++ libraries
8+
* Fully debug `nobind` before its first release
9+
* Provide a currently missing feature in server-side JavaScript - video processing - that would never be possible without C++
10+
11+
This project is on the very high end of the `nobind` spectrum - normally SWIG Node-API would have been better suited for it

binding.gyp

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
'target_defaults': {
3+
'includes': [
4+
'except.gypi'
5+
]
6+
},
7+
'targets': [
8+
{
9+
'target_name': 'node-ffmpeg-avcpp',
10+
'sources': [
11+
'src/avcpp-nobind.cc'
12+
],
13+
'include_dirs': [
14+
'<!@(node -p "require(\'node-addon-api\').include")',
15+
'<!@(node -p "require(\'nobind\').include")',
16+
'<(module_root_dir)'
17+
],
18+
'dependencies': [ 'libavcpp' ]
19+
},
20+
{
21+
'variables': {
22+
'conaninfo': '<!(pip3 install --user "conan<2.0.0"'
23+
' && cd build'
24+
' && python3 -m conans.conan install .. -pr:b=../conan.profile -pr:h=../conan.profile -of build --build=nolibx265 --build=missing'
25+
' > conan.log 2>&1 )'
26+
},
27+
'target_name': 'libavcpp',
28+
'direct_dependent_settings': {
29+
'cflags': [
30+
# TODO: These should definitely be fixed in avcpp
31+
'-Wno-sign-compare'
32+
],
33+
'include_dirs': [
34+
'<!@(node -p "JSON.parse(fs.readFileSync(\'build/conanbuildinfo.json\')).dependencies.map((dep) => dep.include_paths).flat().join(\' \')")'
35+
],
36+
'defines': [
37+
'<!@(node -p "JSON.parse(fs.readFileSync(\'build/conanbuildinfo.json\')).dependencies.map((dep) => dep.defines).flat().join(\' \')")'
38+
],
39+
'libraries': [
40+
'<!@(node -p "JSON.parse(fs.readFileSync(\'build/conanbuildinfo.json\')).dependencies.map((dep) => dep.libs).flat().map((path) => \'-l\' + path).join(\' \')")',
41+
'<!@(node -p "JSON.parse(fs.readFileSync(\'build/conanbuildinfo.json\')).dependencies.map((dep) => dep.lib_paths).flat().map((path) => \'-L\' + path).join(\' \')")'
42+
'<!@(node -p "JSON.parse(fs.readFileSync(\'build/conanbuildinfo.json\')).dependencies.map((dep) => dep.system_libs).flat().map((path) => \'-l\' + path).join(\' \')")',
43+
],
44+
'ldflags': [
45+
'<!@(node -p "JSON.parse(fs.readFileSync(\'build/conanbuildinfo.json\')).dependencies.map((dep) => dep.exelinkflags).flat().join(\' \')")'
46+
]
47+
}
48+
}
49+
]
50+
}

conan.profile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[settings]
2+
os=Linux
3+
os_build=Linux
4+
arch=x86_64
5+
arch_build=x86_64
6+
compiler=gcc
7+
compiler.version=11
8+
# We use std:string and we are sensitive to the C++ ABI
9+
# As nobind requires C++17, we think it is time to switch
10+
# (if you do not know the C++ ABI changed in gcc 5
11+
# https://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi )
12+
compiler.libcxx=libstdc++11
13+
build_type=Release
14+
15+
[options]
16+
17+
[build_requires]
18+
19+
[env]

conanfile.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[requires]
2+
avcpp/2.1.0
3+
ffmpeg/5.0
4+
5+
[options]
6+
ffmpeg:shared=False
7+
ffmpeg:fPIC=True
8+
ffmpeg:with_libalsa=False
9+
ffmpeg:with_pulse=False
10+
ffmpeg:with_vulkan=False
11+
ffmpeg:with_xcb=False
12+
ffmpeg:with_vaapi=False
13+
ffmpeg:with_vdpau=False
14+
ffmpeg:disable_all_devices=True
15+
libx265:shared=False
16+
17+
[generators]
18+
json
19+
pkg_config

except.gypi

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
'defines': [ 'NAPI_CPP_EXCEPTIONS' ],
3+
'cflags!': [ '-fno-exceptions' ],
4+
'cflags_cc!': [ '-fno-exceptions' ],
5+
'conditions': [
6+
["OS=='win'", {
7+
"defines": [
8+
"_HAS_EXCEPTIONS=1"
9+
],
10+
"msvs_settings": {
11+
"VCCLCompilerTool": {
12+
"ExceptionHandling": 1,
13+
'EnablePREfast': 'true'
14+
}
15+
}
16+
}],
17+
["OS=='mac'", {
18+
'xcode_settings': {
19+
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
20+
'CLANG_CXX_LIBRARY': 'libc++',
21+
'MACOSX_DEPLOYMENT_TARGET': '10.7'
22+
}
23+
}]
24+
]
25+
}

package-lock.json

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "node-ffmpeg",
3+
"version": "1.0.0",
4+
"description": "avcpp (ffmpeg) bindings for Node.js",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "test"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/mmomtchev/node-ffmpeg.git"
12+
},
13+
"keywords": [
14+
"node.js",
15+
"ffmpeg",
16+
"video",
17+
"encoding",
18+
"codec"
19+
],
20+
"author": "Momtchil Momtchev <[email protected]>",
21+
"license": "ISC",
22+
"bugs": {
23+
"url": "https://github.com/mmomtchev/node-ffmpeg/issues"
24+
},
25+
"homepage": "https://github.com/mmomtchev/node-ffmpeg#readme",
26+
"dependencies": {
27+
"node-addon-api": "^7.0.0"
28+
}
29+
}

0 commit comments

Comments
 (0)