Skip to content

Commit

Permalink
Update CHANGELOG.md and add one more check
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Nov 1, 2019
1 parent e22c1f4 commit 9cb8d1a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Increase thread safety of `FFmpegFrameFilter`, `FFmpegFrameGrabber`, and `FFmpegFrameRecorder` with `volatile boolean started` flag ([pull #1325](https://github.com/bytedeco/javacv/pull/1325))
* Let `FFmpegFrameFilter.push(null)` indicate EOF to audio filters as well ([issue #1315](https://github.com/bytedeco/javacv/issues/1315))
* Add `RealSense2FrameGrabber` to capture images with librealsense2 ([pull #1316](https://github.com/bytedeco/javacv/pull/1316))
* Disable seek function in `FFmpegFrameGrabber` when `maximumSize <= 0` ([issue #1304](https://github.com/bytedeco/javacv/issues/1304))
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ public Frame grabFrame(boolean doAudio, boolean doVideo, boolean doProcessing, b

public AVPacket grabPacket() throws Exception {
if (oc == null || oc.isNull()) {
throw new Exception("Could not trigger: No AVFormatContext. (Has start() been called?)");
throw new Exception("Could not grab: No AVFormatContext. (Has start() been called?)");
}
if (!started) {
throw new Exception("start() was not called successfully!");
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/org/bytedeco/javacv/FFmpegFrameRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ public void setCloseOutputStream(boolean closeOutputStream) {
setFrameNumber((int)Math.round(timestamp * getFrameRate() / 1000000L));
}

public void start(AVFormatContext ifmt_ctx) throws Exception {
this.ifmt_ctx = ifmt_ctx;
public void start(AVFormatContext inputFormatContext) throws Exception {
this.ifmt_ctx = inputFormatContext;
start();
}

Expand Down Expand Up @@ -1246,6 +1246,12 @@ private void writePacket(int mediaType, AVPacket avPacket) throws Exception {
}

public boolean recordPacket(AVPacket pkt) throws Exception {
if (ifmt_ctx == null) {
throw new Exception("No input format context (Has start(AVFormatContext) been called?)");
}
if (!started) {
throw new Exception("start() was not called successfully!");
}

if (pkt == null) {
return false;
Expand Down

0 comments on commit 9cb8d1a

Please sign in to comment.