Skip to content

Commit 813640f

Browse files
authored
Feature/update big bock bunny fixture (#343)
* chore: Update fixture * feat: Add missing fields to disposition * feat: Add missing id field to FFmpegStream * chore: Add Serializable to FFmpegError fixes #273
1 parent 69b2912 commit 813640f

File tree

7 files changed

+79
-11
lines changed

7 files changed

+79
-11
lines changed

src/main/java/net/bramp/ffmpeg/FFmpegException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class FFmpegException extends IOException {
88

99
private static final long serialVersionUID = 3048288225568984942L;
10-
private FFmpegError error;
10+
private final FFmpegError error;
1111

1212
public FFmpegException(String message, FFmpegError error) {
1313
super(message);

src/main/java/net/bramp/ffmpeg/probe/FFmpegDisposition.java

+28
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ public class FFmpegDisposition {
4444
@JsonAdapter(BooleanTypeAdapter.class)
4545
public boolean attached_pic;
4646

47+
@JsonAdapter(BooleanTypeAdapter.class)
48+
public boolean timed_thumbnails;
49+
50+
@JsonAdapter(BooleanTypeAdapter.class)
51+
public boolean non_diegetic;
52+
4753
@JsonAdapter(BooleanTypeAdapter.class)
4854
public boolean captions;
4955

@@ -53,6 +59,12 @@ public class FFmpegDisposition {
5359
@JsonAdapter(BooleanTypeAdapter.class)
5460
public boolean metadata;
5561

62+
@JsonAdapter(BooleanTypeAdapter.class)
63+
public boolean dependent;
64+
65+
@JsonAdapter(BooleanTypeAdapter.class)
66+
public boolean still_image;
67+
5668
public boolean isDefault() {
5769
return _default;
5870
}
@@ -97,6 +109,14 @@ public boolean isAttachedPic() {
97109
return attached_pic;
98110
}
99111

112+
public boolean isTimedThumbnails() {
113+
return timed_thumbnails;
114+
}
115+
116+
public boolean isNonDiegetic() {
117+
return non_diegetic;
118+
}
119+
100120
public boolean isCaptions() {
101121
return captions;
102122
}
@@ -108,4 +128,12 @@ public boolean isDescriptions() {
108128
public boolean isMetadata() {
109129
return metadata;
110130
}
131+
132+
public boolean isDependent() {
133+
return dependent;
134+
}
135+
136+
public boolean isStillImage() {
137+
return still_image;
138+
}
111139
}

src/main/java/net/bramp/ffmpeg/probe/FFmpegError.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
44

5+
import java.io.Serializable;
6+
57
@SuppressFBWarnings(
68
value = {"UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD"},
79
justification = "POJO objects where the fields are populated by gson")
8-
public class FFmpegError {
10+
public class FFmpegError implements Serializable {
11+
private static final long serialVersionUID = 1L;
12+
913
public int code;
1014
public String string;
1115

src/main/java/net/bramp/ffmpeg/probe/FFmpegStream.java

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class FFmpegStream {
3939
public int refs;
4040
public String is_avc;
4141
public String nal_length_size;
42+
public String id;
4243
public Fraction r_frame_rate;
4344
public Fraction avg_frame_rate;
4445
public Fraction time_base;
@@ -145,6 +146,10 @@ public String getNalLengthSize() {
145146
return nal_length_size;
146147
}
147148

149+
public String getId() {
150+
return id;
151+
}
152+
148153
public Fraction getRFrameRate() {
149154
return r_frame_rate;
150155
}

src/test/java/net/bramp/ffmpeg/FFprobeTest.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,9 @@ public void testFullVideoStreamDeserialization() throws IOException {
547547
assertEquals(31, stream.getLevel());
548548
assertEquals("left", stream.getChromaLocation());
549549
assertEquals(1, stream.getRefs());
550-
assertEquals("1", stream.getIsAvc());
550+
assertEquals("true", stream.getIsAvc());
551551
assertEquals("4", stream.getNalLengthSize());
552+
assertEquals("0x1", stream.getId());
552553
assertEquals(Fraction.getFraction(25, 1), stream.getRFrameRate());
553554
assertEquals(Fraction.getFraction(25, 1), stream.getAvgFrameRate());
554555
assertEquals(Fraction.getFraction(1, 12800), stream.getTimeBase());
@@ -565,7 +566,7 @@ public void testFullVideoStreamDeserialization() throws IOException {
565566
assertEquals(0, stream.getSampleRate());
566567
assertEquals(0, stream.getChannels());
567568
assertNull(stream.getChannelLayout());
568-
assertEquals(3, stream.getTags().size());
569+
assertEquals(4, stream.getTags().size());
569570
assertEquals("und", stream.getTags().get("language"));
570571
assertEquals(0, stream.getSideDataList().size());
571572
}
@@ -594,6 +595,7 @@ public void testFullAudioStreamDeserialization() throws IOException {
594595
assertEquals(0, stream.getRefs());
595596
assertNull(stream.getIsAvc());
596597
assertNull(stream.getNalLengthSize());
598+
assertEquals("0x2", stream.getId());
597599
assertEquals(Fraction.getFraction(0, 1), stream.getRFrameRate());
598600
assertEquals(Fraction.getFraction(0, 1), stream.getAvgFrameRate());
599601
assertEquals(Fraction.getFraction(1, 48_000), stream.getTimeBase());
@@ -610,7 +612,7 @@ public void testFullAudioStreamDeserialization() throws IOException {
610612
assertEquals(48000, stream.getSampleRate());
611613
assertEquals(6, stream.getChannels());
612614
assertEquals("5.1", stream.getChannelLayout());
613-
assertEquals(3, stream.getTags().size());
615+
assertEquals(4, stream.getTags().size());
614616
assertEquals("und", stream.getTags().get("language"));
615617
assertEquals(0, stream.getSideDataList().size());
616618
}
@@ -663,9 +665,13 @@ public void testDispositionWithAllFieldsTrueDeserialization() throws IOException
663665
assertTrue(disposition.isVisualImpaired());
664666
assertTrue(disposition.isCleanEffects());
665667
assertTrue(disposition.isAttachedPic());
668+
assertTrue(disposition.isTimedThumbnails());
669+
assertTrue(disposition.isNonDiegetic());
666670
assertTrue(disposition.isCaptions());
667671
assertTrue(disposition.isDescriptions());
668672
assertTrue(disposition.isMetadata());
673+
assertTrue(disposition.isDependent());
674+
assertTrue(disposition.isStillImage());
669675
}
670676

671677
@Test

src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-big_buck_bunny_720p_1mb.mp4

+30-6
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
"height": 720,
1414
"coded_width": 1280,
1515
"coded_height": 720,
16+
"closed_captions": 0,
17+
"film_grain": 0,
1618
"has_b_frames": 0,
1719
"sample_aspect_ratio": "1:1",
1820
"display_aspect_ratio": "16:9",
1921
"pix_fmt": "yuv420p",
2022
"level": 31,
2123
"chroma_location": "left",
24+
"field_order": "progressive",
2225
"refs": 1,
23-
"is_avc": "1",
26+
"is_avc": "true",
2427
"nal_length_size": "4",
28+
"id": "0x1",
2529
"r_frame_rate": "25/1",
2630
"avg_frame_rate": "25/1",
2731
"time_base": "1/12800",
@@ -32,6 +36,7 @@
3236
"bit_rate": "1205959",
3337
"bits_per_raw_sample": "8",
3438
"nb_frames": "132",
39+
"extradata_size": 38,
3540
"disposition": {
3641
"default": 1,
3742
"dub": 0,
@@ -43,12 +48,20 @@
4348
"hearing_impaired": 0,
4449
"visual_impaired": 0,
4550
"clean_effects": 0,
46-
"attached_pic": 0
51+
"attached_pic": 0,
52+
"timed_thumbnails": 0,
53+
"non_diegetic": 0,
54+
"captions": 0,
55+
"descriptions": 0,
56+
"metadata": 0,
57+
"dependent": 0,
58+
"still_image": 0
4759
},
4860
"tags": {
4961
"creation_time": "1970-01-01 00:00:00",
5062
"language": "und",
51-
"handler_name": "VideoHandler"
63+
"handler_name": "VideoHandler",
64+
"vendor_id": "[0][0][0][0]"
5265
}
5366
},
5467
{
@@ -65,6 +78,8 @@
6578
"channels": 6,
6679
"channel_layout": "5.1",
6780
"bits_per_sample": 0,
81+
"initial_padding": 0,
82+
"id": "0x2",
6883
"r_frame_rate": "0/0",
6984
"avg_frame_rate": "0/0",
7085
"time_base": "1/48000",
@@ -75,6 +90,7 @@
7590
"bit_rate": "384828",
7691
"max_bit_rate": "400392",
7792
"nb_frames": "249",
93+
"extradata_size": 2,
7894
"disposition": {
7995
"default": 1,
8096
"dub": 0,
@@ -86,12 +102,20 @@
86102
"hearing_impaired": 0,
87103
"visual_impaired": 0,
88104
"clean_effects": 0,
89-
"attached_pic": 0
105+
"attached_pic": 0,
106+
"timed_thumbnails": 0,
107+
"non_diegetic": 0,
108+
"captions": 0,
109+
"descriptions": 0,
110+
"metadata": 0,
111+
"dependent": 0,
112+
"still_image": 0
90113
},
91114
"tags": {
92-
"creation_time": "1970-01-01 00:00:00",
115+
"creation_time": "1970-01-01T00:00:00.000000Z",
93116
"language": "und",
94-
"handler_name": "SoundHandler"
117+
"handler_name": "SoundHandler",
118+
"vendor_id": "[0][0][0][0]"
95119
}
96120
}
97121
],

src/test/resources/net/bramp/ffmpeg/fixtures/ffprobe-disposition_all_true

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"clean_effects": 1,
5252
"attached_pic": 1,
5353
"timed_thumbnails": 1,
54+
"non_diegetic": 1,
5455
"captions": 1,
5556
"descriptions": 1,
5657
"metadata": 1,

0 commit comments

Comments
 (0)