当前位置: 首页>>代码示例>>C++>>正文


C++ AudioGenerator::setAudioFrameDesc方法代码示例

本文整理汇总了C++中AudioGenerator::setAudioFrameDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioGenerator::setAudioFrameDesc方法的具体用法?C++ AudioGenerator::setAudioFrameDesc怎么用?C++ AudioGenerator::setAudioFrameDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AudioGenerator的用法示例。


在下文中一共展示了AudioGenerator::setAudioFrameDesc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

StreamTranscoder::StreamTranscoder(
		const ICodec& inputCodec,
		IOutputFile& outputFile,
		const ProfileLoader::Profile& profile
	)
	: _inputStream( NULL )
	, _outputStream( NULL )
	, _sourceBuffer( NULL )
	, _frameBuffer( NULL )
	, _inputDecoder( NULL )
	, _generator( NULL )
	, _currentDecoder( NULL )
	, _outputEncoder( NULL )
	, _transform( NULL )
	, _subStreamIndex( -1 )
	, _offset( 0 )
	, _canSwitchToGenerator( false )
{
	if( profile.find( constants::avProfileType )->second == constants::avProfileTypeVideo )
	{
		// generator decoder
		VideoGenerator* generatorVideo = new VideoGenerator();
		const VideoCodec& inputVideoCodec = static_cast<const VideoCodec&>( inputCodec );
		generatorVideo->setVideoFrameDesc( inputVideoCodec.getVideoFrameDesc() );
		_currentDecoder = generatorVideo;

		// buffers to process
		VideoFrameDesc inputFrameDesc = inputVideoCodec.getVideoFrameDesc();
		VideoFrameDesc outputFrameDesc = inputFrameDesc;
		outputFrameDesc.setParameters( profile );
		_sourceBuffer = new VideoFrame( inputFrameDesc );
		_frameBuffer  = new VideoFrame( outputFrameDesc );

		// transform
		_transform = new VideoTransform();

		// output encoder
		VideoEncoder* outputVideo = new VideoEncoder( profile.at( constants::avProfileCodec ) );
		outputVideo->setProfile( profile, outputFrameDesc );
		_outputEncoder = outputVideo;

		// output stream
		_outputStream = &outputFile.addVideoStream( outputVideo->getVideoCodec() );
	}
	else if( profile.find( constants::avProfileType )->second == constants::avProfileTypeAudio )
	{
		// generator decoder
		AudioGenerator* generatorAudio = new AudioGenerator();
		const AudioCodec& inputAudioCodec = static_cast<const AudioCodec&>( inputCodec );
		generatorAudio->setAudioFrameDesc( inputAudioCodec.getAudioFrameDesc() );
		_currentDecoder = generatorAudio;

		// buffers to process
		AudioFrameDesc inputFrameDesc = inputAudioCodec.getAudioFrameDesc();
		AudioFrameDesc outputFrameDesc = inputFrameDesc;
		outputFrameDesc.setParameters( profile );
		_sourceBuffer = new AudioFrame( inputFrameDesc );
		_frameBuffer  = new AudioFrame( outputFrameDesc );

		// transform
		_transform = new AudioTransform();

		// output encoder
		AudioEncoder* outputAudio = new AudioEncoder( profile.at( constants::avProfileCodec ) );
		outputAudio->setProfile( profile, outputFrameDesc );
		_outputEncoder = outputAudio;

		// output stream
		_outputStream = &outputFile.addAudioStream( outputAudio->getAudioCodec() );
	}
	else
	{
		throw std::runtime_error( "unupported stream type" );
	}
}
开发者ID:cchampet,项目名称:avTranscoder,代码行数:75,代码来源:StreamTranscoder.cpp

示例2: inputFrameDesc

StreamTranscoder::StreamTranscoder(
		IInputStream& inputStream,
		IOutputFile& outputFile
	)
	: _inputStream( &inputStream )
	, _outputStream( NULL )
	, _sourceBuffer( NULL )
	, _frameBuffer( NULL )
	, _inputDecoder( NULL )
	, _generator( NULL )
	, _currentDecoder( NULL )
	, _outputEncoder( NULL )
	, _transform( NULL )
	, _subStreamIndex( -1 )
	, _offset( 0 )
	, _canSwitchToGenerator( false )
{
	// create a re-wrapping case
	switch( _inputStream->getStreamType() )
	{
		case AVMEDIA_TYPE_VIDEO :
		{
			VideoFrameDesc inputFrameDesc( _inputStream->getVideoCodec().getVideoFrameDesc() );

			// generator decoder
			VideoGenerator* generatorVideo = new VideoGenerator();
			generatorVideo->setVideoFrameDesc( inputFrameDesc );
			_generator = generatorVideo;

			// buffers to process
			_sourceBuffer = new VideoFrame( inputFrameDesc );
			_frameBuffer = new VideoFrame( inputFrameDesc );

			// transform
			_transform = new VideoTransform();

			// output encoder
			VideoEncoder* outputVideo = new VideoEncoder( _inputStream->getVideoCodec().getCodecName() );
			outputVideo->getVideoCodec().setImageParameters( inputFrameDesc );
			outputVideo->setup();
			_outputEncoder = outputVideo;

			// output stream
			_outputStream = &outputFile.addVideoStream( _inputStream->getVideoCodec() );

			break;
		}
		case AVMEDIA_TYPE_AUDIO :
		{
			AudioFrameDesc inputFrameDesc( _inputStream->getAudioCodec().getAudioFrameDesc() );

			// generator decoder
			AudioGenerator* generatorAudio = new AudioGenerator();
			generatorAudio->setAudioFrameDesc( inputFrameDesc );
			_generator = generatorAudio;

			// buffers to process
			_sourceBuffer = new AudioFrame( inputFrameDesc );
			_frameBuffer  = new AudioFrame( inputFrameDesc );

			// transform
			_transform = new AudioTransform();

			// output encoder
			AudioEncoder* outputAudio = new AudioEncoder( _inputStream->getAudioCodec().getCodecName()  );
			outputAudio->getAudioCodec().setAudioParameters( inputFrameDesc );
			outputAudio->setup();
			_outputEncoder = outputAudio;

			// output stream
			_outputStream = &outputFile.addAudioStream( _inputStream->getAudioCodec() );

			break;
		}
		case AVMEDIA_TYPE_DATA :
		{
			// @warning: rewrap a data stream can't be lengthen by a generator (end of rewrapping will end the all process)
			_outputStream = &outputFile.addDataStream( _inputStream->getDataCodec() );
			break;
		}
		default:
			break;
	}
}
开发者ID:cchampet,项目名称:avTranscoder,代码行数:84,代码来源:StreamTranscoder.cpp

