Skip to content

OpusFile and OpusFileStream: Open Opus files from memory. #90

@ijc8

Description

@ijc8

It'd be nice if OpusFile (and, for consistency, OpusFileStream) supported opening Opus files from memory.
The underlying opusfile library supports this via op_open_memory(), and this function is already wrapped in opus.py.

I think this would involve tweaking OpusFile.__init__() and OpusFileStream.__init__() to take path: str OR something like data: memoryview (or maybe collections.abc.ByteString).

(For what it's worth, the opposite direction already works nicely for in-memory usage, as OggOpusWriter accepts memoryview in write() and can take io.BytesIO in __init__().)

Let me know if this seems like a reasonable feature; I'd be happy to submit a PR.

Thanks for the useful bindings!
Ian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions