Skip to content

Commit 63116f0

Browse files
committed
Simplify handling of movie chunk references. The audio and video section types can be their own sections.
1 parent 63d4760 commit 63116f0

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

src/MediaStation/Assets/Asset.py

+18-22
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class SectionType(IntEnum):
6262
STAGE = 0x0019
6363
ASSET_ID = 0x001a
6464
CHUNK_REFERENCE = 0x001b
65+
MOVIE_AUDIO_CHUNK_REFERENCE = 0x06a4
66+
MOVIE_VIDEO_CHUNK_REFERENCE = 0x06a5
6567
ASSET_REFERENCE = 0x077b
6668
BOUNDING_BOX = 0x001c
6769
POLYGON = 0x001d
@@ -188,34 +190,28 @@ def _read_section(self, section_type, chunk):
188190
assert_equal(duplicate_asset_id, self.id, 'asset ID')
189191

190192
elif Asset.SectionType.CHUNK_REFERENCE == section_type: # SND, IMG, SPR, MOV, FON
191-
# READ THE CHUNK REFERENCES.
192193
# These are references to the chunk(s) that hold the data for this asset.
193194
# The references and the chunks have the following format "a501".
194195
# There is no guarantee where these chunk(s) might actually be located:
195196
# - They might be in the same RIFF subfile as this header,
196197
# - They might be in a different RIFF subfile in the same CXT file,
197198
# - They might be in a different CXT file entirely.
198-
if self.type == Asset.AssetType.MOVIE:
199-
# READ THE HEADER REFERENCE.
200-
header_reference = Datum(chunk).d.chunk_id
201-
self.chunk_references.append(header_reference)
202-
# TODO: Find out what this is and why we have to skip it.
203-
self.unks.append({hex(section_type): Datum(chunk).d})
204-
205-
# READ THE AUDIO REFERENCE.
206-
audio_reference = Datum(chunk).d.chunk_id
207-
self.chunk_references.append(audio_reference)
208-
# TODO: Find out what this is and why we have to skip it.
209-
self.unks.append({hex(section_type): Datum(chunk).d})
210-
211-
# READ THE VIDEO REFERENCE.
212-
video_reference = Datum(chunk).d.chunk_id
213-
self.chunk_references.append(video_reference)
214-
# TODO: Find out what this is and why we have to skip it.
215-
else:
216-
# READ A SINGLE REFERENCE.
217-
chunk_reference = Datum(chunk).d.chunk_id
218-
self.chunk_references.append(chunk_reference)
199+
#
200+
# Movies have three chunk references. This is just the first one;
201+
# that contains header information; the other two, for audio and
202+
# video, are the next two sections.
203+
chunk_reference = Datum(chunk).d.chunk_id
204+
self.chunk_references.append(chunk_reference)
205+
206+
elif Asset.SectionType.MOVIE_AUDIO_CHUNK_REFERENCE == section_type:
207+
# READ THE MOVIE AUDIO REFERENCE.
208+
audio_reference = Datum(chunk).d.chunk_id
209+
self.chunk_references.append(audio_reference)
210+
211+
elif Asset.SectionType.MOVIE_VIDEO_CHUNK_REFERENCE == section_type:
212+
# READ THE MOVIE VIDEO REFERENCE.
213+
video_reference = Datum(chunk).d.chunk_id
214+
self.chunk_references.append(video_reference)
219215

220216
elif Asset.SectionType.BOUNDING_BOX == section_type: # STG, IMG, HSP, SPR, MOV, TXT, CAM, CVS
221217
self.bounding_box = Datum(chunk).d

0 commit comments

Comments
 (0)