当前位置: 首页>>代码示例>>C++>>正文


C++ processBuffer函数代码示例

本文整理汇总了C++中processBuffer函数的典型用法代码示例。如果您正苦于以下问题:C++ processBuffer函数的具体用法?C++ processBuffer怎么用?C++ processBuffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了processBuffer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processBuffer

void InterSense::deviceThreadMethod(void)
	{
	/* Reset first measurement flags: */
	for(int i=0;i<numTrackers;++i)
		notFirstMeasurements[i]=false;
	
	/* Read first record in synchronizing mode: */
	int stationId;
	char recordBuffer[256];
	stationId=readRecordSync(recordBuffer);
	
	/* Parse read buffer: */
	processBuffer(stationIdToIndex[stationId],recordBuffer);
	
	while(true)
		{
		/* Try reading record in synchronized mode: */
		if((stationId=readRecordNoSync(recordBuffer))==0)
			{
			/* Fall back to synchronizing mode: */
			#ifdef VERBOSE
			printf("InterSense: Resynchronizing with tracker stream\n");
			fflush(stdout);
			#endif
			stationId=readRecordSync(recordBuffer);
			}
		
		/* Parse read buffer: */
		processBuffer(stationIdToIndex[stationId],recordBuffer);
		}
	}
开发者ID:jrevote,项目名称:3DA-Vrui,代码行数:31,代码来源:InterSense.cpp

示例2: readLogLines

static void readLogLines(int logfd)
{
    while (1) {
        unsigned char buf[LOGGER_ENTRY_MAX_LEN + 1] __attribute__((aligned(4)));
        struct logger_entry *entry = (struct logger_entry *) buf;
        int ret;

        ret = read(logfd, entry, LOGGER_ENTRY_MAX_LEN);
        if (ret < 0) {
            if (errno == EINTR)
                continue;
            if (errno == EAGAIN)
                break;
            perror("logcat read");
            exit(EXIT_FAILURE);
        }
        else if (!ret) {
            fprintf(stderr, "read: Unexpected EOF!\n");
            exit(EXIT_FAILURE);
        }

        /* NOTE: driver guarantees we read exactly one full entry */

        entry->msg[entry->len] = '\0';

        if (g_printBinary) {
            printBinary(entry);
        } else {
            (void) processBuffer(entry);
        }
    }
}
开发者ID:Dieken,项目名称:SurfaceFlinger,代码行数:32,代码来源:logcat.cpp

示例3: processBuffer

bool KeyStream::decodeMessage(QByteArray& buffer, int macOffset, int offset, int length)
{
    //qDebug() << "decodeMessage seq:" << seq;
    QByteArray base = buffer.left(buffer.size() - 4);
    QByteArray hmac = buffer.right(4);
    QByteArray buffer2 = processBuffer(base, seq++);
    buffer2 = mac->hmacSha1(buffer2);

    QByteArray origBuffer = buffer;
    buffer = base;
    rc4->Cipher(buffer.data(),0,buffer.size());

    for (int i = 0; i < 4; i++)
    {
        if (buffer2[macOffset + i] != hmac[i])
        {
            qDebug() << "error decoding message. macOffset:" << macOffset << "offset:" << offset << "length:" << length << "bufferSize:" << buffer.size();
            qDebug() << "buffer mac:" << buffer2.toHex() << "hmac:" << hmac.toHex();
            qDebug() << "buffer:" << buffer.toHex();
            qDebug() << "origBuffer:" << origBuffer.toHex();
            return false;
        }
    }
    return true;
}
开发者ID:0xaaa,项目名称:yappari,代码行数:25,代码来源:keystream.cpp

示例4: processBuffer

void ttSerialDevice::update() {
	if ( m_connection.isInitialized() ) {
		int available = m_connection.available();
		if ( available > 0 ) {
			unsigned char* buffer = new unsigned char [ available + 1 ];
			buffer[ available ] = 0;
			m_connection.readBytes(buffer,available);
			//
			//
			//
			bool partial_message = m_buffer.tellp() > 0;
			for ( int i = 0; i < available; i++ ) {
				if ( partial_message ) {
					if ( buffer[ i ] == ']' ) { // end message
						processBuffer();
						return;
					} else {
						m_buffer << buffer[ i ];
					}
				} else if ( buffer[ i ] == '[' ) { // start of message
					partial_message = true;
				}
			}
		}
	}
}
开发者ID:SodaLtd,项目名称:Travellers-Tails,代码行数:26,代码来源:ttSerialDevice.cpp

