本文整理汇总了C++中MemoryBuffer::data方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBuffer::data方法的具体用法?C++ MemoryBuffer::data怎么用?C++ MemoryBuffer::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBuffer
的用法示例。
在下文中一共展示了MemoryBuffer::data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
DecoderStatus AacDecoder::process(Packet*packet){
FXlong fs = packet->stream_position;
FXbool eos = packet->flags&FLAG_EOS;
long unsigned int samplerate;
FXuchar channels;
NeAACDecFrameInfo frame;
if (packet->flags&AAC_FLAG_CONFIG) {
handle = NeAACDecOpen();
if (NeAACDecInit2(handle,packet->data(),packet->size(),&samplerate,&channels)<0){
packet->unref();
return DecoderError;
}
return DecoderOk;
}
else {
buffer.append(packet->data(),packet->size());
packet->unref();
if (handle==NULL) {
handle = NeAACDecOpen();
long n = NeAACDecInit(handle,buffer.data(),buffer.size(),&samplerate,&channels);
if (n<0) return DecoderError;
else if (n>0) buffer.readBytes(n);
af.set(AP_FORMAT_S16,samplerate,channels);
engine->output->post(new ConfigureEvent(af,Codec::AAC));
}
}
if (buffer.size()<FAAD_MIN_STREAMSIZE*2) {
return DecoderOk;
}
do {
if (out==NULL){
out = engine->decoder->get_output_packet();
if (out==NULL) return DecoderInterrupted;
out->af = af;
out->stream_position = fs;
out->stream_length = packet->stream_length;
}
void * outbuffer = out->ptr();
NeAACDecDecode2(handle,&frame,buffer.data(),buffer.size(),&outbuffer,out->availableFrames()*out->af.framesize());
if (frame.bytesconsumed>0) {
buffer.readBytes(frame.bytesconsumed);
}
if (frame.error > 0) {
GM_DEBUG_PRINT("[aac] error %d (%ld): %s\n",frame.error,frame.bytesconsumed,faacDecGetErrorMessage(frame.error));
}
if (frame.samples) {
fs+=(frame.samples/frame.channels);
out->wroteFrames((frame.samples/frame.channels));
if (out->availableFrames()==0) {
engine->output->post(out);
out=NULL;
}
}
}
while(buffer.size()>(2*FAAD_MIN_STREAMSIZE) && frame.bytesconsumed);
if (eos) {
if (out) {
engine->output->post(out);
out=NULL;
}
engine->output->post(new ControlEvent(End,packet->stream));
}
return DecoderOk;
}