示例3: outputFrameDesc

StreamTranscoder::StreamTranscoder(
		IInputStream& inputStream,
		IOutputFile& outputFile,
		const ProfileLoader::Profile& profile,
		const int subStreamIndex,
		const double offset
	)
	: _inputStream( &inputStream )
	, _outputStream( NULL )
	, _sourceBuffer( NULL )
	, _frameBuffer( NULL )
	, _inputDecoder( NULL )
	, _generator( NULL )
	, _currentDecoder( NULL )
	, _outputEncoder( NULL )
	, _transform( NULL )
	, _subStreamIndex( subStreamIndex )
	, _offset( offset )
	, _canSwitchToGenerator( false )
{
	// create a transcode case
	switch( _inputStream->getStreamType() )
	{
		case AVMEDIA_TYPE_VIDEO :
		{
			// input decoder
			VideoDecoder* inputVideo = new VideoDecoder( *static_cast<InputStream*>( _inputStream ) );
			// set decoder options with empty profile to set some key options to specific values (example: threads to auto)
			inputVideo->setProfile( ProfileLoader::Profile() );
			inputVideo->setup();
			_inputDecoder = inputVideo;
			_currentDecoder = _inputDecoder;

			// output encoder
			VideoEncoder* outputVideo = new VideoEncoder( profile.at( constants::avProfileCodec ) );
			_outputEncoder = outputVideo;

			VideoFrameDesc outputFrameDesc = _inputStream->getVideoCodec().getVideoFrameDesc();
			outputFrameDesc.setParameters( profile );
			outputVideo->setProfile( profile, outputFrameDesc );

			// output stream
			_outputStream = &outputFile.addVideoStream( outputVideo->getVideoCodec() );

			// buffers to process
			_sourceBuffer = new VideoFrame( _inputStream->getVideoCodec().getVideoFrameDesc() );
			_frameBuffer = new VideoFrame( outputVideo->getVideoCodec().getVideoFrameDesc() );

			// transform
			_transform = new VideoTransform();

			// generator decoder
			VideoGenerator* generatorVideo = new VideoGenerator();
			generatorVideo->setVideoFrameDesc( outputVideo->getVideoCodec().getVideoFrameDesc() );
			_generator = generatorVideo;

			break;
		}
		case AVMEDIA_TYPE_AUDIO :
		{
			// input decoder
			AudioDecoder* inputAudio = new AudioDecoder( *static_cast<InputStream*>( _inputStream ) );
			// set decoder options with empty profile to set some key options to specific values (example: threads to auto)
			inputAudio->setProfile( ProfileLoader::Profile() );
			inputAudio->setup();
			_inputDecoder = inputAudio;
			_currentDecoder = _inputDecoder;

			// output encoder
			AudioEncoder* outputAudio = new AudioEncoder( profile.at( constants::avProfileCodec )  );
			_outputEncoder = outputAudio;

			AudioFrameDesc outputFrameDesc( _inputStream->getAudioCodec().getAudioFrameDesc() );
			outputFrameDesc.setParameters( profile );
			if( subStreamIndex > -1 )
			{
				// @todo manage downmix ?
				outputFrameDesc.setChannels( 1 );
			}
			outputAudio->setProfile( profile, outputFrameDesc );

			// output stream
			_outputStream = &outputFile.addAudioStream( outputAudio->getAudioCodec() );

			// buffers to process
			AudioFrameDesc inputFrameDesc( _inputStream->getAudioCodec().getAudioFrameDesc() );
			if( subStreamIndex > -1 )
				inputFrameDesc.setChannels( 1 );

			_sourceBuffer = new AudioFrame( inputFrameDesc );
			_frameBuffer  = new AudioFrame( outputAudio->getAudioCodec().getAudioFrameDesc() );

			// transform
			_transform = new AudioTransform();

			// generator decoder
			AudioGenerator* generatorAudio = new AudioGenerator();
			generatorAudio->setAudioFrameDesc( outputAudio->getAudioCodec().getAudioFrameDesc() );
			_generator = generatorAudio;

//.........这里部分代码省略.........
开发者ID:cchampet,项目名称:avTranscoder,代码行数:101,代码来源:StreamTranscoder.cpp


注:本文中的AudioGenerator::setAudioFrameDesc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。