Skip to content

Commit

Permalink
* Add new Frame.pictType field set to I, P, B, etc by `FFmpe…
Browse files Browse the repository at this point in the history
…gFrameGrabber` (pull #1730)
  • Loading branch information
steeveen committed Dec 13, 2021
1 parent 33bea56 commit d9a1ec5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add new `Frame.pictType` field set to `I`, `P`, `B`, etc by `FFmpegFrameGrabber` ([pull #1730](https://github.com/bytedeco/javacv/pull/1730))
* Set metadata for `AVFrame.opaque` in `FFmpegFrameGrabber` with call to `av_frame_copy_props()` ([issue #1729](https://github.com/bytedeco/javacv/issues/1729))
* Add `charset` property to `FrameGrabber` and `FrameRecorder` to use for metadata from FFmpeg ([pull #1720](https://github.com/bytedeco/javacv/pull/1720))
* Call `Frame.close()` on temporary clones in `Java2DFrameUtils` to prevent premature deallocations ([issue #1716](https://github.com/bytedeco/javacv/issues/1716))
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,7 @@ public synchronized Frame grabFrame(boolean doAudio, boolean doVideo, boolean do
done = true;
frame.timestamp = timestamp;
frame.keyFrame = picture.key_frame() != 0;
frame.pictType = (char)av_get_picture_type_char(picture.pict_type());
}
}
} else if (doAudio && audio_st != null && pkt.stream_index() == audio_st.index()) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/bytedeco/javacv/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public class Frame implements AutoCloseable, Indexable {
/** A flag set by a FrameGrabber or a FrameRecorder to indicate a key frame. */
public boolean keyFrame;

/** The type of the image frame ('I', 'P', 'B', etc). */
public char pictType;

/** Constants to be used for {@link #imageDepth}. */
public static final int
DEPTH_BYTE = -8,
Expand Down Expand Up @@ -125,6 +128,7 @@ public Frame(int width, int height, int depth, int channels, int imageStride) {
this.imageDepth = depth;
this.imageChannels = channels;
this.imageStride = imageStride;
this.pictType = '\0';
this.image = new Buffer[1];
this.data = null;
this.streamIndex = -1;
Expand Down Expand Up @@ -216,6 +220,7 @@ public Frame clone() {
newFrame.imageChannels = imageChannels;
newFrame.imageStride = imageStride;
newFrame.keyFrame = keyFrame;
newFrame.pictType = pictType;
newFrame.streamIndex = streamIndex;
newFrame.opaque = new Pointer[3];
if (image != null) {
Expand Down

0 comments on commit d9a1ec5

Please sign in to comment.