本文整理汇总了C++中AudioDecoder::setup方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioDecoder::setup方法的具体用法?C++ AudioDecoder::setup怎么用?C++ AudioDecoder::setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioDecoder
的用法示例。
在下文中一共展示了AudioDecoder::setup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
//.........这里部分代码省略.........