MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / setFile

Method setFile

Engine/source/gfx/video/theoraTexture.cpp:454–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452//-----------------------------------------------------------------------------
453
454bool TheoraTexture::setFile( const String& filename, SFXDescription* desc )
455{
456 _reset();
457
458 if( filename.isEmpty() )
459 return true;
460
461 // Check SFX profile.
462
463 if( desc && !desc->mIsStreaming )
464 {
465 Con::errorf( "TheoraTexture::setFile - Not a streaming SFXDescription" );
466 return false;
467 }
468 mSFXDescription = desc;
469
470 // Open the Theora file.
471
472 Stream* stream = FileStream::createAndOpen( filename, Torque::FS::File::Read );
473 if( !stream )
474 {
475 Con::errorf( "TheoraTexture::setFile - Theora file '%s' not found.", filename.c_str() );
476 return false;
477 }
478
479 // Create the OGG stream.
480
481 Con::printf( "TheoraTexture - Loading file '%s'", filename.c_str() );
482
483 ThreadSafeRef< OggInputStream > oggStream = new OggInputStream( stream );
484 oggStream->addDecoder< OggTheoraDecoder >();
485 #ifndef SPLIT_VORBIS
486 oggStream->addDecoder< OggVorbisDecoder >();
487 #endif
488
489 if( !oggStream->init() )
490 {
491 Con::errorf( "TheoraTexture - Failed to initialize OGG stream" );
492 return false;
493 }
494
495 mFilename = filename;
496 mAsyncState = new AsyncState( oggStream, desc ? desc->mIsLooping : false );
497
498 // Set up video.
499
500 OggTheoraDecoder* theoraDecoder = _getTheora();
501 if( !theoraDecoder )
502 {
503 Con::errorf( "TheoraTexture - '%s' is not a Theora file", filename.c_str() );
504 mAsyncState = NULL;
505 return false;
506 }
507
508 Con::printf( " - Theora: %ix%i pixels, %.02f fps, %s format",
509 theoraDecoder->getFrameWidth(),
510 theoraDecoder->getFrameHeight(),
511 theoraDecoder->getFramesPerSecond(),

Callers

nothing calls this directly

Calls 15

printfFunction · 0.85
GetPixelFormatNameFunction · 0.85
getFrameWidthMethod · 0.80
getFrameHeightMethod · 0.80
getFramesPerSecondMethod · 0.80
getDecoderPixelFormatMethod · 0.80
getNumChannelsMethod · 0.80
errorfFunction · 0.50
isEmptyMethod · 0.45
c_strMethod · 0.45
initMethod · 0.45
getChannelsMethod · 0.45

Tested by

no test coverage detected