-
Notifications
You must be signed in to change notification settings - Fork 4
/
sup-parser.ksy
147 lines (143 loc) · 3.25 KB
/
sup-parser.ksy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
meta:
id: sup
title: PGS/Sup Subtitle
file-extension: sup
endian: be
doc: |
PGS/Sup Subtitle
doc-ref:
- https://blog.thescorpius.com/index.php/2017/07/15/presentation-graphic-stream-sup-files-bluray-subtitle-format/
- https://github.com/SubtitleEdit/subtitleedit/tree/main/src/libse/BluRaySup
seq:
- id: segment
type: sup_segment
repeat: eos
types:
sup_segment:
seq:
- id: magic
contents: 'PG'
- id: pts
type: u4
- id: dts
type: u4
- id: segment_type
type: u1
- id: segment_size
type: u2
- id: segment_body
type:
switch-on: segment_type
cases:
0x14: pds
0x15: ods
0x16: pcs
0x17: wds
0x80: end
size: segment_size
pds:
seq:
- id: palette_id
type: u1
- id: palette_version_number
type: u1
- id: palette
type: palette_type
repeat: expr
repeat-expr: (_parent.segment_size -2) / 5
ods:
seq:
- id: object_id
type: u2
- id: object_version_number
type: u1
- id: last_in_sequence_flag
type: u1
- id: object_data_length
type: b24
- id: width
type: u2
- id: height
type: u2
- id: object_data
size: object_data_length - 4
pcs:
seq:
- id: width
type: u2
- id: height
type: u2
- id: frame_rate
type: u1
- id: composition_number
type: u2
- id: composition_state
type: u1
- id: palette_upd_flag
type: u1
- id: palette_id
type: u1
- id: num_composition_object
type: u1
- id: composition_object
type: composition_object_type
repeat: expr
repeat-expr: num_composition_object
wds:
seq:
- id: number_of_windows
type: u1
- id: windows_object
type: windows_object_type
repeat: expr
repeat-expr: number_of_windows
end:
seq: []
composition_object_type:
seq:
- id: object_id
type: u2
- id: window_id
type: u1
- id: object_cropped_flag
type: u1
- id: object_hor_pos
type: u2
- id: object_ver_pos
type: u2
- id: obj_crop_hor_pos
type: u2
if: object_cropped_flag & 0x80 != 0
- id: obj_crop_ver_pos
type: u2
if: object_cropped_flag & 0x80 != 0
- id: obj_crop_width
type: u2
if: object_cropped_flag & 0x80 != 0
- id: obj_crop_height
type: u2
if: object_cropped_flag & 0x80 != 0
windows_object_type:
seq:
- id: window_id
type: u1
- id: windows_hor_pos
type: u2
- id: windows_ver_pos
type: u2
- id: windows_width
type: u2
- id: windows_height
type: u2
palette_type:
seq:
- id: palette_entry_id
type: u1
- id: palette_y
type: u1
- id: palette_cr
type: u1
- id: palette_cb
type: u1
- id: palette_a
type: u1