Skip to content

Commit bb52097

Browse files
authored
Change FFmpegChapter#id type to long (bramp#310)
1 parent 314e3fd commit bb52097

File tree

4 files changed

+148
-1
lines changed

4 files changed

+148
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
justification = "POJO objects where the fields are populated by gson")
88
public class FFmpegChapter {
99

10-
public int id;
10+
public long id;
1111
public String time_base;
1212
public long start;
1313
public String start_time;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public void before() throws IOException {
5050
when(runFunc.run(argThatHasItem(Samples.side_data_list)))
5151
.thenAnswer(new NewProcessAnswer("ffprobe-side_data_list"));
5252

53+
when(runFunc.run(argThatHasItem(Samples.chapters_with_long_id)))
54+
.thenAnswer(new NewProcessAnswer("chapters_with_long_id.m4b"));
55+
5356
ffprobe = new FFprobe(runFunc);
5457
}
5558

@@ -157,4 +160,12 @@ public void testProbeSideDataList() throws IOException {
157160
"\n00000000: 0 -65536 0\n00000001: 65536 0 0\n00000002: 0 0 1073741824\n"));
158161
assertThat(info.getStreams().get(0).side_data_list[0].rotation, is(90));
159162
}
163+
164+
@Test
165+
public void testChaptersWithLongIds() throws IOException {
166+
FFmpegProbeResult info = ffprobe.probe(Samples.chapters_with_long_id);
167+
168+
assertThat(info.getChapters().get(0).id, is(6613449456311024506L));
169+
assertThat(info.getChapters().get(1).id, is(-4433436293284298339L));
170+
}
160171
}

src/test/java/net/bramp/ffmpeg/fixtures/Samples.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ private Samples() {
3131

3232
public static final String divide_by_zero = FAKE_PREFIX + "Divide By Zero.mp4";
3333

34+
public static final String chapters_with_long_id = FAKE_PREFIX + "chapters_with_long_id.m4b";
35+
3436
// TODO Change to a temp directory
3537
// TODO Generate random names, so we can run tests concurrently
3638
public static final String output_mp4 = "output.mp4";
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"streams": [
3+
{
4+
"index": 0,
5+
"codec_name": "aac",
6+
"codec_long_name": "AAC (Advanced Audio Coding)",
7+
"profile": "LC",
8+
"codec_type": "audio",
9+
"codec_time_base": "1/44100",
10+
"codec_tag_string": "mp4a",
11+
"codec_tag": "0x6134706d",
12+
"sample_fmt": "fltp",
13+
"sample_rate": "44100",
14+
"channels": 1,
15+
"channel_layout": "mono",
16+
"bits_per_sample": 0,
17+
"r_frame_rate": "0/0",
18+
"avg_frame_rate": "0/0",
19+
"time_base": "1/44100",
20+
"start_pts": 0,
21+
"start_time": "0.000000",
22+
"duration_ts": 248628224,
23+
"duration": "5637.828209",
24+
"bit_rate": "62993",
25+
"max_bit_rate": "75648",
26+
"nb_frames": "242801",
27+
"disposition": {
28+
"default": 1,
29+
"dub": 0,
30+
"original": 0,
31+
"comment": 0,
32+
"lyrics": 0,
33+
"karaoke": 0,
34+
"forced": 0,
35+
"hearing_impaired": 0,
36+
"visual_impaired": 0,
37+
"clean_effects": 0,
38+
"attached_pic": 0,
39+
"timed_thumbnails": 0
40+
},
41+
"tags": {
42+
"creation_time": "2016-02-21T08:27:56.000000Z",
43+
"language": "und"
44+
}
45+
},
46+
{
47+
"index": 1,
48+
"codec_name": "bin_data",
49+
"codec_long_name": "binary data",
50+
"codec_type": "data",
51+
"codec_tag_string": "text",
52+
"codec_tag": "0x74786574",
53+
"r_frame_rate": "0/0",
54+
"avg_frame_rate": "0/0",
55+
"time_base": "1/44100",
56+
"start_pts": 0,
57+
"start_time": "0.000000",
58+
"duration_ts": 248628224,
59+
"duration": "5637.828209",
60+
"bit_rate": "1",
61+
"nb_frames": "24",
62+
"disposition": {
63+
"default": 0,
64+
"dub": 0,
65+
"original": 0,
66+
"comment": 0,
67+
"lyrics": 0,
68+
"karaoke": 0,
69+
"forced": 0,
70+
"hearing_impaired": 0,
71+
"visual_impaired": 0,
72+
"clean_effects": 0,
73+
"attached_pic": 0,
74+
"timed_thumbnails": 0
75+
},
76+
"tags": {
77+
"creation_time": "2016-02-21T08:28:13.000000Z",
78+
"language": "und"
79+
}
80+
}
81+
],
82+
"chapters": [
83+
{
84+
"id": 6613449456311024506,
85+
"time_base": "1/1000000000",
86+
"start": 0,
87+
"start_time": "0.000000",
88+
"end": 435458000000,
89+
"end_time": "435.458000",
90+
"tags": {
91+
"title": "Chapitre 01"
92+
}
93+
},
94+
{
95+
"id": -4433436293284298339,
96+
"time_base": "1/1000000000",
97+
"start": 435458000000,
98+
"start_time": "435.458000",
99+
"end": 852333000000,
100+
"end_time": "852.333000",
101+
"tags": {
102+
"title": "Chapitre 02"
103+
}
104+
}
105+
],
106+
"format": {
107+
"filename": "sammyjay_1602_librivox.m4b",
108+
"nb_streams": 2,
109+
"nb_programs": 0,
110+
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
111+
"format_long_name": "QuickTime / MOV",
112+
"start_time": "0.000000",
113+
"duration": "5637.828209",
114+
"size": "45417172",
115+
"bit_rate": "64446",
116+
"probe_score": 100,
117+
"tags": {
118+
"major_brand": "M4A",
119+
"minor_version": "0",
120+
"compatible_brands": "3gp5isom",
121+
"creation_time": "2016-02-21T08:27:56.000000Z",
122+
"genre": "Audiobook",
123+
"media_type": "2",
124+
"encoder": "Chapter and Verse V 1.5",
125+
"title": "The Adventures of Sammy Jay",
126+
"artist": "Thornton W. Burgess",
127+
"album": "The Adventures of Sammy Jay",
128+
"comment": "https://archive.org/details/sammyjay_1602_librivox",
129+
"copyright": "PD1.0",
130+
"track": "1",
131+
"Encoding Params": "vers"
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)