Skip to content

vts_pgci

Classes:

Attributes:

BLOCK_MODE_FIRST_CELL module-attribute

BLOCK_MODE_FIRST_CELL = 1

BLOCK_MODE_IN_BLOCK module-attribute

BLOCK_MODE_IN_BLOCK = 2

BLOCK_MODE_LAST_CELL module-attribute

BLOCK_MODE_LAST_CELL = 3

AudioControl dataclass

AudioControl(available: bool, number: int)

Attributes:

available instance-attribute

available: bool

number instance-attribute

number: int

CellPlayback dataclass

CellPlayback(
    interleaved: bool,
    seamless_play: bool,
    seamless_angle: bool,
    block_mode: int,
    block_type: int,
    playback_time: TimeSpan,
    first_sector: int,
    last_sector: int,
    first_ilvu_end_sector: int,
    last_vobu_start_sector: int,
)

Attributes:

block_mode instance-attribute

block_mode: int

block_type instance-attribute

block_type: int

first_ilvu_end_sector instance-attribute

first_ilvu_end_sector: int

first_sector instance-attribute

first_sector: int

interleaved instance-attribute

interleaved: bool

last_sector instance-attribute

last_sector: int

last_vobu_start_sector instance-attribute

last_vobu_start_sector: int

playback_time instance-attribute

playback_time: TimeSpan

seamless_angle instance-attribute

seamless_angle: bool

seamless_play instance-attribute

seamless_play: bool

CellPosition dataclass

CellPosition(cell_nr: int, vob_id_nr: int)

Attributes:

cell_nr instance-attribute

cell_nr: int

vob_id_nr instance-attribute

vob_id_nr: int

PGC dataclass

PGC(
    program_map: list[int],
    cell_playback: list[CellPlayback],
    cell_position: list[CellPosition],
    nr_of_cells: int,
    nr_of_programs: int,
    next_pgc_nr: int,
    prev_pgc_nr: int,
    goup_pgc_nr: int,
    audio_control: list[AudioControl],
)

Attributes:

audio_control instance-attribute

audio_control: list[AudioControl]

cell_playback instance-attribute

cell_playback: list[CellPlayback]

cell_position instance-attribute

cell_position: list[CellPosition]

goup_pgc_nr instance-attribute

goup_pgc_nr: int

next_pgc_nr instance-attribute

next_pgc_nr: int

nr_of_cells instance-attribute

nr_of_cells: int

nr_of_programs instance-attribute

nr_of_programs: int

prev_pgc_nr instance-attribute

prev_pgc_nr: int

program_map instance-attribute

program_map: list[int]

VTSPgci dataclass

VTSPgci(reader: SectorReadHelper)

Attributes:

Source code
 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
148
149
150
151
152
153
154
def __init__(self, reader: SectorReadHelper):
    reader._goto_sector_ptr(0x00CC)

    posn = reader.ifo.tell()

    nr_pgcs, *_ = reader._unpack_byte(2, 2, 4)

    self.pgcs = list[PGC]()

    for _ in range(nr_pgcs):
        _, offset = reader._unpack_byte(4, 4)
        bk = reader.ifo.tell()

        audio_control = list[AudioControl]()

        pgc_base = posn + offset

        reader.ifo.seek(pgc_base, os.SEEK_SET)

        _, num_programs, num_cells = reader._unpack_byte(2, 1, 1)
        reader._unpack_byte(4, 4)

        for _ in range(8):
            ac, _ = reader._unpack_byte(1, 1)

            available = (ac & 0x80) != 0
            number = ac & 7

            audio_control.append(AudioControl(available=available, number=number))

        reader._unpack_byte(4, repeat=32)

        next_pgcn, prev_pgcn, group_pgcn = reader._unpack_byte(2, 2, 2)

        reader._unpack_byte(1, 1)

        reader._unpack_byte(4, repeat=16)

        _, offset_program, offset_playback, offset_position = reader._unpack_byte(2, 2, 2, 2)

        reader.ifo.seek(pgc_base + offset_program, os.SEEK_SET)

        program_map = list(reader._unpack_byte(1, repeat=num_programs))

        reader.ifo.seek(pgc_base + offset_position, os.SEEK_SET)

        cell_position_bytes = [reader._unpack_byte(2, 1, 1) for _ in range(num_cells)]
        cell_position = [CellPosition(cell_nr=a[2], vob_id_nr=a[0]) for a in cell_position_bytes]

        reader.ifo.seek(pgc_base + offset_playback, os.SEEK_SET)

        cell_playback_bytes = [
            reader._unpack_byte(1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4)
            for _ in range(num_cells)
        ]

        cell_playback = [
            CellPlayback(
                interleaved=(a[0] & 0b100) != 0,
                seamless_play=(a[0] & 0b1000) != 0,
                seamless_angle=(a[0] & 0b1) != 0,
                block_mode=((a[0] & 0b11000000) >> 6),
                block_type=((a[0] & 0b00110000) >> 4),
                playback_time=TimeSpan(*a[4:8]),
                first_sector=a[5 + 3],
                last_sector=a[8 + 3],
                first_ilvu_end_sector=a[6 + 3],
                last_vobu_start_sector=a[7 + 3],
            ) for a in cell_playback_bytes
        ]

        reader.ifo.seek(bk, os.SEEK_SET)

        self.pgcs.append(
            PGC(
                nr_of_cells=num_cells,
                nr_of_programs=num_programs,
                next_pgc_nr=next_pgcn,
                prev_pgc_nr=prev_pgcn,
                goup_pgc_nr=group_pgcn,
                program_map=program_map,
                cell_position=cell_position,
                cell_playback=cell_playback,
                audio_control=audio_control
            )
        )

pgcs instance-attribute

pgcs: list[PGC] = list[PGC]()