[fpc-pascal] Pipe vs Memory buffer.

Lars noreply at z505.com
Sun Jan 29 23:50:18 CET 2017


On Sun, January 29, 2017 4:45 am, fredvs wrote:
> Hello Lars.
>
>
> Thanks for your brilliant light.
>
>
>> (and can you look into the actual source code of opus or is this closed
>>  source?)
>
> ==> https://github.com/xiph/opus
>


Well the function you were using with a buffer is here:

https://github.com/xiph/opusfile/search?utf8=%E2%9C%93&q=op_test_memory

in src/opusfile.c

OggOpusFile *op_test_memory(const unsigned char *_data,size_t _size,
 int *_error){
    OpusFileCallbacks cb;
    return
op_test_close_on_failure(op_mem_stream_create(&cb,_data,_size),&cb,
   _error);
}

So it calls op_mem_stream_create which is:
https://github.com/xiph/opusfile/search?utf8=%E2%9C%93&q=op_mem_stream_create&type=Code

in src/stream.c

void *op_mem_stream_create(OpusFileCallbacks *_cb,
 const unsigned char *_data,size_t _size){
  OpusMemStream *stream;
  if(_size>OP_MEM_SIZE_MAX)return NULL;
  stream=(OpusMemStream *)_ogg_malloc(sizeof(*stream));
  if(stream!=NULL){
    *_cb=*&OP_MEM_CALLBACKS;
    stream->data=_data;
    stream->size=_size;
    stream->pos=0;
  }
  return stream;
}


Thanks to github's cool web gui you can find code pretty fast and share
where code is with developers, compared to if it was on your hard drive
you could not "share your hard drive" unless you were on emule or vnc ;-)



More information about the fpc-pascal mailing list