Пример #1
0
void BMDConfig::DisplayConfiguration()
{
	fprintf(stderr, "Capturing with the following configuration:\n"
		" - Capture device: %s\n"
		" - Video mode: %s %s\n"
		" - Pixel format: %s\n"
		" - Audio channels: %u\n"
		" - Audio sample depth: %u bit \n",
		m_deckLinkName,
		m_displayModeName,
		(m_inputFlags & bmdVideoInputDualStream3D) ? "3D" : "",
		GetPixelFormatName(m_pixelFormat),
		m_audioChannels,
		m_audioSampleDepth
	);
}
Пример #2
0
bool TheoraTexture::setFile( const String& filename, SFXDescription* desc )
{
   _reset();
   
   if( filename.isEmpty() )
      return true;
   
   // Check SFX profile.
   
   if( desc && !desc->mIsStreaming )
   {
      Con::errorf( "TheoraTexture::setFile - Not a streaming SFXDescription" );
      return false;
   }
   mSFXDescription = desc;

   // Open the Theora file.
   
   Stream* stream = FileStream::createAndOpen( filename, Torque::FS::File::Read );
   if( !stream )
   {
      Con::errorf( "TheoraTexture::setFile - Theora file '%s' not found.", filename.c_str() );
      return false;
   }
   
   // Create the OGG stream.
   
   Con::printf( "TheoraTexture - Loading file '%s'", filename.c_str() );
   
   ThreadSafeRef< OggInputStream > oggStream = new OggInputStream( stream );
   oggStream->addDecoder< OggTheoraDecoder >();
   #ifndef SPLIT_VORBIS
   oggStream->addDecoder< OggVorbisDecoder >();
   #endif
   
   if( !oggStream->init() )
   {
      Con::errorf( "TheoraTexture - Failed to initialize OGG stream" );
      return false;
   }
   
   mFilename = filename;
   mAsyncState = new AsyncState( oggStream, desc ? desc->mIsLooping : false );   
      
   // Set up video.
   
   OggTheoraDecoder* theoraDecoder = _getTheora();
   if( !theoraDecoder )
   {
      Con::errorf( "TheoraTexture - '%s' is not a Theora file", filename.c_str() );
      mAsyncState = NULL;
      return false;
   }
   
   Con::printf( "   - Theora: %ix%i pixels, %.02f fps, %s format",
      theoraDecoder->getFrameWidth(),
      theoraDecoder->getFrameHeight(),
      theoraDecoder->getFramesPerSecond(),
      GetPixelFormatName( theoraDecoder->getDecoderPixelFormat() ) );
      
   _initVideo();
   
   // Set up sound if we have it.  For performance reasons, create
   // a separate physical stream for the Vorbis sound data rather than
   // using the bitstream from the multiplexed OGG master stream.  The
   // contention caused by the OGG page/packet feeding will otherwise
   // slow us down significantly.
   
   #ifdef SPLIT_VORBIS
      
   stream = FileStream::createAndOpen( filename, Torque::FS::File::Read );
   if( stream )
   {
      ThreadSafeRef< SFXStream > vorbisStream = SFXVorbisStream::create( stream );
      if( !vorbisStream )
      {
         Con::errorf( "TheoraTexture - could not create Vorbis stream for '%s'", filename.c_str() );
         
         // Stream is deleted by SFXVorbisStream.
      }
      else
      {
         Con::printf( "   - Vorbis: %i channels, %i kHz",
            vorbisStream->getFormat().getChannels(),
            vorbisStream->getFormat().getSamplesPerSecond() / 1000 );
            
         _initAudio( vorbisStream );
      }
   }
   
   #else
   
   OggVorbisDecoder* vorbisDecoder = _getVorbis();
   if( vorbisDecoder )
   {
      Con::printf( "   - Vorbis: %i bits, %i channels, %i kHz",
         vorbisDecoder->getNumChannels(),
         vorbisDecoder->getSamplesPerSecond() / 1000 );

      _initAudio();
   }
   
   #endif
      
   // Initiate the background request chain.
   
   mAsyncState->start();
   
   return true;
}