@scrypted/libav 1.0.158 → 1.0.160
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/.vscode/settings.json +2 -1
- package/package.json +1 -1
- package/src/bsf.cpp +8 -0
- package/src/formatcontext.cpp +11 -3
- package/src/frame.cpp +1 -0
package/.vscode/settings.json
CHANGED
package/package.json
CHANGED
package/src/bsf.cpp
CHANGED
|
@@ -201,5 +201,13 @@ Napi::Value AVBitstreamFilter::CopyParameters(const Napi::CallbackInfo &info)
|
|
|
201
201
|
Napi::Error::New(info.Env(), AVErrorString(ret)).ThrowAsJavaScriptException();
|
|
202
202
|
return info.Env().Undefined();
|
|
203
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
|
+
|
|
204
212
|
return info.Env().Undefined();
|
|
205
213
|
}
|
package/src/formatcontext.cpp
CHANGED
|
@@ -556,12 +556,20 @@ Napi::Value AVFormatContextObject::GetMetadata(const Napi::CallbackInfo &info)
|
|
|
556
556
|
static int write_packet(void *opaque, const uint8_t *buf, int buf_size)
|
|
557
557
|
{
|
|
558
558
|
AVFormatContextObject *formatContextObject = (AVFormatContextObject *)opaque;
|
|
559
|
-
|
|
559
|
+
|
|
560
|
+
// malloc and copy buf
|
|
561
|
+
uint8_t *copy = (uint8_t *)av_malloc(buf_size);
|
|
562
|
+
if (!copy)
|
|
563
|
+
{
|
|
564
|
+
return AVERROR(ENOMEM);
|
|
565
|
+
}
|
|
566
|
+
memcpy(copy, buf, buf_size);
|
|
560
567
|
|
|
561
568
|
// Call the JavaScript function on the main thread
|
|
562
|
-
formatContextObject->callbackRef.BlockingCall([
|
|
569
|
+
formatContextObject->callbackRef.BlockingCall([copy, buf_size](Napi::Env env, Napi::Function jsCallback)
|
|
563
570
|
{
|
|
564
|
-
Napi::Buffer<uint8_t> buffer = Napi::Buffer<uint8_t>::Copy(env,
|
|
571
|
+
Napi::Buffer<uint8_t> buffer = Napi::Buffer<uint8_t>::Copy(env, copy, buf_size);
|
|
572
|
+
av_free(copy);
|
|
565
573
|
jsCallback.Call({buffer});
|
|
566
574
|
//
|
|
567
575
|
});
|
package/src/frame.cpp
CHANGED
|
@@ -248,6 +248,7 @@ Napi::Value AVFrameObject::CreateEncoder(const Napi::CallbackInfo &info)
|
|
|
248
248
|
c->pix_fmt = (enum AVPixelFormat)frame_->format;
|
|
249
249
|
c->time_base.num = timeBaseNum;
|
|
250
250
|
c->time_base.den = timeBaseDen;
|
|
251
|
+
c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
|
251
252
|
|
|
252
253
|
// set framerate if it exists
|
|
253
254
|
Napi::Value framerateValue = options.Get("framerate");
|