@scrypted/libav 1.0.14 → 1.0.16

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.
@@ -0,0 +1,6 @@
1
+ {
2
+ "files.associations": {
3
+ "*.yml": "yaml",
4
+ "__locale": "cpp"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/libav",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "dependencies": {
5
5
  "node-addon-api": "^8.1.0",
6
6
  "prebuild-install": "npm:@scrypted/prebuild-install@^7.1.8"
package/src/decode.cpp CHANGED
@@ -83,24 +83,20 @@ public:
83
83
  // Decode video frames
84
84
  while (av_read_frame(fmt_ctx_, packet) >= 0)
85
85
  {
86
- fprintf(stdout, "read a frame\n");
87
- if (packet->stream_index != videoStreamIndex)
86
+ if (packet->stream_index == videoStreamIndex)
88
87
  {
89
- continue;
90
- }
91
-
92
- if (avcodec_send_packet(codecContext, packet) == 0)
93
- {
94
- if (avcodec_receive_frame(codecContext, frame) == 0)
88
+ if (avcodec_send_packet(codecContext, packet) == 0)
95
89
  {
96
- av_packet_free(&packet);
97
- result = frame;
98
- return;
90
+ if (avcodec_receive_frame(codecContext, frame) == 0)
91
+ {
92
+ av_packet_free(&packet);
93
+ result = frame;
94
+ return;
95
+ }
99
96
  }
97
+ av_packet_unref(packet); // Reset the packet for the next frame
100
98
  }
101
- av_packet_unref(packet); // Reset the packet for the next frame
102
99
  }
103
- fprintf(stdout, "finished reading a frame\n");
104
100
 
105
101
  av_frame_free(&frame);
106
102
  av_packet_free(&packet);
@@ -440,12 +436,12 @@ Napi::Value AVFormatContextObject::Open(const Napi::CallbackInfo &info)
440
436
  return env.Null();
441
437
  }
442
438
 
443
- // Find the first video stream
444
- #ifdef __APPLE__
439
+ // Find the first video stream
440
+ #ifdef __APPLE__
445
441
  const struct AVCodec *codec = nullptr;
446
- #else
442
+ #else
447
443
  struct AVCodec *codec = nullptr;
448
- #endif
444
+ #endif
449
445
 
450
446
  /* find the video stream information */
451
447
  ret = av_find_best_stream(fmt_ctx_, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);