Open ijc8 opened 3 years ago
Hi @ijc8 , I'm looking exactly for this, but for loading a VorbisFile
.
I'm trying to adapt your code to vorbis, but I couldn't find the equivalent of opus.op_open_memory
for the vorbis.
Do you have any idea how to open a VorbisFile
from memory?
Hey @bernardohenz! I haven't tried it myself, but it should be possible using vorbis.ov_open_callbacks
from libvorbisfile as mentioned here.
It looks like that's what opus.op_open_memory
does under the hood. You could use opusfile's read-from-memory callbacks as a model, though this may be a little more painful to implement in Python with ctypes. (See here for how to use Python functions as C callbacks.)
Modifies
OpusFile
/OpusFileStream
's__init__()
to accept a path or buffer and call the appropriate libopusfile function (op_open_file
orop_open_memory
, respectively).Resolves #90.