Exemplo n.º 1
0
bool HDHRDevice::switchEncoding(char *path)
{
#ifndef FILETRANSITION
	return setupEncoding(path, mMaxFileSize);
#else
	// Does that really matter?
	mNextOutputPath = new char[strlen(path)+1];
	strcpy(mNextOutputPath, path);
	mNextOutputFile = fopen(mNextOutputPath, "wb");
	mChannel->setNextOutputFile(mNextOutputFile);
	// If we don't get data; the output file won't switch so we should just bail after 5 seconds
	// That's much better than letting this thread run forever since it'll be the Seeker which kills SageTV altogther then
	int maxWaits = 250;
	while(mChannel->hasNextOutputFile() && maxWaits-- > 0)
	{
		encoderIdle();
		eatEncoderData();
		usleep(20); // Wait a bit so we don't consume all CPU in this loop
	}
	delete mOutputPath;
	mOutputPath=mNextOutputPath;
	mNextOutputPath = NULL;
	mOutputFile = mNextOutputFile ;
	mNextOutputFile = NULL;
	return true;
#endif
}
std::unique_ptr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(
    Document* document) {
  std::unique_ptr<TextResourceDecoder> decoder =
      createDecoderInstance(document);
  setupEncoding(decoder.get(), document);
  return decoder;
}
PassOwnPtr<TextResourceDecoder> TextResourceDecoderBuilder::buildFor(Document* document)
{
    OwnPtr<TextResourceDecoder> decoder = createDecoderInstance(document);
    setupEncoding(decoder.get(), document);
    return decoder.release();
}