26 Commits

Author SHA1 Message Date
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Imayhaveborkedit
fedf26bf3e Add FFmpegOpusAudio and other voice improvements
Rework FFmpeg player and add FFmpegOpusAudio

I have extracted some of the base FFmpeg source code into its own
base class and reimplemented the PCM and the new Opus variants.

Support avconv probing

Also fix a few things

Update `__all__`

Fix the bugs

Rework probe functions and add factory function

Probing involves subprocess so it has been reworked into an async
factory function.

Add docs + a few tweaks

* Removed unnecessary read() and is_opus() functions from FFmpegAudio
* Clear self._stdout in cleanup()
* Add 20 second process communication timeout to probe functions
* Capped probe function bitrate values at 512

Change AudioPlayer to use more accurate, monotonic time.perf_counter()

Add lazy opus loading

The library now no longer loads libopus on import, only on
opus.Encoder creation or manually.

Fix review nits
2019-07-22 20:46:40 -04:00
Imayhaveborkedit
20fa3001f2 Raise max encoder bitrate to 512kbps
Any higher is useless for opus anyways.
2019-06-20 22:52:47 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Rapptz
04262b9371 Wording nit, library -> function in load_opus 2019-04-08 17:51:15 -04:00
Rapptz
c904e4f25b Add a note to load_opus that it's auto loaded on Windows. 2019-04-08 02:34:26 -04:00
NCPlayz
fb02191b80 Organise documentation 2019-03-19 08:24:42 -04:00
Dante Dam
9656a21ebe Bumped copyright years to 2019. 2019-01-28 22:22:50 -05:00
Hornwitser
efb4ff850e [lint] Fix import order
Reorder imports to be consistenly grouped by standard library, third
party library, and local modules in that order thoughout the library.
2018-11-24 22:17:58 -05:00
Hornwitser
34fd266cf9 [lint] Do log formating lazily
Convert log("fmt" % args) to log("fmt", args) as the latter is lazy and
does not do the formating if the string is never logged.
2018-11-24 22:17:58 -05:00
Hornwitser
4ae8e81660 [lint] Remove redundant exception variables
Use bare raise statement when reraising the exception that occured, and
remove unused exception variables.  Also remove a pointless exception
handler in discord.opus.
2018-11-24 22:17:57 -05:00
Daniel
d53c3a6c12
Fixed opus error check
Fixes #1056
2018-02-06 11:19:42 -05:00
Daniel
881e598a6f Add errcheck functions to opus foreign functions 2018-01-31 18:58:27 -05:00
Tobotimus
3112e1c17e Add intersphinx 2018-01-06 17:23:59 -05:00
Rapptz
b06899e7d4 Defer logging formatting until the logger is actually called.
This would cause unnecessary format calls even if you didn't have
logging enabled.
2017-06-09 18:53:24 -04:00
Rapptz
3b1b26ffb1 Re-implement voice sending.
This is a complete redesign of the old voice code.

A list of major changes is as follows:

* The voice websocket will now automatically reconnect with
  exponential back-off just like the regular Client does.
* Removal of the stream player concept.
* Audio now gracefully pauses and resumes when a disconnect is found.
* Introduce a discord.AudioSource concept to abstract streams
* Flatten previous stream player functionality with the
  VoiceClient, e.g. player.stop() is now voice_client.stop()
* With the above re-coupling this means you no longer have to
  store players anywhere.
* The after function now requires a single parameter, the error,
  if any existed. This will typically be None.

A lot of this design is experimental.
2017-04-18 03:49:48 -04:00
Rapptz
ff9f5749e1 Update copyright year to 2017. 2017-01-20 23:19:19 -05:00
Kyle Repinski
643950abf8 Add ability to set opus encoder input signal type. 2017-01-03 09:51:14 -05:00
Rapptz
2fc496304c Add libopus DLLs for ease of use. 2016-05-06 12:23:24 -04:00
Jake
7efabce4b2 Enable FEC/PLR
Enable forward error correction + packet loss percent tuning in opus encoder. Additionally, use some sane defaults. This should fix people hearing robo in music when packet loss is happening.
2016-05-03 22:34:30 -07:00
Rapptz
055f5291f0 Add ability to set bandwith and bitrate.
Patch by Jake.
2016-02-02 19:58:59 -05:00
Rapptz
db4cc791dd Update license of files to 2016. 2016-01-04 22:28:29 -05:00
Rapptz
9bec041423 Documentation fixes for opus related import errors. 2015-12-08 19:47:47 -05:00
Rapptz
72f355bb64 Add OpusNotLoaded exception and opus.is_loaded utility function. 2015-12-08 19:37:34 -05:00
Rapptz
9deb7796a5 Documentation fixes for opus bindings. 2015-12-08 16:22:01 -05:00
Rapptz
a6d6d832ff Working voice sending implementation.
Currently you can only send from a stream that implements
``read`` and a ``ffmpeg`` or ``avconv``.
2015-12-08 06:37:38 -05:00