Skip to content
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

Add Opus. #3022

Open
wants to merge 4 commits into
base: 4.0
Choose a base branch
from
Open

Add Opus. #3022

wants to merge 4 commits into from

Conversation

SineVector241
Copy link

Description

I've added nearly all of the opus's functions and implemented safe handlers for thread safety and reference safety. So it is easier to dispose of opus native objects using an IDisposable wrapper implementation.

Things that are missing are CTL definitions and Error Codes however these can optionally be implemented. Also this code only works with libopus v1.5 and above.

If you want, I can add all the opus cross platform binaries or workflow to this project.

Changes

  • Added NativeOpus.cs
  • Added OpusDecoderSafeHandle.cs
  • Added OpusDREDDecoderSafeHandle.cs
  • Added OpusDREDSafeHandle.cs
  • Added OpusEncoderSafeHandle.cs
  • Added OpusMSDecoderSafeHandle.cs
  • Added OpusMSEncoderSafeHandle.cs
  • Added OpusRepacketizerSafeHandle.cs
  • Created directory /Opus and /Opus/SafeHandlers in Discord.NET.V4.Audio
  • Allowed unsafe blocks in Discord.NET.V4.Audio (You could probably make the NativeOpus code be able to be compiled without having to use unsafe but it requires a bit more thinking.)

Related Issues

N.A.

@SineVector241
Copy link
Author

Also note, this code is part of my other project/library (OpusSharp) however I have added it for freedom of use for Discord.NET

… attribute instead for AOT compatibility. Needed to also convert net6.0 to net7.0 to support LibraryImport attribute.
@kalebbroo
Copy link

As a user I would love to see this implemented!

@SineVector241
Copy link
Author

SineVector241 commented Nov 9, 2024

Some functions still aren't correct. I'm still going through them and double checking them as well as documenting them. I will update the pr after I finish some tests on the fixes I've made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants