@@ -281,7 +281,7 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
281
281
const Scope& sc = GetRequiredScope (element);
282
282
283
283
const Element* const Type = sc[" Type" ];
284
- const Element* const FileName = sc[ " FileName" ];
284
+ const Element* const FileName = sc. FindElementCaseInsensitive ( " FileName" ); // some files retain the information as "Filename", others "FileName", who knows
285
285
const Element* const RelativeFilename = sc[" RelativeFilename" ];
286
286
const Element* const Content = sc[" Content" ];
287
287
@@ -291,35 +291,40 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
291
291
292
292
if (FileName) {
293
293
fileName = ParseTokenAsString (GetRequiredToken (*FileName,0 ));
294
- }
294
+ }
295
295
296
296
if (RelativeFilename) {
297
297
relativeFileName = ParseTokenAsString (GetRequiredToken (*RelativeFilename,0 ));
298
298
}
299
299
300
300
if (Content) {
301
- const Token& token = GetRequiredToken (*Content, 0 );
302
- const char * data = token.begin ();
303
- if (!token.IsBinary ()) {
304
- DOMWarning (" video content is not binary data, ignoring" , &element);
305
- }
306
- else if (static_cast <size_t >(token.end () - data) < 5 ) {
307
- DOMError (" binary data array is too short, need five (5) bytes for type signature and element count" , &element);
308
- }
309
- else if (*data != ' R' ) {
310
- DOMWarning (" video content is not raw binary data, ignoring" , &element);
311
- }
312
- else {
313
- // read number of elements
314
- uint32_t len = 0 ;
315
- ::memcpy (&len, data + 1 , sizeof (len));
316
- AI_SWAP4 (len);
317
-
318
- contentLength = len;
319
-
320
- content = new uint8_t [len];
321
- ::memcpy (content, data + 5 , len);
322
- }
301
+ // this field is ommited when the embedded texture is already loaded, let's ignore if it´s not found
302
+ try {
303
+ const Token& token = GetRequiredToken (*Content, 0 );
304
+ const char * data = token.begin ();
305
+ if (!token.IsBinary ()) {
306
+ DOMWarning (" video content is not binary data, ignoring" , &element);
307
+ }
308
+ else if (static_cast <size_t >(token.end () - data) < 5 ) {
309
+ DOMError (" binary data array is too short, need five (5) bytes for type signature and element count" , &element);
310
+ }
311
+ else if (*data != ' R' ) {
312
+ DOMWarning (" video content is not raw binary data, ignoring" , &element);
313
+ }
314
+ else {
315
+ // read number of elements
316
+ uint32_t len = 0 ;
317
+ ::memcpy (&len, data + 1 , sizeof (len));
318
+ AI_SWAP4 (len);
319
+
320
+ contentLength = len;
321
+
322
+ content = new uint8_t [len];
323
+ ::memcpy (content, data + 5 , len);
324
+ }
325
+ } catch (runtime_error runtimeError) {
326
+ // we don´t need the content data for contents that has already been loaded
327
+ }
323
328
}
324
329
325
330
props = GetPropertyTable (doc," Video.FbxVideo" ,element,sc);
0 commit comments