@scrypted/libav 1.0.15 → 1.0.17

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.15",
3
+ "version": "1.0.17",
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,20 +83,16 @@ 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
- fprintf(stdout, "finished reading a frame\n");
97
- av_packet_free(&packet);
98
- result = frame;
99
- return;
90
+ if (avcodec_receive_frame(codecContext, frame) == 0)
91
+ {
92
+ av_packet_free(&packet);
93
+ result = frame;
94
+ return;
95
+ }
100
96
  }
101
97
  }
102
98
  av_packet_unref(packet); // Reset the packet for the next frame
@@ -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);