@lumen5/beamcoder 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.circleci/config.yml +41 -0
  2. package/.circleci/images/testbeam10-4.1/Dockerfile +12 -0
  3. package/.circleci/test_image/Dockerfile +14 -0
  4. package/.circleci/test_image/build.md +13 -0
  5. package/.eslintrc.js +27 -0
  6. package/.github/workflows/publish-npm.yml +33 -0
  7. package/LICENSE +674 -0
  8. package/README.md +1221 -0
  9. package/beamstreams.js +692 -0
  10. package/binding.gyp +103 -0
  11. package/examples/encode_h264.js +92 -0
  12. package/examples/jpeg_app.js +55 -0
  13. package/examples/jpeg_filter_app.js +101 -0
  14. package/examples/make_mp4.js +123 -0
  15. package/images/beamcoder_small.jpg +0 -0
  16. package/index.d.ts +83 -0
  17. package/index.js +44 -0
  18. package/install_ffmpeg.js +240 -0
  19. package/package.json +45 -0
  20. package/scratch/decode_aac.js +38 -0
  21. package/scratch/decode_avci.js +50 -0
  22. package/scratch/decode_hevc.js +38 -0
  23. package/scratch/decode_pcm.js +39 -0
  24. package/scratch/make_a_mux.js +68 -0
  25. package/scratch/muxer.js +74 -0
  26. package/scratch/read_wav.js +35 -0
  27. package/scratch/simple_mux.js +39 -0
  28. package/scratch/stream_avci.js +127 -0
  29. package/scratch/stream_mp4.js +78 -0
  30. package/scratch/stream_mux.js +47 -0
  31. package/scratch/stream_pcm.js +82 -0
  32. package/scratch/stream_wav.js +62 -0
  33. package/scripts/install_beamcoder_dependencies.sh +25 -0
  34. package/src/adaptor.h +202 -0
  35. package/src/beamcoder.cc +937 -0
  36. package/src/beamcoder_util.cc +1129 -0
  37. package/src/beamcoder_util.h +206 -0
  38. package/src/codec.cc +7386 -0
  39. package/src/codec.h +44 -0
  40. package/src/codec_par.cc +1818 -0
  41. package/src/codec_par.h +40 -0
  42. package/src/decode.cc +569 -0
  43. package/src/decode.h +75 -0
  44. package/src/demux.cc +584 -0
  45. package/src/demux.h +88 -0
  46. package/src/encode.cc +496 -0
  47. package/src/encode.h +72 -0
  48. package/src/filter.cc +1888 -0
  49. package/src/filter.h +30 -0
  50. package/src/format.cc +5287 -0
  51. package/src/format.h +77 -0
  52. package/src/frame.cc +2681 -0
  53. package/src/frame.h +52 -0
  54. package/src/governor.cc +286 -0
  55. package/src/governor.h +30 -0
  56. package/src/hwcontext.cc +378 -0
  57. package/src/hwcontext.h +35 -0
  58. package/src/log.cc +186 -0
  59. package/src/log.h +20 -0
  60. package/src/mux.cc +834 -0
  61. package/src/mux.h +106 -0
  62. package/src/packet.cc +762 -0
  63. package/src/packet.h +49 -0
  64. package/test/codecParamsSpec.js +148 -0
  65. package/test/decoderSpec.js +56 -0
  66. package/test/demuxerSpec.js +41 -0
  67. package/test/encoderSpec.js +69 -0
  68. package/test/filtererSpec.js +47 -0
  69. package/test/formatSpec.js +343 -0
  70. package/test/frameSpec.js +145 -0
  71. package/test/introspectionSpec.js +73 -0
  72. package/test/muxerSpec.js +34 -0
  73. package/test/packetSpec.js +122 -0
  74. package/types/Beamstreams.d.ts +98 -0
  75. package/types/Codec.d.ts +123 -0
  76. package/types/CodecContext.d.ts +555 -0
  77. package/types/CodecPar.d.ts +108 -0
  78. package/types/Decoder.d.ts +137 -0
  79. package/types/Demuxer.d.ts +113 -0
  80. package/types/Encoder.d.ts +94 -0
  81. package/types/Filter.d.ts +324 -0
  82. package/types/FormatContext.d.ts +380 -0
  83. package/types/Frame.d.ts +295 -0
  84. package/types/HWContext.d.ts +62 -0
  85. package/types/Muxer.d.ts +121 -0
  86. package/types/Packet.d.ts +82 -0
  87. package/types/PrivClass.d.ts +25 -0
  88. package/types/Stream.d.ts +165 -0
