@scrypted/libav 1.0.159 → 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.
@@ -26,6 +26,7 @@
26
26
  "scale_eval.h": "c",
27
27
  "filters.h": "c",
28
28
  "ratio": "cpp",
29
- "unordered_map": "cpp"
29
+ "unordered_map": "cpp",
30
+ "__bit_reference": "cpp"
30
31
  }
31
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/libav",
3
- "version": "1.0.159",
3
+ "version": "1.0.160",
4
4
  "dependencies": {
5
5
  "detect-libc": "^2.0.3",
6
6
  "follow-redirects": "^1.15.9",
@@ -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
- // fprintf(stderr, "write_packet called with size: %d\n", buf_size);
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([buf, buf_size](Napi::Env env, Napi::Function jsCallback)
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, buf, buf_size);
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");