void S60VideoPlayerSession::MvloLoadingComplete() { DP0("S60VideoPlayerSession::MvloLoadingComplete +++"); buffered(); DP0("S60VideoPlayerSession::MvloLoadingComplete ---"); }
size_t MediaPlayerPrivateAVFoundation::extraMemoryCost() const { double duration = this->duration(); if (!duration) return 0; unsigned long long extra = totalBytes() * buffered()->totalDuration() / duration; return static_cast<unsigned>(extra); }
// Test all possible combinations of the wrapped stream having a length and a position. static void test_length_combos(skiatest::Reporter* reporter, size_t bufferSize) { for (int hasLen = 0; hasLen <= 1; hasLen++) { for (int hasPos = 0; hasPos <= 1; hasPos++) { LengthOptionalStream* stream = new LengthOptionalStream(SkToBool(hasLen), SkToBool(hasPos)); std::unique_ptr<SkStream> buffered(SkFrontBufferedStream::Create(stream, bufferSize)); test_hasLength(reporter, *buffered.get(), *stream); } } }
size_t capacity() const noexcept override { // Our goal is to cache up to 2 full batches, whereby we pick the highest // batch size available to us (optimistic estimate). size_t desired = 1; for (auto& kvp : this->paths_) desired = std::max(static_cast<size_t>(kvp.second->desired_batch_size), desired); desired *= 2; auto stored = buffered(); return stored < desired ? desired - stored : 0u; }
void S60AudioPlayerSession::doPlay() { // For some reason loading progress callbalck are not called on emulator #ifdef __WINSCW__ buffering(); #endif m_player->Play(); #ifdef __WINSCW__ buffered(); #endif }
void downstream_manager::close(stream_slot slot) { CAF_LOG_TRACE(CAF_ARG(slot)); auto ptr = path(slot); if (ptr == nullptr) { CAF_LOG_DEBUG("cannot close unknown slot:" << slot); return; } if (buffered(slot) == 0 && ptr->clean()) { CAF_LOG_DEBUG("path clean, remove immediately;" << CAF_ARG(slot)); remove_path(slot, none, false); return; } CAF_LOG_DEBUG("path not clean, set to closing;" << CAF_ARG(slot)); ptr->closing = true; }
void SaveTask(Path path, const OrderedTask &task) { XMLNode root_node = XMLNode::CreateRoot(_T("Task")); { WritableDataNodeXML root(root_node); SaveTask(root, task); } FileOutputStream file(path); BufferedOutputStream buffered(file); root_node.Serialise(buffered, true); buffered.Flush(); file.Commit(); }
bool HTTPServerSession::hasMoreRequests() { if (!socket().impl()->initialized()) return false; if (_firstRequest) { _firstRequest = false; --_maxKeepAliveRequests; return socket().poll(getTimeout(), Socket::SELECT_READ); } else if (_maxKeepAliveRequests != 0 && getKeepAlive()) { if (_maxKeepAliveRequests > 0) --_maxKeepAliveRequests; return buffered() > 0 || socket().poll(_keepAliveTimeout, Socket::SELECT_READ); } else return false; }
void readFromUserStream(hkPackfileReader* reader) { // seek is never required for loadEntireFile CustomStreamReader_NoSetMark_NoSeek* stream = HK_NULL; // streams need not be positioned as offset zero CustomHeader customHeader; stream->read( &customHeader, sizeof(CustomHeader)); // Binary can load entire file without mark/seek { hkBinaryPackfileReader* bin = static_cast<hkBinaryPackfileReader*>(reader); bin->loadEntireFile( stream ); } // Xml requires mark for parsing // hkBufferedStreamReader does the hard work for you { hkBinaryPackfileReader* bin = static_cast<hkBinaryPackfileReader*>(reader); hkBufferedStreamReader buffered(stream); bin->loadEntireFile( &buffered ); } }
void Buffer::update(const UpdateEvent &event) { bool flag=false; QRect receiveRect=event.getRect(); QVector<BitType> receiveBitmap=event.getBitmap(); if(rect.isNull()){ rect=receiveRect; bitmap=receiveBitmap; flag=true; } else{ int w=receiveRect.width(); int rl=receiveRect.left(); int rt=receiveRect.top(); int cl=rect.left(); int ct=rect.top(); for(int i=0;i<receiveBitmap.size();++i){ int x=i%w+rl,y=i/w+rt; if(rect.contains(x,y)){ bitmap[x-cl+rect.width()*(y-ct)]=receiveBitmap[i]; flag=true; } } } if(flag){ QPainter painter; pixmap=QPixmap(rect.size()*50); painter.begin(&pixmap); int w=rect.width(); for(int i=0;i<bitmap.size();++i){ painter.drawPixmap((i%w)*50,(i/w)*50,square[bitmap[i]]); } painter.end(); emit buffered(); } }
qreal PacketBuffer::bufferProgress() const { const qreal p = qreal(buffered())/qreal(bufferValue()); return qMax<qreal>(qMin<qreal>(p, 1.0), 0.0); }
bool PacketBuffer::checkFull() const { return buffered() >= qint64(qreal(bufferValue())*bufferMax()); }
bool PacketBuffer::checkEnough() const { return buffered() >= bufferValue(); }
bool downstream_manager::clean(stream_slot slot) const noexcept { auto ptr = path(slot); return ptr != nullptr ? buffered(slot) == 0 && ptr->clean() : false; }
bool downstream_manager::clean() const noexcept { auto pred = [](const outbound_path& x) { return x.clean(); }; return buffered() == 0 && all_paths(pred); }
bool Buffered::Initialize( Renderer* renderer ) { // create offscreen int width(512); int height(512); bool r = m_FrameBuffer.Allocate( width, height ); ASSERT( r, "Cannot allocate offscreen buffer!"); m_Texture = m_FrameBuffer.GetTexture(); #if 0 // Add a cube Viewport *viewport(new Viewport(width, height)); viewport->SetClearColor( {1.0f, 1.0f, 1.0f } ); AddEntity( EntityPtr(viewport) ); EntityPtr particleEmitter( new Emitter(renderer) ); particleEmitter->GetRenderState()->Translate( Vector(0.0, 0.0, -60), Vector(1.0f, 1.0f, 1.0f) ); viewport->AddEntity( particleEmitter ); #endif boost::shared_ptr<BmpBrush> bmpBrush( new BmpBrush ); ASSERT( bmpBrush->Load( "data/Floor_D.bmp"), "BMP Load error!" ); //////////////////////////////////////////////////////////////////////////// // Compose our scene // Add a cube EntityPtr viewport(new Viewport(width, height)); // this entity renders AddEntity(viewport); // Add the camera EntityPtr camera(new Camera(NULL)); // this entity renders viewport->AddEntity(camera, 0); EntityPtr cube( new Cube() ); cube->GetRenderState()->Translate( Vector(-8.0, 0, 10), Vector(2.0f, 2.0f, 2.0f) ); cube->GetRenderState()->Rotate( Vector(0.0f, 0.0f, 0.0f ) ); // this entity renders camera->AddEntity(cube, 20 ); EntityPtr cube2( new Cube( bmpBrush ) ); cube2->GetRenderState()->Translate( Vector(+8.0, 0, 10), Vector(2.0f, 2.0f, 2.0f) ); cube2->GetRenderState()->Rotate( Vector(0.0f, 0.0f, 0.0f ) ); // this entity renders camera->AddEntity(cube2, 20 ); if ( --rec > 0 ) { // this creates a recursion EntityPtr buffered( new Cube ); buffered->GetRenderState()->Translate( Vector(0.0, 0.0, 15.0), Vector(3.0f, 3.0f, 3.0f) ); // this entity renders camera->AddEntity(buffered, 30 ); } #define PARTICLES #ifdef PARTICLES EntityPtr particleEmitter( new Emitter( renderer ) ); particleEmitter->GetRenderState()->Translate( Vector(0.0, 0.0, -30.0), Vector(1.0f, 1.0f, 1.0f) ); // this entity renders camera->AddEntity(particleEmitter, 100 ); #endif // Subtree will be initialized here: return Cube::Initialize( renderer ); }
void S60AudioPlayerSession::MaloLoadingComplete() { TRACE("S60AudioPlayerSession::MaloLoadingComplete" << qtThisPtr()); buffered(); }
void S60AudioPlayerSession::MaloLoadingComplete() { buffered(); }
void S60AudioPlayerSession::doPlay() { buffering(); m_player->Play(); buffered(); }
int tail() const { return head() - buffered(); }
Texture<GLubyte> Texture<GLubyte>::copy() const { Texture<GLubyte> texture(buffer().data(), filter(), internalFormat(), width(), height(), buffered(), wrapping()); if(borderColor() != vec4(0)) texture.setBorderColor(borderColor()); return texture; }
void level1_connector::do_prepare_statement(statement_handle const & handle, std::string const & sql) const { cpp_odbc::level2::input_string_buffer buffered(sql); auto const return_code = level1_api_->prepare_statement(handle.handle, buffered.data_pointer(), buffered.size()); impl::throw_on_error(return_code, *this, handle); }