Skip to content

Commit cd8544a

Browse files
committed
test/libmpv_test_track_selection: add a program ID matching test
1 parent 256f6cf commit cd8544a

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

test/libmpv_test_track_selection.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,28 @@ static void test_track_selection(char *file, char *path)
304304
set_property_string("sid", "3");
305305
reload_file(path);
306306
check_string("track-list/5/selected", "yes");
307+
} else if (strcmp(file, "multiprogram.ts") == 0) {
308+
set_property_string("subs-match-os-language", "no");
309+
set_property_string("vid", "2");
310+
311+
// no subs are selected by default
312+
reload_file(path);
313+
check_string("track-list/1/selected", "no");
314+
check_string("track-list/3/selected", "no");
315+
316+
// because subs-fallback=default, the jpn track cannot be chosen
317+
// so we choose the eng track despite it having the wrong program ID
318+
set_property_string("slang", "eng");
319+
reload_file(path);
320+
check_string("current-tracks/sub/lang", "eng");
321+
check_string("track-list/1/selected", "yes");
322+
323+
// the jpn track is selected to match video program ID
324+
// even though the user requested eng subtitles
325+
set_property_string("subs-fallback", "yes");
326+
reload_file(path);
327+
check_string("current-tracks/sub/lang", "jpn");
328+
check_string("track-list/3/selected", "yes");
307329
}
308330
}
309331

test/samples/img_sub.idx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# VobSub index file, v7 (do not modify this line!)
2+
#
3+
# To repair desynchronization, you can insert gaps this way:
4+
# (it usually happens after vob id changes)
5+
#
6+
# delay: [sign]hh:mm:ss:ms
7+
#
8+
# Where:
9+
# [sign]: +, - (optional)
10+
# hh: hours (0 <= hh)
11+
# mm/ss: minutes/seconds (0 <= mm/ss <= 59)
12+
# ms: milliseconds (0 <= ms <= 999)
13+
#
14+
# Note: You can't position a sub before the previous with a negative value.
15+
#
16+
# You can also modify timestamps or delete a few subs you don't like.
17+
# Just make sure they stay in increasing order.
18+
19+
# Settings
20+
21+
# Original frame size
22+
size: 1280x720
23+
24+
# Origin, relative to the upper-left corner, can be overloaded by aligment
25+
org: 0, 0
26+
27+
# Image scaling (hor,ver), origin is at the upper-left corner or at the alignment coord (x, y)
28+
scale: 100%, 100%
29+
30+
# Alpha blending
31+
alpha: 100%
32+
33+
# Smoothing for very blocky images (use OLD for no filtering)
34+
smooth: OFF
35+
36+
# In milliseconds
37+
fadein/out: 50, 50
38+
39+
# Force subtitle placement relative to (org.x, org.y)
40+
align: OFF at LEFT TOP
41+
42+
# For correcting non-progressive desync. (in milliseconds or hh:mm:ss:ms)
43+
# Note: Not effective in DirectVobSub, use 'delay: ... ' instead.
44+
time offset: 0
45+
46+
# ON: displays only forced subtitles, OFF: shows everything
47+
forced subs: OFF
48+
49+
# The original palette of the DVD
50+
palette: 000000, ffffff, 000000, 000000, 828282, 828282, 828282, ffffff, 828282, bababa, 828282, 828282, 828282, 828282, 828282, 828282
51+
52+
# Custom colors (transp idxs and the four colors)
53+
custom colors: OFF, tridx: 0000, colors: 000000, 000000, 000000, 000000
54+
55+
# Language index in use
56+
langidx: 0
57+
58+
# English
59+
id: en, index: 0
60+
# Decomment next line to activate alternative name in DirectVobSub / Windows Media Player 6.x
61+
# alt: English
62+
# Vob/Cell ID: 1, 1 (PTS: 0)
63+
timestamp: 00:00:00:000, filepos: 000000000
64+
timestamp: 00:00:01:000, filepos: 000000800

test/samples/img_sub.sub

4 KB
Binary file not shown.

test/samples/meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ audio = custom_target('audio.flac',
1212
)
1313

1414
sub = join_paths(source_root, 'test', 'samples', 'sub.srt')
15+
img_sub = join_paths(source_root, 'test', 'samples', 'img_sub.idx')
1516

1617
common_args = ['-v', 'error', '-y', '-i', video, '-i', audio,
1718
'-f', 'srt', '-i', sub, '-c', 'copy',
@@ -72,6 +73,11 @@ samples = {
7273
'language=eng', '-metadata:s:s:2', 'language=eng', '-metadata:s:s:3', 'language=eng',
7374
'-disposition:s:0', 'default', '-disposition:s:1', 'forced', '-disposition:s:3', 'default',
7475
'@OUTPUT@'],
76+
'multiprogram.ts':
77+
[ffmpeg, '-v', 'error', '-y', '-i', video, '-f', 'vobsub', '-i', img_sub,
78+
'-c:v', 'copy', '-c:s', 'dvbsub', '-map', '0:0', '-map', '1:0', '-map', '0:0', '-map', '1:0',
79+
'-metadata:s:s:0', 'language=eng', '-metadata:s:s:1', 'language=jpn',
80+
'-program', 'program_num=1:st=0:st=1', '-program', 'program_num=2:st=2:st=3', '@OUTPUT@'],
7581
}
7682

7783
foreach name, cmd: samples

0 commit comments

Comments
 (0)