@@ -0,0 +1,41 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ working_directory: ~/Streampunk/beamcoder
5
+ parallelism: 1
6
+ shell: /bin/bash --login
7
+ environment:
8
+ CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
9
+ CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
10
+ UV_THREADPOOL_SIZE: 16
11
+ docker:
12
+ - image: streampunkmedia/testbeam:16-5.0
13
+ steps:
14
+ - checkout
15
+ - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
16
+ - restore_cache:
17
+ keys:
18
+ # This branch if available
19
+ - v2-dep-{{ .Branch }}-
20
+ # Default branch if not
21
+ - v2-dep-master-
22
+ # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
23
+ - v2-dep-
24
+ - run: npm install tap-xunit
25
+ - run: npm install --unsafe-perm
26
+ - save_cache:
27
+ key: v2-dep-{{ .Branch }}-{{ epoch }}
28
+ paths:
29
+ - ./node_modules
30
+ - run: echo 'export PATH="~/Streampunk/beamcoder/node_modules/.bin:$PATH"' >> $BASH_ENV
31
+ - run: mkdir -p $CIRCLE_TEST_REPORTS/eslint
32
+ - run: mkdir -p $CIRCLE_TEST_REPORTS/xunit
33
+ - run: eslint '**/*.js' -f junit -o /tmp/circleci-test-results/eslint/eslint.xml
34
+ - run: set -eo pipefail && npm test | tap-xunit > /tmp/circleci-test-results/xunit/results.xml
35
+
36
+ - store_test_results:
37
+ path: /tmp/circleci-test-results
38
+ - store_artifacts:
39
+ path: /tmp/circleci-artifacts
40
+ - store_artifacts:
41
+ path: /tmp/circleci-test-results
@@ -0,0 +1,12 @@
1
+ FROM circleci/node:10
2
+
3
+ # install OpenCL driver
4
+ RUN sudo apt-get update \
5
+ && sudo apt-get install software-properties-common \
6
+ && sudo add-apt-repository ppa:jonathonf/ffmpeg-4 \
7
+ && sudo apt-get update \
8
+ && sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev
9
+
10
+ # delete all the apt list files since they're big and get stale quickly
11
+ RUN sudo rm -rf /var/lib/apt/lists/*
12
+ # this forces "apt-get update" in dependent images, which is also good
@@ -0,0 +1,14 @@
1
+ FROM cimg/node:16.14
2
+
3
+ # install FFmpeg
4
+ RUN sudo apt-get update \
5
+ && sudo apt-get install software-properties-common \
6
+ && sudo add-apt-repository ppa:savoury1/ffmpeg4 \
7
+ && sudo add-apt-repository ppa:savoury1/ffmpeg5 \
8
+ && sudo apt-get update \
9
+ && sudo apt-get upgrade && sudo apt-get dist-upgrade \
10
+ && sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev
11
+
12
+ # delete all the apt list files since they're big and get stale quickly
13
+ RUN sudo rm -rf /var/lib/apt/lists/*
14
+ # this forces "apt-get update" in dependent images, which is also good
@@ -0,0 +1,13 @@
1
+ # Instructions for building the CircleCI docker image for testing
2
+
3
+ - install docker desktop
4
+ - cd to this directory
5
+ - docker build -t streampunkmedia/testbeam:x-y.z .
6
+ - run container locally to check build
7
+ - push to Docker Hub
8
+ - update config.yml to pull new version tag
9
+ - push to git to trigger new build and test
10
+
11
+ (x: NodeAPI base version, y.z: FFmpeg build number)
12
+
13
+ See https://circleci.com/developer/images/image/cimg/node for CircleCI docker image tags
package/.eslintrc.js ADDED
@@ -0,0 +1,27 @@
1
+ module.exports = {
2
+ 'env': {
3
+ 'es6': true,
4
+ 'node': true
5
+ },
6
+ 'parserOptions': {
7
+ 'ecmaVersion': 2018,
8
+ 'sourceType': 'module',
9
+ },
10
+ 'extends': 'eslint:recommended',
11
+ 'rules': {
12
+ 'indent': [
13
+ 'error',
14
+ 2
15
+ ],
16
+ 'quotes': [
17
+ 'error',
18
+ 'single'
19
+ ],
20
+ 'semi': [
21
+ 'error',
22
+ 'always'
23
+ ],
24
+ 'no-console': 'off',
25
+ 'prefer-arrow-callback': 'error'
26
+ }
27
+ };
@@ -0,0 +1,33 @@
1
+ # This workflow will publish npm package on release
2
+ # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ push:
8
+ branches: [ "add-ci" ]
9
+ release:
10
+ types: [created]
11
+
12
+ jobs:
13
+ publish-npm:
14
+ runs-on: ubuntu-latest
15
+ env:
16
+ CPATH: /tmp/beamcoder/.ffmpeg/ffmpeg/include/
17
+ PKG_CONFIG_PATH: /tmp/beamcoder/.ffmpeg/ffmpeg/lib/pkgconfig/
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - uses: actions/setup-node@v3
21
+ with:
22
+ node-version: 20
23
+ registry-url: https://registry.npmjs.org/
24
+ - run: mkdir /tmp/beamcoder
25
+ - run: cp -r . /tmp/beamcoder
26
+ - run: sudo ./scripts/install_beamcoder_dependencies.sh
27
+ working-directory: /tmp/beamcoder
28
+ - run: yarn install --frozen-lockfile
29
+ working-directory: /tmp/beamcoder
30
+ - run: yarn publish
31
+ working-directory: /tmp/beamcoder
32
+ env:
33
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}