示例5: while

void EPDStreamer::processResponse()
{
    while (connState == STATE_CONN_CONNECTED) {
        while (client.available()) {
            char c = client.read();

            if (httpState == STATE_HTTP_BODY) {
                if (callbacksEnabled && onBodyByteReadCallback) {
                    onBodyByteReadCallback(c);
                }
            } else {
                if (c == 13) {
                    continue;
                } else if (c == 10) {
                    buffer[bufferPtr] = 0;
                    processBuffer();
                    bufferPtr = 0;
                } else {
                    buffer[bufferPtr++] = c;
                }
            }
        }

        if (!client.connected()) {
            Serial.println("The client has disconnected");
            client.stop();
            connState = STATE_CONN_DISCONNECTED;

            if (httpState == STATE_HTTP_BODY && callbacksEnabled && onStreamingCompletedCallback) {
                onStreamingCompletedCallback();
            }
        }
    }
}
开发者ID:oxullo,项目名称:weatherpod,代码行数:34,代码来源:epdstreamer.cpp

示例6: LOG

void WebSocketChannel::didReceiveSocketStreamData(SocketStreamHandle& handle, const char* data, std::optional<size_t> len)
{
    if (len)
        LOG(Network, "WebSocketChannel %p didReceiveSocketStreamData() Received %zu bytes", this, len.value());
    else
        LOG(Network, "WebSocketChannel %p didReceiveSocketStreamData() Received no bytes", this);
    Ref<WebSocketChannel> protectedThis(*this); // The client can close the channel, potentially removing the last reference.
    ASSERT(&handle == m_handle);
    if (!m_document) {
        return;
    }
    if (!len || !len.value()) {
        handle.disconnect();
        return;
    }
    if (!m_client) {
        m_shouldDiscardReceivedData = true;
        handle.disconnect();
        return;
    }
    if (m_shouldDiscardReceivedData)
        return;
    if (!appendToBuffer(data, len.value())) {
        m_shouldDiscardReceivedData = true;
        fail("Ran out of memory while receiving WebSocket data.");
        return;
    }
    while (!m_suspended && m_client && !m_buffer.isEmpty()) {
        if (!processBuffer())
            break;
    }
}
开发者ID:eocanha,项目名称:webkit,代码行数:32,代码来源:WebSocketChannel.cpp

示例7: newRawPack

void PackParser::processBuffer()
{
    if(last_pack_unfinished){
        if(raw_buffer_.bytesAvailable() >= pack_size){
            QByteArray info = raw_buffer_.read(pack_size);
            last_pack_unfinished = false;
            emit newRawPack(info);
        }else{
            return;
        }
    }

    if(raw_buffer_.size() < 4){
        return;
    }

    // in case we have a lot of data to process
    QCoreApplication::processEvents();
    char c1, c2, c3, c4;
    raw_buffer_.getChar(&c1);
    raw_buffer_.getChar(&c2);
    raw_buffer_.getChar(&c3);
    raw_buffer_.getChar(&c4);
    pack_size = (uchar(c1) << 24) + (uchar(c2) << 16)
            + (uchar(c3) << 8) + uchar(c4);

    processBuffer();
}
开发者ID:aluex,项目名称:painttyWidget,代码行数:28,代码来源:packparser.cpp

示例8: ASSERT_UNUSED

void MainThreadWebSocketChannel::resumeTimerFired(Timer<MainThreadWebSocketChannel>* timer)
{
    ASSERT_UNUSED(timer, timer == &m_resumeTimer);

    processBuffer();
    if (!m_suspended && m_client && (m_state == ChannelClosed) && m_handle)
        didCloseSocketStream(m_handle.get());
}
开发者ID:darktears,项目名称:blink-crosswalk,代码行数:8,代码来源:MainThreadWebSocketChannel.cpp

示例9: printNextEntry

static void printNextEntry(log_device_t* dev) {
    maybePrintStart(dev);
    if (g_printBinary) {
        printBinary(&dev->queue->entry);
    } else {
        processBuffer(dev, &dev->queue->entry);
    }
    skipNextEntry(dev);
}
开发者ID:ACSOP,项目名称:android_system_core,代码行数:9,代码来源:logcat.cpp

示例10: protectedThis

void WebSocketChannel::resumeTimerFired()
{
    Ref<WebSocketChannel> protectedThis(*this); // The client can close the channel, potentially removing the last reference.
    while (!m_suspended && m_client && !m_buffer.isEmpty())
        if (!processBuffer())
            break;
    if (!m_suspended && m_client && m_closed && m_handle)
        didCloseSocketStream(*m_handle);
}
开发者ID:eocanha,项目名称:webkit,代码行数:9,代码来源:WebSocketChannel.cpp

示例11: envir

void TCPStreamSink::afterGettingFrame(unsigned frameSize, unsigned numTruncatedBytes) {
  if (numTruncatedBytes > 0) {
    envir() << "TCPStreamSink::afterGettingFrame(): The input frame data was too large for our buffer.  "
	    << numTruncatedBytes
	    << " bytes of trailing data was dropped!  Correct this by increasing the definition of \"TCP_STREAM_SINK_BUFFER_SIZE\" in \"include/TCPStreamSink.hh\".\n";
  }
  fUnwrittenBytesEnd += frameSize;
  processBuffer();
}
开发者ID:DayDayUpCQ,项目名称:live555,代码行数:9,代码来源:TCPStreamSink.cpp

示例12: while

void Connection::socketData() {

    int toRead;
    int bytesRead=0;
    int thisRead;

    toRead=tcpSocket->bytesAvailable();
    while(bytesRead<toRead) {
        switch(state) {
        case READ_HEADER_TYPE:
            thisRead=tcpSocket->read(&hdr[0],1);
            if (thisRead == 1) bytes++;
            if (hdr[0] == AUDIO_BUFFER) state=READ_AUDIO_HEADER;
            else state=READ_HEADER;
            break;

        case READ_AUDIO_HEADER:
            thisRead=tcpSocket->read(&hdr[bytes],AUDIO_HEADER_SIZE - bytes);
            bytes+=thisRead;
            if ((bytes == AUDIO_HEADER_SIZE)){
                    length = atoi(&hdr[AUDIO_LENGTH_POSITION]);
                    buffer = (char*)malloc(length);
                    bytes = 0;
                    state = READ_BUFFER;
             }
            break;

         case READ_HEADER:
            thisRead=tcpSocket->read(&hdr[bytes],HEADER_SIZE - bytes);
            bytes+=thisRead;
            if(bytes==HEADER_SIZE) {
                length=atoi(&hdr[26]);
                buffer=(char*)malloc(length);
                bytes=0;
                state=READ_BUFFER;
            }
            break;

        case READ_BUFFER:
            thisRead=tcpSocket->read(&buffer[bytes],length-bytes);
            bytes+=thisRead;
            //qDebug() << "READ_BUFFER: read " << bytes << " of " << length;
            if(bytes==length) {
                queue.enqueue(new Buffer(hdr,buffer));
                QTimer::singleShot(0,this,SLOT(processBuffer()));
                hdr=(char*)malloc(HEADER_SIZE);
                bytes=0;
                state=READ_HEADER_TYPE;
            }
            break;
        }
        bytesRead+=thisRead;
    }
}
开发者ID:8cH9azbsFifZ,项目名称:ghpsdr3-alex,代码行数:54,代码来源:Connection.cpp

示例13: QWidget

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    Fdata=new fft;
    Wdata=new wavedata;
    probe=new QAudioProbe;
    Ddata=new detaildata;
    l=new QStringList;
    label=new QLabel;

    label->resize( QSize( 500, 100 ));
    QPalette pa;

    pa.setColor(QPalette::Background, QColor(0x00,0xff,0x00,0x00));
    pa.setColor(QPalette::WindowText,Qt::white);

    label->setPalette (pa);

    QFont ft;
    ft.setPointSize(14);
    label->setFont(ft);
    volume=80;
    order=0;
    ismute=0;
    ui->setupUi(this);
    pushButtonc=0;
    ui->tableWidget->clearContents();
    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    playList=new QMediaPlaylist;
    playList->setPlaybackMode(QMediaPlaylist::Loop);
    player=new QMediaPlayer;
    player->setPlaylist(playList);
    player->setVolume(volume);
    ui->horizontalSlider->setRange(0, 0);
    ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint&)),
            this, SLOT(show_contextmenu(const QPoint&)));

    connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged1(qint64)));
    connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged1(qint64)));

    probe->setSource(player);
    connect(probe,SIGNAL(audioBufferProbed(QAudioBuffer)),Wdata,SLOT(processBuffer(QAudioBuffer)));
    //connect(probe,SIGNAL(audioBufferProbed(QAudioBuffer)),this,SLOT(test(QAudioBuffer)));
    connect(Wdata,SIGNAL(wavedataUpdated(wavedata&)),Fdata,SLOT(calculateFFT(wavedata&)));
    connect(Wdata,SIGNAL(wavedataUpdated(wavedata&)),Ddata,SLOT(processWaveData(wavedata&)));
    connect(Fdata,SIGNAL(FFTstandby(fft&)),Ddata,SLOT(processFFTData(fft&)));
    connect(Ddata,SIGNAL(detailDataStandbyT(QString&)),this,SLOT(update_ZhuangBi(QString&)));


}
开发者ID:LetUsScrewSomething,项目名称:triangle,代码行数:52,代码来源:widget.cpp

示例14: processBuffer

void StreamingPlayer::poling() {

    int processed = cross::AudioSystem::getSourceProcessed(source_id_);

    if (processed) {
        cross::AudioSystem::BufferID buffer;

        // 処理を終えたキューをデキュー
        cross::AudioSystem::unqueueBuffers(source_id_, 1, &buffer);

        // バッファを埋める
        processBuffer(buffer);
        
        // エンキュー
        cross::AudioSystem::queueBuffers(source_id_, 1, &buffer);
    }

}
开发者ID:doscoy,项目名称:tri_engine,代码行数:18,代码来源:tri_streaming_player.cpp

示例15: assert

bool ImuseChannel::appendData(Common::SeekableReadStream &b, int32 size) {
	if (_dataSize == -1) {
		assert(size > 8);
		uint32 imus_type = b.readUint32BE();
		/*uint32 imus_size =*/ b.readUint32BE();
		if (imus_type != MKTAG('i','M','U','S'))
			error("Invalid Chunk for imuse_channel");
		size -= 8;
		_tbufferSize = size;
		assert(_tbufferSize);
		_tbuffer = (byte *)malloc(_tbufferSize);
		if (!_tbuffer)
			error("imuse_channel failed to allocate memory");
		b.read(_tbuffer, size);
		_dataSize = -2;
	} else {
		if (_tbuffer) {
			byte *old = _tbuffer;
			int32 new_size = size + _tbufferSize;
			_tbuffer = (byte *)malloc(new_size);
			if (!_tbuffer)
				error("imuse_channel failed to allocate memory");
			memcpy(_tbuffer, old, _tbufferSize);
			free(old);
			b.read(_tbuffer + _tbufferSize, size);
			_tbufferSize += size;
		} else {
			_tbufferSize = size;
			_tbuffer = (byte *)malloc(_tbufferSize);
			if (!_tbuffer)
				error("imuse_channel failed to allocate memory");
			b.read(_tbuffer, size);
		}
	}

	processBuffer();

	_srbufferSize = _sbufferSize;
	if (_sbuffer && _bitsize == 12)
		decode();

	return true;
}
开发者ID:AlbanBedel,项目名称:scummvm,代码行数:43,代码来源:imuse_channel.cpp


注:本文中的processBuffer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。