本文整理汇总了C++中Sink::getInput方法的典型用法代码示例。如果您正苦于以下问题:C++ Sink::getInput方法的具体用法?C++ Sink::getInput怎么用?C++ Sink::getInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sink
的用法示例。
在下文中一共展示了Sink::getInput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
vtime_t start_time(time);
Chunk chunk;
while ( ! fp->eof() )
{
if ( fp->loadFrame() )
{
++frames;
if ( fp->isNewStream() )
++streams;
if ( spdif.parseFrame(fp->getFrame(), fp->getFrameSize()) )
{
const Speakers &spk(spdif.getSpeakers());
if ( spk.isSpdif() )
{
static bool hasPrinted(false);
if ( ! hasPrinted )
{
std::cout << "Format Spdif:"
<< " channels" << spk.getChannelCount()
<< " sampleRate" << spk.getSampleRate()
<< std::endl;
hasPrinted = true;
}
#if 1
chunk.setRawData(spk, spdif.getRawData(), spdif.getRawSize());
#else
chunk.setRawData(
Speakers(FORMAT_PCM16, MODE_STEREO, spk.getSampleRate())
, spdif.getRawData(), spdif.getRawSize());
#endif
if ( sink->process(&chunk) )
size += chunk.size;
else
++errors;
}
else
++skipped;
}
else
{
++errors;
}
}
time = getLocalTime();
if ( fp->eof() || time > old_time + 0.1 )
{
char info[256];
old_time = time;
float fileSize = float(fp->getSize());
float processed = float(fp->getPos());
float elapsed = float(old_time - start_time);
int eta = int((fileSize / processed - 1.0) * elapsed);
snprintf(info, sizeof(info), "%02i%% %02i:%02i In: %iM (%2iMB/s) Out: %liM Frames: %i (%s) \r"
, int(processed * 100 / fileSize)
, eta / 60
, eta % 60
, int(processed / 1000000)
, int(processed/elapsed/1000000)
, (long)(size / 1000000)
, frames
, fp->isInSync() ? fp->getSpeakers().getFormatText(): "Unknown");
std::cerr << info << std::flush;
}
}
// flush output
chunk.setEmpty(sink->getInput(), false, 0, true);
sink->process(&chunk);
delete fp;
delete mhp;
delete sink;
// Final notes
std::cout << std::endl;
if ( streams > 1 )
std::cout << streams << " streams converted" << std::endl;
if ( skipped )
std::cout << skipped << " frames skipped" << std::endl;
if ( errors )
std::cout << errors << " frame conversion errors" << std::endl;
return 0;
}