本文整理汇总了C++中AudioGenerator类的典型用法代码示例。如果您正苦于以下问题:C++ AudioGenerator类的具体用法?C++ AudioGenerator怎么用?C++ AudioGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AudioGenerator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _inputStream
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;
}
}
示例2: getAudioGenerator
AudioGenerator* getAudioGenerator()
{
return g_Audio.IsValid() ? &g_Audio : NULL;
}
示例3: seekFrame
void seekFrame(int nDiff)
{
XnStatus nRetVal = XN_STATUS_OK;
if (isPlayerOn())
{
const XnChar* strNodeName = NULL;
if (g_pPrimary != NULL)
{
strNodeName = g_pPrimary->GetName();
}
else if (g_Depth.IsValid())
{
strNodeName = g_Depth.GetName();
}
else if (g_Image.IsValid())
{
strNodeName = g_Image.GetName();
}
else if (g_IR.IsValid())
{
strNodeName = g_IR.GetName();
}
else if (g_Audio.IsValid())
{
strNodeName = g_Audio.GetName();
}
nRetVal = g_Player.SeekToFrame(strNodeName, nDiff, XN_PLAYER_SEEK_CUR);
if (nRetVal != XN_STATUS_OK)
{
displayMessage("Failed to seek: %s", xnGetStatusString(nRetVal));
return;
}
XnUInt32 nFrame = 0;
XnUInt32 nNumFrames = 0;
nRetVal = g_Player.TellFrame(strNodeName, nFrame);
if (nRetVal != XN_STATUS_OK)
{
displayMessage("Failed to tell frame: %s", xnGetStatusString(nRetVal));
return;
}
nRetVal = g_Player.GetNumFrames(strNodeName, nNumFrames);
if (nRetVal != XN_STATUS_OK)
{
displayMessage("Failed to get number of frames: %s", xnGetStatusString(nRetVal));
return;
}
displayMessage("Seeked %s to frame %u/%u", strNodeName, nFrame, nNumFrames);
}
}
示例4: closeDevice
void closeDevice()
{
g_Player.Release();
g_Device.Release();
g_Depth.Release();
g_Image.Release();
g_IR.Release();
g_Audio.Release();
g_scriptNode.Release();
g_Context.Release();
}
示例5: readFrame
void readFrame()
{
if (!g_Depth.IsValid() && !g_Image.IsValid() && !g_IR.IsValid() && !g_Audio.IsValid()) // @@@dded
return;
XnStatus rc = XN_STATUS_OK;
if (g_pPrimary != NULL)
{
rc = g_Context.WaitOneUpdateAll(*g_pPrimary);
}
else
{
rc = g_Context.WaitAnyUpdateAll();
}
if (rc != XN_STATUS_OK)
{
printf("Error: %s\n", xnGetStatusString(rc));
}
if (g_Depth.IsValid())
{
g_Depth.GetMetaData(g_DepthMD);
}
if (g_Image.IsValid())
{
g_Image.GetMetaData(g_ImageMD);
}
if (g_IR.IsValid())
{
g_IR.GetMetaData(g_irMD);
}
if (g_Audio.IsValid())
{
g_Audio.GetMetaData(g_AudioMD);
}
}
示例6: getAudioMetaData
const AudioMetaData* getAudioMetaData()
{
return g_Audio.IsValid() ? &g_AudioMD : NULL;
}