@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.
- package/.circleci/config.yml +41 -0
- package/.circleci/images/testbeam10-4.1/Dockerfile +12 -0
- package/.circleci/test_image/Dockerfile +14 -0
- package/.circleci/test_image/build.md +13 -0
- package/.eslintrc.js +27 -0
- package/.github/workflows/publish-npm.yml +33 -0
- package/LICENSE +674 -0
- package/README.md +1221 -0
- package/beamstreams.js +692 -0
- package/binding.gyp +103 -0
- package/examples/encode_h264.js +92 -0
- package/examples/jpeg_app.js +55 -0
- package/examples/jpeg_filter_app.js +101 -0
- package/examples/make_mp4.js +123 -0
- package/images/beamcoder_small.jpg +0 -0
- package/index.d.ts +83 -0
- package/index.js +44 -0
- package/install_ffmpeg.js +240 -0
- package/package.json +45 -0
- package/scratch/decode_aac.js +38 -0
- package/scratch/decode_avci.js +50 -0
- package/scratch/decode_hevc.js +38 -0
- package/scratch/decode_pcm.js +39 -0
- package/scratch/make_a_mux.js +68 -0
- package/scratch/muxer.js +74 -0
- package/scratch/read_wav.js +35 -0
- package/scratch/simple_mux.js +39 -0
- package/scratch/stream_avci.js +127 -0
- package/scratch/stream_mp4.js +78 -0
- package/scratch/stream_mux.js +47 -0
- package/scratch/stream_pcm.js +82 -0
- package/scratch/stream_wav.js +62 -0
- package/scripts/install_beamcoder_dependencies.sh +25 -0
- package/src/adaptor.h +202 -0
- package/src/beamcoder.cc +937 -0
- package/src/beamcoder_util.cc +1129 -0
- package/src/beamcoder_util.h +206 -0
- package/src/codec.cc +7386 -0
- package/src/codec.h +44 -0
- package/src/codec_par.cc +1818 -0
- package/src/codec_par.h +40 -0
- package/src/decode.cc +569 -0
- package/src/decode.h +75 -0
- package/src/demux.cc +584 -0
- package/src/demux.h +88 -0
- package/src/encode.cc +496 -0
- package/src/encode.h +72 -0
- package/src/filter.cc +1888 -0
- package/src/filter.h +30 -0
- package/src/format.cc +5287 -0
- package/src/format.h +77 -0
- package/src/frame.cc +2681 -0
- package/src/frame.h +52 -0
- package/src/governor.cc +286 -0
- package/src/governor.h +30 -0
- package/src/hwcontext.cc +378 -0
- package/src/hwcontext.h +35 -0
- package/src/log.cc +186 -0
- package/src/log.h +20 -0
- package/src/mux.cc +834 -0
- package/src/mux.h +106 -0
- package/src/packet.cc +762 -0
- package/src/packet.h +49 -0
- package/test/codecParamsSpec.js +148 -0
- package/test/decoderSpec.js +56 -0
- package/test/demuxerSpec.js +41 -0
- package/test/encoderSpec.js +69 -0
- package/test/filtererSpec.js +47 -0
- package/test/formatSpec.js +343 -0
- package/test/frameSpec.js +145 -0
- package/test/introspectionSpec.js +73 -0
- package/test/muxerSpec.js +34 -0
- package/test/packetSpec.js +122 -0
- package/types/Beamstreams.d.ts +98 -0
- package/types/Codec.d.ts +123 -0
- package/types/CodecContext.d.ts +555 -0
- package/types/CodecPar.d.ts +108 -0
- package/types/Decoder.d.ts +137 -0
- package/types/Demuxer.d.ts +113 -0
- package/types/Encoder.d.ts +94 -0
- package/types/Filter.d.ts +324 -0
- package/types/FormatContext.d.ts +380 -0
- package/types/Frame.d.ts +295 -0
- package/types/HWContext.d.ts +62 -0
- package/types/Muxer.d.ts +121 -0
- package/types/Packet.d.ts +82 -0
- package/types/PrivClass.d.ts +25 -0
- package/types/Stream.d.ts +165 -0
package/src/mux.h
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Aerostat Beam Coder - Node.js native bindings for FFmpeg.
|
|
3
|
+
Copyright (C) 2019 Streampunk Media Ltd.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
https://www.streampunk.media/ mailto:furnace@streampunk.media
|
|
19
|
+
14 Ormiscaig, Aultbea, Achnasheen, IV22 2JJ U.K.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
#ifndef MUX_H
|
|
23
|
+
#define MUX_H
|
|
24
|
+
|
|
25
|
+
#include "node_api.h"
|
|
26
|
+
#include "beamcoder_util.h"
|
|
27
|
+
#include "format.h"
|
|
28
|
+
#include "frame.h"
|
|
29
|
+
#include "adaptor.h"
|
|
30
|
+
|
|
31
|
+
extern "C" {
|
|
32
|
+
#include <libavformat/avformat.h>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
napi_value muxer(napi_env env, napi_callback_info info); // Set to interleaving once
|
|
36
|
+
|
|
37
|
+
void openIOExecute(napi_env env, void* data);
|
|
38
|
+
void openIOComplete(napi_env env, napi_status asyncStatus, void* data);
|
|
39
|
+
napi_value openIO(napi_env env, napi_callback_info info);
|
|
40
|
+
|
|
41
|
+
void writeHeaderExecute(napi_env env, void* data);
|
|
42
|
+
void writeHeaderComplete(napi_env env, napi_status asyncStatus, void* data);
|
|
43
|
+
napi_value writeHeader(napi_env env, napi_callback_info info);
|
|
44
|
+
|
|
45
|
+
void initOutputExecute(napi_env env, void* data);
|
|
46
|
+
void initOutputComplete(napi_env env, napi_status asyncStatus, void* data);
|
|
47
|
+
napi_value initOutput(napi_env env, napi_callback_info info);
|
|
48
|
+
|
|
49
|
+
void writeFrameExecute(napi_env env, void* data);
|
|
50
|
+
void writeFrameComplete(napi_env env, napi_status asyncStatus, void* data);
|
|
51
|
+
napi_value writeFrame(napi_env env, napi_callback_info info); // IF AVFrame, must include stream_index
|
|
52
|
+
|
|
53
|
+
void writeTrailerExecute(napi_env env, void* data);
|
|
54
|
+
void writeTrailerComplete(napi_env env, napi_status asyncStatus, void* data);
|
|
55
|
+
napi_value writeTrailer(napi_env env, napi_callback_info info);
|
|
56
|
+
|
|
57
|
+
napi_value forceClose(napi_env env, napi_callback_info info);
|
|
58
|
+
|
|
59
|
+
struct openIOCarrier : carrier {
|
|
60
|
+
AVFormatContext* format;
|
|
61
|
+
int flags = AVIO_FLAG_WRITE;
|
|
62
|
+
AVDictionary* options = nullptr;
|
|
63
|
+
~openIOCarrier() {
|
|
64
|
+
if (options != nullptr) av_dict_free(&options);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
struct writeHeaderCarrier : carrier {
|
|
69
|
+
AVFormatContext* format;
|
|
70
|
+
AVDictionary* options = nullptr;
|
|
71
|
+
int result = -1;
|
|
72
|
+
~writeHeaderCarrier() {
|
|
73
|
+
if (options != nullptr) av_dict_free(&options);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
struct initOutputCarrier : carrier {
|
|
78
|
+
AVFormatContext* format;
|
|
79
|
+
AVDictionary* options = nullptr;
|
|
80
|
+
int result = -1;
|
|
81
|
+
~initOutputCarrier() {
|
|
82
|
+
if (options != nullptr) av_dict_free(&options);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
struct writeFrameCarrier : carrier {
|
|
87
|
+
AVFormatContext* format;
|
|
88
|
+
Adaptor *adaptor = nullptr;
|
|
89
|
+
AVPacket* packet = nullptr;
|
|
90
|
+
AVFrame* frame = nullptr;
|
|
91
|
+
int streamIndex = 0;
|
|
92
|
+
bool interleaved = true;
|
|
93
|
+
~writeFrameCarrier() {
|
|
94
|
+
if (packet != nullptr) { av_packet_free(&packet); }
|
|
95
|
+
if (frame != nullptr) { av_frame_free(&frame); }
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
struct writeTrailerCarrier : carrier {
|
|
100
|
+
AVFormatContext* format;
|
|
101
|
+
Adaptor *adaptor = nullptr;
|
|
102
|
+
~writeTrailerCarrier() {
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
#endif // MUX_H
|