├── src ├── main │ ├── resources │ │ ├── darwin │ │ │ └── libopus.dylib │ │ ├── linux-x86 │ │ │ └── libopus.so │ │ ├── win32-x86-64 │ │ │ ├── opus.dll │ │ │ └── opus0.dll │ │ ├── linux-x86-64 │ │ │ └── libopus.so │ │ └── win32-x86 │ │ │ └── opus.dll │ └── java │ │ └── net │ │ └── tomp2p │ │ └── opuswrapper │ │ └── Opus.java └── test │ └── java │ └── net │ └── tomp2p │ └── opuswrapper │ └── OpusExample.java ├── .gitignore ├── Readme.md └── pom.xml /src/main/resources/darwin/libopus.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbocek/opus-wrapper/HEAD/src/main/resources/darwin/libopus.dylib -------------------------------------------------------------------------------- /src/main/resources/linux-x86/libopus.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbocek/opus-wrapper/HEAD/src/main/resources/linux-x86/libopus.so -------------------------------------------------------------------------------- /src/main/resources/win32-x86-64/opus.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbocek/opus-wrapper/HEAD/src/main/resources/win32-x86-64/opus.dll -------------------------------------------------------------------------------- /src/main/resources/linux-x86-64/libopus.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tbocek/opus-wrapper/HEAD/src/main/resources/linux-x86-64/libopus.so -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .settings 4 | .checkstyle 5 | .cache 6 | .idea 7 | *.iml 8 | *~ 9 | p2p.log 10 | /target 11 | /bin -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Java Opus Wrapper 2 | ===================== 3 | 4 | This wrapper was created with https://code.google.com/p/jnaerator/ and sligthly adapted. 5 | 6 | Binaries found here: 7 | 8 | * https://github.com/JohnACarruthers/Aural/tree/master/Aural/Libs/64bit 9 | * https://github.com/JohnACarruthers/Aural/tree/master/Aural/Libs/32bit 10 | * http://packages.ubuntu.com/trusty/amd64/libopus0/download 11 | * http://packages.ubuntu.com/trusty/i386/libopus0/download 12 | * OSX binaries compiled by David Aggeler 13 | 14 | How to use the opus wrapper: 15 | 16 | Either get the "jar":http://tomp2p.net/dev/mvn/net/tomp2p/opus-wrapper/1.3/ 17 | 18 | or use maven with 19 | 20 | ``` 21 | 22 | 23 | tomp2p.net 24 | http://tomp2p.net/dev/mvn/ 25 | 26 | 27 | 28 | ... 29 | 30 | 31 | net.tomp2p 32 | opus-wrapper 33 | 1.3 34 | 35 | ``` 36 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | net.tomp2p 4 | opus-wrapper 5 | 1.5-SNAPSHOT 6 | 7 | 8 | https://github.com/tbocek/opus-wrapper/OpusWrapper 9 | scm:git:git://github.com/tbocek/opus-wrapper.git 10 | scm:git:ssh://git@github.com/tbocek/opus-wrapper.git 11 | 12 | 13 | 14 | 15 | ssh.tomp2p 16 | 17 | scp://tomp2p.net/home/draft/maven 18 | 19 | 20 | 21 | 22 | 23 | 24 | org.apache.maven.wagon 25 | wagon-ssh 26 | 2.6 27 | 28 | 29 | 30 | 31 | maven-compiler-plugin 32 | 3.1 33 | 34 | 1.7 35 | 1.7 36 | 37 | 38 | 39 | maven-source-plugin 40 | 2.1.2 41 | 42 | 43 | attach-source 44 | package 45 | 46 | jar 47 | 48 | 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | net.java.dev.jna 59 | jna 60 | 4.1.0 61 | 62 | 63 | junit 64 | junit 65 | 4.11 66 | test 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/test/java/net/tomp2p/opuswrapper/OpusExample.java: -------------------------------------------------------------------------------- 1 | package net.tomp2p.opuswrapper; 2 | 3 | import java.io.File; 4 | import java.nio.ByteBuffer; 5 | import java.nio.IntBuffer; 6 | import java.nio.ShortBuffer; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import javax.sound.sampled.AudioFormat; 11 | import javax.sound.sampled.AudioSystem; 12 | import javax.sound.sampled.DataLine; 13 | import javax.sound.sampled.LineUnavailableException; 14 | import javax.sound.sampled.SourceDataLine; 15 | import javax.sound.sampled.TargetDataLine; 16 | 17 | import org.junit.Test; 18 | 19 | import com.sun.jna.Native; 20 | import com.sun.jna.ptr.PointerByReference; 21 | 22 | public class OpusExample { 23 | 24 | static { 25 | try { 26 | System.loadLibrary("opus"); 27 | } catch (UnsatisfiedLinkError e1) { 28 | try { 29 | File f = Native.extractFromResourcePath("opus"); 30 | System.load(f.getAbsolutePath()); 31 | } catch (Exception e2) { 32 | e1.printStackTrace(); 33 | e2.printStackTrace(); 34 | } 35 | } 36 | } 37 | 38 | @Test 39 | public void testCodec() throws LineUnavailableException { 40 | 41 | AudioFormat format = new AudioFormat(8000.0f, 16, 1, true, true); 42 | ShortBuffer dataFromMic = recordFromMicrophone(format, 5000); 43 | List packets = encode(dataFromMic); 44 | // packets go over network 45 | ShortBuffer decodedFromNetwork = decode(packets); 46 | playBack(format, decodedFromNetwork); 47 | } 48 | 49 | private ShortBuffer decode(List packets) { 50 | IntBuffer error = IntBuffer.allocate(4); 51 | PointerByReference opusDecoder = Opus.INSTANCE.opus_decoder_create(8000, 1, error); 52 | 53 | ShortBuffer shortBuffer = ShortBuffer.allocate(1024 * 1024); 54 | for (ByteBuffer dataBuffer : packets) { 55 | byte[] transferedBytes = new byte[dataBuffer.remaining()]; 56 | dataBuffer.get(transferedBytes); 57 | int decoded = Opus.INSTANCE.opus_decode(opusDecoder, transferedBytes, transferedBytes.length, 58 | shortBuffer, 80, 0); 59 | shortBuffer.position(shortBuffer.position() + decoded); 60 | } 61 | shortBuffer.flip(); 62 | 63 | Opus.INSTANCE.opus_decoder_destroy(opusDecoder); 64 | return shortBuffer; 65 | } 66 | 67 | private List encode(ShortBuffer shortBuffer) { 68 | IntBuffer error = IntBuffer.allocate(4); 69 | PointerByReference opusEncoder = Opus.INSTANCE.opus_encoder_create(8000, 1, 70 | Opus.OPUS_APPLICATION_RESTRICTED_LOWDELAY, error); 71 | int read = 0; 72 | List list = new ArrayList<>(); 73 | while (shortBuffer.hasRemaining()) { 74 | ByteBuffer dataBuffer = ByteBuffer.allocate(1024); 75 | int toRead = Math.min(shortBuffer.remaining(), dataBuffer.remaining()); 76 | /* 77 | * if (frame_size==sampling_rate/400) variable_duration = 78 | * OPUS_FRAMESIZE_2_5_MS; else if (frame_size==sampling_rate/200) 79 | * variable_duration = OPUS_FRAMESIZE_5_MS; else if 80 | * (frame_size==sampling_rate/100) variable_duration = 81 | * OPUS_FRAMESIZE_10_MS; else if (frame_size==sampling_rate/50) 82 | * variable_duration = OPUS_FRAMESIZE_20_MS; else if 83 | * (frame_size==sampling_rate/25) variable_duration = 84 | * OPUS_FRAMESIZE_40_MS; 85 | */ 86 | read = Opus.INSTANCE.opus_encode(opusEncoder, shortBuffer, 80, dataBuffer, toRead); 87 | // System.err.println("read: "+read); 88 | dataBuffer.position(dataBuffer.position() + read); 89 | dataBuffer.flip(); 90 | list.add(dataBuffer); 91 | shortBuffer.position(shortBuffer.position() + 80); 92 | } 93 | Opus.INSTANCE.opus_encoder_destroy(opusEncoder); 94 | // used for debugging 95 | shortBuffer.flip(); 96 | return list; 97 | } 98 | 99 | private void playBack(AudioFormat format, ShortBuffer shortBuffer) throws LineUnavailableException { 100 | SourceDataLine speaker = AudioSystem.getSourceDataLine(format); 101 | speaker.open(format); 102 | speaker.start(); 103 | 104 | short[] shortAudioBuffer = new short[shortBuffer.remaining()]; 105 | shortBuffer.get(shortAudioBuffer); 106 | byte[] audio = ShortToByte_Twiddle_Method(shortAudioBuffer); 107 | speaker.write(audio, 0, audio.length); 108 | } 109 | 110 | private ShortBuffer recordFromMicrophone(AudioFormat format, int lengthMillis) 111 | throws LineUnavailableException { 112 | DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); 113 | if (!AudioSystem.isLineSupported(info)) { 114 | throw new LineUnavailableException("not supported"); 115 | } 116 | TargetDataLine microphone = AudioSystem.getTargetDataLine(format); 117 | // Obtain and open the line. 118 | microphone.open(format); 119 | 120 | // Assume that the TargetDataLine, line, has already been obtained and 121 | // opened. 122 | 123 | byte[] data = new byte[microphone.getBufferSize() / 5]; 124 | 125 | // Begin audio capture. 126 | microphone.start(); 127 | // probably way too big 128 | ShortBuffer shortBuffer = ShortBuffer.allocate(1024 * 1024); 129 | // Here, stopped is a global boolean set by another thread. 130 | long start = System.currentTimeMillis(); 131 | int numBytesRead; 132 | while (System.currentTimeMillis() - start < lengthMillis) { 133 | // Read the next chunk of data from the TargetDataLine. 134 | numBytesRead = microphone.read(data, 0, data.length); 135 | // Save this chunk of data. 136 | for (int i = 0; i < numBytesRead; i += 2) { 137 | int b1 = data[i + 1] & 0xff; 138 | int b2 = data[i] << 8; 139 | shortBuffer.put((short) (b1 | b2)); 140 | } 141 | } 142 | shortBuffer.flip(); 143 | return shortBuffer; 144 | } 145 | 146 | private byte[] ShortToByte_Twiddle_Method(final short[] input) { 147 | final int len = input.length; 148 | final byte[] buffer = new byte[len * 2]; 149 | for (int i = 0; i < len; i++) { 150 | buffer[(i * 2) + 1] = (byte) (input[i]); 151 | buffer[(i * 2)] = (byte) (input[i] >> 8); 152 | } 153 | return buffer; 154 | } 155 | } -------------------------------------------------------------------------------- /src/main/resources/win32-x86-64/opus0.dll: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Aural/Aural/Libs/64bit/opus.dll at master · JohnACarruthers/Aural 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Skip to content 66 |
67 | 68 | 69 | 70 | 71 | 72 | 73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 95 | 96 | 97 | 98 |
99 | 100 | This repository 101 | 102 | 103 | 120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 136 |
137 | 138 | 139 | 140 | 141 | 172 | 173 | 194 | 195 | 196 | 197 |
198 |
199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 |
207 |
208 | 209 |
210 |
211 | 212 | 213 |
    214 | 215 |
  • 216 |
    217 | 218 |
    219 | 222 | 223 | 224 | 225 | Watch 226 | 227 | 228 | 229 |
    230 | 280 |
    281 |
    282 | 283 |
    284 |
  • 285 | 286 |
  • 287 | 288 | 289 | 306 | 307 |
  • 308 | 309 | 310 |
  • 311 | 312 | Fork 313 | 314 | 315 |
  • 316 | 317 | 318 |
319 | 320 |

321 | public 322 | 323 | 324 | 325 | 326 | / 327 | Aural 328 | 329 | 330 | Octocat-spinner-32 331 | 332 | 333 |

334 |
335 |
336 | 337 |
338 |
339 |
340 | 341 | 342 |
343 |
344 | 372 |
373 | 393 | 394 | 395 |
396 |
397 | 398 |
399 | 400 | 401 | 402 | 403 |
406 |

HTTPS clone URL

407 |
408 | 410 | 411 | 412 |
413 |
414 | 415 | 416 | 417 |
420 |

SSH clone URL

421 |
422 | 424 | 425 | 426 |
427 |
428 | 429 | 430 | 431 |
434 |

Subversion checkout URL

435 |
436 | 438 | 439 | 440 |
441 |
442 | 443 | 444 |

You can clone with 445 | HTTPS, 446 | SSH, 447 | or Subversion. 448 | 449 | 450 | 451 | 452 | 453 |

454 | 455 | 456 | 457 | 462 | 463 | Download ZIP 464 | 465 |
466 |
467 | 468 |
469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 |
479 | 480 | 481 |
482 | 486 | 487 | branch: 488 | master 489 | 490 | 491 | 545 |
546 | 547 | 550 |
551 | 552 | 553 |
554 | Fetching contributors… 555 | 556 |
557 |

Octocat-spinner-32-eaf2f5

558 |

Cannot retrieve contributors at this time

559 |
560 |
561 | 562 |
563 |
564 |
565 |
566 | 567 | file 568 | 569 | 469.504 kb 570 |
571 |
572 |
573 | Raw 574 | History 575 |
576 | 577 | 581 | 582 | Delete 583 | 584 |
585 |
586 |
587 |
588 | View Raw 589 |
590 |
591 | 592 |
593 |
594 | 595 | 596 | 602 | 603 |
604 | 605 |
606 | 607 |
608 |
609 | 610 | 611 |
612 | 613 |
614 | 637 |
638 | 639 | 640 |
641 |
642 |
643 | 644 |
645 |
646 | 655 |
656 | 657 | 658 | 659 |
660 | 661 | 662 | Something went wrong with that request. Please try again. 663 |
664 | 665 | 666 | 667 | 668 | -------------------------------------------------------------------------------- /src/main/resources/win32-x86/opus.dll: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Aural/Aural/Libs/32bit/opus.dll at master · JohnACarruthers/Aural 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Skip to content 66 |
67 | 68 | 69 | 70 | 71 | 72 | 73 |
74 |
75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 95 | 96 | 97 | 98 |
99 | 100 | This repository 101 | 102 | 103 | 120 |
121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 136 |
137 | 138 | 139 | 140 | 141 | 172 | 173 | 194 | 195 | 196 | 197 |
198 |
199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 |
207 |
208 | 209 |
210 |
211 | 212 | 213 |
    214 | 215 |
  • 216 |
    217 | 218 |
    219 | 222 | 223 | 224 | 225 | Watch 226 | 227 | 228 | 229 |
    230 | 280 |
    281 |
    282 | 283 |
    284 |
  • 285 | 286 |
  • 287 | 288 | 289 | 306 | 307 |
  • 308 | 309 | 310 |
  • 311 | 312 | Fork 313 | 314 | 315 |
  • 316 | 317 | 318 |
319 | 320 |

321 | public 322 | 323 | 324 | 325 | 326 | / 327 | Aural 328 | 329 | 330 | Octocat-spinner-32 331 | 332 | 333 |

334 |
335 |
336 | 337 |
338 |
339 |
340 | 341 | 342 |
343 |
344 | 372 |
373 | 393 | 394 | 395 |
396 |
397 | 398 |
399 | 400 | 401 | 402 | 403 |
406 |

HTTPS clone URL

407 |
408 | 410 | 411 | 412 |
413 |
414 | 415 | 416 | 417 |
420 |

SSH clone URL

421 |
422 | 424 | 425 | 426 |
427 |
428 | 429 | 430 | 431 |
434 |

Subversion checkout URL

