diff --git a/src/main/java/net/bramp/ffmpeg/FFmpegException.java b/src/main/java/net/bramp/ffmpeg/FFmpegException.java index a6b5cb36..d00dc011 100644 --- a/src/main/java/net/bramp/ffmpeg/FFmpegException.java +++ b/src/main/java/net/bramp/ffmpeg/FFmpegException.java @@ -7,7 +7,7 @@ public class FFmpegException extends IOException { private static final long serialVersionUID = 3048288225568984942L; - private FFmpegError error; + private final FFmpegError error; public FFmpegException(String message, FFmpegError error) { super(message); diff --git a/src/main/java/net/bramp/ffmpeg/probe/FFmpegDisposition.java b/src/main/java/net/bramp/ffmpeg/probe/FFmpegDisposition.java index 887b279b..ad961513 100644 --- a/src/main/java/net/bramp/ffmpeg/probe/FFmpegDisposition.java +++ b/src/main/java/net/bramp/ffmpeg/probe/FFmpegDisposition.java @@ -44,6 +44,12 @@ public class FFmpegDisposition { @JsonAdapter(BooleanTypeAdapter.class) public boolean attached_pic; + @JsonAdapter(BooleanTypeAdapter.class) + public boolean timed_thumbnails; + + @JsonAdapter(BooleanTypeAdapter.class) + public boolean non_diegetic; + @JsonAdapter(BooleanTypeAdapter.class) public boolean captions; @@ -53,6 +59,12 @@ public class FFmpegDisposition { @JsonAdapter(BooleanTypeAdapter.class) public boolean metadata; + @JsonAdapter(BooleanTypeAdapter.class) + public boolean dependent; + + @JsonAdapter(BooleanTypeAdapter.class) + public boolean still_image; + public boolean isDefault() { return _default; } @@ -97,6 +109,14 @@ public boolean isAttachedPic() { return attached_pic; } + public boolean isTimedThumbnails() { + return timed_thumbnails; + } + + public boolean isNonDiegetic() { + return non_diegetic; + } + public boolean isCaptions() { return captions; } @@ -108,4 +128,12 @@ public boolean isDescriptions() { public boolean isMetadata() { return metadata; } + + public boolean isDependent() { + return dependent; + } + + public boolean isStillImage() { + return still_image; + } } diff --git a/src/main/java/net/bramp/ffmpeg/probe/FFmpegError.java b/src/main/java/net/bramp/ffmpeg/probe/FFmpegError.java index 13b49c99..da9634f7 100644 --- a/src/main/java/net/bramp/ffmpeg/probe/FFmpegError.java +++ b/src/main/java/net/bramp/ffmpeg/probe/FFmpegError.java @@ -2,10 +2,14 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import java.io.Serializable; + @SuppressFBWarnings( value = {"UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD"}, justification = "POJO objects where the fields are populated by gson") -public class FFmpegError { +public class FFmpegError implements Serializable { + private static final long serialVersionUID = 1L; + public int code; public String string; diff --git a/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java b/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java index 4cea7bcb..32099f8a 100644 --- a/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java +++ b/src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java @@ -39,6 +39,7 @@ public class FFmpegStream { public int refs; public String is_avc; public String nal_length_size; + public String id; public Fraction r_frame_rate; public Fraction avg_frame_rate; public Fraction time_base; @@ -145,6 +146,10 @@ public String getNalLengthSize() { return nal_length_size; } + public String getId() { + return id; + } + public Fraction getRFrameRate() { return r_frame_rate; } diff --git a/src/test/java/net/bramp/ffmpeg/FFprobeTest.java b/src/test/java/net/bramp/ffmpeg/FFprobeTest.java index 4ef49d4a..d211dfea 100644 --- a/src/test/java/net/bramp/ffmpeg/FFprobeTest.java +++ b/src/test/java/net/bramp/ffmpeg/FFprobeTest.java @@ -547,8 +547,9 @@ public void testFullVideoStreamDeserialization() throws IOException { assertEquals(31, stream.getLevel()); assertEquals("left", stream.getChromaLocation()); assertEquals(1, stream.getRefs()); - assertEquals("1", stream.getIsAvc()); + assertEquals("true", stream.getIsAvc()); assertEquals("4", stream.getNalLengthSize()); + assertEquals("0x1", stream.getId()); assertEquals(Fraction.getFraction(25, 1), stream.getRFrameRate()); assertEquals(Fraction.getFraction(25, 1), stream.getAvgFrameRate()); assertEquals(Fraction.getFraction(1, 12800), stream.getTimeBase()); @@ -565,7 +566,7 @@ public void testFullVideoStreamDeserialization() throws IOException { assertEquals(0, stream.getSampleRate()); assertEquals(0, stream.getChannels()); assertNull(stream.getChannelLayout()); - assertEquals(3, stream.getTags().size()); + assertEquals(4, stream.getTags().size()); assertEquals("und", stream.getTags().get("language")); assertEquals(0, stream.getSideDataList().size()); } @@ -594,6 +595,7 @@ public void testFullAudioStreamDeserialization() throws IOException { assertEquals(0, stream.getRefs()); assertNull(stream.getIsAvc()); assertNull(stream.getNalLengthSize()); + assertEquals("0x2", stream.getId()); assertEquals(Fraction.getFraction(0, 1), stream.getRFrameRate()); assertEquals(Fraction.getFraction(0, 1), stream.getAvgFrameRate()); assertEquals(Fraction.getFraction(1, 48_000), stream.getTimeBase()); @@ -610,7 +612,7 @@ public void testFullAudioStreamDeserialization() throws IOException { assertEquals(48000, stream.getSampleRate()); assertEquals(6, stream.getChannels()); assertEquals("5.1", stream.getChannelLayout()); - assertEquals(3, stream.getTags().size()); + assertEquals(4, stream.getTags().size()); assertEquals("und", stream.getTags().get("language")); assertEquals(0, stream.getSideDataList().size()); } @@ -663,9 +665,13 @@ public void testDispositionWithAllFieldsTrueDeserialization() throws IOException assertTrue(disposition.isVisualImpaired()); assertTrue(disposition.isCleanEffects()); assertTrue(disposition.isAttachedPic()); + assertTrue(disposition.isTimedThumbnails()); + assertTrue(disposition.isNonDiegetic()); assertTrue(disposition.isCaptions()); assertTrue(disposition.isDescriptions()); assertTrue(disposition.isMetadata()); + assertTrue(disposition.isDependent()); + assertTrue(disposition.isStillImage()); } @Test diff --git a/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-big_buck_bunny_720p_1mb.mp4 b/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-big_buck_bunny_720p_1mb.mp4 index 79380adc..0c9c75c2 100644 --- a/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-big_buck_bunny_720p_1mb.mp4 +++ b/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-big_buck_bunny_720p_1mb.mp4 @@ -13,15 +13,19 @@ "height": 720, "coded_width": 1280, "coded_height": 720, + "closed_captions": 0, + "film_grain": 0, "has_b_frames": 0, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p", "level": 31, "chroma_location": "left", + "field_order": "progressive", "refs": 1, - "is_avc": "1", + "is_avc": "true", "nal_length_size": "4", + "id": "0x1", "r_frame_rate": "25/1", "avg_frame_rate": "25/1", "time_base": "1/12800", @@ -32,6 +36,7 @@ "bit_rate": "1205959", "bits_per_raw_sample": "8", "nb_frames": "132", + "extradata_size": 38, "disposition": { "default": 1, "dub": 0, @@ -43,12 +48,20 @@ "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, - "attached_pic": 0 + "attached_pic": 0, + "timed_thumbnails": 0, + "non_diegetic": 0, + "captions": 0, + "descriptions": 0, + "metadata": 0, + "dependent": 0, + "still_image": 0 }, "tags": { "creation_time": "1970-01-01 00:00:00", "language": "und", - "handler_name": "VideoHandler" + "handler_name": "VideoHandler", + "vendor_id": "[0][0][0][0]" } }, { @@ -65,6 +78,8 @@ "channels": 6, "channel_layout": "5.1", "bits_per_sample": 0, + "initial_padding": 0, + "id": "0x2", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/48000", @@ -75,6 +90,7 @@ "bit_rate": "384828", "max_bit_rate": "400392", "nb_frames": "249", + "extradata_size": 2, "disposition": { "default": 1, "dub": 0, @@ -86,12 +102,20 @@ "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, - "attached_pic": 0 + "attached_pic": 0, + "timed_thumbnails": 0, + "non_diegetic": 0, + "captions": 0, + "descriptions": 0, + "metadata": 0, + "dependent": 0, + "still_image": 0 }, "tags": { - "creation_time": "1970-01-01 00:00:00", + "creation_time": "1970-01-01T00:00:00.000000Z", "language": "und", - "handler_name": "SoundHandler" + "handler_name": "SoundHandler", + "vendor_id": "[0][0][0][0]" } } ], diff --git a/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-disposition_all_true b/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-disposition_all_true index b090d66d..e15ba102 100644 --- a/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-disposition_all_true +++ b/src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-disposition_all_true @@ -51,6 +51,7 @@ "clean_effects": 1, "attached_pic": 1, "timed_thumbnails": 1, + "non_diegetic": 1, "captions": 1, "descriptions": 1, "metadata": 1,