Skip to content

Commit

Permalink
Feature/update big bock bunny fixture (#343)
Browse files Browse the repository at this point in the history
* chore: Update fixture
* feat: Add missing fields to disposition
* feat: Add missing id field to FFmpegStream
* chore: Add Serializable to FFmpegError

fixes #273
  • Loading branch information
Euklios authored Aug 9, 2024
1 parent 69b2912 commit 813640f
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/bramp/ffmpeg/FFmpegException.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/net/bramp/ffmpeg/probe/FFmpegDisposition.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -108,4 +128,12 @@ public boolean isDescriptions() {
public boolean isMetadata() {
return metadata;
}

public boolean isDependent() {
return dependent;
}

public boolean isStillImage() {
return still_image;
}
}
6 changes: 5 additions & 1 deletion src/main/java/net/bramp/ffmpeg/probe/FFmpegError.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -145,6 +146,10 @@ public String getNalLengthSize() {
return nal_length_size;
}

public String getId() {
return id;
}

public Fraction getRFrameRate() {
return r_frame_rate;
}
Expand Down
12 changes: 9 additions & 3 deletions src/test/java/net/bramp/ffmpeg/FFprobeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
}
Expand Down Expand Up @@ -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());
Expand All @@ -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());
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -32,6 +36,7 @@
"bit_rate": "1205959",
"bits_per_raw_sample": "8",
"nb_frames": "132",
"extradata_size": 38,
"disposition": {
"default": 1,
"dub": 0,
Expand All @@ -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]"
}
},
{
Expand All @@ -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",
Expand All @@ -75,6 +90,7 @@
"bit_rate": "384828",
"max_bit_rate": "400392",
"nb_frames": "249",
"extradata_size": 2,
"disposition": {
"default": 1,
"dub": 0,
Expand All @@ -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]"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"clean_effects": 1,
"attached_pic": 1,
"timed_thumbnails": 1,
"non_diegetic": 1,
"captions": 1,
"descriptions": 1,
"metadata": 1,
Expand Down

0 comments on commit 813640f

Please sign in to comment.