435 |
436 | 438 | 439 | 440 |
441 |
442 | 443 | 444 |

You can clone with 445 | HTTPS, 446 | SSH, 447 | or Subversion. 448 | 449 | 450 | 451 | 452 | 453 |

454 | 455 | 456 | 457 | 462 | 463 | Download ZIP 464 | 465 |
466 |
467 | 468 |
469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 |
479 | 480 | 481 |
482 | 486 | 487 | branch: 488 | master 489 | 490 | 491 | 545 |
546 | 547 | 550 |
551 | 552 | 553 |
554 | John Carruthers 555 | 556 | 557 | 560 | 561 |
562 |

1 contributor

563 | 564 |
565 | 574 |
575 | 576 |
577 |
578 |
579 |
580 | 581 | file 582 | 583 | 380.928 kb 584 |
585 |
586 |
587 | Raw 588 | History 589 |
590 | 591 | 595 | 596 | Delete 597 | 598 |
599 |
600 |
601 |
602 | View Raw 603 |
604 |
605 | 606 |
607 |
608 | 609 | 610 | 616 | 617 |
618 | 619 |
620 | 621 |
622 |
623 | 624 | 625 |
626 | 627 |
628 | 651 |
652 | 653 | 654 |
655 |
656 |
657 | 658 |
659 |
660 | 669 |
670 | 671 | 672 | 673 |
674 | 675 | 676 | Something went wrong with that request. Please try again. 677 |
678 | 679 | 680 | 681 | 682 | -------------------------------------------------------------------------------- /src/main/java/net/tomp2p/opuswrapper/Opus.java: -------------------------------------------------------------------------------- 1 | package net.tomp2p.opuswrapper; 2 | import java.nio.ByteBuffer; 3 | import java.nio.FloatBuffer; 4 | import java.nio.IntBuffer; 5 | import java.nio.ShortBuffer; 6 | 7 | import com.sun.jna.Library; 8 | import com.sun.jna.Native; 9 | import com.sun.jna.NativeLibrary; 10 | import com.sun.jna.Pointer; 11 | import com.sun.jna.PointerType; 12 | import com.sun.jna.ptr.FloatByReference; 13 | import com.sun.jna.ptr.IntByReference; 14 | import com.sun.jna.ptr.PointerByReference; 15 | import com.sun.jna.ptr.ShortByReference; 16 | /** 17 | * JNA Wrapper for library opus
18 | * This file was autogenerated by JNAerator,
19 | * a tool written by Olivier Chafik that uses a few opensource projects..
20 | * For help, please visit NativeLibs4Java , Rococoa, or JNA. 21 | */ 22 | public interface Opus extends Library { 23 | public static final String JNA_LIBRARY_NAME = "opus"; 24 | public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(Opus.JNA_LIBRARY_NAME); 25 | public static final Opus INSTANCE = (Opus)Native.loadLibrary(Opus.JNA_LIBRARY_NAME, Opus.class); 26 | 27 | // ****** Constants 28 | 29 | /** native declaration : /tmp/opus_defines.h */ 30 | public static final int OPUS_GET_LSB_DEPTH_REQUEST = (int)4037; 31 | /** native declaration : /tmp/opus_defines.h */ 32 | public static final int OPUS_GET_APPLICATION_REQUEST = (int)4001; 33 | /** native declaration : /tmp/opus_defines.h */ 34 | public static final int OPUS_GET_FORCE_CHANNELS_REQUEST = (int)4023; 35 | /** native declaration : /tmp/opus_defines.h */ 36 | public static final int OPUS_GET_VBR_REQUEST = (int)4007; 37 | /** native declaration : /tmp/opus_defines.h */ 38 | public static final int OPUS_GET_BANDWIDTH_REQUEST = (int)4009; 39 | /** native declaration : /tmp/opus_defines.h */ 40 | public static final int OPUS_SET_BITRATE_REQUEST = (int)4002; 41 | /** native declaration : /tmp/opus_defines.h */ 42 | public static final int OPUS_SET_BANDWIDTH_REQUEST = (int)4008; 43 | /** native declaration : /tmp/opus_defines.h */ 44 | public static final int OPUS_SIGNAL_MUSIC = (int)3002; 45 | /** native declaration : /tmp/opus_defines.h */ 46 | public static final int OPUS_RESET_STATE = (int)4028; 47 | /** native declaration : /tmp/opus_defines.h */ 48 | public static final int OPUS_FRAMESIZE_2_5_MS = (int)5001; 49 | /** native declaration : /tmp/opus_defines.h */ 50 | public static final int OPUS_GET_COMPLEXITY_REQUEST = (int)4011; 51 | /** native declaration : /tmp/opus_defines.h */ 52 | public static final int OPUS_FRAMESIZE_40_MS = (int)5005; 53 | /** native declaration : /tmp/opus_defines.h */ 54 | public static final int OPUS_SET_PACKET_LOSS_PERC_REQUEST = (int)4014; 55 | /** native declaration : /tmp/opus_defines.h */ 56 | public static final int OPUS_GET_VBR_CONSTRAINT_REQUEST = (int)4021; 57 | /** native declaration : /tmp/opus_defines.h */ 58 | public static final int OPUS_SET_INBAND_FEC_REQUEST = (int)4012; 59 | /** native declaration : /tmp/opus_defines.h */ 60 | public static final int OPUS_APPLICATION_RESTRICTED_LOWDELAY = (int)2051; 61 | /** native declaration : /tmp/opus_defines.h */ 62 | public static final int OPUS_BANDWIDTH_FULLBAND = (int)1105; 63 | /** native declaration : /tmp/opus_defines.h */ 64 | public static final int OPUS_SET_VBR_REQUEST = (int)4006; 65 | /** native declaration : /tmp/opus_defines.h */ 66 | public static final int OPUS_BANDWIDTH_SUPERWIDEBAND = (int)1104; 67 | /** native declaration : /tmp/opus_defines.h */ 68 | public static final int OPUS_SET_FORCE_CHANNELS_REQUEST = (int)4022; 69 | /** native declaration : /tmp/opus_defines.h */ 70 | public static final int OPUS_APPLICATION_VOIP = (int)2048; 71 | /** native declaration : /tmp/opus_defines.h */ 72 | public static final int OPUS_SIGNAL_VOICE = (int)3001; 73 | /** native declaration : /tmp/opus_defines.h */ 74 | public static final int OPUS_GET_FINAL_RANGE_REQUEST = (int)4031; 75 | /** native declaration : /tmp/opus_defines.h */ 76 | public static final int OPUS_BUFFER_TOO_SMALL = (int)-2; 77 | /** native declaration : /tmp/opus_defines.h */ 78 | public static final int OPUS_SET_COMPLEXITY_REQUEST = (int)4010; 79 | /** native declaration : /tmp/opus_defines.h */ 80 | public static final int OPUS_FRAMESIZE_ARG = (int)5000; 81 | /** native declaration : /tmp/opus_defines.h */ 82 | public static final int OPUS_GET_LOOKAHEAD_REQUEST = (int)4027; 83 | /** native declaration : /tmp/opus_defines.h */ 84 | public static final int OPUS_GET_INBAND_FEC_REQUEST = (int)4013; 85 | /** native declaration : /tmp/opus_defines.h */ 86 | public static final int OPUS_BITRATE_MAX = (int)-1; 87 | /** native declaration : /tmp/opus_defines.h */ 88 | public static final int OPUS_FRAMESIZE_5_MS = (int)5002; 89 | /** native declaration : /tmp/opus_defines.h */ 90 | public static final int OPUS_BAD_ARG = (int)-1; 91 | /** native declaration : /tmp/opus_defines.h */ 92 | public static final int OPUS_GET_PITCH_REQUEST = (int)4033; 93 | /** native declaration : /tmp/opus_defines.h */ 94 | public static final int OPUS_SET_SIGNAL_REQUEST = (int)4024; 95 | /** native declaration : /tmp/opus_defines.h */ 96 | public static final int OPUS_FRAMESIZE_20_MS = (int)5004; 97 | /** native declaration : /tmp/opus_defines.h */ 98 | public static final int OPUS_APPLICATION_AUDIO = (int)2049; 99 | /** native declaration : /tmp/opus_defines.h */ 100 | public static final int OPUS_GET_DTX_REQUEST = (int)4017; 101 | /** native declaration : /tmp/opus_defines.h */ 102 | public static final int OPUS_FRAMESIZE_10_MS = (int)5003; 103 | /** native declaration : /tmp/opus_defines.h */ 104 | public static final int OPUS_SET_LSB_DEPTH_REQUEST = (int)4036; 105 | /** native declaration : /tmp/opus_defines.h */ 106 | public static final int OPUS_UNIMPLEMENTED = (int)-5; 107 | /** native declaration : /tmp/opus_defines.h */ 108 | public static final int OPUS_GET_PACKET_LOSS_PERC_REQUEST = (int)4015; 109 | /** native declaration : /tmp/opus_defines.h */ 110 | public static final int OPUS_INVALID_STATE = (int)-6; 111 | /** native declaration : /tmp/opus_defines.h */ 112 | public static final int OPUS_SET_EXPERT_FRAME_DURATION_REQUEST = (int)4040; 113 | /** native declaration : /tmp/opus_defines.h */ 114 | public static final int OPUS_FRAMESIZE_60_MS = (int)5006; 115 | /** native declaration : /tmp/opus_defines.h */ 116 | public static final int OPUS_GET_BITRATE_REQUEST = (int)4003; 117 | /** native declaration : /tmp/opus_defines.h */ 118 | public static final int OPUS_INTERNAL_ERROR = (int)-3; 119 | /** native declaration : /tmp/opus_defines.h */ 120 | public static final int OPUS_SET_MAX_BANDWIDTH_REQUEST = (int)4004; 121 | /** native declaration : /tmp/opus_defines.h */ 122 | public static final int OPUS_SET_VBR_CONSTRAINT_REQUEST = (int)4020; 123 | /** native declaration : /tmp/opus_defines.h */ 124 | public static final int OPUS_GET_MAX_BANDWIDTH_REQUEST = (int)4005; 125 | /** native declaration : /tmp/opus_defines.h */ 126 | public static final int OPUS_BANDWIDTH_NARROWBAND = (int)1101; 127 | /** native declaration : /tmp/opus_defines.h */ 128 | public static final int OPUS_SET_GAIN_REQUEST = (int)4034; 129 | /** native declaration : /tmp/opus_defines.h */ 130 | public static final int OPUS_SET_PREDICTION_DISABLED_REQUEST = (int)4042; 131 | /** native declaration : /tmp/opus_defines.h */ 132 | public static final int OPUS_SET_APPLICATION_REQUEST = (int)4000; 133 | /** native declaration : /tmp/opus_defines.h */ 134 | public static final int OPUS_SET_DTX_REQUEST = (int)4016; 135 | /** native declaration : /tmp/opus_defines.h */ 136 | public static final int OPUS_BANDWIDTH_MEDIUMBAND = (int)1102; 137 | /** native declaration : /tmp/opus_defines.h */ 138 | public static final int OPUS_GET_SAMPLE_RATE_REQUEST = (int)4029; 139 | /** native declaration : /tmp/opus_defines.h */ 140 | public static final int OPUS_GET_EXPERT_FRAME_DURATION_REQUEST = (int)4041; 141 | /** native declaration : /tmp/opus_defines.h */ 142 | public static final int OPUS_AUTO = (int)-1000; 143 | /** native declaration : /tmp/opus_defines.h */ 144 | public static final int OPUS_GET_SIGNAL_REQUEST = (int)4025; 145 | /** native declaration : /tmp/opus_defines.h */ 146 | public static final int OPUS_GET_LAST_PACKET_DURATION_REQUEST = (int)4039; 147 | /** native declaration : /tmp/opus_defines.h */ 148 | public static final int OPUS_GET_PREDICTION_DISABLED_REQUEST = (int)4043; 149 | /** native declaration : /tmp/opus_defines.h */ 150 | public static final int OPUS_GET_GAIN_REQUEST = (int)4045; 151 | /** native declaration : /tmp/opus_defines.h */ 152 | public static final int OPUS_BANDWIDTH_WIDEBAND = (int)1103; 153 | /** native declaration : /tmp/opus_defines.h */ 154 | public static final int OPUS_INVALID_PACKET = (int)-4; 155 | /** native declaration : /tmp/opus_defines.h */ 156 | public static final int OPUS_ALLOC_FAIL = (int)-7; 157 | /** native declaration : /tmp/opus_defines.h */ 158 | public static final int OPUS_OK = (int)0; 159 | 160 | /** native declaration : /tmp/opus_multistream.h */ 161 | public static final int OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST = (int)5122; 162 | /** native declaration : /tmp/opus_multistream.h */ 163 | public static final int OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST = (int)5120; 164 | 165 | /** 166 | * Gets the size of an OpusEncoder structure.
167 | * @param[in] channels int: Number of channels.
168 | * This must be 1 or 2.
169 | * @returns The size in bytes.
170 | * Original signature : int opus_encoder_get_size(int)
171 | * native declaration : /tmp/opus.h:134 172 | */ 173 | int opus_encoder_get_size(int channels); 174 | /** 175 | * Allocates and initializes an encoder state.
176 | * There are three coding modes:
177 | * * @ref OPUS_APPLICATION_VOIP gives best quality at a given bitrate for voice
178 | * signals. It enhances the input signal by high-pass filtering and
179 | * emphasizing formants and harmonics. Optionally it includes in-band
180 | * forward error correction to protect against packet loss. Use this
181 | * mode for typical VoIP applications. Because of the enhancement,
182 | * even at high bitrates the output may sound different from the input.
183 | * * @ref OPUS_APPLICATION_AUDIO gives best quality at a given bitrate for most
184 | * non-voice signals like music. Use this mode for music and mixed
185 | * (music/voice) content, broadcast, and applications requiring less
186 | * than 15 ms of coding delay.
187 | * * @ref OPUS_APPLICATION_RESTRICTED_LOWDELAY configures low-delay mode that
188 | * disables the speech-optimized mode in exchange for slightly reduced delay.
189 | * This mode can only be set on an newly initialized or freshly reset encoder
190 | * because it changes the codec delay.
191 | * * This is useful when the caller knows that the speech-optimized modes will not be needed (use with caution).
192 | * @param [in] Fs opus_int32: Sampling rate of input signal (Hz)
193 | * This must be one of 8000, 12000, 16000,
194 | * 24000, or 48000.
195 | * @param [in] channels int: Number of channels (1 or 2) in input signal
196 | * @param [in] application int: Coding mode (@ref OPUS_APPLICATION_VOIP/@ref OPUS_APPLICATION_AUDIO/@ref OPUS_APPLICATION_RESTRICTED_LOWDELAY)
197 | * @param [out] error int*: @ref opus_errorcodes
198 | * @note Regardless of the sampling rate and number channels selected, the Opus encoder
199 | * can switch to a lower audio bandwidth or number of channels if the bitrate
200 | * selected is too low. This also means that it is safe to always use 48 kHz stereo input
201 | * and let the encoder optimize the encoding.
202 | * Original signature : OpusEncoder* opus_encoder_create(opus_int32, int, int, int*)
203 | * native declaration : /tmp/opus.h:171 204 | */ 205 | PointerByReference opus_encoder_create(int Fs, int channels, int application, IntBuffer error); 206 | /** 207 | * Initializes a previously allocated encoder state
208 | * The memory pointed to by st must be at least the size returned by opus_encoder_get_size().
209 | * This is intended for applications which use their own allocator instead of malloc.
210 | * @see opus_encoder_create(),opus_encoder_get_size()
211 | * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
212 | * @param [in] st OpusEncoder*: Encoder state
213 | * @param [in] Fs opus_int32: Sampling rate of input signal (Hz)
214 | * This must be one of 8000, 12000, 16000,
215 | * 24000, or 48000.
216 | * @param [in] channels int: Number of channels (1 or 2) in input signal
217 | * @param [in] application int: Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO/OPUS_APPLICATION_RESTRICTED_LOWDELAY)
218 | * @retval #OPUS_OK Success or @ref opus_errorcodes
219 | * Original signature : int opus_encoder_init(OpusEncoder*, opus_int32, int, int)
220 | * native declaration : /tmp/opus.h:191 221 | */ 222 | int opus_encoder_init(PointerByReference st, int Fs, int channels, int application); 223 | /** 224 | * Encodes an Opus frame.
225 | * @param [in] st OpusEncoder*: Encoder state
226 | * @param [in] pcm opus_int16*: Input signal (interleaved if 2 channels). length is frame_size*channels*sizeof(opus_int16)
227 | * @param [in] frame_size int: Number of samples per channel in the
228 | * input signal.
229 | * This must be an Opus frame size for
230 | * the encoder's sampling rate.
231 | * For example, at 48 kHz the permitted
232 | * values are 120, 240, 480, 960, 1920,
233 | * and 2880.
234 | * Passing in a duration of less than
235 | * 10 ms (480 samples at 48 kHz) will
236 | * prevent the encoder from using the LPC
237 | * or hybrid modes.
238 | * @param [out] data unsigned char*: Output payload.
239 | * This must contain storage for at
240 | * least \a max_data_bytes.
241 | * @param [in] max_data_bytes opus_int32: Size of the allocated
242 | * memory for the output
243 | * payload. This may be
244 | * used to impose an upper limit on
245 | * the instant bitrate, but should
246 | * not be used as the only bitrate
247 | * control. Use #OPUS_SET_BITRATE to
248 | * control the bitrate.
249 | * @returns The length of the encoded packet (in bytes) on success or a
250 | * negative error code (see @ref opus_errorcodes) on failure.
251 | * Original signature : opus_int32 opus_encode(OpusEncoder*, const opus_int16*, int, unsigned char*, opus_int32)
252 | * native declaration : /tmp/opus.h:226 253 | */ 254 | int opus_encode(PointerByReference st, ShortBuffer pcm, int frame_size, ByteBuffer data, int max_data_bytes); 255 | /** 256 | * Encodes an Opus frame.
257 | * @param [in] st OpusEncoder*: Encoder state
258 | * @param [in] pcm opus_int16*: Input signal (interleaved if 2 channels). length is frame_size*channels*sizeof(opus_int16)
259 | * @param [in] frame_size int: Number of samples per channel in the
260 | * input signal.
261 | * This must be an Opus frame size for
262 | * the encoder's sampling rate.
263 | * For example, at 48 kHz the permitted
264 | * values are 120, 240, 480, 960, 1920,
265 | * and 2880.
266 | * Passing in a duration of less than
267 | * 10 ms (480 samples at 48 kHz) will
268 | * prevent the encoder from using the LPC
269 | * or hybrid modes.
270 | * @param [out] data unsigned char*: Output payload.
271 | * This must contain storage for at
272 | * least \a max_data_bytes.
273 | * @param [in] max_data_bytes opus_int32: Size of the allocated
274 | * memory for the output
275 | * payload. This may be
276 | * used to impose an upper limit on
277 | * the instant bitrate, but should
278 | * not be used as the only bitrate
279 | * control. Use #OPUS_SET_BITRATE to
280 | * control the bitrate.
281 | * @returns The length of the encoded packet (in bytes) on success or a
282 | * negative error code (see @ref opus_errorcodes) on failure.
283 | * Original signature : opus_int32 opus_encode(OpusEncoder*, const opus_int16*, int, unsigned char*, opus_int32)
284 | * native declaration : /tmp/opus.h:226 285 | */ 286 | int opus_encode(PointerByReference st, ShortByReference pcm, int frame_size, Pointer data, int max_data_bytes); 287 | /** 288 | * Encodes an Opus frame from floating point input.
289 | * @param [in] st OpusEncoder*: Encoder state
290 | * @param [in] pcm float*: Input in float format (interleaved if 2 channels), with a normal range of +/-1.0.
291 | * Samples with a range beyond +/-1.0 are supported but will
292 | * be clipped by decoders using the integer API and should
293 | * only be used if it is known that the far end supports
294 | * extended dynamic range.
295 | * length is frame_size*channels*sizeof(float)
296 | * @param [in] frame_size int: Number of samples per channel in the
297 | * input signal.
298 | * This must be an Opus frame size for
299 | * the encoder's sampling rate.
300 | * For example, at 48 kHz the permitted
301 | * values are 120, 240, 480, 960, 1920,
302 | * and 2880.
303 | * Passing in a duration of less than
304 | * 10 ms (480 samples at 48 kHz) will
305 | * prevent the encoder from using the LPC
306 | * or hybrid modes.
307 | * @param [out] data unsigned char*: Output payload.
308 | * This must contain storage for at
309 | * least \a max_data_bytes.
310 | * @param [in] max_data_bytes opus_int32: Size of the allocated
311 | * memory for the output
312 | * payload. This may be
313 | * used to impose an upper limit on
314 | * the instant bitrate, but should
315 | * not be used as the only bitrate
316 | * control. Use #OPUS_SET_BITRATE to
317 | * control the bitrate.
318 | * @returns The length of the encoded packet (in bytes) on success or a
319 | * negative error code (see @ref opus_errorcodes) on failure.
320 | * Original signature : opus_int32 opus_encode_float(OpusEncoder*, const float*, int, unsigned char*, opus_int32)
321 | * native declaration : /tmp/opus.h:267 322 | */ 323 | int opus_encode_float(PointerByReference st, float pcm[], int frame_size, ByteBuffer data, int max_data_bytes); 324 | /** 325 | * Encodes an Opus frame from floating point input.
326 | * @param [in] st OpusEncoder*: Encoder state
327 | * @param [in] pcm float*: Input in float format (interleaved if 2 channels), with a normal range of +/-1.0.
328 | * Samples with a range beyond +/-1.0 are supported but will
329 | * be clipped by decoders using the integer API and should
330 | * only be used if it is known that the far end supports
331 | * extended dynamic range.
332 | * length is frame_size*channels*sizeof(float)
333 | * @param [in] frame_size int: Number of samples per channel in the
334 | * input signal.
335 | * This must be an Opus frame size for
336 | * the encoder's sampling rate.
337 | * For example, at 48 kHz the permitted
338 | * values are 120, 240, 480, 960, 1920,
339 | * and 2880.
340 | * Passing in a duration of less than
341 | * 10 ms (480 samples at 48 kHz) will
342 | * prevent the encoder from using the LPC
343 | * or hybrid modes.
344 | * @param [out] data unsigned char*: Output payload.
345 | * This must contain storage for at
346 | * least \a max_data_bytes.
347 | * @param [in] max_data_bytes opus_int32: Size of the allocated
348 | * memory for the output
349 | * payload. This may be
350 | * used to impose an upper limit on
351 | * the instant bitrate, but should
352 | * not be used as the only bitrate
353 | * control. Use #OPUS_SET_BITRATE to
354 | * control the bitrate.
355 | * @returns The length of the encoded packet (in bytes) on success or a
356 | * negative error code (see @ref opus_errorcodes) on failure.
357 | * Original signature : opus_int32 opus_encode_float(OpusEncoder*, const float*, int, unsigned char*, opus_int32)
358 | * native declaration : /tmp/opus.h:267 359 | */ 360 | int opus_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data, int max_data_bytes); 361 | /** 362 | * Frees an OpusEncoder allocated by opus_encoder_create().
363 | * @param[in] st OpusEncoder*: State to be freed.
364 | * Original signature : void opus_encoder_destroy(OpusEncoder*)
365 | * native declaration : /tmp/opus.h:278 366 | */ 367 | void opus_encoder_destroy(PointerByReference st); 368 | /** 369 | * Perform a CTL function on an Opus encoder.
370 | * * Generally the request and subsequent arguments are generated
371 | * by a convenience macro.
372 | * @param st OpusEncoder*: Encoder state.
373 | * @param request This and all remaining parameters should be replaced by one
374 | * of the convenience macros in @ref opus_genericctls or
375 | * @ref opus_encoderctls.
376 | * @see opus_genericctls
377 | * @see opus_encoderctls
378 | * Original signature : int opus_encoder_ctl(OpusEncoder*, int, null)
379 | * native declaration : /tmp/opus.h:291 380 | */ 381 | int opus_encoder_ctl(PointerByReference st, int request, Object... varargs); 382 | /** 383 | * Gets the size of an OpusDecoder structure.
384 | * @param [in] channels int: Number of channels.
385 | * This must be 1 or 2.
386 | * @returns The size in bytes.
387 | * Original signature : int opus_decoder_get_size(int)
388 | * native declaration : /tmp/opus.h:369 389 | */ 390 | int opus_decoder_get_size(int channels); 391 | /** 392 | * Allocates and initializes a decoder state.
393 | * @param [in] Fs opus_int32: Sample rate to decode at (Hz).
394 | * This must be one of 8000, 12000, 16000,
395 | * 24000, or 48000.
396 | * @param [in] channels int: Number of channels (1 or 2) to decode
397 | * @param [out] error int*: #OPUS_OK Success or @ref opus_errorcodes
398 | * * Internally Opus stores data at 48000 Hz, so that should be the default
399 | * value for Fs. However, the decoder can efficiently decode to buffers
400 | * at 8, 12, 16, and 24 kHz so if for some reason the caller cannot use
401 | * data at the full sample rate, or knows the compressed data doesn't
402 | * use the full frequency range, it can request decoding at a reduced
403 | * rate. Likewise, the decoder is capable of filling in either mono or
404 | * interleaved stereo pcm buffers, at the caller's request.
405 | * Original signature : OpusDecoder* opus_decoder_create(opus_int32, int, int*)
406 | * native declaration : /tmp/opus.h:386 407 | */ 408 | PointerByReference opus_decoder_create(int Fs, int channels, IntBuffer error); 409 | /** 410 | * Initializes a previously allocated decoder state.
411 | * The state must be at least the size returned by opus_decoder_get_size().
412 | * This is intended for applications which use their own allocator instead of malloc. @see opus_decoder_create,opus_decoder_get_size
413 | * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
414 | * @param [in] st OpusDecoder*: Decoder state.
415 | * @param [in] Fs opus_int32: Sampling rate to decode to (Hz).
416 | * This must be one of 8000, 12000, 16000,
417 | * 24000, or 48000.
418 | * @param [in] channels int: Number of channels (1 or 2) to decode
419 | * @retval #OPUS_OK Success or @ref opus_errorcodes
420 | * Original signature : int opus_decoder_init(OpusDecoder*, opus_int32, int)
421 | * native declaration : /tmp/opus.h:403 422 | */ 423 | int opus_decoder_init(PointerByReference st, int Fs, int channels); 424 | /** 425 | * Decode an Opus packet.
426 | * @param [in] st OpusDecoder*: Decoder state
427 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
428 | * @param [in] len opus_int32: Number of bytes in payload*
429 | * @param [out] pcm opus_int16*: Output signal (interleaved if 2 channels). length
430 | * is frame_size*channels*sizeof(opus_int16)
431 | * @param [in] frame_size Number of samples per channel of available space in \a pcm.
432 | * If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will
433 | * not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
434 | * then frame_size needs to be exactly the duration of audio that is missing, otherwise the
435 | * decoder will not be in the optimal state to decode the next incoming packet. For the PLC and
436 | * FEC cases, frame_size must be a multiple of 2.5 ms.
437 | * @param [in] decode_fec int: Flag (0 or 1) to request that any in-band forward error correction data be
438 | * decoded. If no such data is available, the frame is decoded as if it were lost.
439 | * @returns Number of decoded samples or @ref opus_errorcodes
440 | * Original signature : int opus_decode(OpusDecoder*, const unsigned char*, opus_int32, opus_int16*, int, int)
441 | * native declaration : /tmp/opus.h:425 442 | */ 443 | int opus_decode(PointerByReference st, byte data[], int len, ShortBuffer pcm, int frame_size, int decode_fec); 444 | /** 445 | * Decode an Opus packet.
446 | * @param [in] st OpusDecoder*: Decoder state
447 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
448 | * @param [in] len opus_int32: Number of bytes in payload*
449 | * @param [out] pcm opus_int16*: Output signal (interleaved if 2 channels). length
450 | * is frame_size*channels*sizeof(opus_int16)
451 | * @param [in] frame_size Number of samples per channel of available space in \a pcm.
452 | * If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will
453 | * not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
454 | * then frame_size needs to be exactly the duration of audio that is missing, otherwise the
455 | * decoder will not be in the optimal state to decode the next incoming packet. For the PLC and
456 | * FEC cases, frame_size must be a multiple of 2.5 ms.
457 | * @param [in] decode_fec int: Flag (0 or 1) to request that any in-band forward error correction data be
458 | * decoded. If no such data is available, the frame is decoded as if it were lost.
459 | * @returns Number of decoded samples or @ref opus_errorcodes
460 | * Original signature : int opus_decode(OpusDecoder*, const unsigned char*, opus_int32, opus_int16*, int, int)
461 | * native declaration : /tmp/opus.h:425 462 | */ 463 | int opus_decode(PointerByReference st, Pointer data, int len, ShortByReference pcm, int frame_size, int decode_fec); 464 | /** 465 | * Decode an Opus packet with floating point output.
466 | * @param [in] st OpusDecoder*: Decoder state
467 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
468 | * @param [in] len opus_int32: Number of bytes in payload
469 | * @param [out] pcm float*: Output signal (interleaved if 2 channels). length
470 | * is frame_size*channels*sizeof(float)
471 | * @param [in] frame_size Number of samples per channel of available space in \a pcm.
472 | * If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will
473 | * not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
474 | * then frame_size needs to be exactly the duration of audio that is missing, otherwise the
475 | * decoder will not be in the optimal state to decode the next incoming packet. For the PLC and
476 | * FEC cases, frame_size must be a multiple of 2.5 ms.
477 | * @param [in] decode_fec int: Flag (0 or 1) to request that any in-band forward error correction data be
478 | * decoded. If no such data is available the frame is decoded as if it were lost.
479 | * @returns Number of decoded samples or @ref opus_errorcodes
480 | * Original signature : int opus_decode_float(OpusDecoder*, const unsigned char*, opus_int32, float*, int, int)
481 | * native declaration : /tmp/opus.h:450 482 | */ 483 | int opus_decode_float(PointerByReference st, byte data[], int len, FloatBuffer pcm, int frame_size, int decode_fec); 484 | /** 485 | * Decode an Opus packet with floating point output.
486 | * @param [in] st OpusDecoder*: Decoder state
487 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
488 | * @param [in] len opus_int32: Number of bytes in payload
489 | * @param [out] pcm float*: Output signal (interleaved if 2 channels). length
490 | * is frame_size*channels*sizeof(float)
491 | * @param [in] frame_size Number of samples per channel of available space in \a pcm.
492 | * If this is less than the maximum packet duration (120ms; 5760 for 48kHz), this function will
493 | * not be capable of decoding some packets. In the case of PLC (data==NULL) or FEC (decode_fec=1),
494 | * then frame_size needs to be exactly the duration of audio that is missing, otherwise the
495 | * decoder will not be in the optimal state to decode the next incoming packet. For the PLC and
496 | * FEC cases, frame_size must be a multiple of 2.5 ms.
497 | * @param [in] decode_fec int: Flag (0 or 1) to request that any in-band forward error correction data be
498 | * decoded. If no such data is available the frame is decoded as if it were lost.
499 | * @returns Number of decoded samples or @ref opus_errorcodes
500 | * Original signature : int opus_decode_float(OpusDecoder*, const unsigned char*, opus_int32, float*, int, int)
501 | * native declaration : /tmp/opus.h:450 502 | */ 503 | int opus_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size, int decode_fec); 504 | /** 505 | * Perform a CTL function on an Opus decoder.
506 | * * Generally the request and subsequent arguments are generated
507 | * by a convenience macro.
508 | * @param st OpusDecoder*: Decoder state.
509 | * @param request This and all remaining parameters should be replaced by one
510 | * of the convenience macros in @ref opus_genericctls or
511 | * @ref opus_decoderctls.
512 | * @see opus_genericctls
513 | * @see opus_decoderctls
514 | * Original signature : int opus_decoder_ctl(OpusDecoder*, int, null)
515 | * native declaration : /tmp/opus.h:470 516 | */ 517 | int opus_decoder_ctl(PointerByReference st, int request, Object... varargs); 518 | /** 519 | * Frees an OpusDecoder allocated by opus_decoder_create().
520 | * @param[in] st OpusDecoder*: State to be freed.
521 | * Original signature : void opus_decoder_destroy(OpusDecoder*)
522 | * native declaration : /tmp/opus.h:475 523 | */ 524 | void opus_decoder_destroy(PointerByReference st); 525 | /** 526 | * Parse an opus packet into one or more frames.
527 | * Opus_decode will perform this operation internally so most applications do
528 | * not need to use this function.
529 | * This function does not copy the frames, the returned pointers are pointers into
530 | * the input packet.
531 | * @param [in] data char*: Opus packet to be parsed
532 | * @param [in] len opus_int32: size of data
533 | * @param [out] out_toc char*: TOC pointer
534 | * @param [out] frames char*[48] encapsulated frames
535 | * @param [out] size opus_int16[48] sizes of the encapsulated frames
536 | * @param [out] payload_offset int*: returns the position of the payload within the packet (in bytes)
537 | * @returns number of frames
538 | * Original signature : int opus_packet_parse(const unsigned char*, opus_int32, unsigned char*, const unsigned char*[48], opus_int16[48], int*)
539 | * native declaration : /tmp/opus.h:490 540 | */ 541 | int opus_packet_parse(byte data[], int len, ByteBuffer out_toc, byte frames[], ShortBuffer size, IntBuffer payload_offset); 542 | /** 543 | * Gets the bandwidth of an Opus packet.
544 | * @param [in] data char*: Opus packet
545 | * @retval OPUS_BANDWIDTH_NARROWBAND Narrowband (4kHz bandpass)
546 | * @retval OPUS_BANDWIDTH_MEDIUMBAND Mediumband (6kHz bandpass)
547 | * @retval OPUS_BANDWIDTH_WIDEBAND Wideband (8kHz bandpass)
548 | * @retval OPUS_BANDWIDTH_SUPERWIDEBAND Superwideband (12kHz bandpass)
549 | * @retval OPUS_BANDWIDTH_FULLBAND Fullband (20kHz bandpass)
550 | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
551 | * Original signature : int opus_packet_get_bandwidth(const unsigned char*)
552 | * native declaration : /tmp/opus.h:508 553 | */ 554 | int opus_packet_get_bandwidth(byte data[]); 555 | /** 556 | * Gets the number of samples per frame from an Opus packet.
557 | * @param [in] data char*: Opus packet.
558 | * This must contain at least one byte of
559 | * data.
560 | * @param [in] Fs opus_int32: Sampling rate in Hz.
561 | * This must be a multiple of 400, or
562 | * inaccurate results will be returned.
563 | * @returns Number of samples per frame.
564 | * Original signature : int opus_packet_get_samples_per_frame(const unsigned char*, opus_int32)
565 | * native declaration : /tmp/opus.h:519 566 | */ 567 | int opus_packet_get_samples_per_frame(byte data[], int Fs); 568 | /** 569 | * Gets the number of channels from an Opus packet.
570 | * @param [in] data char*: Opus packet
571 | * @returns Number of channels
572 | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
573 | * Original signature : int opus_packet_get_nb_channels(const unsigned char*)
574 | * native declaration : /tmp/opus.h:526 575 | */ 576 | int opus_packet_get_nb_channels(byte data[]); 577 | /** 578 | * Gets the number of frames in an Opus packet.
579 | * @param [in] packet char*: Opus packet
580 | * @param [in] len opus_int32: Length of packet
581 | * @returns Number of frames
582 | * @retval OPUS_BAD_ARG Insufficient data was passed to the function
583 | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
584 | * Original signature : int opus_packet_get_nb_frames(const unsigned char[], opus_int32)
585 | * native declaration : /tmp/opus.h:535 586 | */ 587 | int opus_packet_get_nb_frames(byte packet[], int len); 588 | /** 589 | * Gets the number of samples of an Opus packet.
590 | * @param [in] packet char*: Opus packet
591 | * @param [in] len opus_int32: Length of packet
592 | * @param [in] Fs opus_int32: Sampling rate in Hz.
593 | * This must be a multiple of 400, or
594 | * inaccurate results will be returned.
595 | * @returns Number of samples
596 | * @retval OPUS_BAD_ARG Insufficient data was passed to the function
597 | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
598 | * Original signature : int opus_packet_get_nb_samples(const unsigned char[], opus_int32, opus_int32)
599 | * native declaration : /tmp/opus.h:547 600 | */ 601 | int opus_packet_get_nb_samples(byte packet[], int len, int Fs); 602 | /** 603 | * Gets the number of samples of an Opus packet.
604 | * @param [in] dec OpusDecoder*: Decoder state
605 | * @param [in] packet char*: Opus packet
606 | * @param [in] len opus_int32: Length of packet
607 | * @returns Number of samples
608 | * @retval OPUS_BAD_ARG Insufficient data was passed to the function
609 | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
610 | * Original signature : int opus_decoder_get_nb_samples(const OpusDecoder*, const unsigned char[], opus_int32)
611 | * native declaration : /tmp/opus.h:557 612 | */ 613 | int opus_decoder_get_nb_samples(PointerByReference dec, byte packet[], int len); 614 | /** 615 | * Gets the number of samples of an Opus packet.
616 | * @param [in] dec OpusDecoder*: Decoder state
617 | * @param [in] packet char*: Opus packet
618 | * @param [in] len opus_int32: Length of packet
619 | * @returns Number of samples
620 | * @retval OPUS_BAD_ARG Insufficient data was passed to the function
621 | * @retval OPUS_INVALID_PACKET The compressed data passed is corrupted or of an unsupported type
622 | * Original signature : int opus_decoder_get_nb_samples(const OpusDecoder*, const unsigned char[], opus_int32)
623 | * native declaration : /tmp/opus.h:557 624 | */ 625 | int opus_decoder_get_nb_samples(PointerByReference dec, Pointer packet, int len); 626 | /** 627 | * Applies soft-clipping to bring a float signal within the [-1,1] range. If
628 | * the signal is already in that range, nothing is done. If there are values
629 | * outside of [-1,1], then the signal is clipped as smoothly as possible to
630 | * both fit in the range and avoid creating excessive distortion in the
631 | * process.
632 | * @param [in,out] pcm float*: Input PCM and modified PCM
633 | * @param [in] frame_size int Number of samples per channel to process
634 | * @param [in] channels int: Number of channels
635 | * @param [in,out] softclip_mem float*: State memory for the soft clipping process (one float per channel, initialized to zero)
636 | * Original signature : void opus_pcm_soft_clip(float*, int, int, float*)
637 | * native declaration : /tmp/opus.h:569 638 | */ 639 | void opus_pcm_soft_clip(FloatBuffer pcm, int frame_size, int channels, FloatBuffer softclip_mem); 640 | /** 641 | * Gets the size of an OpusRepacketizer structure.
642 | * @returns The size in bytes.
643 | * Original signature : int opus_repacketizer_get_size()
644 | * native declaration : /tmp/opus.h:719 645 | */ 646 | int opus_repacketizer_get_size(); 647 | /** 648 | * (Re)initializes a previously allocated repacketizer state.
649 | * The state must be at least the size returned by opus_repacketizer_get_size().
650 | * This can be used for applications which use their own allocator instead of
651 | * malloc().
652 | * It must also be called to reset the queue of packets waiting to be
653 | * repacketized, which is necessary if the maximum packet duration of 120 ms
654 | * is reached or if you wish to submit packets with a different Opus
655 | * configuration (coding mode, audio bandwidth, frame size, or channel count).
656 | * Failure to do so will prevent a new packet from being added with
657 | * opus_repacketizer_cat().
658 | * @see opus_repacketizer_create
659 | * @see opus_repacketizer_get_size
660 | * @see opus_repacketizer_cat
661 | * @param rp OpusRepacketizer*: The repacketizer state to
662 | * (re)initialize.
663 | * @returns A pointer to the same repacketizer state that was passed in.
664 | * Original signature : OpusRepacketizer* opus_repacketizer_init(OpusRepacketizer*)
665 | * native declaration : /tmp/opus.h:738 666 | */ 667 | PointerByReference opus_repacketizer_init(PointerByReference rp); 668 | /** 669 | * Allocates memory and initializes the new repacketizer with
670 | * opus_repacketizer_init().
671 | * Original signature : OpusRepacketizer* opus_repacketizer_create()
672 | * native declaration : /tmp/opus.h:743 673 | */ 674 | PointerByReference opus_repacketizer_create(); 675 | /** 676 | * Frees an OpusRepacketizer allocated by
677 | * opus_repacketizer_create().
678 | * @param[in] rp OpusRepacketizer*: State to be freed.
679 | * Original signature : void opus_repacketizer_destroy(OpusRepacketizer*)
680 | * native declaration : /tmp/opus.h:749 681 | */ 682 | void opus_repacketizer_destroy(PointerByReference rp); 683 | /** 684 | * Add a packet to the current repacketizer state.
685 | * This packet must match the configuration of any packets already submitted
686 | * for repacketization since the last call to opus_repacketizer_init().
687 | * This means that it must have the same coding mode, audio bandwidth, frame
688 | * size, and channel count.
689 | * This can be checked in advance by examining the top 6 bits of the first
690 | * byte of the packet, and ensuring they match the top 6 bits of the first
691 | * byte of any previously submitted packet.
692 | * The total duration of audio in the repacketizer state also must not exceed
693 | * 120 ms, the maximum duration of a single packet, after adding this packet.
694 | * * The contents of the current repacketizer state can be extracted into new
695 | * packets using opus_repacketizer_out() or opus_repacketizer_out_range().
696 | * * In order to add a packet with a different configuration or to add more
697 | * audio beyond 120 ms, you must clear the repacketizer state by calling
698 | * opus_repacketizer_init().
699 | * If a packet is too large to add to the current repacketizer state, no part
700 | * of it is added, even if it contains multiple frames, some of which might
701 | * fit.
702 | * If you wish to be able to add parts of such packets, you should first use
703 | * another repacketizer to split the packet into pieces and add them
704 | * individually.
705 | * @see opus_repacketizer_out_range
706 | * @see opus_repacketizer_out
707 | * @see opus_repacketizer_init
708 | * @param rp OpusRepacketizer*: The repacketizer state to which to
709 | * add the packet.
710 | * @param[in] data const unsigned char*: The packet data.
711 | * The application must ensure
712 | * this pointer remains valid
713 | * until the next call to
714 | * opus_repacketizer_init() or
715 | * opus_repacketizer_destroy().
716 | * @param len opus_int32: The number of bytes in the packet data.
717 | * @returns An error code indicating whether or not the operation succeeded.
718 | * @retval #OPUS_OK The packet's contents have been added to the repacketizer
719 | * state.
720 | * @retval #OPUS_INVALID_PACKET The packet did not have a valid TOC sequence,
721 | * the packet's TOC sequence was not compatible
722 | * with previously submitted packets (because
723 | * the coding mode, audio bandwidth, frame size,
724 | * or channel count did not match), or adding
725 | * this packet would increase the total amount of
726 | * audio stored in the repacketizer state to more
727 | * than 120 ms.
728 | * Original signature : int opus_repacketizer_cat(OpusRepacketizer*, const unsigned char*, opus_int32)
729 | * native declaration : /tmp/opus.h:798 730 | */ 731 | int opus_repacketizer_cat(PointerByReference rp, byte data[], int len); 732 | /** 733 | * Add a packet to the current repacketizer state.
734 | * This packet must match the configuration of any packets already submitted
735 | * for repacketization since the last call to opus_repacketizer_init().
736 | * This means that it must have the same coding mode, audio bandwidth, frame
737 | * size, and channel count.
738 | * This can be checked in advance by examining the top 6 bits of the first
739 | * byte of the packet, and ensuring they match the top 6 bits of the first
740 | * byte of any previously submitted packet.
741 | * The total duration of audio in the repacketizer state also must not exceed
742 | * 120 ms, the maximum duration of a single packet, after adding this packet.
743 | * * The contents of the current repacketizer state can be extracted into new
744 | * packets using opus_repacketizer_out() or opus_repacketizer_out_range().
745 | * * In order to add a packet with a different configuration or to add more
746 | * audio beyond 120 ms, you must clear the repacketizer state by calling
747 | * opus_repacketizer_init().
748 | * If a packet is too large to add to the current repacketizer state, no part
749 | * of it is added, even if it contains multiple frames, some of which might
750 | * fit.
751 | * If you wish to be able to add parts of such packets, you should first use
752 | * another repacketizer to split the packet into pieces and add them
753 | * individually.
754 | * @see opus_repacketizer_out_range
755 | * @see opus_repacketizer_out
756 | * @see opus_repacketizer_init
757 | * @param rp OpusRepacketizer*: The repacketizer state to which to
758 | * add the packet.
759 | * @param[in] data const unsigned char*: The packet data.
760 | * The application must ensure
761 | * this pointer remains valid
762 | * until the next call to
763 | * opus_repacketizer_init() or
764 | * opus_repacketizer_destroy().
765 | * @param len opus_int32: The number of bytes in the packet data.
766 | * @returns An error code indicating whether or not the operation succeeded.
767 | * @retval #OPUS_OK The packet's contents have been added to the repacketizer
768 | * state.
769 | * @retval #OPUS_INVALID_PACKET The packet did not have a valid TOC sequence,
770 | * the packet's TOC sequence was not compatible
771 | * with previously submitted packets (because
772 | * the coding mode, audio bandwidth, frame size,
773 | * or channel count did not match), or adding
774 | * this packet would increase the total amount of
775 | * audio stored in the repacketizer state to more
776 | * than 120 ms.
777 | * Original signature : int opus_repacketizer_cat(OpusRepacketizer*, const unsigned char*, opus_int32)
778 | * native declaration : /tmp/opus.h:798 779 | */ 780 | int opus_repacketizer_cat(PointerByReference rp, Pointer data, int len); 781 | /** 782 | * Construct a new packet from data previously submitted to the repacketizer
783 | * state via opus_repacketizer_cat().
784 | * @param rp OpusRepacketizer*: The repacketizer state from which to
785 | * construct the new packet.
786 | * @param begin int: The index of the first frame in the current
787 | * repacketizer state to include in the output.
788 | * @param end int: One past the index of the last frame in the
789 | * current repacketizer state to include in the
790 | * output.
791 | * @param[out] data const unsigned char*: The buffer in which to
792 | * store the output packet.
793 | * @param maxlen opus_int32: The maximum number of bytes to store in
794 | * the output buffer. In order to guarantee
795 | * success, this should be at least
796 | * 1276 for a single frame,
797 | * or for multiple frames,
798 | * 1277*(end-begin).
799 | * However, 1*(end-begin) plus
800 | * the size of all packet data submitted to
801 | * the repacketizer since the last call to
802 | * opus_repacketizer_init() or
803 | * opus_repacketizer_create() is also
804 | * sufficient, and possibly much smaller.
805 | * @returns The total size of the output packet on success, or an error code
806 | * on failure.
807 | * @retval #OPUS_BAD_ARG [begin,end) was an invalid range of
808 | * frames (begin < 0, begin >= end, or end >
809 | * opus_repacketizer_get_nb_frames()).
810 | * @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain the
811 | * complete output packet.
812 | * Original signature : opus_int32 opus_repacketizer_out_range(OpusRepacketizer*, int, int, unsigned char*, opus_int32)
813 | * native declaration : /tmp/opus.h:832 814 | */ 815 | int opus_repacketizer_out_range(PointerByReference rp, int begin, int end, ByteBuffer data, int maxlen); 816 | /** 817 | * Construct a new packet from data previously submitted to the repacketizer
818 | * state via opus_repacketizer_cat().
819 | * @param rp OpusRepacketizer*: The repacketizer state from which to
820 | * construct the new packet.
821 | * @param begin int: The index of the first frame in the current
822 | * repacketizer state to include in the output.
823 | * @param end int: One past the index of the last frame in the
824 | * current repacketizer state to include in the
825 | * output.
826 | * @param[out] data const unsigned char*: The buffer in which to
827 | * store the output packet.
828 | * @param maxlen opus_int32: The maximum number of bytes to store in
829 | * the output buffer. In order to guarantee
830 | * success, this should be at least
831 | * 1276 for a single frame,
832 | * or for multiple frames,
833 | * 1277*(end-begin).
834 | * However, 1*(end-begin) plus
835 | * the size of all packet data submitted to
836 | * the repacketizer since the last call to
837 | * opus_repacketizer_init() or
838 | * opus_repacketizer_create() is also
839 | * sufficient, and possibly much smaller.
840 | * @returns The total size of the output packet on success, or an error code
841 | * on failure.
842 | * @retval #OPUS_BAD_ARG [begin,end) was an invalid range of
843 | * frames (begin < 0, begin >= end, or end >
844 | * opus_repacketizer_get_nb_frames()).
845 | * @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain the
846 | * complete output packet.
847 | * Original signature : opus_int32 opus_repacketizer_out_range(OpusRepacketizer*, int, int, unsigned char*, opus_int32)
848 | * native declaration : /tmp/opus.h:832 849 | */ 850 | int opus_repacketizer_out_range(PointerByReference rp, int begin, int end, Pointer data, int maxlen); 851 | /** 852 | * Return the total number of frames contained in packet data submitted to
853 | * the repacketizer state so far via opus_repacketizer_cat() since the last
854 | * call to opus_repacketizer_init() or opus_repacketizer_create().
855 | * This defines the valid range of packets that can be extracted with
856 | * opus_repacketizer_out_range() or opus_repacketizer_out().
857 | * @param rp OpusRepacketizer*: The repacketizer state containing the
858 | * frames.
859 | * @returns The total number of frames contained in the packet data submitted
860 | * to the repacketizer state.
861 | * Original signature : int opus_repacketizer_get_nb_frames(OpusRepacketizer*)
862 | * native declaration : /tmp/opus.h:844 863 | */ 864 | int opus_repacketizer_get_nb_frames(PointerByReference rp); 865 | /** 866 | * Construct a new packet from data previously submitted to the repacketizer
867 | * state via opus_repacketizer_cat().
868 | * This is a convenience routine that returns all the data submitted so far
869 | * in a single packet.
870 | * It is equivalent to calling
871 | * @code
872 | * opus_repacketizer_out_range(rp, 0, opus_repacketizer_get_nb_frames(rp),
873 | * data, maxlen)
874 | * @endcode
875 | * @param rp OpusRepacketizer*: The repacketizer state from which to
876 | * construct the new packet.
877 | * @param[out] data const unsigned char*: The buffer in which to
878 | * store the output packet.
879 | * @param maxlen opus_int32: The maximum number of bytes to store in
880 | * the output buffer. In order to guarantee
881 | * success, this should be at least
882 | * 1277*opus_repacketizer_get_nb_frames(rp).
883 | * However,
884 | * 1*opus_repacketizer_get_nb_frames(rp)
885 | * plus the size of all packet data
886 | * submitted to the repacketizer since the
887 | * last call to opus_repacketizer_init() or
888 | * opus_repacketizer_create() is also
889 | * sufficient, and possibly much smaller.
890 | * @returns The total size of the output packet on success, or an error code
891 | * on failure.
892 | * @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain the
893 | * complete output packet.
894 | * Original signature : opus_int32 opus_repacketizer_out(OpusRepacketizer*, unsigned char*, opus_int32)
895 | * native declaration : /tmp/opus.h:875 896 | */ 897 | int opus_repacketizer_out(PointerByReference rp, ByteBuffer data, int maxlen); 898 | /** 899 | * Construct a new packet from data previously submitted to the repacketizer
900 | * state via opus_repacketizer_cat().
901 | * This is a convenience routine that returns all the data submitted so far
902 | * in a single packet.
903 | * It is equivalent to calling
904 | * @code
905 | * opus_repacketizer_out_range(rp, 0, opus_repacketizer_get_nb_frames(rp),
906 | * data, maxlen)
907 | * @endcode
908 | * @param rp OpusRepacketizer*: The repacketizer state from which to
909 | * construct the new packet.
910 | * @param[out] data const unsigned char*: The buffer in which to
911 | * store the output packet.
912 | * @param maxlen opus_int32: The maximum number of bytes to store in
913 | * the output buffer. In order to guarantee
914 | * success, this should be at least
915 | * 1277*opus_repacketizer_get_nb_frames(rp).
916 | * However,
917 | * 1*opus_repacketizer_get_nb_frames(rp)
918 | * plus the size of all packet data
919 | * submitted to the repacketizer since the
920 | * last call to opus_repacketizer_init() or
921 | * opus_repacketizer_create() is also
922 | * sufficient, and possibly much smaller.
923 | * @returns The total size of the output packet on success, or an error code
924 | * on failure.
925 | * @retval #OPUS_BUFFER_TOO_SMALL \a maxlen was insufficient to contain the
926 | * complete output packet.
927 | * Original signature : opus_int32 opus_repacketizer_out(OpusRepacketizer*, unsigned char*, opus_int32)
928 | * native declaration : /tmp/opus.h:875 929 | */ 930 | int opus_repacketizer_out(PointerByReference rp, Pointer data, int maxlen); 931 | /** 932 | * Pads a given Opus packet to a larger size (possibly changing the TOC sequence).
933 | * @param[in,out] data const unsigned char*: The buffer containing the
934 | * packet to pad.
935 | * @param len opus_int32: The size of the packet.
936 | * This must be at least 1.
937 | * @param new_len opus_int32: The desired size of the packet after padding.
938 | * This must be at least as large as len.
939 | * @returns an error code
940 | * @retval #OPUS_OK \a on success.
941 | * @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
942 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
943 | * Original signature : int opus_packet_pad(unsigned char*, opus_int32, opus_int32)
944 | * native declaration : /tmp/opus.h:889 945 | */ 946 | int opus_packet_pad(ByteBuffer data, int len, int new_len); 947 | /** 948 | * Remove all padding from a given Opus packet and rewrite the TOC sequence to
949 | * minimize space usage.
950 | * @param[in,out] data const unsigned char*: The buffer containing the
951 | * packet to strip.
952 | * @param len opus_int32: The size of the packet.
953 | * This must be at least 1.
954 | * @returns The new size of the output packet on success, or an error code
955 | * on failure.
956 | * @retval #OPUS_BAD_ARG \a len was less than 1.
957 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
958 | * Original signature : opus_int32 opus_packet_unpad(unsigned char*, opus_int32)
959 | * native declaration : /tmp/opus.h:902 960 | */ 961 | int opus_packet_unpad(ByteBuffer data, int len); 962 | /** 963 | * Pads a given Opus multi-stream packet to a larger size (possibly changing the TOC sequence).
964 | * @param[in,out] data const unsigned char*: The buffer containing the
965 | * packet to pad.
966 | * @param len opus_int32: The size of the packet.
967 | * This must be at least 1.
968 | * @param new_len opus_int32: The desired size of the packet after padding.
969 | * This must be at least 1.
970 | * @param nb_streams opus_int32: The number of streams (not channels) in the packet.
971 | * This must be at least as large as len.
972 | * @returns an error code
973 | * @retval #OPUS_OK \a on success.
974 | * @retval #OPUS_BAD_ARG \a len was less than 1.
975 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
976 | * Original signature : int opus_multistream_packet_pad(unsigned char*, opus_int32, opus_int32, int)
977 | * native declaration : /tmp/opus.h:918 978 | */ 979 | int opus_multistream_packet_pad(ByteBuffer data, int len, int new_len, int nb_streams); 980 | /** 981 | * Remove all padding from a given Opus multi-stream packet and rewrite the TOC sequence to
982 | * minimize space usage.
983 | * @param[in,out] data const unsigned char*: The buffer containing the
984 | * packet to strip.
985 | * @param len opus_int32: The size of the packet.
986 | * This must be at least 1.
987 | * @param nb_streams opus_int32: The number of streams (not channels) in the packet.
988 | * This must be at least 1.
989 | * @returns The new size of the output packet on success, or an error code
990 | * on failure.
991 | * @retval #OPUS_BAD_ARG \a len was less than 1 or new_len was less than len.
992 | * @retval #OPUS_INVALID_PACKET \a data did not contain a valid Opus packet.
993 | * Original signature : opus_int32 opus_multistream_packet_unpad(unsigned char*, opus_int32, int)
994 | * native declaration : /tmp/opus.h:933 995 | */ 996 | int opus_multistream_packet_unpad(ByteBuffer data, int len, int nb_streams); 997 | public static class OpusDecoder extends PointerType { 998 | public OpusDecoder(Pointer address) { 999 | super(address); 1000 | } 1001 | public OpusDecoder() { 1002 | super(); 1003 | } 1004 | }; 1005 | public static class OpusEncoder extends PointerType { 1006 | public OpusEncoder(Pointer address) { 1007 | super(address); 1008 | } 1009 | public OpusEncoder() { 1010 | super(); 1011 | } 1012 | }; 1013 | public static class OpusRepacketizer extends PointerType { 1014 | public OpusRepacketizer(Pointer address) { 1015 | super(address); 1016 | } 1017 | public OpusRepacketizer() { 1018 | super(); 1019 | } 1020 | }; 1021 | 1022 | /** 1023 | * Converts an opus error code into a human readable string.
1024 | * * @param[in] error int: Error number
1025 | * @returns Error string
1026 | * Original signature : char* opus_strerror(int)
1027 | * native declaration : /tmp/opus_defines.h:712 1028 | */ 1029 | String opus_strerror(int error); 1030 | /** 1031 | * Gets the libopus version string.
1032 | * * @returns Version string
1033 | * Original signature : char* opus_get_version_string()
1034 | * native declaration : /tmp/opus_defines.h:718 1035 | */ 1036 | String opus_get_version_string(); 1037 | 1038 | //******************** Multi Stream Support 1039 | 1040 | /** 1041 | * Gets the size of an OpusMSEncoder structure.
1042 | * @param streams int: The total number of streams to encode from the
1043 | * input.
1044 | * This must be no more than 255.
1045 | * @param coupled_streams int: Number of coupled (2 channel) streams
1046 | * to encode.
1047 | * This must be no larger than the total
1048 | * number of streams.
1049 | * Additionally, The total number of
1050 | * encoded channels (streams +
1051 | * coupled_streams
) must be no
1052 | * more than 255.
1053 | * @returns The size in bytes on success, or a negative error code
1054 | * (see @ref opus_errorcodes) on error.
1055 | * Original signature : opus_int32 opus_multistream_encoder_get_size(int, int)
1056 | * native declaration : /tmp/opus_multistream.h:202 1057 | */ 1058 | int opus_multistream_encoder_get_size(int streams, int coupled_streams); 1059 | /** 1060 | * Original signature : opus_int32 opus_multistream_surround_encoder_get_size(int, int)
1061 | * native declaration : /tmp/opus_multistream.h:207 1062 | */ 1063 | int opus_multistream_surround_encoder_get_size(int channels, int mapping_family); 1064 | /** 1065 | * Allocates and initializes a multistream encoder state.
1066 | * Call opus_multistream_encoder_destroy() to release
1067 | * this object when finished.
1068 | * @param Fs opus_int32: Sampling rate of the input signal (in Hz).
1069 | * This must be one of 8000, 12000, 16000,
1070 | * 24000, or 48000.
1071 | * @param channels int: Number of channels in the input signal.
1072 | * This must be at most 255.
1073 | * It may be greater than the number of
1074 | * coded channels (streams +
1075 | * coupled_streams
).
1076 | * @param streams int: The total number of streams to encode from the
1077 | * input.
1078 | * This must be no more than the number of channels.
1079 | * @param coupled_streams int: Number of coupled (2 channel) streams
1080 | * to encode.
1081 | * This must be no larger than the total
1082 | * number of streams.
1083 | * Additionally, The total number of
1084 | * encoded channels (streams +
1085 | * coupled_streams
) must be no
1086 | * more than the number of input channels.
1087 | * @param[in] mapping const unsigned char[channels]: Mapping from
1088 | * encoded channels to input channels, as described in
1089 | * @ref opus_multistream. As an extra constraint, the
1090 | * multistream encoder does not allow encoding coupled
1091 | * streams for which one channel is unused since this
1092 | * is never a good idea.
1093 | * @param application int: The target encoder application.
1094 | * This must be one of the following:
1095 | *

1096 | *
#OPUS_APPLICATION_VOIP

1097 | *
Process signal for improved speech intelligibility.

1098 | *
#OPUS_APPLICATION_AUDIO

1099 | *
Favor faithfulness to the original input.

1100 | *
#OPUS_APPLICATION_RESTRICTED_LOWDELAY

1101 | *
Configure the minimum possible coding delay by disabling certain modes
1102 | * of operation.

1103 | *

1104 | * @param[out] error int *: Returns #OPUS_OK on success, or an error
1105 | * code (see @ref opus_errorcodes) on
1106 | * failure.
1107 | * Original signature : OpusMSEncoder* opus_multistream_encoder_create(opus_int32, int, int, int, const unsigned char*, int, int*)
1108 | * native declaration : /tmp/opus_multistream.h:256 1109 | */ 1110 | PointerByReference opus_multistream_encoder_create(int Fs, int channels, int streams, int coupled_streams, byte mapping[], int application, IntBuffer error); 1111 | /** 1112 | * Original signature : OpusMSEncoder* opus_multistream_surround_encoder_create(opus_int32, int, int, int*, int*, unsigned char*, int, int*)
1113 | * native declaration : /tmp/opus_multistream.h:266 1114 | */ 1115 | PointerByReference opus_multistream_surround_encoder_create(int Fs, int channels, int mapping_family, IntBuffer streams, IntBuffer coupled_streams, ByteBuffer mapping, int application, IntBuffer error); 1116 | /** 1117 | * Initialize a previously allocated multistream encoder state.
1118 | * The memory pointed to by \a st must be at least the size returned by
1119 | * opus_multistream_encoder_get_size().
1120 | * This is intended for applications which use their own allocator instead of
1121 | * malloc.
1122 | * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
1123 | * @see opus_multistream_encoder_create
1124 | * @see opus_multistream_encoder_get_size
1125 | * @param st OpusMSEncoder*: Multistream encoder state to initialize.
1126 | * @param Fs opus_int32: Sampling rate of the input signal (in Hz).
1127 | * This must be one of 8000, 12000, 16000,
1128 | * 24000, or 48000.
1129 | * @param channels int: Number of channels in the input signal.
1130 | * This must be at most 255.
1131 | * It may be greater than the number of
1132 | * coded channels (streams +
1133 | * coupled_streams
).
1134 | * @param streams int: The total number of streams to encode from the
1135 | * input.
1136 | * This must be no more than the number of channels.
1137 | * @param coupled_streams int: Number of coupled (2 channel) streams
1138 | * to encode.
1139 | * This must be no larger than the total
1140 | * number of streams.
1141 | * Additionally, The total number of
1142 | * encoded channels (streams +
1143 | * coupled_streams
) must be no
1144 | * more than the number of input channels.
1145 | * @param[in] mapping const unsigned char[channels]: Mapping from
1146 | * encoded channels to input channels, as described in
1147 | * @ref opus_multistream. As an extra constraint, the
1148 | * multistream encoder does not allow encoding coupled
1149 | * streams for which one channel is unused since this
1150 | * is never a good idea.
1151 | * @param application int: The target encoder application.
1152 | * This must be one of the following:
1153 | *

1154 | *
#OPUS_APPLICATION_VOIP

1155 | *
Process signal for improved speech intelligibility.

1156 | *
#OPUS_APPLICATION_AUDIO

1157 | *
Favor faithfulness to the original input.

1158 | *
#OPUS_APPLICATION_RESTRICTED_LOWDELAY

1159 | *
Configure the minimum possible coding delay by disabling certain modes
1160 | * of operation.

1161 | *

1162 | * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
1163 | * on failure.
1164 | * Original signature : int opus_multistream_encoder_init(OpusMSEncoder*, opus_int32, int, int, int, const unsigned char*, int)
1165 | * native declaration : /tmp/opus_multistream.h:325 1166 | */ 1167 | int opus_multistream_encoder_init(PointerByReference st, int Fs, int channels, int streams, int coupled_streams, byte mapping[], int application); 1168 | /** 1169 | * Initialize a previously allocated multistream encoder state.
1170 | * The memory pointed to by \a st must be at least the size returned by
1171 | * opus_multistream_encoder_get_size().
1172 | * This is intended for applications which use their own allocator instead of
1173 | * malloc.
1174 | * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
1175 | * @see opus_multistream_encoder_create
1176 | * @see opus_multistream_encoder_get_size
1177 | * @param st OpusMSEncoder*: Multistream encoder state to initialize.
1178 | * @param Fs opus_int32: Sampling rate of the input signal (in Hz).
1179 | * This must be one of 8000, 12000, 16000,
1180 | * 24000, or 48000.
1181 | * @param channels int: Number of channels in the input signal.
1182 | * This must be at most 255.
1183 | * It may be greater than the number of
1184 | * coded channels (streams +
1185 | * coupled_streams
).
1186 | * @param streams int: The total number of streams to encode from the
1187 | * input.
1188 | * This must be no more than the number of channels.
1189 | * @param coupled_streams int: Number of coupled (2 channel) streams
1190 | * to encode.
1191 | * This must be no larger than the total
1192 | * number of streams.
1193 | * Additionally, The total number of
1194 | * encoded channels (streams +
1195 | * coupled_streams
) must be no
1196 | * more than the number of input channels.
1197 | * @param[in] mapping const unsigned char[channels]: Mapping from
1198 | * encoded channels to input channels, as described in
1199 | * @ref opus_multistream. As an extra constraint, the
1200 | * multistream encoder does not allow encoding coupled
1201 | * streams for which one channel is unused since this
1202 | * is never a good idea.
1203 | * @param application int: The target encoder application.
1204 | * This must be one of the following:
1205 | *

1206 | *
#OPUS_APPLICATION_VOIP

1207 | *
Process signal for improved speech intelligibility.

1208 | *
#OPUS_APPLICATION_AUDIO

1209 | *
Favor faithfulness to the original input.

1210 | *
#OPUS_APPLICATION_RESTRICTED_LOWDELAY

1211 | *
Configure the minimum possible coding delay by disabling certain modes
1212 | * of operation.

1213 | *

1214 | * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
1215 | * on failure.
1216 | * Original signature : int opus_multistream_encoder_init(OpusMSEncoder*, opus_int32, int, int, int, const unsigned char*, int)
1217 | * native declaration : /tmp/opus_multistream.h:325 1218 | */ 1219 | int opus_multistream_encoder_init(PointerByReference st, int Fs, int channels, int streams, int coupled_streams, Pointer mapping, int application); 1220 | /** 1221 | * Original signature : int opus_multistream_surround_encoder_init(OpusMSEncoder*, opus_int32, int, int, int*, int*, unsigned char*, int)
1222 | * native declaration : /tmp/opus_multistream.h:335 1223 | */ 1224 | int opus_multistream_surround_encoder_init(PointerByReference st, int Fs, int channels, int mapping_family, IntBuffer streams, IntBuffer coupled_streams, ByteBuffer mapping, int application); 1225 | /** 1226 | * Original signature : int opus_multistream_surround_encoder_init(OpusMSEncoder*, opus_int32, int, int, int*, int*, unsigned char*, int)
1227 | * native declaration : /tmp/opus_multistream.h:335 1228 | */ 1229 | int opus_multistream_surround_encoder_init(PointerByReference st, int Fs, int channels, int mapping_family, IntByReference streams, IntByReference coupled_streams, Pointer mapping, int application); 1230 | /** 1231 | * Encodes a multistream Opus frame.
1232 | * @param st OpusMSEncoder*: Multistream encoder state.
1233 | * @param[in] pcm const opus_int16*: The input signal as interleaved
1234 | * samples.
1235 | * This must contain
1236 | * frame_size*channels
1237 | * samples.
1238 | * @param frame_size int: Number of samples per channel in the input
1239 | * signal.
1240 | * This must be an Opus frame size for the
1241 | * encoder's sampling rate.
1242 | * For example, at 48 kHz the permitted values
1243 | * are 120, 240, 480, 960, 1920, and 2880.
1244 | * Passing in a duration of less than 10 ms
1245 | * (480 samples at 48 kHz) will prevent the
1246 | * encoder from using the LPC or hybrid modes.
1247 | * @param[out] data unsigned char*: Output payload.
1248 | * This must contain storage for at
1249 | * least \a max_data_bytes.
1250 | * @param [in] max_data_bytes opus_int32: Size of the allocated
1251 | * memory for the output
1252 | * payload. This may be
1253 | * used to impose an upper limit on
1254 | * the instant bitrate, but should
1255 | * not be used as the only bitrate
1256 | * control. Use #OPUS_SET_BITRATE to
1257 | * control the bitrate.
1258 | * @returns The length of the encoded packet (in bytes) on success or a
1259 | * negative error code (see @ref opus_errorcodes) on failure.
1260 | * Original signature : int opus_multistream_encode(OpusMSEncoder*, const opus_int16*, int, unsigned char*, opus_int32)
1261 | * native declaration : /tmp/opus_multistream.h:376 1262 | */ 1263 | int opus_multistream_encode(PointerByReference st, ShortBuffer pcm, int frame_size, ByteBuffer data, int max_data_bytes); 1264 | /** 1265 | * Encodes a multistream Opus frame.
1266 | * @param st OpusMSEncoder*: Multistream encoder state.
1267 | * @param[in] pcm const opus_int16*: The input signal as interleaved
1268 | * samples.
1269 | * This must contain
1270 | * frame_size*channels
1271 | * samples.
1272 | * @param frame_size int: Number of samples per channel in the input
1273 | * signal.
1274 | * This must be an Opus frame size for the
1275 | * encoder's sampling rate.
1276 | * For example, at 48 kHz the permitted values
1277 | * are 120, 240, 480, 960, 1920, and 2880.
1278 | * Passing in a duration of less than 10 ms
1279 | * (480 samples at 48 kHz) will prevent the
1280 | * encoder from using the LPC or hybrid modes.
1281 | * @param[out] data unsigned char*: Output payload.
1282 | * This must contain storage for at
1283 | * least \a max_data_bytes.
1284 | * @param [in] max_data_bytes opus_int32: Size of the allocated
1285 | * memory for the output
1286 | * payload. This may be
1287 | * used to impose an upper limit on
1288 | * the instant bitrate, but should
1289 | * not be used as the only bitrate
1290 | * control. Use #OPUS_SET_BITRATE to
1291 | * control the bitrate.
1292 | * @returns The length of the encoded packet (in bytes) on success or a
1293 | * negative error code (see @ref opus_errorcodes) on failure.
1294 | * Original signature : int opus_multistream_encode(OpusMSEncoder*, const opus_int16*, int, unsigned char*, opus_int32)
1295 | * native declaration : /tmp/opus_multistream.h:376 1296 | */ 1297 | int opus_multistream_encode(PointerByReference st, ShortByReference pcm, int frame_size, Pointer data, int max_data_bytes); 1298 | /** 1299 | * Encodes a multistream Opus frame from floating point input.
1300 | * @param st OpusMSEncoder*: Multistream encoder state.
1301 | * @param[in] pcm const float*: The input signal as interleaved
1302 | * samples with a normal range of
1303 | * +/-1.0.
1304 | * Samples with a range beyond +/-1.0
1305 | * are supported but will be clipped by
1306 | * decoders using the integer API and
1307 | * should only be used if it is known
1308 | * that the far end supports extended
1309 | * dynamic range.
1310 | * This must contain
1311 | * frame_size*channels
1312 | * samples.
1313 | * @param frame_size int: Number of samples per channel in the input
1314 | * signal.
1315 | * This must be an Opus frame size for the
1316 | * encoder's sampling rate.
1317 | * For example, at 48 kHz the permitted values
1318 | * are 120, 240, 480, 960, 1920, and 2880.
1319 | * Passing in a duration of less than 10 ms
1320 | * (480 samples at 48 kHz) will prevent the
1321 | * encoder from using the LPC or hybrid modes.
1322 | * @param[out] data unsigned char*: Output payload.
1323 | * This must contain storage for at
1324 | * least \a max_data_bytes.
1325 | * @param [in] max_data_bytes opus_int32: Size of the allocated
1326 | * memory for the output
1327 | * payload. This may be
1328 | * used to impose an upper limit on
1329 | * the instant bitrate, but should
1330 | * not be used as the only bitrate
1331 | * control. Use #OPUS_SET_BITRATE to
1332 | * control the bitrate.
1333 | * @returns The length of the encoded packet (in bytes) on success or a
1334 | * negative error code (see @ref opus_errorcodes) on failure.
1335 | * Original signature : int opus_multistream_encode_float(OpusMSEncoder*, const float*, int, unsigned char*, opus_int32)
1336 | * native declaration : /tmp/opus_multistream.h:421 1337 | */ 1338 | int opus_multistream_encode_float(PointerByReference st, float pcm[], int frame_size, ByteBuffer data, int max_data_bytes); 1339 | /** 1340 | * Encodes a multistream Opus frame from floating point input.
1341 | * @param st OpusMSEncoder*: Multistream encoder state.
1342 | * @param[in] pcm const float*: The input signal as interleaved
1343 | * samples with a normal range of
1344 | * +/-1.0.
1345 | * Samples with a range beyond +/-1.0
1346 | * are supported but will be clipped by
1347 | * decoders using the integer API and
1348 | * should only be used if it is known
1349 | * that the far end supports extended
1350 | * dynamic range.
1351 | * This must contain
1352 | * frame_size*channels
1353 | * samples.
1354 | * @param frame_size int: Number of samples per channel in the input
1355 | * signal.
1356 | * This must be an Opus frame size for the
1357 | * encoder's sampling rate.
1358 | * For example, at 48 kHz the permitted values
1359 | * are 120, 240, 480, 960, 1920, and 2880.
1360 | * Passing in a duration of less than 10 ms
1361 | * (480 samples at 48 kHz) will prevent the
1362 | * encoder from using the LPC or hybrid modes.
1363 | * @param[out] data unsigned char*: Output payload.
1364 | * This must contain storage for at
1365 | * least \a max_data_bytes.
1366 | * @param [in] max_data_bytes opus_int32: Size of the allocated
1367 | * memory for the output
1368 | * payload. This may be
1369 | * used to impose an upper limit on
1370 | * the instant bitrate, but should
1371 | * not be used as the only bitrate
1372 | * control. Use #OPUS_SET_BITRATE to
1373 | * control the bitrate.
1374 | * @returns The length of the encoded packet (in bytes) on success or a
1375 | * negative error code (see @ref opus_errorcodes) on failure.
1376 | * Original signature : int opus_multistream_encode_float(OpusMSEncoder*, const float*, int, unsigned char*, opus_int32)
1377 | * native declaration : /tmp/opus_multistream.h:421 1378 | */ 1379 | int opus_multistream_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer data, int max_data_bytes); 1380 | /** 1381 | * Frees an OpusMSEncoder allocated by
1382 | * opus_multistream_encoder_create().
1383 | * @param st OpusMSEncoder*: Multistream encoder state to be freed.
1384 | * Original signature : void opus_multistream_encoder_destroy(OpusMSEncoder*)
1385 | * native declaration : /tmp/opus_multistream.h:433 1386 | */ 1387 | void opus_multistream_encoder_destroy(PointerByReference st); 1388 | /** 1389 | * Perform a CTL function on a multistream Opus encoder.
1390 | * * Generally the request and subsequent arguments are generated by a
1391 | * convenience macro.
1392 | * @param st OpusMSEncoder*: Multistream encoder state.
1393 | * @param request This and all remaining parameters should be replaced by one
1394 | * of the convenience macros in @ref opus_genericctls,
1395 | * @ref opus_encoderctls, or @ref opus_multistream_ctls.
1396 | * @see opus_genericctls
1397 | * @see opus_encoderctls
1398 | * @see opus_multistream_ctls
1399 | * Original signature : int opus_multistream_encoder_ctl(OpusMSEncoder*, int, null)
1400 | * native declaration : /tmp/opus_multistream.h:447 1401 | */ 1402 | int opus_multistream_encoder_ctl(PointerByReference st, int request, Object... varargs); 1403 | /** 1404 | * Gets the size of an OpusMSDecoder structure.
1405 | * @param streams int: The total number of streams coded in the
1406 | * input.
1407 | * This must be no more than 255.
1408 | * @param coupled_streams int: Number streams to decode as coupled
1409 | * (2 channel) streams.
1410 | * This must be no larger than the total
1411 | * number of streams.
1412 | * Additionally, The total number of
1413 | * coded channels (streams +
1414 | * coupled_streams
) must be no
1415 | * more than 255.
1416 | * @returns The size in bytes on success, or a negative error code
1417 | * (see @ref opus_errorcodes) on error.
1418 | * Original signature : opus_int32 opus_multistream_decoder_get_size(int, int)
1419 | * native declaration : /tmp/opus_multistream.h:469 1420 | */ 1421 | int opus_multistream_decoder_get_size(int streams, int coupled_streams); 1422 | /** 1423 | * Allocates and initializes a multistream decoder state.
1424 | * Call opus_multistream_decoder_destroy() to release
1425 | * this object when finished.
1426 | * @param Fs opus_int32: Sampling rate to decode at (in Hz).
1427 | * This must be one of 8000, 12000, 16000,
1428 | * 24000, or 48000.
1429 | * @param channels int: Number of channels to output.
1430 | * This must be at most 255.
1431 | * It may be different from the number of coded
1432 | * channels (streams +
1433 | * coupled_streams
).
1434 | * @param streams int: The total number of streams coded in the
1435 | * input.
1436 | * This must be no more than 255.
1437 | * @param coupled_streams int: Number of streams to decode as coupled
1438 | * (2 channel) streams.
1439 | * This must be no larger than the total
1440 | * number of streams.
1441 | * Additionally, The total number of
1442 | * coded channels (streams +
1443 | * coupled_streams
) must be no
1444 | * more than 255.
1445 | * @param[in] mapping const unsigned char[channels]: Mapping from
1446 | * coded channels to output channels, as described in
1447 | * @ref opus_multistream.
1448 | * @param[out] error int *: Returns #OPUS_OK on success, or an error
1449 | * code (see @ref opus_errorcodes) on
1450 | * failure.
1451 | * Original signature : OpusMSDecoder* opus_multistream_decoder_create(opus_int32, int, int, int, const unsigned char*, int*)
1452 | * native declaration : /tmp/opus_multistream.h:503 1453 | */ 1454 | PointerByReference opus_multistream_decoder_create(int Fs, int channels, int streams, int coupled_streams, byte mapping[], IntBuffer error); 1455 | /** 1456 | * Intialize a previously allocated decoder state object.
1457 | * The memory pointed to by \a st must be at least the size returned by
1458 | * opus_multistream_encoder_get_size().
1459 | * This is intended for applications which use their own allocator instead of
1460 | * malloc.
1461 | * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
1462 | * @see opus_multistream_decoder_create
1463 | * @see opus_multistream_deocder_get_size
1464 | * @param st OpusMSEncoder*: Multistream encoder state to initialize.
1465 | * @param Fs opus_int32: Sampling rate to decode at (in Hz).
1466 | * This must be one of 8000, 12000, 16000,
1467 | * 24000, or 48000.
1468 | * @param channels int: Number of channels to output.
1469 | * This must be at most 255.
1470 | * It may be different from the number of coded
1471 | * channels (streams +
1472 | * coupled_streams
).
1473 | * @param streams int: The total number of streams coded in the
1474 | * input.
1475 | * This must be no more than 255.
1476 | * @param coupled_streams int: Number of streams to decode as coupled
1477 | * (2 channel) streams.
1478 | * This must be no larger than the total
1479 | * number of streams.
1480 | * Additionally, The total number of
1481 | * coded channels (streams +
1482 | * coupled_streams
) must be no
1483 | * more than 255.
1484 | * @param[in] mapping const unsigned char[channels]: Mapping from
1485 | * coded channels to output channels, as described in
1486 | * @ref opus_multistream.
1487 | * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
1488 | * on failure.
1489 | * Original signature : int opus_multistream_decoder_init(OpusMSDecoder*, opus_int32, int, int, int, const unsigned char*)
1490 | * native declaration : /tmp/opus_multistream.h:546 1491 | */ 1492 | int opus_multistream_decoder_init(PointerByReference st, int Fs, int channels, int streams, int coupled_streams, byte mapping[]); 1493 | /** 1494 | * Intialize a previously allocated decoder state object.
1495 | * The memory pointed to by \a st must be at least the size returned by
1496 | * opus_multistream_encoder_get_size().
1497 | * This is intended for applications which use their own allocator instead of
1498 | * malloc.
1499 | * To reset a previously initialized state, use the #OPUS_RESET_STATE CTL.
1500 | * @see opus_multistream_decoder_create
1501 | * @see opus_multistream_deocder_get_size
1502 | * @param st OpusMSEncoder*: Multistream encoder state to initialize.
1503 | * @param Fs opus_int32: Sampling rate to decode at (in Hz).
1504 | * This must be one of 8000, 12000, 16000,
1505 | * 24000, or 48000.
1506 | * @param channels int: Number of channels to output.
1507 | * This must be at most 255.
1508 | * It may be different from the number of coded
1509 | * channels (streams +
1510 | * coupled_streams
).
1511 | * @param streams int: The total number of streams coded in the
1512 | * input.
1513 | * This must be no more than 255.
1514 | * @param coupled_streams int: Number of streams to decode as coupled
1515 | * (2 channel) streams.
1516 | * This must be no larger than the total
1517 | * number of streams.
1518 | * Additionally, The total number of
1519 | * coded channels (streams +
1520 | * coupled_streams
) must be no
1521 | * more than 255.
1522 | * @param[in] mapping const unsigned char[channels]: Mapping from
1523 | * coded channels to output channels, as described in
1524 | * @ref opus_multistream.
1525 | * @returns #OPUS_OK on success, or an error code (see @ref opus_errorcodes)
1526 | * on failure.
1527 | * Original signature : int opus_multistream_decoder_init(OpusMSDecoder*, opus_int32, int, int, int, const unsigned char*)
1528 | * native declaration : /tmp/opus_multistream.h:546 1529 | */ 1530 | int opus_multistream_decoder_init(PointerByReference st, int Fs, int channels, int streams, int coupled_streams, Pointer mapping); 1531 | /** 1532 | * Decode a multistream Opus packet.
1533 | * @param st OpusMSDecoder*: Multistream decoder state.
1534 | * @param[in] data const unsigned char*: Input payload.
1535 | * Use a NULL
1536 | * pointer to indicate packet
1537 | * loss.
1538 | * @param len opus_int32: Number of bytes in payload.
1539 | * @param[out] pcm opus_int16*: Output signal, with interleaved
1540 | * samples.
1541 | * This must contain room for
1542 | * frame_size*channels
1543 | * samples.
1544 | * @param frame_size int: The number of samples per channel of
1545 | * available space in \a pcm.
1546 | * If this is less than the maximum packet duration
1547 | * (120 ms; 5760 for 48kHz), this function will not be capable
1548 | * of decoding some packets. In the case of PLC (data==NULL)
1549 | * or FEC (decode_fec=1), then frame_size needs to be exactly
1550 | * the duration of audio that is missing, otherwise the
1551 | * decoder will not be in the optimal state to decode the
1552 | * next incoming packet. For the PLC and FEC cases, frame_size
1553 | * must be a multiple of 2.5 ms.
1554 | * @param decode_fec int: Flag (0 or 1) to request that any in-band
1555 | * forward error correction data be decoded.
1556 | * If no such data is available, the frame is
1557 | * decoded as if it were lost.
1558 | * @returns Number of samples decoded on success or a negative error code
1559 | * (see @ref opus_errorcodes) on failure.
1560 | * Original signature : int opus_multistream_decode(OpusMSDecoder*, const unsigned char*, opus_int32, opus_int16*, int, int)
1561 | * native declaration : /tmp/opus_multistream.h:584 1562 | */ 1563 | int opus_multistream_decode(PointerByReference st, byte data[], int len, ShortBuffer pcm, int frame_size, int decode_fec); 1564 | /** 1565 | * Decode a multistream Opus packet.
1566 | * @param st OpusMSDecoder*: Multistream decoder state.
1567 | * @param[in] data const unsigned char*: Input payload.
1568 | * Use a NULL
1569 | * pointer to indicate packet
1570 | * loss.
1571 | * @param len opus_int32: Number of bytes in payload.
1572 | * @param[out] pcm opus_int16*: Output signal, with interleaved
1573 | * samples.
1574 | * This must contain room for
1575 | * frame_size*channels
1576 | * samples.
1577 | * @param frame_size int: The number of samples per channel of
1578 | * available space in \a pcm.
1579 | * If this is less than the maximum packet duration
1580 | * (120 ms; 5760 for 48kHz), this function will not be capable
1581 | * of decoding some packets. In the case of PLC (data==NULL)
1582 | * or FEC (decode_fec=1), then frame_size needs to be exactly
1583 | * the duration of audio that is missing, otherwise the
1584 | * decoder will not be in the optimal state to decode the
1585 | * next incoming packet. For the PLC and FEC cases, frame_size
1586 | * must be a multiple of 2.5 ms.
1587 | * @param decode_fec int: Flag (0 or 1) to request that any in-band
1588 | * forward error correction data be decoded.
1589 | * If no such data is available, the frame is
1590 | * decoded as if it were lost.
1591 | * @returns Number of samples decoded on success or a negative error code
1592 | * (see @ref opus_errorcodes) on failure.
1593 | * Original signature : int opus_multistream_decode(OpusMSDecoder*, const unsigned char*, opus_int32, opus_int16*, int, int)
1594 | * native declaration : /tmp/opus_multistream.h:584 1595 | */ 1596 | int opus_multistream_decode(PointerByReference st, Pointer data, int len, ShortByReference pcm, int frame_size, int decode_fec); 1597 | /** 1598 | * Decode a multistream Opus packet with floating point output.
1599 | * @param st OpusMSDecoder*: Multistream decoder state.
1600 | * @param[in] data const unsigned char*: Input payload.
1601 | * Use a NULL
1602 | * pointer to indicate packet
1603 | * loss.
1604 | * @param len opus_int32: Number of bytes in payload.
1605 | * @param[out] pcm opus_int16*: Output signal, with interleaved
1606 | * samples.
1607 | * This must contain room for
1608 | * frame_size*channels
1609 | * samples.
1610 | * @param frame_size int: The number of samples per channel of
1611 | * available space in \a pcm.
1612 | * If this is less than the maximum packet duration
1613 | * (120 ms; 5760 for 48kHz), this function will not be capable
1614 | * of decoding some packets. In the case of PLC (data==NULL)
1615 | * or FEC (decode_fec=1), then frame_size needs to be exactly
1616 | * the duration of audio that is missing, otherwise the
1617 | * decoder will not be in the optimal state to decode the
1618 | * next incoming packet. For the PLC and FEC cases, frame_size
1619 | * must be a multiple of 2.5 ms.
1620 | * @param decode_fec int: Flag (0 or 1) to request that any in-band
1621 | * forward error correction data be decoded.
1622 | * If no such data is available, the frame is
1623 | * decoded as if it were lost.
1624 | * @returns Number of samples decoded on success or a negative error code
1625 | * (see @ref opus_errorcodes) on failure.
1626 | * Original signature : int opus_multistream_decode_float(OpusMSDecoder*, const unsigned char*, opus_int32, float*, int, int)
1627 | * native declaration : /tmp/opus_multistream.h:622 1628 | */ 1629 | int opus_multistream_decode_float(PointerByReference st, byte data[], int len, FloatBuffer pcm, int frame_size, int decode_fec); 1630 | /** 1631 | * Decode a multistream Opus packet with floating point output.
1632 | * @param st OpusMSDecoder*: Multistream decoder state.
1633 | * @param[in] data const unsigned char*: Input payload.
1634 | * Use a NULL
1635 | * pointer to indicate packet
1636 | * loss.
1637 | * @param len opus_int32: Number of bytes in payload.
1638 | * @param[out] pcm opus_int16*: Output signal, with interleaved
1639 | * samples.
1640 | * This must contain room for
1641 | * frame_size*channels
1642 | * samples.
1643 | * @param frame_size int: The number of samples per channel of
1644 | * available space in \a pcm.
1645 | * If this is less than the maximum packet duration
1646 | * (120 ms; 5760 for 48kHz), this function will not be capable
1647 | * of decoding some packets. In the case of PLC (data==NULL)
1648 | * or FEC (decode_fec=1), then frame_size needs to be exactly
1649 | * the duration of audio that is missing, otherwise the
1650 | * decoder will not be in the optimal state to decode the
1651 | * next incoming packet. For the PLC and FEC cases, frame_size
1652 | * must be a multiple of 2.5 ms.
1653 | * @param decode_fec int: Flag (0 or 1) to request that any in-band
1654 | * forward error correction data be decoded.
1655 | * If no such data is available, the frame is
1656 | * decoded as if it were lost.
1657 | * @returns Number of samples decoded on success or a negative error code
1658 | * (see @ref opus_errorcodes) on failure.
1659 | * Original signature : int opus_multistream_decode_float(OpusMSDecoder*, const unsigned char*, opus_int32, float*, int, int)
1660 | * native declaration : /tmp/opus_multistream.h:622 1661 | */ 1662 | int opus_multistream_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size, int decode_fec); 1663 | /** 1664 | * Perform a CTL function on a multistream Opus decoder.
1665 | * * Generally the request and subsequent arguments are generated by a
1666 | * convenience macro.
1667 | * @param st OpusMSDecoder*: Multistream decoder state.
1668 | * @param request This and all remaining parameters should be replaced by one
1669 | * of the convenience macros in @ref opus_genericctls,
1670 | * @ref opus_decoderctls, or @ref opus_multistream_ctls.
1671 | * @see opus_genericctls
1672 | * @see opus_decoderctls
1673 | * @see opus_multistream_ctls
1674 | * Original signature : int opus_multistream_decoder_ctl(OpusMSDecoder*, int, null)
1675 | * native declaration : /tmp/opus_multistream.h:643 1676 | */ 1677 | int opus_multistream_decoder_ctl(PointerByReference st, int request, Object... varargs); 1678 | /** 1679 | * Frees an OpusMSDecoder allocated by
1680 | * opus_multistream_decoder_create().
1681 | * @param st OpusMSDecoder: Multistream decoder state to be freed.
1682 | * Original signature : void opus_multistream_decoder_destroy(OpusMSDecoder*)
1683 | * native declaration : /tmp/opus_multistream.h:649 1684 | */ 1685 | void opus_multistream_decoder_destroy(PointerByReference st); 1686 | public static class OpusMSEncoder extends PointerType { 1687 | public OpusMSEncoder(Pointer address) { 1688 | super(address); 1689 | } 1690 | public OpusMSEncoder() { 1691 | super(); 1692 | } 1693 | }; 1694 | public static class OpusMSDecoder extends PointerType { 1695 | public OpusMSDecoder(Pointer address) { 1696 | super(address); 1697 | } 1698 | public OpusMSDecoder() { 1699 | super(); 1700 | } 1701 | }; 1702 | 1703 | // ******************** Custom Support 1704 | 1705 | /** 1706 | * Creates a new mode struct. This will be passed to an encoder or
1707 | * decoder. The mode MUST NOT BE DESTROYED until the encoders and
1708 | * decoders that use it are destroyed as well.
1709 | * @param [in] Fs int: Sampling rate (8000 to 96000 Hz)
1710 | * @param [in] frame_size int: Number of samples (per channel) to encode in each
1711 | * packet (64 - 1024, prime factorization must contain zero or more 2s, 3s, or 5s and no other primes)
1712 | * @param [out] error int*: Returned error code (if NULL, no error will be returned)
1713 | * @return A newly created mode
1714 | * Original signature : OpusCustomMode* opus_custom_mode_create(opus_int32, int, int*)
1715 | * native declaration : /tmp/opus_custom.h:120 1716 | */ 1717 | PointerByReference opus_custom_mode_create(int Fs, int frame_size, IntBuffer error); 1718 | /** 1719 | * Destroys a mode struct. Only call this after all encoders and
1720 | * decoders using this mode are destroyed as well.
1721 | * @param [in] mode OpusCustomMode*: Mode to be freed.
1722 | * Original signature : void opus_custom_mode_destroy(OpusCustomMode*)
1723 | * native declaration : /tmp/opus_custom.h:126 1724 | */ 1725 | void opus_custom_mode_destroy(PointerByReference mode); 1726 | /** 1727 | * Gets the size of an OpusCustomEncoder structure.
1728 | * @param [in] mode OpusCustomMode *: Mode configuration
1729 | * @param [in] channels int: Number of channels
1730 | * @returns size
1731 | * Original signature : int opus_custom_encoder_get_size(const OpusCustomMode*, int)
1732 | * native declaration : /tmp/opus_custom.h:137 1733 | */ 1734 | int opus_custom_encoder_get_size(PointerByReference mode, int channels); 1735 | /** 1736 | * Creates a new encoder state. Each stream needs its own encoder
1737 | * state (can't be shared across simultaneous streams).
1738 | * @param [in] mode OpusCustomMode*: Contains all the information about the characteristics of
1739 | * the stream (must be the same characteristics as used for the
1740 | * decoder)
1741 | * @param [in] channels int: Number of channels
1742 | * @param [out] error int*: Returns an error code
1743 | * @return Newly created encoder state.
1744 | * Original signature : OpusCustomEncoder* opus_custom_encoder_create(const OpusCustomMode*, int, int*)
1745 | * native declaration : /tmp/opus_custom.h:173 1746 | */ 1747 | PointerByReference opus_custom_encoder_create(PointerByReference mode, int channels, IntBuffer error); 1748 | /** 1749 | * Creates a new encoder state. Each stream needs its own encoder
1750 | * state (can't be shared across simultaneous streams).
1751 | * @param [in] mode OpusCustomMode*: Contains all the information about the characteristics of
1752 | * the stream (must be the same characteristics as used for the
1753 | * decoder)
1754 | * @param [in] channels int: Number of channels
1755 | * @param [out] error int*: Returns an error code
1756 | * @return Newly created encoder state.
1757 | * Original signature : OpusCustomEncoder* opus_custom_encoder_create(const OpusCustomMode*, int, int*)
1758 | * native declaration : /tmp/opus_custom.h:173 1759 | */ 1760 | PointerByReference opus_custom_encoder_create(PointerByReference mode, int channels, IntByReference error); 1761 | /** 1762 | * Destroys a an encoder state.
1763 | * @param[in] st OpusCustomEncoder*: State to be freed.
1764 | * Original signature : void opus_custom_encoder_destroy(OpusCustomEncoder*)
1765 | * native declaration : /tmp/opus_custom.h:183 1766 | */ 1767 | void opus_custom_encoder_destroy(PointerByReference st); 1768 | /** 1769 | * Encodes a frame of audio.
1770 | * @param [in] st OpusCustomEncoder*: Encoder state
1771 | * @param [in] pcm float*: PCM audio in float format, with a normal range of +/-1.0.
1772 | * Samples with a range beyond +/-1.0 are supported but will
1773 | * be clipped by decoders using the integer API and should
1774 | * only be used if it is known that the far end supports
1775 | * extended dynamic range. There must be exactly
1776 | * frame_size samples per channel.
1777 | * @param [in] frame_size int: Number of samples per frame of input signal
1778 | * @param [out] compressed char *: The compressed data is written here. This may not alias pcm and must be at least maxCompressedBytes long.
1779 | * @param [in] maxCompressedBytes int: Maximum number of bytes to use for compressing the frame
1780 | * (can change from one frame to another)
1781 | * @return Number of bytes written to "compressed".
1782 | * If negative, an error has occurred (see error codes). It is IMPORTANT that
1783 | * the length returned be somehow transmitted to the decoder. Otherwise, no
1784 | * decoding is possible.
1785 | * Original signature : int opus_custom_encode_float(OpusCustomEncoder*, const float*, int, unsigned char*, int)
1786 | * native declaration : /tmp/opus_custom.h:202 1787 | */ 1788 | int opus_custom_encode_float(PointerByReference st, float pcm[], int frame_size, ByteBuffer compressed, int maxCompressedBytes); 1789 | /** 1790 | * Encodes a frame of audio.
1791 | * @param [in] st OpusCustomEncoder*: Encoder state
1792 | * @param [in] pcm float*: PCM audio in float format, with a normal range of +/-1.0.
1793 | * Samples with a range beyond +/-1.0 are supported but will
1794 | * be clipped by decoders using the integer API and should
1795 | * only be used if it is known that the far end supports
1796 | * extended dynamic range. There must be exactly
1797 | * frame_size samples per channel.
1798 | * @param [in] frame_size int: Number of samples per frame of input signal
1799 | * @param [out] compressed char *: The compressed data is written here. This may not alias pcm and must be at least maxCompressedBytes long.
1800 | * @param [in] maxCompressedBytes int: Maximum number of bytes to use for compressing the frame
1801 | * (can change from one frame to another)
1802 | * @return Number of bytes written to "compressed".
1803 | * If negative, an error has occurred (see error codes). It is IMPORTANT that
1804 | * the length returned be somehow transmitted to the decoder. Otherwise, no
1805 | * decoding is possible.
1806 | * Original signature : int opus_custom_encode_float(OpusCustomEncoder*, const float*, int, unsigned char*, int)
1807 | * native declaration : /tmp/opus_custom.h:202 1808 | */ 1809 | int opus_custom_encode_float(PointerByReference st, FloatByReference pcm, int frame_size, Pointer compressed, int maxCompressedBytes); 1810 | /** 1811 | * Encodes a frame of audio.
1812 | * @param [in] st OpusCustomEncoder*: Encoder state
1813 | * @param [in] pcm opus_int16*: PCM audio in signed 16-bit format (native endian).
1814 | * There must be exactly frame_size samples per channel.
1815 | * @param [in] frame_size int: Number of samples per frame of input signal
1816 | * @param [out] compressed char *: The compressed data is written here. This may not alias pcm and must be at least maxCompressedBytes long.
1817 | * @param [in] maxCompressedBytes int: Maximum number of bytes to use for compressing the frame
1818 | * (can change from one frame to another)
1819 | * @return Number of bytes written to "compressed".
1820 | * If negative, an error has occurred (see error codes). It is IMPORTANT that
1821 | * the length returned be somehow transmitted to the decoder. Otherwise, no
1822 | * decoding is possible.
1823 | * Original signature : int opus_custom_encode(OpusCustomEncoder*, const opus_int16*, int, unsigned char*, int)
1824 | * native declaration : /tmp/opus_custom.h:223 1825 | */ 1826 | int opus_custom_encode(PointerByReference st, ShortBuffer pcm, int frame_size, ByteBuffer compressed, int maxCompressedBytes); 1827 | /** 1828 | * Encodes a frame of audio.
1829 | * @param [in] st OpusCustomEncoder*: Encoder state
1830 | * @param [in] pcm opus_int16*: PCM audio in signed 16-bit format (native endian).
1831 | * There must be exactly frame_size samples per channel.
1832 | * @param [in] frame_size int: Number of samples per frame of input signal
1833 | * @param [out] compressed char *: The compressed data is written here. This may not alias pcm and must be at least maxCompressedBytes long.
1834 | * @param [in] maxCompressedBytes int: Maximum number of bytes to use for compressing the frame
1835 | * (can change from one frame to another)
1836 | * @return Number of bytes written to "compressed".
1837 | * If negative, an error has occurred (see error codes). It is IMPORTANT that
1838 | * the length returned be somehow transmitted to the decoder. Otherwise, no
1839 | * decoding is possible.
1840 | * Original signature : int opus_custom_encode(OpusCustomEncoder*, const opus_int16*, int, unsigned char*, int)
1841 | * native declaration : /tmp/opus_custom.h:223 1842 | */ 1843 | int opus_custom_encode(PointerByReference st, ShortByReference pcm, int frame_size, Pointer compressed, int maxCompressedBytes); 1844 | /** 1845 | * Perform a CTL function on an Opus custom encoder.
1846 | * * Generally the request and subsequent arguments are generated
1847 | * by a convenience macro.
1848 | * @see opus_encoderctls
1849 | * Original signature : int opus_custom_encoder_ctl(OpusCustomEncoder*, int, null)
1850 | * native declaration : /tmp/opus_custom.h:237 1851 | */ 1852 | int opus_custom_encoder_ctl(PointerByReference st, int request, Object... varargs); 1853 | /** 1854 | * Gets the size of an OpusCustomDecoder structure.
1855 | * @param [in] mode OpusCustomMode *: Mode configuration
1856 | * @param [in] channels int: Number of channels
1857 | * @returns size
1858 | * Original signature : int opus_custom_decoder_get_size(const OpusCustomMode*, int)
1859 | * native declaration : /tmp/opus_custom.h:248 1860 | */ 1861 | int opus_custom_decoder_get_size(PointerByReference mode, int channels); 1862 | /** 1863 | * Initializes a previously allocated decoder state
1864 | * The memory pointed to by st must be the size returned by opus_custom_decoder_get_size.
1865 | * This is intended for applications which use their own allocator instead of malloc.
1866 | * @see opus_custom_decoder_create(),opus_custom_decoder_get_size()
1867 | * To reset a previously initialized state use the OPUS_RESET_STATE CTL.
1868 | * @param [in] st OpusCustomDecoder*: Decoder state
1869 | * @param [in] mode OpusCustomMode *: Contains all the information about the characteristics of
1870 | * the stream (must be the same characteristics as used for the
1871 | * encoder)
1872 | * @param [in] channels int: Number of channels
1873 | * @return OPUS_OK Success or @ref opus_errorcodes
1874 | * Original signature : int opus_custom_decoder_init(OpusCustomDecoder*, const OpusCustomMode*, int)
1875 | * native declaration : /tmp/opus_custom.h:265 1876 | */ 1877 | int opus_custom_decoder_init(PointerByReference st, PointerByReference mode, int channels); 1878 | /** 1879 | * Creates a new decoder state. Each stream needs its own decoder state (can't
1880 | * be shared across simultaneous streams).
1881 | * @param [in] mode OpusCustomMode: Contains all the information about the characteristics of the
1882 | * stream (must be the same characteristics as used for the encoder)
1883 | * @param [in] channels int: Number of channels
1884 | * @param [out] error int*: Returns an error code
1885 | * @return Newly created decoder state.
1886 | * Original signature : OpusCustomDecoder* opus_custom_decoder_create(const OpusCustomMode*, int, int*)
1887 | * native declaration : /tmp/opus_custom.h:282 1888 | */ 1889 | PointerByReference opus_custom_decoder_create(PointerByReference mode, int channels, IntBuffer error); 1890 | /** 1891 | * Creates a new decoder state. Each stream needs its own decoder state (can't
1892 | * be shared across simultaneous streams).
1893 | * @param [in] mode OpusCustomMode: Contains all the information about the characteristics of the
1894 | * stream (must be the same characteristics as used for the encoder)
1895 | * @param [in] channels int: Number of channels
1896 | * @param [out] error int*: Returns an error code
1897 | * @return Newly created decoder state.
1898 | * Original signature : OpusCustomDecoder* opus_custom_decoder_create(const OpusCustomMode*, int, int*)
1899 | * native declaration : /tmp/opus_custom.h:282 1900 | */ 1901 | PointerByReference opus_custom_decoder_create(PointerByReference mode, int channels, IntByReference error); 1902 | /** 1903 | * Destroys a an decoder state.
1904 | * @param[in] st OpusCustomDecoder*: State to be freed.
1905 | * Original signature : void opus_custom_decoder_destroy(OpusCustomDecoder*)
1906 | * native declaration : /tmp/opus_custom.h:291 1907 | */ 1908 | void opus_custom_decoder_destroy(PointerByReference st); 1909 | /** 1910 | * Decode an opus custom frame with floating point output
1911 | * @param [in] st OpusCustomDecoder*: Decoder state
1912 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
1913 | * @param [in] len int: Number of bytes in payload
1914 | * @param [out] pcm float*: Output signal (interleaved if 2 channels). length
1915 | * is frame_size*channels*sizeof(float)
1916 | * @param [in] frame_size Number of samples per channel of available space in *pcm.
1917 | * @returns Number of decoded samples or @ref opus_errorcodes
1918 | * Original signature : int opus_custom_decode_float(OpusCustomDecoder*, const unsigned char*, int, float*, int)
1919 | * native declaration : /tmp/opus_custom.h:302 1920 | */ 1921 | int opus_custom_decode_float(PointerByReference st, byte data[], int len, FloatBuffer pcm, int frame_size); 1922 | /** 1923 | * Decode an opus custom frame with floating point output
1924 | * @param [in] st OpusCustomDecoder*: Decoder state
1925 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
1926 | * @param [in] len int: Number of bytes in payload
1927 | * @param [out] pcm float*: Output signal (interleaved if 2 channels). length
1928 | * is frame_size*channels*sizeof(float)
1929 | * @param [in] frame_size Number of samples per channel of available space in *pcm.
1930 | * @returns Number of decoded samples or @ref opus_errorcodes
1931 | * Original signature : int opus_custom_decode_float(OpusCustomDecoder*, const unsigned char*, int, float*, int)
1932 | * native declaration : /tmp/opus_custom.h:302 1933 | */ 1934 | int opus_custom_decode_float(PointerByReference st, Pointer data, int len, FloatByReference pcm, int frame_size); 1935 | /** 1936 | * Decode an opus custom frame
1937 | * @param [in] st OpusCustomDecoder*: Decoder state
1938 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
1939 | * @param [in] len int: Number of bytes in payload
1940 | * @param [out] pcm opus_int16*: Output signal (interleaved if 2 channels). length
1941 | * is frame_size*channels*sizeof(opus_int16)
1942 | * @param [in] frame_size Number of samples per channel of available space in *pcm.
1943 | * @returns Number of decoded samples or @ref opus_errorcodes
1944 | * Original signature : int opus_custom_decode(OpusCustomDecoder*, const unsigned char*, int, opus_int16*, int)
1945 | * native declaration : /tmp/opus_custom.h:319 1946 | */ 1947 | int opus_custom_decode(PointerByReference st, byte data[], int len, ShortBuffer pcm, int frame_size); 1948 | /** 1949 | * Decode an opus custom frame
1950 | * @param [in] st OpusCustomDecoder*: Decoder state
1951 | * @param [in] data char*: Input payload. Use a NULL pointer to indicate packet loss
1952 | * @param [in] len int: Number of bytes in payload
1953 | * @param [out] pcm opus_int16*: Output signal (interleaved if 2 channels). length
1954 | * is frame_size*channels*sizeof(opus_int16)
1955 | * @param [in] frame_size Number of samples per channel of available space in *pcm.
1956 | * @returns Number of decoded samples or @ref opus_errorcodes
1957 | * Original signature : int opus_custom_decode(OpusCustomDecoder*, const unsigned char*, int, opus_int16*, int)
1958 | * native declaration : /tmp/opus_custom.h:319 1959 | */ 1960 | int opus_custom_decode(PointerByReference st, Pointer data, int len, ShortByReference pcm, int frame_size); 1961 | /** 1962 | * Perform a CTL function on an Opus custom decoder.
1963 | * * Generally the request and subsequent arguments are generated
1964 | * by a convenience macro.
1965 | * @see opus_genericctls
1966 | * Original signature : int opus_custom_decoder_ctl(OpusCustomDecoder*, int, null)
1967 | * native declaration : /tmp/opus_custom.h:333 1968 | */ 1969 | int opus_custom_decoder_ctl(PointerByReference st, int request, Object... varargs); 1970 | public static class OpusCustomDecoder extends PointerType { 1971 | public OpusCustomDecoder(Pointer address) { 1972 | super(address); 1973 | } 1974 | public OpusCustomDecoder() { 1975 | super(); 1976 | } 1977 | }; 1978 | public static class OpusCustomEncoder extends PointerType { 1979 | public OpusCustomEncoder(Pointer address) { 1980 | super(address); 1981 | } 1982 | public OpusCustomEncoder() { 1983 | super(); 1984 | } 1985 | }; 1986 | public static class OpusCustomMode extends PointerType { 1987 | public OpusCustomMode(Pointer address) { 1988 | super(address); 1989 | } 1990 | public OpusCustomMode() { 1991 | super(); 1992 | } 1993 | }; 1994 | } 1995 | --------------------------------------------------------------------------------