-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpusFile and OpusFileStream: Open Opus files from memory. #90
Comments
Hey Ian,
Sounds like a great idea to me. Thanks for the offer.
Please add tests in to demonstrate the functionality.
Cheers,
Matthew
…On Sat, 11 Sep 2021 at 08:51, Ian Clester ***@***.***> wrote:
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()
<https://opus-codec.org/docs/opusfile_api-0.7/group__stream__open__close.html#gaffc5769a1e5977f186f77a1fb08cb248>,
and this function is already wrapped in opus.py
<https://github.com/TeamPyOgg/PyOgg/blob/6871a4f234e8a3a346c4874a12509bfa02c4c63a/pyogg/opus.py#L1026>
.
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
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#90>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA653XEIOOOL4NYWWYRWOLDUBJVW3ANCNFSM5D2C2BRQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hi Matthew, Great! I went ahead and submitted #91 for this. Best, |
Awesome :o) Thanks Ian. I’ll try to get to it this week.
Cheers,
Matthew
…On Tue, 14 Sep 2021 at 10:56, Ian Clester ***@***.***> wrote:
Hi Matthew,
Great! I went ahead and submitted #91
<#91> for this.
A little ctypes finagling was required to avoid an extra copy, but
everything typechecks and passes (including the new tests).
Let me know if you'd like to see any changes (in style, API, tests, etc.).
Best,
Ian
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#90 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA653XAVY74XCW3VDN4ZYPTUBZ6TBANCNFSM5D2C2BRQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hey, any updates? I accidentally implemented the same functionality 😄 Best, Andreas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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__()
andOpusFileStream.__init__()
to takepath: str
OR something likedata: memoryview
(or maybecollections.abc.ByteString
).(For what it's worth, the opposite direction already works nicely for in-memory usage, as
OggOpusWriter
acceptsmemoryview
inwrite()
and can takeio.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
The text was updated successfully, but these errors were encountered: