├── .cproject ├── .gitignore ├── .project ├── COPYING ├── README.md ├── build.gradle ├── libpulse-android.iml ├── proguard-project.txt ├── project.properties └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── harrcharr │ └── pulse │ ├── ChannelMap.java │ ├── ClientInfo.java │ ├── InfoCallback.java │ ├── JNIObject.java │ ├── JNIStruct.java │ ├── JNIUtil.java │ ├── JniCallback.java │ ├── Mainloop.java │ ├── NoConnectionException.java │ ├── NotifyCallback.java │ ├── OwnedStreamNode.java │ ├── OwnerStreamNode.java │ ├── PulseContext.java │ ├── PulseNode.java │ ├── SinkInfo.java │ ├── SinkInfoCallback.java │ ├── SinkInput.java │ ├── SinkInputInfoCallback.java │ ├── SourceInfo.java │ ├── SourceInfoCallback.java │ ├── SourceOutput.java │ ├── SourceOutputInfoCallback.java │ ├── Stream.java │ ├── StreamNode.java │ ├── SubscriptionCallback.java │ ├── SuccessCallback.java │ └── Volume.java ├── jni ├── Android.mk ├── context.c ├── context.h ├── context_util.c ├── context_util.h ├── jni_core.c ├── jni_core.h ├── jni_util.c ├── libjson │ ├── Android.mk │ └── lib │ │ └── libjson.so ├── libpulse │ ├── Android.mk │ ├── include │ │ └── pulse │ │ │ ├── cdecl.h │ │ │ ├── channelmap.h │ │ │ ├── client-conf-x11.h │ │ │ ├── client-conf.h │ │ │ ├── context.h │ │ │ ├── def.h │ │ │ ├── error.h │ │ │ ├── ext-device-manager.h │ │ │ ├── ext-device-restore.h │ │ │ ├── ext-stream-restore.h │ │ │ ├── fork-detect.h │ │ │ ├── format.h │ │ │ ├── gccmacro.h │ │ │ ├── glib-mainloop.h │ │ │ ├── internal.h │ │ │ ├── introspect.h │ │ │ ├── mainloop-api.h │ │ │ ├── mainloop-signal.h │ │ │ ├── mainloop.h │ │ │ ├── operation.h │ │ │ ├── proplist.h │ │ │ ├── pulseaudio.h │ │ │ ├── rtclock.h │ │ │ ├── sample.h │ │ │ ├── scache.h │ │ │ ├── simple.h │ │ │ ├── stream.h │ │ │ ├── subscribe.h │ │ │ ├── thread-mainloop.h │ │ │ ├── timeval.h │ │ │ ├── utf8.h │ │ │ ├── util.h │ │ │ ├── version.h │ │ │ ├── volume.h │ │ │ └── xmalloc.h │ └── lib │ │ └── libpulse.so ├── libpulsecommon │ ├── Android.mk │ ├── include │ │ └── pulse │ │ │ ├── cdecl.h │ │ │ ├── channelmap.h │ │ │ ├── client-conf-x11.h │ │ │ ├── client-conf.h │ │ │ ├── context.h │ │ │ ├── def.h │ │ │ ├── error.h │ │ │ ├── ext-device-manager.h │ │ │ ├── ext-device-restore.h │ │ │ ├── ext-stream-restore.h │ │ │ ├── fork-detect.h │ │ │ ├── format.h │ │ │ ├── gccmacro.h │ │ │ ├── glib-mainloop.h │ │ │ ├── internal.h │ │ │ ├── introspect.h │ │ │ ├── mainloop-api.h │ │ │ ├── mainloop-signal.h │ │ │ ├── mainloop.h │ │ │ ├── operation.h │ │ │ ├── proplist.h │ │ │ ├── pulseaudio.h │ │ │ ├── rtclock.h │ │ │ ├── sample.h │ │ │ ├── scache.h │ │ │ ├── simple.h │ │ │ ├── stream.h │ │ │ ├── subscribe.h │ │ │ ├── thread-mainloop.h │ │ │ ├── timeval.h │ │ │ ├── utf8.h │ │ │ ├── util.h │ │ │ ├── version.h │ │ │ ├── volume.h │ │ │ └── xmalloc.h │ └── lib │ │ └── libpulsecommon-UNKNOWN.UNKNOWN.so ├── libsndfile │ ├── Android.mk │ └── lib │ │ └── libsndfile.so ├── logging.c ├── logging.h ├── mainloop.c ├── pulse-android.cpp ├── pulse.c ├── pulse.h ├── pulse_interface.cpp ├── stream.c ├── volume.c └── wrap_struct.c ├── jniLibs └── armeabi-v7a └── res ├── drawable-hdpi └── ic_launcher.png ├── drawable-ldpi └── ic_launcher.png ├── drawable-mdpi └── ic_launcher.png ├── drawable-xhdpi └── ic_launcher.png ├── layout └── main.xml └── values └── strings.xml /.gitignore: -------------------------------------------------------------------------------- 1 | gen 2 | bin 3 | obj 4 | libs 5 | .classpath 6 | lint.xml 7 | build 8 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | libpulse-android 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | 11 | 12 | ?children? 13 | ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\|| 14 | 15 | 16 | ?name? 17 | 18 | 19 | 20 | org.eclipse.cdt.make.core.append_environment 21 | true 22 | 23 | 24 | org.eclipse.cdt.make.core.buildArguments 25 | 26 | 27 | 28 | org.eclipse.cdt.make.core.buildCommand 29 | ndk-build 30 | 31 | 32 | org.eclipse.cdt.make.core.cleanBuildTarget 33 | clean 34 | 35 | 36 | org.eclipse.cdt.make.core.contents 37 | org.eclipse.cdt.make.core.activeConfigSettings 38 | 39 | 40 | org.eclipse.cdt.make.core.enableAutoBuild 41 | false 42 | 43 | 44 | org.eclipse.cdt.make.core.enableCleanBuild 45 | true 46 | 47 | 48 | org.eclipse.cdt.make.core.enableFullBuild 49 | true 50 | 51 | 52 | org.eclipse.cdt.make.core.stopOnError 53 | true 54 | 55 | 56 | org.eclipse.cdt.make.core.useDefaultBuildCmd 57 | true 58 | 59 | 60 | 61 | 62 | com.android.ide.eclipse.adt.ResourceManagerBuilder 63 | 64 | 65 | 66 | 67 | com.android.ide.eclipse.adt.PreCompilerBuilder 68 | 69 | 70 | 71 | 72 | org.eclipse.jdt.core.javabuilder 73 | 74 | 75 | 76 | 77 | com.android.ide.eclipse.adt.ApkBuilder 78 | 79 | 80 | 81 | 82 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 83 | full,incremental, 84 | 85 | 86 | 87 | 88 | 89 | com.android.ide.eclipse.adt.AndroidNature 90 | org.eclipse.jdt.core.javanature 91 | org.eclipse.cdt.core.cnature 92 | org.eclipse.cdt.core.ccnature 93 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 94 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 95 | 96 | 97 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Libpulse-android is a JNI interface to functions of libpulse (which communicates with pulseaudio). 2 | 3 | As of now, it is focused on providing access to introspection functions of the library, so as to 4 | enable writing of a remote control volume application (see my project Reverb on github) 5 | 6 | On Building libpulse.so for Android 7 | ============================================== 8 | I got... kind of lucky when I built libpulse for Android and realized I could start this project. If anyone can streamline and improve on this, and build libpulse again, I'd like to know! Preferrably, the newest version (I think this is sub-1.0, even) of the library. 9 | 10 | 11 | Building libpulse-android 12 | ============================================== 13 | I'm working on moving lp-a to a gradle build structure. 14 | 15 | CAREFUL: right now jniLibs is a bunch of symlinks to the .so files. I plan to update Android.mk or otherwise so 16 | that ndk-build puts the prebuilts in the proper directories. It seems that 17 | Gradle's NDK support is far too lacking for the scope involved in this project. -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { url 'http://repo1.maven.org/maven2' } 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:0.11.+' 7 | } 8 | } 9 | 10 | apply plugin: 'android-library' 11 | 12 | android { 13 | compileSdkVersion 17 14 | buildToolsVersion "19.1.0" 15 | 16 | sourceSets.main.jni.srcDirs = ['src/main/fakejni'] 17 | defaultConfig{ 18 | ndk { 19 | moduleName "pulse_interface" 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /libpulse-android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 18 | 19 | 20 | 21 | 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 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-4 15 | android.library=true 16 | -------------------------------------------------------------------------------- /src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/ChannelMap.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | import java.util.HashMap; 25 | 26 | public class ChannelMap { 27 | private static final HashMap MAP_NAMES = new HashMap(); 28 | 29 | char mChannels; 30 | int[] mChannelMap; 31 | 32 | public ChannelMap(int[] map) { 33 | mChannelMap = map; 34 | mChannels = (char)map.length; 35 | } 36 | 37 | public int[] getChannelMap() { 38 | return mChannelMap; 39 | } 40 | public int getNumChannels() { 41 | return mChannelMap.length; 42 | } 43 | 44 | public String getChannelNameByIndex(int index) { 45 | return getChannelName(mChannelMap[index]); 46 | } 47 | public String getChannelName(int mapping) { 48 | String name = MAP_NAMES.get(Integer.valueOf(mapping)); 49 | if (name == null) { 50 | name = JNIPositionPrettyPrintString(mapping); 51 | MAP_NAMES.put(Integer.valueOf(mapping), name); 52 | } 53 | 54 | return name; 55 | } 56 | private static native String JNIPositionPrettyPrintString(int mapping); 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/ClientInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public class ClientInfo extends PulseNode { 25 | String sName; 26 | 27 | public ClientInfo(PulseContext pulse, long ptr) { 28 | super(pulse, ptr); 29 | } 30 | 31 | public void update(long ptr) { 32 | JNIPopulateStruct(ptr); 33 | } 34 | public String getName() { 35 | return sName; 36 | } 37 | 38 | public String toString() { 39 | return sName; 40 | } 41 | 42 | private final native void JNIPopulateStruct(long pClientInfo); 43 | 44 | @Override 45 | public String getDescriptiveName() { 46 | return sName; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/InfoCallback.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public abstract class InfoCallback extends JniCallback { 25 | protected PulseContext mPulse; 26 | public InfoCallback () { 27 | super(); 28 | } 29 | public InfoCallback (PulseContext c) { 30 | this(); 31 | mPulse = c; 32 | } 33 | public void setContext(PulseContext c) { 34 | mPulse = c; 35 | } 36 | 37 | public abstract void run(long iPtr); 38 | public abstract void run(final T node); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/JNIObject.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | import java.util.HashMap; 25 | 26 | public abstract class JNIObject { 27 | private long mPointer; 28 | private static HashMap ptrTable = new HashMap(); 29 | 30 | protected JNIObject(long ptr) { 31 | mPointer = ptr; 32 | addToTable(); 33 | } 34 | protected void finalize() { 35 | purge(); 36 | } 37 | 38 | /* 39 | * Delete object being pointed to, remove self from pointer table 40 | */ 41 | public synchronized void purge() { 42 | ptrTable.remove(new Long(mPointer)); 43 | } 44 | 45 | public static JNIObject getByPointer(long ptr) { 46 | return getByPointer(new Long(ptr)); 47 | } 48 | public static JNIObject getByPointer(Long ptr) { 49 | return ptrTable.get(ptr); 50 | } 51 | protected void addToTable() { 52 | ptrTable.put(new Long(mPointer), this); 53 | } 54 | public long getPointer() { 55 | return mPointer; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/JNIStruct.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public abstract class JNIStruct { 25 | protected JNIStruct(long ptr) { 26 | if (ptr != 0) { 27 | update(ptr); 28 | } 29 | } 30 | public abstract void update(long ptr); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/JNIUtil.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | class JNIUtil { 4 | public static native void deleteGlobalRef(long ref); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/JniCallback.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public abstract class JniCallback implements Comparable { 4 | private PulseContext mPulse; 5 | private long mGlobalRef; 6 | private boolean mReferenced; 7 | 8 | public void storeGlobal(PulseContext pulse, long ref) { 9 | mPulse = pulse; 10 | mGlobalRef = ref; 11 | mReferenced = true; 12 | 13 | mPulse.holdCallback(this); 14 | } 15 | 16 | public PulseContext getPulseContext() { 17 | return mPulse; 18 | } 19 | 20 | public long getGlobal() { 21 | return mGlobalRef; 22 | } 23 | 24 | public void unstoreGlobal() { 25 | unstoreGlobal(true); 26 | } 27 | public void unstoreGlobal(boolean unhold) { 28 | if (unhold) { 29 | mPulse.unholdCallback(this); 30 | } 31 | mReferenced = false; 32 | } 33 | 34 | public void freeGlobal() { 35 | freeGlobal(true); 36 | } 37 | public void freeGlobal(boolean unhold) { 38 | if (mReferenced) { 39 | unstoreGlobal(unhold); 40 | JNIUtil.deleteGlobalRef(mGlobalRef); 41 | } 42 | } 43 | 44 | public int compareTo(JniCallback cb) { 45 | return (int)(getGlobal() - cb.getGlobal()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/Mainloop.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public class Mainloop extends JNIObject { 25 | static { 26 | System.loadLibrary("json"); 27 | System.loadLibrary("sndfile"); 28 | System.loadLibrary("pulsecommon-UNKNOWN.UNKNOWN"); 29 | System.loadLibrary("pulse"); 30 | System.loadLibrary("pulse_interface"); 31 | } 32 | 33 | public Mainloop() { 34 | super(Mainloop.JNINew()); 35 | Mainloop.JNIStart(getPointer()); 36 | } 37 | 38 | private final static native long JNINew(); 39 | private final static native long JNIStart(long pMainloop); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/NoConnectionException.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public class NoConnectionException extends Exception { 4 | private static final long serialVersionUID = -3499607693294784702L; 5 | 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/NotifyCallback.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public abstract class NotifyCallback extends JniCallback { 25 | public abstract void run(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/OwnedStreamNode.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | import android.util.Log; 25 | 26 | public abstract class OwnedStreamNode extends StreamNode { 27 | protected int mOwnerModuleIndex; 28 | protected int mClientIndex; 29 | protected int mOwnerStreamIndex; 30 | 31 | protected boolean mCorked; 32 | protected boolean mHasVolume; 33 | protected boolean mVolumeWritable; 34 | 35 | protected OwnerStreamNode mOwner; 36 | 37 | // More optional parameters 38 | protected String mAppName; 39 | 40 | public OwnedStreamNode(PulseContext pulse, long ptr) { 41 | super(pulse, ptr); 42 | } 43 | 44 | public String getName() { 45 | return mName; 46 | } 47 | public String getDescriptiveName() { 48 | return mName; 49 | } 50 | 51 | public String getAppName() { 52 | return mAppName; 53 | } 54 | 55 | public boolean isMuted() { 56 | return false; 57 | } 58 | 59 | public int getOwnerIndex() { 60 | return mOwnerStreamIndex; 61 | } 62 | 63 | public int getSourceIndex() { 64 | return mOwner.getSourceIndex(); 65 | } 66 | 67 | public Stream getNewStream(String name) { 68 | final Stream stream = mPulse.newStream(name + " for " + getDescriptiveName()); 69 | stream.setMonitorStream(this); 70 | 71 | return stream; 72 | } 73 | 74 | public void connectRecordStream(Stream stream) { 75 | stream.connectRecord(getSourceIndex()); 76 | } 77 | 78 | public void setOwner(OwnerStreamNode n) { 79 | // Change to OwnerStreamNode when implemented 80 | mOwner = n; 81 | } 82 | 83 | public void moveNode(OwnerStreamNode n, SuccessCallback cb) { 84 | mOwner = n; 85 | moveNodeByIndex(mOwner.getIndex(), cb); 86 | } 87 | 88 | protected abstract void moveNodeByIndex(int index, SuccessCallback cb); 89 | 90 | public StreamNode getOwner() { 91 | return mOwner; 92 | } 93 | 94 | public void update(OwnedStreamNode n) { 95 | super.update(n); 96 | 97 | mOwnerModuleIndex = n.mOwnerModuleIndex; 98 | mClientIndex = n.mClientIndex; 99 | mOwnerStreamIndex = n.mOwnerStreamIndex; 100 | 101 | mCorked = n.mCorked; 102 | mHasVolume = n.mHasVolume; 103 | mVolumeWritable = n.mVolumeWritable; 104 | 105 | mAppName = n.mAppName; 106 | } 107 | 108 | public String toString() { 109 | return mName; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/OwnerStreamNode.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public abstract class OwnerStreamNode extends StreamNode { 25 | protected String mName; 26 | protected String mDescription; 27 | 28 | public OwnerStreamNode(PulseContext pulse) { 29 | this(pulse, 0); 30 | } 31 | public OwnerStreamNode(PulseContext pulse, long ptr) { 32 | super(pulse, ptr); 33 | } 34 | 35 | public String getDescription() { 36 | return mDescription; 37 | } 38 | 39 | public String toString() { 40 | return mName + "\n" + mDescription; 41 | } 42 | 43 | public Stream getNewStream(String name) { 44 | final Stream stream = mPulse.newStream(name); 45 | 46 | return stream; 47 | } 48 | 49 | public void connectRecordStream(Stream stream) { 50 | stream.connectRecord(getSourceIndex()); 51 | } 52 | 53 | public void update(OwnerStreamNode n) { 54 | super.update(n); 55 | 56 | mName = n.mName; 57 | mDescription = n.mDescription; 58 | } 59 | 60 | @Override 61 | public String getDescriptiveName() { 62 | return getDescription(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/PulseNode.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | import java.nio.ByteBuffer; 25 | 26 | public abstract class PulseNode extends JNIStruct { 27 | public static String PROP_APPLICATION_NAME = "application.name"; 28 | 29 | protected PulseContext mPulse; 30 | 31 | protected int mIndex; 32 | protected int mOwnerModule; 33 | 34 | protected String mName; 35 | protected String mDriver; 36 | 37 | public PulseNode(PulseContext pulse, long iPtr) { 38 | super(iPtr); 39 | mPulse = pulse; 40 | } 41 | 42 | public int getIndex() { 43 | return mIndex; 44 | } 45 | 46 | public void update(PulseNode n) { 47 | mPulse = n.mPulse; 48 | 49 | mIndex = n.mIndex; 50 | mOwnerModule = n.mOwnerModule; 51 | 52 | mName = n.mName; 53 | mDriver = n.mDriver; 54 | } 55 | 56 | /* 57 | * Returns a human-readable name for this PulseNode. 58 | */ 59 | public abstract String getDescriptiveName(); 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SinkInfo.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public class SinkInfo extends OwnerStreamNode { 4 | protected int mMonitorSourceIndex; 5 | 6 | public SinkInfo(PulseContext pulse) { 7 | this(pulse, 0); 8 | } 9 | public SinkInfo(PulseContext pulse, long ptr) { 10 | super(pulse, ptr); 11 | } 12 | 13 | public void update(long ptr) { 14 | JNIPopulateStruct(ptr); 15 | } 16 | 17 | public void setMute(boolean mute, SuccessCallback cb) { 18 | mPulse.setSinkMute(mIndex, mute, cb); 19 | } 20 | public void setVolume(Volume volume, SuccessCallback cb) { 21 | mPulse.setSinkVolume(mIndex, volume, cb); 22 | } 23 | 24 | public int getSourceIndex() { 25 | return mMonitorSourceIndex; 26 | } 27 | 28 | private final native void JNIPopulateStruct(long pSinkInfo); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SinkInfoCallback.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public abstract class SinkInfoCallback extends InfoCallback { 4 | @Override 5 | public final void run(long ptr) { 6 | run(new SinkInfo(mPulse, ptr)); 7 | } 8 | 9 | public abstract void run(final SinkInfo node); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SinkInput.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public class SinkInput extends OwnedStreamNode { 4 | public SinkInput(PulseContext pulse, long ptr) { 5 | super(pulse, ptr); 6 | } 7 | 8 | public void update(long ptr) { 9 | JNIPopulateStruct(ptr); 10 | } 11 | 12 | public void setMute(boolean mute, SuccessCallback cb) { 13 | mPulse.setSinkInputMute(mIndex, mute, cb); 14 | } 15 | public void setVolume(Volume volume, SuccessCallback cb) { 16 | mPulse.setSinkInputVolume(mIndex, volume, cb); 17 | } 18 | 19 | public void update(SinkInput n) { 20 | super.update(n); 21 | } 22 | 23 | protected void moveNodeByIndex(int index, SuccessCallback cb) { 24 | mPulse.moveSinkInput(mIndex, index, cb); 25 | } 26 | 27 | private final native void JNIPopulateStruct(long pSinkInputInfo); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SinkInputInfoCallback.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public abstract class SinkInputInfoCallback extends InfoCallback { 4 | @Override 5 | public final void run(long ptr) { 6 | run(new SinkInput(mPulse, ptr)); 7 | } 8 | 9 | public abstract void run(final SinkInput node); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SourceInfo.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public class SourceInfo extends OwnerStreamNode { 4 | public SourceInfo(PulseContext pulse) { 5 | this(pulse, 0); 6 | } 7 | public SourceInfo(PulseContext pulse, long ptr) { 8 | super(pulse, ptr); 9 | } 10 | 11 | public void update(long ptr) { 12 | JNIPopulateStruct(ptr); 13 | } 14 | 15 | public void setMute(boolean mute, SuccessCallback cb) { 16 | mPulse.setSourceMute(mIndex, mute, cb); 17 | } 18 | public void setVolume(Volume volume, SuccessCallback cb) { 19 | mPulse.setSourceVolume(mIndex, volume, cb); 20 | } 21 | 22 | public int getSourceIndex() { 23 | return mIndex; 24 | } 25 | 26 | private final native void JNIPopulateStruct(long pSinkInfo); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SourceInfoCallback.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public abstract class SourceInfoCallback extends InfoCallback { 4 | @Override 5 | public final void run(long ptr) { 6 | run(new SourceInfo(mPulse, ptr)); 7 | } 8 | 9 | public abstract void run(final SourceInfo node); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SourceOutput.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public class SourceOutput extends OwnedStreamNode { 4 | public SourceOutput(PulseContext pulse, long ptr) { 5 | super(pulse, ptr); 6 | } 7 | 8 | public void update(long ptr) { 9 | JNIPopulateStruct(ptr); 10 | } 11 | 12 | public void setMute(boolean mute, SuccessCallback cb) { 13 | mPulse.setSourceOutputMute(mIndex, mute, cb); 14 | } 15 | public void setVolume(Volume volume, SuccessCallback cb) { 16 | mPulse.setSourceOutputVolume(mIndex, volume, cb); 17 | } 18 | 19 | public void update(SourceOutput n) { 20 | super.update(n); 21 | } 22 | 23 | public void connectRecordStream(Stream s) { 24 | 25 | } 26 | 27 | protected void moveNodeByIndex(int index, SuccessCallback cb) { 28 | mPulse.moveSourceOutput(mIndex, index, cb); 29 | } 30 | 31 | private final native void JNIPopulateStruct(long pSinkInputInfo); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SourceOutputInfoCallback.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public abstract class SourceOutputInfoCallback extends InfoCallback { 4 | @Override 5 | public final void run(long ptr) { 6 | run(new SourceOutput(mPulse, ptr)); 7 | } 8 | 9 | public abstract void run(final SourceOutput node); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/Stream.java: -------------------------------------------------------------------------------- 1 | package com.harrcharr.pulse; 2 | 3 | public class Stream extends JNIObject { 4 | Stream(PulseContext pulse, String name) { 5 | super(JNINewStream(pulse.getPointer(), name)); 6 | } 7 | private static native long JNINewStream(long cPtr, String name); 8 | 9 | public void setMonitorStream(OwnedStreamNode node) { 10 | setMonitorStream(node.getIndex()); 11 | } 12 | public native void setMonitorStream(int idx); 13 | 14 | public native void setReadCallback(ReadCallback cb); 15 | public native void setSuspendedCallback(Runnable cb); 16 | 17 | public void connectRecord(StreamNode node){ 18 | connectRecord(node.getSourceIndex()); 19 | } 20 | public void connectRecord(int idx) { 21 | connectRecord(""+idx); 22 | } 23 | public native void connectRecord(String dev); 24 | public native void disconnect(); 25 | 26 | public static interface ReadCallback { 27 | public void run(double vol); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/StreamNode.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public abstract class StreamNode extends PulseNode { 25 | protected boolean mMuted; 26 | 27 | protected Volume mVolume; 28 | protected ChannelMap mChannelMap; 29 | 30 | public StreamNode(PulseContext pulse, long iPtr) { 31 | super(pulse, iPtr); 32 | } 33 | 34 | public Volume getVolume() { 35 | return mVolume; 36 | } 37 | 38 | public ChannelMap getChannelMap() { 39 | return mChannelMap; 40 | } 41 | 42 | public boolean isMuted() { 43 | return mMuted; 44 | } 45 | 46 | public void update(StreamNode n) { 47 | super.update(n); 48 | 49 | mMuted = n.mMuted; 50 | 51 | mVolume = n.mVolume; 52 | mChannelMap = n.mChannelMap; 53 | } 54 | 55 | public abstract int getSourceIndex(); 56 | 57 | public abstract Stream getNewStream(String name); 58 | public abstract void connectRecordStream(Stream stream); 59 | 60 | public abstract void setMute(boolean mute, SuccessCallback c); 61 | public abstract void setVolume(Volume volume, SuccessCallback c); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SubscriptionCallback.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public abstract class SubscriptionCallback extends JniCallback { 25 | public final static int EVENT_REMOVE = 32; 26 | public abstract void run(int event, int index); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/SuccessCallback.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | public abstract class SuccessCallback extends JniCallback { 25 | public abstract void run(int result); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/harrcharr/pulse/Volume.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2012 Harrison Chapman. 3 | * 4 | * This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | * Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | ******************************************************************************/ 22 | package com.harrcharr.pulse; 23 | 24 | import android.util.Log; 25 | 26 | public class Volume { 27 | public static int NORM = 0x10000; 28 | public static int MUTED = 0; 29 | 30 | char mChannels; 31 | int[] mVolumes; 32 | 33 | public Volume(int[] vols) { 34 | mVolumes = vols; 35 | mChannels = (char)vols.length; 36 | } 37 | 38 | public int[] getVolumes() { 39 | return mVolumes; 40 | } 41 | public int getNumChannels() { 42 | return mVolumes.length; 43 | } 44 | public int get() { 45 | return mVolumes[0]; 46 | } 47 | 48 | public void setVolume(int channel, int volume) { 49 | mVolumes[channel] = volume; 50 | } 51 | public void setVolume(int volume) { 52 | for (int i = 0; i < mVolumes.length; i++) { 53 | mVolumes[i] = volume; 54 | } 55 | } 56 | 57 | public static double asPercent(int volume, int precision) { 58 | return ((long)((double)volume * 100.0 * Math.pow(10, precision) / (double)Volume.NORM)) / Math.pow(10, precision); 59 | } 60 | public static double asLinear(int volume) { 61 | return Math.pow(((double)volume / (double)Volume.NORM), 3); 62 | } 63 | 64 | public static double asDecibels(int volume) { 65 | return (20.0 * Math.log10(asLinear(volume))); 66 | } 67 | public static double asDecibels(int volume, int precision) { 68 | return ((long)(asDecibels(volume) * Math.pow(10, precision))) / Math.pow(10, precision); 69 | } 70 | // public Volume(char channels, int[] values) { 71 | // // init it somehow maybe 72 | // } 73 | 74 | public final native int getMax(); 75 | } 76 | -------------------------------------------------------------------------------- /src/main/jni/Android.mk: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Copyright (c) 2012 Harrison Chapman. 3 | # 4 | # This file is part of Reverb. 5 | # 6 | # Reverb is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Reverb is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with Reverb. If not, see . 18 | # 19 | # Contributors: 20 | # Harrison Chapman - initial API and implementation 21 | #------------------------------------------------------------------------------- 22 | 23 | LOCAL_PATH := $(call my-dir) 24 | ROOT_PATH := $(LOCAL_PATH) 25 | 26 | include $(call all-subdir-makefiles) 27 | include $(CLEAR_VARS) 28 | 29 | LOCAL_PATH = $(ROOT_PATH) 30 | LOCAL_CFLAGS := -Wall -Wextra -Ilibpulse/include 31 | 32 | LOCAL_MODULE := pulse_interface 33 | LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog 34 | LOCAL_SHARED_LIBRARIES := libjson libpulse 35 | LOCAL_SRC_FILES := jni_core.c logging.c pulse.c context.c \ 36 | mainloop.c wrap_struct.c jni_util.c context_util.c stream.c 37 | include $(BUILD_SHARED_LIBRARY) 38 | 39 | -------------------------------------------------------------------------------- /src/main/jni/context.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #ifndef __PA_CONTEXT_H 24 | #define __PA_CONTEXT_H 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/main/jni/context_util.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #ifndef __PA_CONTEXT_UTIL_H 24 | #define __PA_CONTEXT_UTIL_H 25 | 26 | #include 27 | #include 28 | 29 | #include "jni_core.h" 30 | 31 | // A structure holding (global) references to runnables, per event type 32 | typedef struct jni_pa_event_cbs { 33 | jobject source_output_cbo; 34 | jobject sink_input_cbo; 35 | jobject sink_cbo; 36 | jobject source_cbo; 37 | } jni_pa_event_cbs_t; 38 | 39 | typedef struct jni_pa_state_cbs { 40 | jobject unconnected_cbo; 41 | jobject connecting_cbo; 42 | jobject authorizing_cbo; 43 | jobject setting_name_cbo; 44 | jobject ready_cbo; 45 | jobject failed_cbo; 46 | jobject terminated_cbo; 47 | } jni_pa_state_cbs_t; 48 | 49 | typedef pa_operation *(*pa_context_get_info_t)( 50 | pa_context *c, uint32_t idx, void (*cb), void *userdata); 51 | typedef pa_operation *(*pa_context_get_info_list_t)( 52 | pa_context *c, void (*cb), void *userdata); 53 | typedef pa_operation *(*pa_context_set_mute_t)( 54 | pa_context *c, uint32_t idx, int mute, void (*cb), void *userdata); 55 | typedef pa_operation *(*pa_context_set_volume_t)( 56 | pa_context *c, uint32_t idx, pa_cvolume *vol, void (*cb), void *userdata); 57 | typedef pa_operation *(*pa_context_move_t)( 58 | pa_context *c, uint32_t idx, uint32_t owner_idx, void (*cb), void *userdata); 59 | 60 | void context_synchronized_info_call( 61 | JNIEnv *jenv, jobject jcontext, jobject jcb, 62 | pa_context_get_info_t get_info, uint32_t idx, 63 | void (*cb)); 64 | void context_synchronized_info_list_call( 65 | JNIEnv *jenv, jobject jcontext, jobject jcb, 66 | pa_context_get_info_list_t get_info_list, 67 | void (*cb)); 68 | 69 | void context_synchronized_mute_call( 70 | JNIEnv *jenv, jobject jcontext, jobject jcb, 71 | pa_context_set_mute_t set_mute, uint32_t idx, int mute, 72 | void (*cb)); 73 | void context_synchronized_volume_call( 74 | JNIEnv *jenv, jobject jcontext, jobject jcb, 75 | pa_context_set_volume_t set_volume, uint32_t idx, jintArray volumes, 76 | void (*cb)); 77 | void context_synchronized_move_call( 78 | JNIEnv *jenv, jobject jcontext, jobject jcb, 79 | pa_context_move_t move_node, uint32_t idx, uint32_t owner_idx, 80 | void (*cb)); 81 | 82 | jni_pa_cb_info_t *new_cbinfo(JNIEnv *jenv, jobject jcontext, jobject jcb, 83 | pa_threaded_mainloop *m, void *to_free); 84 | 85 | pa_context *get_context_ptr(JNIEnv *jenv, jobject jcontext); 86 | pa_threaded_mainloop *get_mainloop_ptr(JNIEnv *jenv, jobject jcontext); 87 | 88 | jni_pa_event_cbs_t *new_event_cbs(); 89 | jni_pa_state_cbs_t *new_state_cbs(); 90 | 91 | jni_pa_event_cbs_t *get_event_cbs_ptr(JNIEnv *jenv, jobject jcontext); 92 | jni_pa_state_cbs_t *get_state_cbs_ptr(JNIEnv *jenv, jobject jcontext); 93 | 94 | void set_event_cbs_ptr(JNIEnv *jenv, jobject jcontext, jni_pa_event_cbs_t *cbs); 95 | void set_state_cbs_ptr(JNIEnv *jenv, jobject jcontext, jni_pa_state_cbs_t *cbs); 96 | 97 | // For dealing with callback global references 98 | jobject get_cb_globalref(JNIEnv *jenv, jobject c, jobject ref); 99 | void del_cb_globalref(JNIEnv *jenv, jobject gref); 100 | 101 | // Actual callback functions passed to pulseaudio. 102 | void call_subscription_run(pa_subscription_event_type_t t, uint32_t idx, jobject runnable); 103 | void context_subscription_cb(pa_context* c, pa_subscription_event_type_t t, 104 | uint32_t idx, void *userdata); 105 | void context_state_cb(pa_context* c, void* userdata); 106 | void info_cb(pa_context* c, const void *i, 107 | int eol, void *userdata); 108 | void success_cb(pa_context* c, int success, void *userdata); 109 | 110 | #endif 111 | 112 | -------------------------------------------------------------------------------- /src/main/jni/jni_core.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #include "jni_core.h" 24 | #include "logging.h" 25 | 26 | JavaVM *g_vm; 27 | jclass jcls_context; 28 | jclass jcls_volume; 29 | jclass jcls_stream; 30 | jclass jcls_channel_map; 31 | 32 | const char *k_context_path = 33 | "com/harrcharr/pulse/PulseContext"; 34 | const char *k_stream_path = 35 | "com/harrcharr/pulse/Stream"; 36 | const char *k_volume_path = 37 | "com/harrcharr/pulse/Volume"; 38 | const char *k_channel_map_path = 39 | "com/harrcharr/pulse/ChannelMap"; 40 | 41 | 42 | jenv_status_t get_jnienv(JNIEnv **env) { 43 | int status = (*g_vm)->GetEnv(g_vm, (void **) env, JNI_VERSION_1_6); 44 | if(status < 0){ 45 | // We're running from a C thread, so attach to Java 46 | status = (*g_vm)->AttachCurrentThread(g_vm, env, NULL); 47 | if(status < 0) { 48 | // Failure of some sort 49 | return JENV_UNSUCCESSFUL; 50 | } 51 | return JENV_ATTACHED; 52 | } 53 | return JENV_UNATTACHED; 54 | } 55 | 56 | void detach_jnienv(jenv_status_t status) { 57 | if (status == JENV_ATTACHED) 58 | (*g_vm)->DetachCurrentThread(g_vm); 59 | } 60 | 61 | void *get_obj_ptr(JNIEnv *env, jobject obj) { 62 | jclass cls = (*env)->GetObjectClass(env, obj); 63 | jfieldID fid = (*env)->GetFieldID(env, cls, "mPointer", "J"); 64 | if (fid == NULL) 65 | return; 66 | 67 | return (*env)->GetLongField(env, obj, fid); 68 | } 69 | 70 | void *get_pointer_field(JNIEnv *env, jobject obj, char *fname) { 71 | jclass cls = (*env)->GetObjectClass(env, obj); 72 | jfieldID fid = (*env)->GetFieldID(env, cls, fname, "J"); 73 | if (fid == NULL) 74 | return; 75 | 76 | return (*env)->GetLongField(env, obj, fid); 77 | } 78 | 79 | long get_long_field(JNIEnv *env, jobject obj, char *fname) { 80 | jclass cls = (*env)->GetObjectClass(env, obj); 81 | jfieldID fid = (*env)->GetFieldID(env, cls, fname, "J"); 82 | if (fid == NULL) 83 | return; 84 | 85 | return (*env)->GetLongField(env, obj, fid); 86 | } 87 | 88 | char get_char_field(JNIEnv *env, jobject obj, char *field) { 89 | jclass cls = (*env)->GetObjectClass(env, obj); 90 | jfieldID fid = (*env)->GetFieldID(env, cls, field, "C"); 91 | if (fid == NULL) 92 | return NULL; 93 | 94 | return (*env)->GetCharField(env, obj, fid); 95 | } 96 | 97 | void init_class_helper(JNIEnv *env, 98 | const char *path, jclass *clsptr) { 99 | jclass cls = (*env)->FindClass(env, path); 100 | (*clsptr) = (*env)->NewGlobalRef(env, cls); 101 | } 102 | 103 | void throw_exception(JNIEnv *env, const char *name, const char *msg) 104 | { 105 | jclass cls = (*env)->FindClass(env, name); 106 | /* if cls is NULL, an exception has already been thrown */ 107 | if (cls != NULL) { 108 | (*env)->ThrowNew(env, cls, msg); 109 | } 110 | /* free the local ref */ 111 | (*env)->DeleteLocalRef(env, cls); 112 | } 113 | 114 | JNIEXPORT jint JNICALL JNI_OnLoad( 115 | JavaVM *jvm, void *reserved) { 116 | (void)reserved; 117 | JNIEnv *env; 118 | 119 | g_vm = jvm; 120 | if ((*jvm)->GetEnv(jvm, (void**) &env, JNI_VERSION_1_6) != JNI_OK) { 121 | return -1; 122 | } 123 | init_class_helper(env, k_context_path, &jcls_context); 124 | init_class_helper(env, k_stream_path, &jcls_stream); 125 | init_class_helper(env, k_volume_path, &jcls_volume); 126 | init_class_helper(env, k_channel_map_path, &jcls_channel_map); 127 | 128 | return JNI_VERSION_1_6; 129 | } 130 | -------------------------------------------------------------------------------- /src/main/jni/jni_core.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #ifndef __PA_JNI_CORE_H 24 | #define __PA_JNI_CORE_H 25 | 26 | #include 27 | #include 28 | 29 | typedef struct jni_pa_cb_info { 30 | jobject cb_runnable; // Object with the run() command 31 | pa_threaded_mainloop *m; // pa_mainloop for signaling 32 | void *to_free; // an object to free on success 33 | } jni_pa_cb_info_t ; 34 | 35 | 36 | typedef enum { 37 | JENV_UNSUCCESSFUL, 38 | JENV_ATTACHED, 39 | JENV_UNATTACHED 40 | } jenv_status_t ; 41 | 42 | /* 43 | * Get the JNIenv, attaching to a thread if necessary. 44 | * @returns: status of the Java environment connection 45 | */ 46 | jenv_status_t get_jnienv(JNIEnv **jenv); 47 | void detach_jnienv(jenv_status_t status); 48 | 49 | void *get_obj_ptr(JNIEnv *env, jobject obj); 50 | long get_long_field(JNIEnv *env, jobject obj, char *fname); 51 | 52 | void throw_exception(JNIEnv *env, const char *name, const char *msg); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/main/jni/jni_util.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #import "jni_core.h" 24 | 25 | JNIEXPORT void JNICALL 26 | Java_com_harrcharr_pulse_JNIUtil_deleteGlobalRef( 27 | JNIEnv *jenv, jclass jcls, jlong gref) { 28 | (*jenv)->DeleteGlobalRef(jenv, (jobject)gref); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/jni/libjson/Android.mk: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Copyright (c) 2012 Harrison Chapman. 3 | # 4 | # This file is part of Reverb. 5 | # 6 | # Reverb is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Reverb is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with Reverb. If not, see . 18 | # 19 | # Contributors: 20 | # Harrison Chapman - initial API and implementation 21 | #------------------------------------------------------------------------------- 22 | # LiveStreams/jni/librtmp/Android.mk 23 | LOCAL_PATH := $(call my-dir) 24 | 25 | include $(CLEAR_VARS) 26 | 27 | LOCAL_MODULE := libjson 28 | 29 | LOCAL_SRC_FILES := lib/libjson.so 30 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include 31 | 32 | include $(PREBUILT_SHARED_LIBRARY) 33 | -------------------------------------------------------------------------------- /src/main/jni/libjson/lib/libjson.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/jni/libjson/lib/libjson.so -------------------------------------------------------------------------------- /src/main/jni/libpulse/Android.mk: -------------------------------------------------------------------------------- 1 | # LiveStreams/jni/librtmp/Android.mk 2 | LOCAL_PATH := $(call my-dir) 3 | 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_MODULE := libpulse 7 | 8 | LOCAL_SRC_FILES := lib/libpulse.so 9 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include 10 | 11 | include $(PREBUILT_SHARED_LIBRARY) 12 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/cdecl.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulsecdeclhfoo 2 | #define foopulsecdeclhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | /** \file 26 | * C++ compatibility support */ 27 | 28 | #ifdef __cplusplus 29 | /** If using C++ this macro enables C mode, otherwise does nothing */ 30 | #define PA_C_DECL_BEGIN extern "C" { 31 | /** If using C++ this macros switches back to C++ mode, otherwise does nothing */ 32 | #define PA_C_DECL_END } 33 | 34 | #else 35 | /** If using C++ this macro enables C mode, otherwise does nothing */ 36 | #define PA_C_DECL_BEGIN 37 | /** If using C++ this macros switches back to C++ mode, otherwise does nothing */ 38 | #define PA_C_DECL_END 39 | 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/client-conf-x11.h: -------------------------------------------------------------------------------- 1 | #ifndef fooclientconfx11hfoo 2 | #define fooclientconfx11hfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include "client-conf.h" 26 | 27 | /* Load client configuration data from the specified X11 display, 28 | * overwriting the current settings in *c */ 29 | int pa_client_conf_from_x11(pa_client_conf *c, const char *display); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/client-conf.h: -------------------------------------------------------------------------------- 1 | #ifndef fooclientconfhfoo 2 | #define fooclientconfhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | 28 | /* A structure containing configuration data for PulseAudio clients. */ 29 | 30 | typedef struct pa_client_conf { 31 | char *daemon_binary, *extra_arguments, *default_sink, *default_source, *default_server, *default_dbus_server, *cookie_file; 32 | pa_bool_t autospawn, disable_shm, auto_connect_localhost, auto_connect_display; 33 | uint8_t cookie[PA_NATIVE_COOKIE_LENGTH]; 34 | pa_bool_t cookie_valid; /* non-zero, when cookie is valid */ 35 | size_t shm_size; 36 | } pa_client_conf; 37 | 38 | /* Create a new configuration data object and reset it to defaults */ 39 | pa_client_conf *pa_client_conf_new(void); 40 | void pa_client_conf_free(pa_client_conf *c); 41 | 42 | /* Load the configuration data from the specified file, overwriting 43 | * the current settings in *c. When the filename is NULL, the 44 | * default client configuration file name is used. */ 45 | int pa_client_conf_load(pa_client_conf *c, const char *filename); 46 | 47 | /* Load the configuration data from the environment of the current 48 | process, overwriting the current settings in *c. */ 49 | int pa_client_conf_env(pa_client_conf *c); 50 | 51 | /* Load cookie data from c->cookie_file into c->cookie */ 52 | int pa_client_conf_load_cookie(pa_client_conf* c); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/error.h: -------------------------------------------------------------------------------- 1 | #ifndef fooerrorhfoo 2 | #define fooerrorhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | 29 | /** \file 30 | * Error management */ 31 | 32 | PA_C_DECL_BEGIN 33 | 34 | /** Return a human readable error message for the specified numeric error code */ 35 | const char* pa_strerror(int error); 36 | 37 | PA_C_DECL_END 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/ext-device-manager.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseextdevicemanagerhfoo 2 | #define foopulseextdevicemanagerhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2008 Lennart Poettering 8 | Copyright 2009 Colin Guthrie 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /** \file 31 | * 32 | * Routines for controlling module-device-manager 33 | */ 34 | 35 | PA_C_DECL_BEGIN 36 | 37 | typedef struct pa_ext_device_manager_role_priority_info { 38 | const char *role; 39 | uint32_t priority; 40 | } pa_ext_device_manager_role_priority_info; 41 | 42 | /** Stores information about one device in the device database that is 43 | * maintained by module-device-manager. \since 0.9.21 */ 44 | typedef struct pa_ext_device_manager_info { 45 | const char *name; /**< Identifier string of the device. A string like "sink:" or similar followed by the name of the device. */ 46 | const char *description; /**< The description of the device when it was last seen, if applicable and saved */ 47 | const char *icon; /**< The icon given to the device */ 48 | uint32_t index; /**< The device index if it is currently available or PA_INVALID_INDEX */ 49 | uint32_t n_role_priorities; /**< How many role priorities do we have? */ 50 | pa_ext_device_manager_role_priority_info *role_priorities; /**< An array of role priority structures or NULL */ 51 | } pa_ext_device_manager_info; 52 | 53 | /** Callback prototype for pa_ext_device_manager_test(). \since 0.9.21 */ 54 | typedef void (*pa_ext_device_manager_test_cb_t)( 55 | pa_context *c, 56 | uint32_t version, 57 | void *userdata); 58 | 59 | /** Test if this extension module is available in the server. \since 0.9.21 */ 60 | pa_operation *pa_ext_device_manager_test( 61 | pa_context *c, 62 | pa_ext_device_manager_test_cb_t cb, 63 | void *userdata); 64 | 65 | /** Callback prototype for pa_ext_device_manager_read(). \since 0.9.21 */ 66 | typedef void (*pa_ext_device_manager_read_cb_t)( 67 | pa_context *c, 68 | const pa_ext_device_manager_info *info, 69 | int eol, 70 | void *userdata); 71 | 72 | /** Read all entries from the device database. \since 0.9.21 */ 73 | pa_operation *pa_ext_device_manager_read( 74 | pa_context *c, 75 | pa_ext_device_manager_read_cb_t cb, 76 | void *userdata); 77 | 78 | /** Sets the description for a device. \since 0.9.21 */ 79 | pa_operation *pa_ext_device_manager_set_device_description( 80 | pa_context *c, 81 | const char* device, 82 | const char* description, 83 | pa_context_success_cb_t cb, 84 | void *userdata); 85 | 86 | /** Delete entries from the device database. \since 0.9.21 */ 87 | pa_operation *pa_ext_device_manager_delete( 88 | pa_context *c, 89 | const char *const s[], 90 | pa_context_success_cb_t cb, 91 | void *userdata); 92 | 93 | /** Enable the role-based device-priority routing mode. \since 0.9.21 */ 94 | pa_operation *pa_ext_device_manager_enable_role_device_priority_routing( 95 | pa_context *c, 96 | int enable, 97 | pa_context_success_cb_t cb, 98 | void *userdata); 99 | 100 | /** Prefer a given device in the priority list. \since 0.9.21 */ 101 | pa_operation *pa_ext_device_manager_reorder_devices_for_role( 102 | pa_context *c, 103 | const char* role, 104 | const char** devices, 105 | pa_context_success_cb_t cb, 106 | void *userdata); 107 | 108 | /** Subscribe to changes in the device database. \since 0.9.21 */ 109 | pa_operation *pa_ext_device_manager_subscribe( 110 | pa_context *c, 111 | int enable, 112 | pa_context_success_cb_t cb, 113 | void *userdata); 114 | 115 | /** Callback prototype for pa_ext_device_manager_set_subscribe_cb(). \since 0.9.21 */ 116 | typedef void (*pa_ext_device_manager_subscribe_cb_t)( 117 | pa_context *c, 118 | void *userdata); 119 | 120 | /** Set the subscription callback that is called when 121 | * pa_ext_device_manager_subscribe() was called. \since 0.9.21 */ 122 | void pa_ext_device_manager_set_subscribe_cb( 123 | pa_context *c, 124 | pa_ext_device_manager_subscribe_cb_t cb, 125 | void *userdata); 126 | 127 | PA_C_DECL_END 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/ext-device-restore.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseextdevicerestorehfoo 2 | #define foopulseextdevicerestorehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2008 Lennart Poettering 8 | Copyright 2011 Colin Guthrie 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /** \file 31 | * 32 | * Routines for controlling module-device-restore 33 | */ 34 | 35 | PA_C_DECL_BEGIN 36 | 37 | /** Stores information about one device in the device database that is 38 | * maintained by module-device-manager. \since 1.0 */ 39 | typedef struct pa_ext_device_restore_info { 40 | pa_device_type_t type; /**< Device type sink or source? */ 41 | uint32_t index; /**< The device index */ 42 | uint8_t n_formats; /**< How many formats do we have? */ 43 | pa_format_info **formats; /**< An array of formats (may be NULL if n_formats == 0) */ 44 | } pa_ext_device_restore_info; 45 | 46 | /** Callback prototype for pa_ext_device_restore_test(). \since 1.0 */ 47 | typedef void (*pa_ext_device_restore_test_cb_t)( 48 | pa_context *c, 49 | uint32_t version, 50 | void *userdata); 51 | 52 | /** Test if this extension module is available in the server. \since 1.0 */ 53 | pa_operation *pa_ext_device_restore_test( 54 | pa_context *c, 55 | pa_ext_device_restore_test_cb_t cb, 56 | void *userdata); 57 | 58 | /** Subscribe to changes in the device database. \since 1.0 */ 59 | pa_operation *pa_ext_device_restore_subscribe( 60 | pa_context *c, 61 | int enable, 62 | pa_context_success_cb_t cb, 63 | void *userdata); 64 | 65 | /** Callback prototype for pa_ext_device_restore_set_subscribe_cb(). \since 1.0 */ 66 | typedef void (*pa_ext_device_restore_subscribe_cb_t)( 67 | pa_context *c, 68 | pa_device_type_t type, 69 | uint32_t idx, 70 | void *userdata); 71 | 72 | /** Set the subscription callback that is called when 73 | * pa_ext_device_restore_subscribe() was called. \since 1.0 */ 74 | void pa_ext_device_restore_set_subscribe_cb( 75 | pa_context *c, 76 | pa_ext_device_restore_subscribe_cb_t cb, 77 | void *userdata); 78 | 79 | /** Callback prototype for pa_ext_device_restore_read_formats(). \since 1.0 */ 80 | typedef void (*pa_ext_device_restore_read_device_formats_cb_t)( 81 | pa_context *c, 82 | const pa_ext_device_restore_info *info, 83 | int eol, 84 | void *userdata); 85 | 86 | /** Read the formats for all present devices from the device database. \since 1.0 */ 87 | pa_operation *pa_ext_device_restore_read_formats_all( 88 | pa_context *c, 89 | pa_ext_device_restore_read_device_formats_cb_t cb, 90 | void *userdata); 91 | 92 | /** Read an entry from the device database. \since 1.0 */ 93 | pa_operation *pa_ext_device_restore_read_formats( 94 | pa_context *c, 95 | pa_device_type_t type, 96 | uint32_t idx, 97 | pa_ext_device_restore_read_device_formats_cb_t cb, 98 | void *userdata); 99 | 100 | /** Read an entry from the device database. \since 1.0 */ 101 | pa_operation *pa_ext_device_restore_save_formats( 102 | pa_context *c, 103 | pa_device_type_t type, 104 | uint32_t idx, 105 | uint8_t n_formats, 106 | pa_format_info **formats, 107 | pa_context_success_cb_t cb, 108 | void *userdata); 109 | 110 | PA_C_DECL_END 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/ext-stream-restore.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseextstreamrestorehfoo 2 | #define foopulseextstreamrestorehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2008 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /** \file 32 | * 33 | * Routines for controlling module-stream-restore 34 | */ 35 | 36 | PA_C_DECL_BEGIN 37 | 38 | /** Stores information about one entry in the stream database that is 39 | * maintained by module-stream-restore. \since 0.9.12 */ 40 | typedef struct pa_ext_stream_restore_info { 41 | const char *name; /**< Identifier string of the stream. A string like "sink-input-by-role:" or similar followed by some arbitrary property value. */ 42 | pa_channel_map channel_map; /**< The channel map for the volume field, if applicable */ 43 | pa_cvolume volume; /**< The volume of the stream when it was seen last, if applicable and saved */ 44 | const char *device; /**< The sink/source of the stream when it was last seen, if applicable and saved */ 45 | int mute; /**< The boolean mute state of the stream when it was last seen, if applicable and saved */ 46 | } pa_ext_stream_restore_info; 47 | 48 | /** Callback prototype for pa_ext_stream_restore_test(). \since 0.9.12 */ 49 | typedef void (*pa_ext_stream_restore_test_cb_t)( 50 | pa_context *c, 51 | uint32_t version, 52 | void *userdata); 53 | 54 | /** Test if this extension module is available in the server. \since 0.9.12 */ 55 | pa_operation *pa_ext_stream_restore_test( 56 | pa_context *c, 57 | pa_ext_stream_restore_test_cb_t cb, 58 | void *userdata); 59 | 60 | /** Callback prototype for pa_ext_stream_restore_read(). \since 0.9.12 */ 61 | typedef void (*pa_ext_stream_restore_read_cb_t)( 62 | pa_context *c, 63 | const pa_ext_stream_restore_info *info, 64 | int eol, 65 | void *userdata); 66 | 67 | /** Read all entries from the stream database. \since 0.9.12 */ 68 | pa_operation *pa_ext_stream_restore_read( 69 | pa_context *c, 70 | pa_ext_stream_restore_read_cb_t cb, 71 | void *userdata); 72 | 73 | /** Store entries in the stream database. \since 0.9.12 */ 74 | pa_operation *pa_ext_stream_restore_write( 75 | pa_context *c, 76 | pa_update_mode_t mode, 77 | const pa_ext_stream_restore_info data[], 78 | unsigned n, 79 | int apply_immediately, 80 | pa_context_success_cb_t cb, 81 | void *userdata); 82 | 83 | /** Delete entries from the stream database. \since 0.9.12 */ 84 | pa_operation *pa_ext_stream_restore_delete( 85 | pa_context *c, 86 | const char *const s[], 87 | pa_context_success_cb_t cb, 88 | void *userdata); 89 | 90 | /** Subscribe to changes in the stream database. \since 0.9.12 */ 91 | pa_operation *pa_ext_stream_restore_subscribe( 92 | pa_context *c, 93 | int enable, 94 | pa_context_success_cb_t cb, 95 | void *userdata); 96 | 97 | /** Callback prototype for pa_ext_stream_restore_set_subscribe_cb(). \since 0.9.12 */ 98 | typedef void (*pa_ext_stream_restore_subscribe_cb_t)( 99 | pa_context *c, 100 | void *userdata); 101 | 102 | /** Set the subscription callback that is called when 103 | * pa_ext_stream_restore_subscribe() was called. \since 0.9.12 */ 104 | void pa_ext_stream_restore_set_subscribe_cb( 105 | pa_context *c, 106 | pa_ext_stream_restore_subscribe_cb_t cb, 107 | void *userdata); 108 | 109 | PA_C_DECL_END 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/fork-detect.h: -------------------------------------------------------------------------------- 1 | #ifndef fooforkdetecthfoo 2 | #define fooforkdetecthfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2009 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | int pa_detect_fork(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/gccmacro.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulsegccmacrohfoo 2 | #define foopulsegccmacrohfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | /** \file 26 | * GCC attribute macros */ 27 | 28 | #ifdef __GNUC__ 29 | #define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b))) 30 | #else 31 | /** If we're in GNU C, use some magic for detecting invalid format strings */ 32 | #define PA_GCC_PRINTF_ATTR(a,b) 33 | #endif 34 | 35 | #if defined(__GNUC__) && (__GNUC__ >= 4) 36 | #define PA_GCC_SENTINEL __attribute__ ((sentinel)) 37 | #else 38 | /** Macro for usage of GCC's sentinel compilation warnings */ 39 | #define PA_GCC_SENTINEL 40 | #endif 41 | 42 | #ifdef __GNUC__ 43 | #define PA_GCC_NORETURN __attribute__((noreturn)) 44 | #else 45 | /** Macro for no-return functions */ 46 | #define PA_GCC_NORETURN 47 | #endif 48 | 49 | #ifdef __GNUC__ 50 | #define PA_GCC_UNUSED __attribute__ ((unused)) 51 | #else 52 | /** Macro for not used function, variable or parameter */ 53 | #define PA_GCC_UNUSED 54 | #endif 55 | 56 | #ifdef __GNUC__ 57 | #define PA_GCC_DESTRUCTOR __attribute__ ((destructor)) 58 | #else 59 | /** Call this function when process terminates */ 60 | #define PA_GCC_DESTRUCTOR 61 | #endif 62 | 63 | #ifndef PA_GCC_PURE 64 | #ifdef __GNUC__ 65 | #define PA_GCC_PURE __attribute__ ((pure)) 66 | #else 67 | /** This function's return value depends only the arguments list and global state **/ 68 | #define PA_GCC_PURE 69 | #endif 70 | #endif 71 | 72 | #ifndef PA_GCC_CONST 73 | #ifdef __GNUC__ 74 | #define PA_GCC_CONST __attribute__ ((const)) 75 | #else 76 | /** This function's return value depends only the arguments list (stricter version of PA_GCC_PURE) **/ 77 | #define PA_GCC_CONST 78 | #endif 79 | #endif 80 | 81 | #ifndef PA_GCC_DEPRECATED 82 | #ifdef __GNUC__ 83 | #define PA_GCC_DEPRECATED __attribute__ ((deprecated)) 84 | #else 85 | /** This function is deprecated **/ 86 | #define PA_GCC_DEPRECATED 87 | #endif 88 | #endif 89 | 90 | #ifndef PA_GCC_PACKED 91 | #ifdef __GNUC__ 92 | #define PA_GCC_PACKED __attribute__ ((packed)) 93 | #else 94 | /** Structure shall be packed in memory **/ 95 | #define PA_GCC_PACKED 96 | #endif 97 | #endif 98 | 99 | #ifndef PA_GCC_ALLOC_SIZE 100 | #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) 101 | #define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x))) 102 | #define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y))) 103 | #else 104 | /** Macro for usage of GCC's alloc_size attribute */ 105 | #define PA_GCC_ALLOC_SIZE(x) 106 | /** Macro for usage of GCC's alloc_size attribute */ 107 | #define PA_GCC_ALLOC_SIZE2(x,y) 108 | #endif 109 | #endif 110 | 111 | #ifndef PA_GCC_MALLOC 112 | #ifdef __GNUC__ 113 | #define PA_GCC_MALLOC __attribute__ ((malloc)) 114 | #else 115 | /** Macro for usage of GCC's malloc attribute */ 116 | #define PA_GCC_MALLOC 117 | #endif 118 | #endif 119 | 120 | #ifndef PA_GCC_WEAKREF 121 | #if defined(__GNUC__) && defined(__ELF__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 1)) || (__GNUC__ > 4)) 122 | /** Macro for usage of GCC's weakref attribute */ 123 | #define PA_GCC_WEAKREF(x) __attribute__((weakref(#x))) 124 | #endif 125 | #endif 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/glib-mainloop.h: -------------------------------------------------------------------------------- 1 | #ifndef fooglibmainloophfoo 2 | #define fooglibmainloophfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | /** \page glib-mainloop GLIB Main Loop Bindings 33 | * 34 | * \section overv_sec Overview 35 | * 36 | * The GLIB main loop bindings are extremely easy to use. All that is 37 | * required is to create a pa_glib_mainloop object using 38 | * pa_glib_mainloop_new(). When the main loop abstraction is needed, it is 39 | * provided by pa_glib_mainloop_get_api(). 40 | * 41 | */ 42 | 43 | /** \file 44 | * GLIB main loop support 45 | * 46 | * See also \subpage glib-mainloop 47 | */ 48 | 49 | PA_C_DECL_BEGIN 50 | 51 | /** An opaque GLIB main loop object */ 52 | typedef struct pa_glib_mainloop pa_glib_mainloop; 53 | 54 | /** Create a new GLIB main loop object for the specified GLIB main 55 | * loop context. Takes an argument c for the 56 | * GMainContext to use. If c is NULL the default context is used. */ 57 | pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c); 58 | 59 | /** Free the GLIB main loop object */ 60 | void pa_glib_mainloop_free(pa_glib_mainloop* g); 61 | 62 | /** Return the abstract main loop API vtable for the GLIB main loop 63 | object. No need to free the API as it is owned by the loop 64 | and is destroyed when the loop is freed. */ 65 | pa_mainloop_api* pa_glib_mainloop_get_api(pa_glib_mainloop *g); 66 | 67 | PA_C_DECL_END 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/mainloop-signal.h: -------------------------------------------------------------------------------- 1 | #ifndef foomainloopsignalhfoo 2 | #define foomainloopsignalhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2008 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | 29 | PA_C_DECL_BEGIN 30 | 31 | /** \file 32 | * UNIX signal support for main loops. In contrast to other 33 | * main loop event sources such as timer and IO events, UNIX signal 34 | * support requires modification of the global process 35 | * environment. Due to this the generic main loop abstraction layer as 36 | * defined in \ref mainloop-api.h doesn't have direct support for UNIX 37 | * signals. However, you may hook signal support into an abstract main loop via the routines defined herein. 38 | */ 39 | 40 | /** An opaque UNIX signal event source object */ 41 | typedef struct pa_signal_event pa_signal_event; 42 | 43 | /** Callback prototype for signal events */ 44 | typedef void (*pa_signal_cb_t) (pa_mainloop_api *api, pa_signal_event*e, int sig, void *userdata); 45 | 46 | /** Destroy callback prototype for signal events */ 47 | typedef void (*pa_signal_destroy_cb_t) (pa_mainloop_api *api, pa_signal_event*e, void *userdata); 48 | 49 | /** Initialize the UNIX signal subsystem and bind it to the specified main loop */ 50 | int pa_signal_init(pa_mainloop_api *api); 51 | 52 | /** Cleanup the signal subsystem */ 53 | void pa_signal_done(void); 54 | 55 | /** Create a new UNIX signal event source object */ 56 | pa_signal_event* pa_signal_new(int sig, pa_signal_cb_t callback, void *userdata); 57 | 58 | /** Free a UNIX signal event source object */ 59 | void pa_signal_free(pa_signal_event *e); 60 | 61 | /** Set a function that is called when the signal event source is destroyed. Use this to free the userdata argument if required */ 62 | void pa_signal_set_destroy(pa_signal_event *e, pa_signal_destroy_cb_t callback); 63 | 64 | PA_C_DECL_END 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/mainloop.h: -------------------------------------------------------------------------------- 1 | #ifndef foomainloophfoo 2 | #define foomainloophfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | 29 | PA_C_DECL_BEGIN 30 | 31 | struct pollfd; 32 | 33 | /** \page mainloop Main Loop 34 | * 35 | * \section overv_sec Overview 36 | * 37 | * The built-in main loop implementation is based on the poll() system call. 38 | * It supports the functions defined in the main loop abstraction and very 39 | * little else. 40 | * 41 | * The main loop is created using pa_mainloop_new() and destroyed using 42 | * pa_mainloop_free(). To get access to the main loop abstraction, 43 | * pa_mainloop_get_api() is used. 44 | * 45 | * \section iter_sec Iteration 46 | * 47 | * The main loop is designed around the concept of iterations. Each iteration 48 | * consists of three steps that repeat during the application's entire 49 | * lifetime: 50 | * 51 | * -# Prepare - Build a list of file descriptors 52 | * that need to be monitored and calculate the next timeout. 53 | * -# Poll - Execute the actual poll() system call. 54 | * -# Dispatch - Dispatch any events that have fired. 55 | * 56 | * When using the main loop, the application can either execute each 57 | * iteration, one at a time, using pa_mainloop_iterate(), or let the library 58 | * iterate automatically using pa_mainloop_run(). 59 | * 60 | * \section thread_sec Threads 61 | * 62 | * The main loop functions are designed to be thread safe, but the objects 63 | * are not. What this means is that multiple main loops can be used, but only 64 | * one object per thread. 65 | * 66 | */ 67 | 68 | /** \file 69 | * 70 | * A minimal main loop implementation based on the C library's poll() 71 | * function. Using the routines defined herein you may create a simple 72 | * main loop supporting the generic main loop abstraction layer as 73 | * defined in \ref mainloop-api.h. This implementation is thread safe 74 | * as long as you access the main loop object from a single thread only. 75 | * 76 | * See also \subpage mainloop 77 | */ 78 | 79 | /** An opaque main loop object */ 80 | typedef struct pa_mainloop pa_mainloop; 81 | 82 | /** Allocate a new main loop object */ 83 | pa_mainloop *pa_mainloop_new(void); 84 | 85 | /** Free a main loop object */ 86 | void pa_mainloop_free(pa_mainloop* m); 87 | 88 | /** Prepare for a single iteration of the main loop. Returns a negative value 89 | on error or exit request. timeout specifies a maximum timeout for the subsequent 90 | poll, or -1 for blocking behaviour. .*/ 91 | int pa_mainloop_prepare(pa_mainloop *m, int timeout); 92 | 93 | /** Execute the previously prepared poll. Returns a negative value on error.*/ 94 | int pa_mainloop_poll(pa_mainloop *m); 95 | 96 | /** Dispatch timeout, io and deferred events from the previously executed poll. Returns 97 | a negative value on error. On success returns the number of source dispatched. */ 98 | int pa_mainloop_dispatch(pa_mainloop *m); 99 | 100 | /** Return the return value as specified with the main loop's quit() routine. */ 101 | int pa_mainloop_get_retval(pa_mainloop *m); 102 | 103 | /** Run a single iteration of the main loop. This is a convenience function 104 | for pa_mainloop_prepare(), pa_mainloop_poll() and pa_mainloop_dispatch(). 105 | Returns a negative value on error or exit request. If block is nonzero, 106 | block for events if none are queued. Optionally return the return value as 107 | specified with the main loop's quit() routine in the integer variable retval points 108 | to. On success returns the number of sources dispatched in this iteration. */ 109 | int pa_mainloop_iterate(pa_mainloop *m, int block, int *retval); 110 | 111 | /** Run unlimited iterations of the main loop object until the main loop's quit() routine is called. */ 112 | int pa_mainloop_run(pa_mainloop *m, int *retval); 113 | 114 | /** Return the abstract main loop abstraction layer vtable for this 115 | main loop. No need to free the API as it is owned by the loop 116 | and is destroyed when the loop is freed. */ 117 | pa_mainloop_api* pa_mainloop_get_api(pa_mainloop*m); 118 | 119 | /** Shutdown the main loop */ 120 | void pa_mainloop_quit(pa_mainloop *m, int r); 121 | 122 | /** Interrupt a running poll (for threaded systems) */ 123 | void pa_mainloop_wakeup(pa_mainloop *m); 124 | 125 | /** Generic prototype of a poll() like function */ 126 | typedef int (*pa_poll_func)(struct pollfd *ufds, unsigned long nfds, int timeout, void*userdata); 127 | 128 | /** Change the poll() implementation */ 129 | void pa_mainloop_set_poll_func(pa_mainloop *m, pa_poll_func poll_func, void *userdata); 130 | 131 | PA_C_DECL_END 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/operation.h: -------------------------------------------------------------------------------- 1 | #ifndef foooperationhfoo 2 | #define foooperationhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | /** \file 30 | * Asynchronous operations */ 31 | 32 | PA_C_DECL_BEGIN 33 | 34 | /** An asynchronous operation object */ 35 | typedef struct pa_operation pa_operation; 36 | 37 | /** Increase the reference count by one */ 38 | pa_operation *pa_operation_ref(pa_operation *o); 39 | 40 | /** Decrease the reference count by one */ 41 | void pa_operation_unref(pa_operation *o); 42 | 43 | /** Cancel the operation. Beware! This will not necessarily cancel the 44 | * execution of the operation on the server side. However it will make 45 | * sure that the callback associated with this operation will not be 46 | * called anymore, effectively disabling the operation from the client 47 | * side's view. */ 48 | void pa_operation_cancel(pa_operation *o); 49 | 50 | /** Return the current status of the operation */ 51 | pa_operation_state_t pa_operation_get_state(pa_operation *o); 52 | 53 | PA_C_DECL_END 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/pulseaudio.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseaudiohfoo 2 | #define foopulseaudiohfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | /** \file 51 | * Include all libpulse header files at once. The following files are 52 | * included: \ref mainloop-api.h, \ref sample.h, \ref def.h, \ref 53 | * context.h, \ref stream.h, \ref introspect.h, \ref subscribe.h, \ref 54 | * scache.h, \ref version.h, \ref error.h, \ref channelmap.h, \ref 55 | * operation.h,\ref volume.h, \ref xmalloc.h, \ref utf8.h, \ref 56 | * thread-mainloop.h, \ref mainloop.h, \ref util.h, \ref proplist.h, 57 | * \ref timeval.h, \ref rtclock.h and \ref mainloop-signal.h at 58 | * once */ 59 | 60 | /** \mainpage 61 | * 62 | * \section intro_sec Introduction 63 | * 64 | * This document describes the client API for the PulseAudio sound 65 | * server. The API comes in two flavours to accommodate different styles 66 | * of applications and different needs in complexity: 67 | * 68 | * \li The complete but somewhat complicated to use asynchronous API 69 | * \li The simplified, easy to use, but limited synchronous API 70 | * 71 | * All strings in PulseAudio are in the UTF-8 encoding, regardless of current 72 | * locale. Some functions will filter invalid sequences from the string, some 73 | * will simply fail. To ensure reliable behaviour, make sure everything you 74 | * pass to the API is already in UTF-8. 75 | 76 | * \section simple_sec Simple API 77 | * 78 | * Use this if you develop your program in synchronous style and just 79 | * need a way to play or record data on the sound server. See 80 | * \subpage simple for more details. 81 | * 82 | * \section async_sec Asynchronous API 83 | * 84 | * Use this if you develop your programs in asynchronous, event loop 85 | * based style or if you want to use the advanced features of the 86 | * PulseAudio API. A guide can be found in \subpage async. 87 | * 88 | * By using the built-in threaded main loop, it is possible to achieve a 89 | * pseudo-synchronous API, which can be useful in synchronous applications 90 | * where the simple API is insufficient. See the \ref async page for 91 | * details. 92 | * 93 | * \section thread_sec Threads 94 | * 95 | * The PulseAudio client libraries are not designed to be directly 96 | * thread-safe. They are however designed to be reentrant and 97 | * threads-aware. 98 | * 99 | * To use the libraries in a threaded environment, you must assure that 100 | * all objects are only used in one thread at a time. Normally, this means 101 | * that all objects belonging to a single context must be accessed from the 102 | * same thread. 103 | * 104 | * The included main loop implementation is also not thread safe. Take care 105 | * to make sure event objects are not manipulated when any other code is 106 | * using the main loop. 107 | * 108 | * \section pkgconfig pkg-config 109 | * 110 | * The PulseAudio libraries provide pkg-config snippets for the different 111 | * modules: 112 | * 113 | * \li libpulse - The asynchronous API and the internal main loop implementation. 114 | * \li libpulse-mainloop-glib - GLIB 2.x main loop bindings. 115 | * \li libpulse-simple - The simple PulseAudio API. 116 | */ 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/rtclock.h: -------------------------------------------------------------------------------- 1 | #ifndef foortclockfoo 2 | #define foortclockfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2009 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as 11 | published by the Free Software Foundation; either version 2.1 of the 12 | License, or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public 20 | License along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | 28 | /** \file 29 | * Monotonic clock utilities. */ 30 | 31 | PA_C_DECL_BEGIN 32 | 33 | /** Return the current monotonic system time in usec, if such a clock 34 | * is available. If it is not available this will return the 35 | * wallclock time instead. \since 0.9.16 */ 36 | pa_usec_t pa_rtclock_now(void); 37 | 38 | PA_C_DECL_END 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/scache.h: -------------------------------------------------------------------------------- 1 | #ifndef fooscachehfoo 2 | #define fooscachehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | /** \page scache Sample Cache 34 | * 35 | * \section overv_sec Overview 36 | * 37 | * The sample cache provides a simple way of overcoming high network latencies 38 | * and reducing bandwidth. Instead of streaming a sound precisely when it 39 | * should be played, it is stored on the server and only the command to start 40 | * playing it needs to be sent. 41 | * 42 | * \section create_sec Creation 43 | * 44 | * To create a sample, the normal stream API is used (see \ref streams). The 45 | * function pa_stream_connect_upload() will make sure the stream is stored as 46 | * a sample on the server. 47 | * 48 | * To complete the upload, pa_stream_finish_upload() is called and the sample 49 | * will receive the same name as the stream. If the upload should be aborted, 50 | * simply call pa_stream_disconnect(). 51 | * 52 | * \section play_sec Playing samples 53 | * 54 | * To play back a sample, simply call pa_context_play_sample(): 55 | * 56 | * \code 57 | * pa_operation *o; 58 | * 59 | * o = pa_context_play_sample(my_context, 60 | * "sample2", // Name of my sample 61 | * NULL, // Use default sink 62 | * PA_VOLUME_NORM, // Full volume 63 | * NULL, // Don't need a callback 64 | * NULL 65 | * ); 66 | * if (o) 67 | * pa_operation_unref(o); 68 | * \endcode 69 | * 70 | * \section rem_sec Removing samples 71 | * 72 | * When a sample is no longer needed, it should be removed on the server to 73 | * save resources. The sample is deleted using pa_context_remove_sample(). 74 | */ 75 | 76 | /** \file 77 | * All sample cache related routines 78 | * 79 | * See also \subpage scache 80 | */ 81 | 82 | PA_C_DECL_BEGIN 83 | 84 | /** Callback prototype for pa_context_play_sample_with_proplist(). The 85 | * idx value is the index of the sink input object, or 86 | * PA_INVALID_INDEX on failure. \since 0.9.11 */ 87 | typedef void (*pa_context_play_sample_cb_t)(pa_context *c, uint32_t idx, void *userdata); 88 | 89 | /** Make this stream a sample upload stream */ 90 | int pa_stream_connect_upload(pa_stream *s, size_t length); 91 | 92 | /** Finish the sample upload, the stream name will become the sample 93 | * name. You cancel a sample upload by issuing 94 | * pa_stream_disconnect() */ 95 | int pa_stream_finish_upload(pa_stream *s); 96 | 97 | /** Remove a sample from the sample cache. Returns an operation object which may be used to cancel the operation while it is running */ 98 | pa_operation* pa_context_remove_sample(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata); 99 | 100 | /** Play a sample from the sample cache to the specified device. If 101 | * the latter is NULL use the default sink. Returns an operation 102 | * object */ 103 | pa_operation* pa_context_play_sample( 104 | pa_context *c /**< Context */, 105 | const char *name /**< Name of the sample to play */, 106 | const char *dev /**< Sink to play this sample on */, 107 | pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ , 108 | pa_context_success_cb_t cb /**< Call this function after successfully starting playback, or NULL */, 109 | void *userdata /**< Userdata to pass to the callback */); 110 | 111 | /** Play a sample from the sample cache to the specified device, 112 | * allowing specification of a property list for the playback 113 | * stream. If the latter is NULL use the default sink. Returns an 114 | * operation object. \since 0.9.11 */ 115 | pa_operation* pa_context_play_sample_with_proplist( 116 | pa_context *c /**< Context */, 117 | const char *name /**< Name of the sample to play */, 118 | const char *dev /**< Sink to play this sample on */, 119 | pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ , 120 | pa_proplist *proplist /**< Property list for this sound. The property list of the cached entry will be merged into this property list */, 121 | pa_context_play_sample_cb_t cb /**< Call this function after successfully starting playback, or NULL */, 122 | void *userdata /**< Userdata to pass to the callback */); 123 | 124 | PA_C_DECL_END 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/subscribe.h: -------------------------------------------------------------------------------- 1 | #ifndef foosubscribehfoo 2 | #define foosubscribehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | /** \page subscribe Event Subscription 34 | * 35 | * \section overv_sec Overview 36 | * 37 | * The application can be notified, asynchronously, whenever the internal 38 | * layout of the server changes. Possible notifications are described in the 39 | * \ref pa_subscription_event_type and \ref pa_subscription_mask 40 | * enumerations. 41 | * 42 | * The application sets the notification mask using pa_context_subscribe() 43 | * and the function that will be called whenever a notification occurs using 44 | * pa_context_set_subscribe_callback(). 45 | * 46 | * The callback will be called with a \ref pa_subscription_event_type_t 47 | * representing the event that caused the callback. Clients can examine what 48 | * object changed using \ref PA_SUBSCRIPTION_EVENT_FACILITY_MASK. The actual 49 | * event type can then be extracted with \ref PA_SUBSCRIPTION_EVENT_TYPE_MASK. 50 | * Please note that the masked values are integers, not flags (so you will 51 | * check the object/event type using a comparison not a binary AND). For 52 | * example, the callback might look something like: 53 | * 54 | @verbatim 55 | void my_subscription_callback(pa_context *c, pa_subscription_event_type_t t, 56 | uint32_t idx, void *userdata) 57 | { 58 | if ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE) { 59 | if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) { 60 | ... a source was added, let's do stuff! ... 61 | } 62 | } 63 | } 64 | @endverbatim 65 | */ 66 | 67 | /** \file 68 | * Daemon introspection event subscription subsystem. 69 | * 70 | * See also \subpage subscribe 71 | */ 72 | 73 | PA_C_DECL_BEGIN 74 | 75 | /** Subscription event callback prototype */ 76 | typedef void (*pa_context_subscribe_cb_t)(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata); 77 | 78 | /** Enable event notification */ 79 | pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_context_success_cb_t cb, void *userdata); 80 | 81 | /** Set the context specific call back function that is called whenever the state of the daemon changes */ 82 | void pa_context_set_subscribe_callback(pa_context *c, pa_context_subscribe_cb_t cb, void *userdata); 83 | 84 | PA_C_DECL_END 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/timeval.h: -------------------------------------------------------------------------------- 1 | #ifndef footimevalhfoo 2 | #define footimevalhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /** \file 32 | * Utility functions for handling timeval calculations */ 33 | 34 | PA_C_DECL_BEGIN 35 | 36 | /** The number of milliseconds in a second */ 37 | #define PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL) 38 | 39 | /** The number of microseconds in a second */ 40 | #define PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL) 41 | 42 | /** The number of nanoseconds in a second */ 43 | #define PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL) 44 | 45 | /** The number of microseconds in a millisecond */ 46 | #define PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL) 47 | 48 | /** The number of nanoseconds in a millisecond */ 49 | #define PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL) 50 | 51 | /** The number of nanoseconds in a microsecond */ 52 | #define PA_NSEC_PER_USEC ((unsigned long long) 1000ULL) 53 | 54 | /** Invalid time in usec. \since 0.9.15 */ 55 | #define PA_USEC_INVALID ((pa_usec_t) -1) 56 | 57 | /** Biggest time in usec. \since 0.9.18 */ 58 | #define PA_USEC_MAX ((pa_usec_t) -2) 59 | 60 | struct timeval; 61 | 62 | /** Return the current wallclock timestamp, just like UNIX gettimeofday(). */ 63 | struct timeval *pa_gettimeofday(struct timeval *tv); 64 | 65 | /** Calculate the difference between the two specified timeval 66 | * structs. */ 67 | pa_usec_t pa_timeval_diff(const struct timeval *a, const struct timeval *b) PA_GCC_PURE; 68 | 69 | /** Compare the two timeval structs and return 0 when equal, negative when a < b, positive otherwise */ 70 | int pa_timeval_cmp(const struct timeval *a, const struct timeval *b) PA_GCC_PURE; 71 | 72 | /** Return the time difference between now and the specified timestamp */ 73 | pa_usec_t pa_timeval_age(const struct timeval *tv); 74 | 75 | /** Add the specified time in microseconds to the specified timeval structure */ 76 | struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v); 77 | 78 | /** Subtract the specified time in microseconds to the specified timeval structure. \since 0.9.11 */ 79 | struct timeval* pa_timeval_sub(struct timeval *tv, pa_usec_t v); 80 | 81 | /** Store the specified usec value in the timeval struct. \since 0.9.7 */ 82 | struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v); 83 | 84 | /** Load the specified tv value and return it in usec. \since 0.9.7 */ 85 | pa_usec_t pa_timeval_load(const struct timeval *tv); 86 | 87 | PA_C_DECL_END 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/utf8.h: -------------------------------------------------------------------------------- 1 | #ifndef fooutf8hfoo 2 | #define fooutf8hfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /** \file 31 | * UTF-8 validation functions 32 | */ 33 | 34 | PA_C_DECL_BEGIN 35 | 36 | /** Test if the specified strings qualifies as valid UTF8. Return the string if so, otherwise NULL */ 37 | char *pa_utf8_valid(const char *str) PA_GCC_PURE; 38 | 39 | /** Test if the specified strings qualifies as valid 7-bit ASCII. Return the string if so, otherwise NULL. \since 0.9.15 */ 40 | char *pa_ascii_valid(const char *str) PA_GCC_PURE; 41 | 42 | /** Filter all invalid UTF8 characters from the specified string, returning a new fully UTF8 valid string. Don't forget to free the returned string with pa_xfree() */ 43 | char *pa_utf8_filter(const char *str); 44 | 45 | /** Filter all invalid ASCII characters from the specified string, returning a new fully ASCII valid string. Don't forget to free the returned string with pa_xfree(). \since 0.9.15 */ 46 | char *pa_ascii_filter(const char *str); 47 | 48 | /** Convert a UTF-8 string to the current locale. Free the string using pa_xfree(). */ 49 | char* pa_utf8_to_locale (const char *str); 50 | 51 | /** Convert a string in the current locale to UTF-8. Free the string using pa_xfree(). */ 52 | char* pa_locale_to_utf8 (const char *str); 53 | 54 | PA_C_DECL_END 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/util.h: -------------------------------------------------------------------------------- 1 | #ifndef fooutilhfoo 2 | #define fooutilhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | /** \file 32 | * Assorted utility functions */ 33 | 34 | PA_C_DECL_BEGIN 35 | 36 | /** Return the current username in the specified string buffer. */ 37 | char *pa_get_user_name(char *s, size_t l); 38 | 39 | /** Return the current hostname in the specified buffer. */ 40 | char *pa_get_host_name(char *s, size_t l); 41 | 42 | /** Return the fully qualified domain name in s */ 43 | char *pa_get_fqdn(char *s, size_t l); 44 | 45 | /** Return the home directory of the current user */ 46 | char *pa_get_home_dir(char *s, size_t l); 47 | 48 | /** Return the binary file name of the current process. This is not 49 | * supported on all architectures, in which case NULL is returned. */ 50 | char *pa_get_binary_name(char *s, size_t l); 51 | 52 | /** Return a pointer to the filename inside a path (which is the last 53 | * component). If passed NULL will return NULL. */ 54 | char *pa_path_get_filename(const char *p); 55 | 56 | /** Wait t milliseconds */ 57 | int pa_msleep(unsigned long t); 58 | 59 | PA_C_DECL_END 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/version.h: -------------------------------------------------------------------------------- 1 | #ifndef fooversionhfoo /*-*-C-*-*/ 2 | #define fooversionhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | /* WARNING: Make sure to edit the real source file version.h.in! */ 27 | 28 | #include 29 | 30 | /** \file 31 | * Define header version */ 32 | 33 | PA_C_DECL_BEGIN 34 | 35 | /** Return the version of the header files. Keep in mind that this is 36 | a macro and not a function, so it is impossible to get the pointer of 37 | it. */ 38 | #define pa_get_headers_version() ("UNKNOWN.UNKNOWN.0") 39 | 40 | /** Return the version of the library the current application is 41 | * linked to. */ 42 | const char* pa_get_library_version(void); 43 | 44 | /** The current API version. Version 6 relates to Polypaudio 45 | * 0.6. Prior versions (i.e. Polypaudio 0.5.1 and older) have 46 | * PA_API_VERSION undefined. Please note that this is only ever 47 | * increased on incompatible API changes! */ 48 | #define PA_API_VERSION 12 49 | 50 | /** The current protocol version. Version 8 relates to Polypaudio 51 | * 0.8/PulseAudio 0.9. */ 52 | #define PA_PROTOCOL_VERSION 25 53 | 54 | /** The major version of PA. \since 0.9.15 */ 55 | #define PA_MAJOR UNKNOWN 56 | 57 | /** The minor version of PA. \since 0.9.15 */ 58 | #define PA_MINOR UNKNOWN 59 | 60 | /** The micro version of PA (will always be 0 from v1.0 onwards). \since 0.9.15 */ 61 | #define PA_MICRO 0 62 | 63 | /** Evaluates to TRUE if the PulseAudio library version is equal or 64 | * newer than the specified. \since 0.9.16 */ 65 | #define PA_CHECK_VERSION(major,minor,micro) \ 66 | ((PA_MAJOR > (major)) || \ 67 | (PA_MAJOR == (major) && PA_MINOR > (minor)) || \ 68 | (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro))) 69 | 70 | PA_C_DECL_END 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/include/pulse/xmalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef foomemoryhfoo 2 | #define foomemoryhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | /** \file 35 | * Memory allocation functions. 36 | */ 37 | 38 | PA_C_DECL_BEGIN 39 | 40 | /** Allocate the specified number of bytes, just like malloc() does. However, in case of OOM, terminate */ 41 | void* pa_xmalloc(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1); 42 | 43 | /** Same as pa_xmalloc(), but initialize allocated memory to 0 */ 44 | void *pa_xmalloc0(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1); 45 | 46 | /** The combination of pa_xmalloc() and realloc() */ 47 | void *pa_xrealloc(void *ptr, size_t size) PA_GCC_ALLOC_SIZE(2); 48 | 49 | /** Free allocated memory */ 50 | void pa_xfree(void *p); 51 | 52 | /** Duplicate the specified string, allocating memory with pa_xmalloc() */ 53 | char *pa_xstrdup(const char *s) PA_GCC_MALLOC; 54 | 55 | /** Duplicate the specified string, but truncate after l characters */ 56 | char *pa_xstrndup(const char *s, size_t l) PA_GCC_MALLOC; 57 | 58 | /** Duplicate the specified memory block */ 59 | void* pa_xmemdup(const void *p, size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(2); 60 | 61 | /** Internal helper for pa_xnew() */ 62 | static void* _pa_xnew_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2); 63 | 64 | static inline void* _pa_xnew_internal(size_t n, size_t k) { 65 | assert(n < INT_MAX/k); 66 | return pa_xmalloc(n*k); 67 | } 68 | 69 | /** Allocate n new structures of the specified type. */ 70 | #define pa_xnew(type, n) ((type*) _pa_xnew_internal((n), sizeof(type))) 71 | 72 | /** Internal helper for pa_xnew0() */ 73 | static void* _pa_xnew0_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2); 74 | 75 | static inline void* _pa_xnew0_internal(size_t n, size_t k) { 76 | assert(n < INT_MAX/k); 77 | return pa_xmalloc0(n*k); 78 | } 79 | 80 | /** Same as pa_xnew() but set the memory to zero */ 81 | #define pa_xnew0(type, n) ((type*) _pa_xnew0_internal((n), sizeof(type))) 82 | 83 | /** Internal helper for pa_xnew0() */ 84 | static void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3); 85 | 86 | static inline void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) { 87 | assert(n < INT_MAX/k); 88 | return pa_xmemdup(p, n*k); 89 | } 90 | 91 | /** Same as pa_xnew() but duplicate the specified data */ 92 | #define pa_xnewdup(type, p, n) ((type*) _pa_xnewdup_internal((p), (n), sizeof(type))) 93 | 94 | /** Internal helper for pa_xrenew() */ 95 | static void* _pa_xrenew_internal(void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3); 96 | 97 | static inline void* _pa_xrenew_internal(void *p, size_t n, size_t k) { 98 | assert(n < INT_MAX/k); 99 | return pa_xrealloc(p, n*k); 100 | } 101 | 102 | /** Reallocate n new structures of the specified type. */ 103 | #define pa_xrenew(type, p, n) ((type*) _pa_xrenew_internal(p, (n), sizeof(type))) 104 | 105 | PA_C_DECL_END 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /src/main/jni/libpulse/lib/libpulse.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/jni/libpulse/lib/libpulse.so -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/Android.mk: -------------------------------------------------------------------------------- 1 | # LiveStreams/jni/librtmp/Android.mk 2 | LOCAL_PATH := $(call my-dir) 3 | 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_MODULE := libpulsecommon 7 | 8 | LOCAL_SRC_FILES := lib/libpulsecommon-UNKNOWN.UNKNOWN.so 9 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include 10 | 11 | include $(PREBUILT_SHARED_LIBRARY) 12 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/cdecl.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulsecdeclhfoo 2 | #define foopulsecdeclhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | /** \file 26 | * C++ compatibility support */ 27 | 28 | #ifdef __cplusplus 29 | /** If using C++ this macro enables C mode, otherwise does nothing */ 30 | #define PA_C_DECL_BEGIN extern "C" { 31 | /** If using C++ this macros switches back to C++ mode, otherwise does nothing */ 32 | #define PA_C_DECL_END } 33 | 34 | #else 35 | /** If using C++ this macro enables C mode, otherwise does nothing */ 36 | #define PA_C_DECL_BEGIN 37 | /** If using C++ this macros switches back to C++ mode, otherwise does nothing */ 38 | #define PA_C_DECL_END 39 | 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/client-conf-x11.h: -------------------------------------------------------------------------------- 1 | #ifndef fooclientconfx11hfoo 2 | #define fooclientconfx11hfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include "client-conf.h" 26 | 27 | /* Load client configuration data from the specified X11 display, 28 | * overwriting the current settings in *c */ 29 | int pa_client_conf_from_x11(pa_client_conf *c, const char *display); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/client-conf.h: -------------------------------------------------------------------------------- 1 | #ifndef fooclientconfhfoo 2 | #define fooclientconfhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | 28 | /* A structure containing configuration data for PulseAudio clients. */ 29 | 30 | typedef struct pa_client_conf { 31 | char *daemon_binary, *extra_arguments, *default_sink, *default_source, *default_server, *default_dbus_server, *cookie_file; 32 | pa_bool_t autospawn, disable_shm, auto_connect_localhost, auto_connect_display; 33 | uint8_t cookie[PA_NATIVE_COOKIE_LENGTH]; 34 | pa_bool_t cookie_valid; /* non-zero, when cookie is valid */ 35 | size_t shm_size; 36 | } pa_client_conf; 37 | 38 | /* Create a new configuration data object and reset it to defaults */ 39 | pa_client_conf *pa_client_conf_new(void); 40 | void pa_client_conf_free(pa_client_conf *c); 41 | 42 | /* Load the configuration data from the specified file, overwriting 43 | * the current settings in *c. When the filename is NULL, the 44 | * default client configuration file name is used. */ 45 | int pa_client_conf_load(pa_client_conf *c, const char *filename); 46 | 47 | /* Load the configuration data from the environment of the current 48 | process, overwriting the current settings in *c. */ 49 | int pa_client_conf_env(pa_client_conf *c); 50 | 51 | /* Load cookie data from c->cookie_file into c->cookie */ 52 | int pa_client_conf_load_cookie(pa_client_conf* c); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/error.h: -------------------------------------------------------------------------------- 1 | #ifndef fooerrorhfoo 2 | #define fooerrorhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | 29 | /** \file 30 | * Error management */ 31 | 32 | PA_C_DECL_BEGIN 33 | 34 | /** Return a human readable error message for the specified numeric error code */ 35 | const char* pa_strerror(int error); 36 | 37 | PA_C_DECL_END 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/ext-device-manager.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseextdevicemanagerhfoo 2 | #define foopulseextdevicemanagerhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2008 Lennart Poettering 8 | Copyright 2009 Colin Guthrie 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /** \file 31 | * 32 | * Routines for controlling module-device-manager 33 | */ 34 | 35 | PA_C_DECL_BEGIN 36 | 37 | typedef struct pa_ext_device_manager_role_priority_info { 38 | const char *role; 39 | uint32_t priority; 40 | } pa_ext_device_manager_role_priority_info; 41 | 42 | /** Stores information about one device in the device database that is 43 | * maintained by module-device-manager. \since 0.9.21 */ 44 | typedef struct pa_ext_device_manager_info { 45 | const char *name; /**< Identifier string of the device. A string like "sink:" or similar followed by the name of the device. */ 46 | const char *description; /**< The description of the device when it was last seen, if applicable and saved */ 47 | const char *icon; /**< The icon given to the device */ 48 | uint32_t index; /**< The device index if it is currently available or PA_INVALID_INDEX */ 49 | uint32_t n_role_priorities; /**< How many role priorities do we have? */ 50 | pa_ext_device_manager_role_priority_info *role_priorities; /**< An array of role priority structures or NULL */ 51 | } pa_ext_device_manager_info; 52 | 53 | /** Callback prototype for pa_ext_device_manager_test(). \since 0.9.21 */ 54 | typedef void (*pa_ext_device_manager_test_cb_t)( 55 | pa_context *c, 56 | uint32_t version, 57 | void *userdata); 58 | 59 | /** Test if this extension module is available in the server. \since 0.9.21 */ 60 | pa_operation *pa_ext_device_manager_test( 61 | pa_context *c, 62 | pa_ext_device_manager_test_cb_t cb, 63 | void *userdata); 64 | 65 | /** Callback prototype for pa_ext_device_manager_read(). \since 0.9.21 */ 66 | typedef void (*pa_ext_device_manager_read_cb_t)( 67 | pa_context *c, 68 | const pa_ext_device_manager_info *info, 69 | int eol, 70 | void *userdata); 71 | 72 | /** Read all entries from the device database. \since 0.9.21 */ 73 | pa_operation *pa_ext_device_manager_read( 74 | pa_context *c, 75 | pa_ext_device_manager_read_cb_t cb, 76 | void *userdata); 77 | 78 | /** Sets the description for a device. \since 0.9.21 */ 79 | pa_operation *pa_ext_device_manager_set_device_description( 80 | pa_context *c, 81 | const char* device, 82 | const char* description, 83 | pa_context_success_cb_t cb, 84 | void *userdata); 85 | 86 | /** Delete entries from the device database. \since 0.9.21 */ 87 | pa_operation *pa_ext_device_manager_delete( 88 | pa_context *c, 89 | const char *const s[], 90 | pa_context_success_cb_t cb, 91 | void *userdata); 92 | 93 | /** Enable the role-based device-priority routing mode. \since 0.9.21 */ 94 | pa_operation *pa_ext_device_manager_enable_role_device_priority_routing( 95 | pa_context *c, 96 | int enable, 97 | pa_context_success_cb_t cb, 98 | void *userdata); 99 | 100 | /** Prefer a given device in the priority list. \since 0.9.21 */ 101 | pa_operation *pa_ext_device_manager_reorder_devices_for_role( 102 | pa_context *c, 103 | const char* role, 104 | const char** devices, 105 | pa_context_success_cb_t cb, 106 | void *userdata); 107 | 108 | /** Subscribe to changes in the device database. \since 0.9.21 */ 109 | pa_operation *pa_ext_device_manager_subscribe( 110 | pa_context *c, 111 | int enable, 112 | pa_context_success_cb_t cb, 113 | void *userdata); 114 | 115 | /** Callback prototype for pa_ext_device_manager_set_subscribe_cb(). \since 0.9.21 */ 116 | typedef void (*pa_ext_device_manager_subscribe_cb_t)( 117 | pa_context *c, 118 | void *userdata); 119 | 120 | /** Set the subscription callback that is called when 121 | * pa_ext_device_manager_subscribe() was called. \since 0.9.21 */ 122 | void pa_ext_device_manager_set_subscribe_cb( 123 | pa_context *c, 124 | pa_ext_device_manager_subscribe_cb_t cb, 125 | void *userdata); 126 | 127 | PA_C_DECL_END 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/ext-device-restore.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseextdevicerestorehfoo 2 | #define foopulseextdevicerestorehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2008 Lennart Poettering 8 | Copyright 2011 Colin Guthrie 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /** \file 31 | * 32 | * Routines for controlling module-device-restore 33 | */ 34 | 35 | PA_C_DECL_BEGIN 36 | 37 | /** Stores information about one device in the device database that is 38 | * maintained by module-device-manager. \since 1.0 */ 39 | typedef struct pa_ext_device_restore_info { 40 | pa_device_type_t type; /**< Device type sink or source? */ 41 | uint32_t index; /**< The device index */ 42 | uint8_t n_formats; /**< How many formats do we have? */ 43 | pa_format_info **formats; /**< An array of formats (may be NULL if n_formats == 0) */ 44 | } pa_ext_device_restore_info; 45 | 46 | /** Callback prototype for pa_ext_device_restore_test(). \since 1.0 */ 47 | typedef void (*pa_ext_device_restore_test_cb_t)( 48 | pa_context *c, 49 | uint32_t version, 50 | void *userdata); 51 | 52 | /** Test if this extension module is available in the server. \since 1.0 */ 53 | pa_operation *pa_ext_device_restore_test( 54 | pa_context *c, 55 | pa_ext_device_restore_test_cb_t cb, 56 | void *userdata); 57 | 58 | /** Subscribe to changes in the device database. \since 1.0 */ 59 | pa_operation *pa_ext_device_restore_subscribe( 60 | pa_context *c, 61 | int enable, 62 | pa_context_success_cb_t cb, 63 | void *userdata); 64 | 65 | /** Callback prototype for pa_ext_device_restore_set_subscribe_cb(). \since 1.0 */ 66 | typedef void (*pa_ext_device_restore_subscribe_cb_t)( 67 | pa_context *c, 68 | pa_device_type_t type, 69 | uint32_t idx, 70 | void *userdata); 71 | 72 | /** Set the subscription callback that is called when 73 | * pa_ext_device_restore_subscribe() was called. \since 1.0 */ 74 | void pa_ext_device_restore_set_subscribe_cb( 75 | pa_context *c, 76 | pa_ext_device_restore_subscribe_cb_t cb, 77 | void *userdata); 78 | 79 | /** Callback prototype for pa_ext_device_restore_read_formats(). \since 1.0 */ 80 | typedef void (*pa_ext_device_restore_read_device_formats_cb_t)( 81 | pa_context *c, 82 | const pa_ext_device_restore_info *info, 83 | int eol, 84 | void *userdata); 85 | 86 | /** Read the formats for all present devices from the device database. \since 1.0 */ 87 | pa_operation *pa_ext_device_restore_read_formats_all( 88 | pa_context *c, 89 | pa_ext_device_restore_read_device_formats_cb_t cb, 90 | void *userdata); 91 | 92 | /** Read an entry from the device database. \since 1.0 */ 93 | pa_operation *pa_ext_device_restore_read_formats( 94 | pa_context *c, 95 | pa_device_type_t type, 96 | uint32_t idx, 97 | pa_ext_device_restore_read_device_formats_cb_t cb, 98 | void *userdata); 99 | 100 | /** Read an entry from the device database. \since 1.0 */ 101 | pa_operation *pa_ext_device_restore_save_formats( 102 | pa_context *c, 103 | pa_device_type_t type, 104 | uint32_t idx, 105 | uint8_t n_formats, 106 | pa_format_info **formats, 107 | pa_context_success_cb_t cb, 108 | void *userdata); 109 | 110 | PA_C_DECL_END 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/ext-stream-restore.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseextstreamrestorehfoo 2 | #define foopulseextstreamrestorehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2008 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /** \file 32 | * 33 | * Routines for controlling module-stream-restore 34 | */ 35 | 36 | PA_C_DECL_BEGIN 37 | 38 | /** Stores information about one entry in the stream database that is 39 | * maintained by module-stream-restore. \since 0.9.12 */ 40 | typedef struct pa_ext_stream_restore_info { 41 | const char *name; /**< Identifier string of the stream. A string like "sink-input-by-role:" or similar followed by some arbitrary property value. */ 42 | pa_channel_map channel_map; /**< The channel map for the volume field, if applicable */ 43 | pa_cvolume volume; /**< The volume of the stream when it was seen last, if applicable and saved */ 44 | const char *device; /**< The sink/source of the stream when it was last seen, if applicable and saved */ 45 | int mute; /**< The boolean mute state of the stream when it was last seen, if applicable and saved */ 46 | } pa_ext_stream_restore_info; 47 | 48 | /** Callback prototype for pa_ext_stream_restore_test(). \since 0.9.12 */ 49 | typedef void (*pa_ext_stream_restore_test_cb_t)( 50 | pa_context *c, 51 | uint32_t version, 52 | void *userdata); 53 | 54 | /** Test if this extension module is available in the server. \since 0.9.12 */ 55 | pa_operation *pa_ext_stream_restore_test( 56 | pa_context *c, 57 | pa_ext_stream_restore_test_cb_t cb, 58 | void *userdata); 59 | 60 | /** Callback prototype for pa_ext_stream_restore_read(). \since 0.9.12 */ 61 | typedef void (*pa_ext_stream_restore_read_cb_t)( 62 | pa_context *c, 63 | const pa_ext_stream_restore_info *info, 64 | int eol, 65 | void *userdata); 66 | 67 | /** Read all entries from the stream database. \since 0.9.12 */ 68 | pa_operation *pa_ext_stream_restore_read( 69 | pa_context *c, 70 | pa_ext_stream_restore_read_cb_t cb, 71 | void *userdata); 72 | 73 | /** Store entries in the stream database. \since 0.9.12 */ 74 | pa_operation *pa_ext_stream_restore_write( 75 | pa_context *c, 76 | pa_update_mode_t mode, 77 | const pa_ext_stream_restore_info data[], 78 | unsigned n, 79 | int apply_immediately, 80 | pa_context_success_cb_t cb, 81 | void *userdata); 82 | 83 | /** Delete entries from the stream database. \since 0.9.12 */ 84 | pa_operation *pa_ext_stream_restore_delete( 85 | pa_context *c, 86 | const char *const s[], 87 | pa_context_success_cb_t cb, 88 | void *userdata); 89 | 90 | /** Subscribe to changes in the stream database. \since 0.9.12 */ 91 | pa_operation *pa_ext_stream_restore_subscribe( 92 | pa_context *c, 93 | int enable, 94 | pa_context_success_cb_t cb, 95 | void *userdata); 96 | 97 | /** Callback prototype for pa_ext_stream_restore_set_subscribe_cb(). \since 0.9.12 */ 98 | typedef void (*pa_ext_stream_restore_subscribe_cb_t)( 99 | pa_context *c, 100 | void *userdata); 101 | 102 | /** Set the subscription callback that is called when 103 | * pa_ext_stream_restore_subscribe() was called. \since 0.9.12 */ 104 | void pa_ext_stream_restore_set_subscribe_cb( 105 | pa_context *c, 106 | pa_ext_stream_restore_subscribe_cb_t cb, 107 | void *userdata); 108 | 109 | PA_C_DECL_END 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/fork-detect.h: -------------------------------------------------------------------------------- 1 | #ifndef fooforkdetecthfoo 2 | #define fooforkdetecthfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2009 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | int pa_detect_fork(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/gccmacro.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulsegccmacrohfoo 2 | #define foopulsegccmacrohfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | /** \file 26 | * GCC attribute macros */ 27 | 28 | #ifdef __GNUC__ 29 | #define PA_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b))) 30 | #else 31 | /** If we're in GNU C, use some magic for detecting invalid format strings */ 32 | #define PA_GCC_PRINTF_ATTR(a,b) 33 | #endif 34 | 35 | #if defined(__GNUC__) && (__GNUC__ >= 4) 36 | #define PA_GCC_SENTINEL __attribute__ ((sentinel)) 37 | #else 38 | /** Macro for usage of GCC's sentinel compilation warnings */ 39 | #define PA_GCC_SENTINEL 40 | #endif 41 | 42 | #ifdef __GNUC__ 43 | #define PA_GCC_NORETURN __attribute__((noreturn)) 44 | #else 45 | /** Macro for no-return functions */ 46 | #define PA_GCC_NORETURN 47 | #endif 48 | 49 | #ifdef __GNUC__ 50 | #define PA_GCC_UNUSED __attribute__ ((unused)) 51 | #else 52 | /** Macro for not used function, variable or parameter */ 53 | #define PA_GCC_UNUSED 54 | #endif 55 | 56 | #ifdef __GNUC__ 57 | #define PA_GCC_DESTRUCTOR __attribute__ ((destructor)) 58 | #else 59 | /** Call this function when process terminates */ 60 | #define PA_GCC_DESTRUCTOR 61 | #endif 62 | 63 | #ifndef PA_GCC_PURE 64 | #ifdef __GNUC__ 65 | #define PA_GCC_PURE __attribute__ ((pure)) 66 | #else 67 | /** This function's return value depends only the arguments list and global state **/ 68 | #define PA_GCC_PURE 69 | #endif 70 | #endif 71 | 72 | #ifndef PA_GCC_CONST 73 | #ifdef __GNUC__ 74 | #define PA_GCC_CONST __attribute__ ((const)) 75 | #else 76 | /** This function's return value depends only the arguments list (stricter version of PA_GCC_PURE) **/ 77 | #define PA_GCC_CONST 78 | #endif 79 | #endif 80 | 81 | #ifndef PA_GCC_DEPRECATED 82 | #ifdef __GNUC__ 83 | #define PA_GCC_DEPRECATED __attribute__ ((deprecated)) 84 | #else 85 | /** This function is deprecated **/ 86 | #define PA_GCC_DEPRECATED 87 | #endif 88 | #endif 89 | 90 | #ifndef PA_GCC_PACKED 91 | #ifdef __GNUC__ 92 | #define PA_GCC_PACKED __attribute__ ((packed)) 93 | #else 94 | /** Structure shall be packed in memory **/ 95 | #define PA_GCC_PACKED 96 | #endif 97 | #endif 98 | 99 | #ifndef PA_GCC_ALLOC_SIZE 100 | #if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) 101 | #define PA_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x))) 102 | #define PA_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y))) 103 | #else 104 | /** Macro for usage of GCC's alloc_size attribute */ 105 | #define PA_GCC_ALLOC_SIZE(x) 106 | /** Macro for usage of GCC's alloc_size attribute */ 107 | #define PA_GCC_ALLOC_SIZE2(x,y) 108 | #endif 109 | #endif 110 | 111 | #ifndef PA_GCC_MALLOC 112 | #ifdef __GNUC__ 113 | #define PA_GCC_MALLOC __attribute__ ((malloc)) 114 | #else 115 | /** Macro for usage of GCC's malloc attribute */ 116 | #define PA_GCC_MALLOC 117 | #endif 118 | #endif 119 | 120 | #ifndef PA_GCC_WEAKREF 121 | #if defined(__GNUC__) && defined(__ELF__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 1)) || (__GNUC__ > 4)) 122 | /** Macro for usage of GCC's weakref attribute */ 123 | #define PA_GCC_WEAKREF(x) __attribute__((weakref(#x))) 124 | #endif 125 | #endif 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/glib-mainloop.h: -------------------------------------------------------------------------------- 1 | #ifndef fooglibmainloophfoo 2 | #define fooglibmainloophfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | /** \page glib-mainloop GLIB Main Loop Bindings 33 | * 34 | * \section overv_sec Overview 35 | * 36 | * The GLIB main loop bindings are extremely easy to use. All that is 37 | * required is to create a pa_glib_mainloop object using 38 | * pa_glib_mainloop_new(). When the main loop abstraction is needed, it is 39 | * provided by pa_glib_mainloop_get_api(). 40 | * 41 | */ 42 | 43 | /** \file 44 | * GLIB main loop support 45 | * 46 | * See also \subpage glib-mainloop 47 | */ 48 | 49 | PA_C_DECL_BEGIN 50 | 51 | /** An opaque GLIB main loop object */ 52 | typedef struct pa_glib_mainloop pa_glib_mainloop; 53 | 54 | /** Create a new GLIB main loop object for the specified GLIB main 55 | * loop context. Takes an argument c for the 56 | * GMainContext to use. If c is NULL the default context is used. */ 57 | pa_glib_mainloop *pa_glib_mainloop_new(GMainContext *c); 58 | 59 | /** Free the GLIB main loop object */ 60 | void pa_glib_mainloop_free(pa_glib_mainloop* g); 61 | 62 | /** Return the abstract main loop API vtable for the GLIB main loop 63 | object. No need to free the API as it is owned by the loop 64 | and is destroyed when the loop is freed. */ 65 | pa_mainloop_api* pa_glib_mainloop_get_api(pa_glib_mainloop *g); 66 | 67 | PA_C_DECL_END 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/mainloop-signal.h: -------------------------------------------------------------------------------- 1 | #ifndef foomainloopsignalhfoo 2 | #define foomainloopsignalhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2008 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | 29 | PA_C_DECL_BEGIN 30 | 31 | /** \file 32 | * UNIX signal support for main loops. In contrast to other 33 | * main loop event sources such as timer and IO events, UNIX signal 34 | * support requires modification of the global process 35 | * environment. Due to this the generic main loop abstraction layer as 36 | * defined in \ref mainloop-api.h doesn't have direct support for UNIX 37 | * signals. However, you may hook signal support into an abstract main loop via the routines defined herein. 38 | */ 39 | 40 | /** An opaque UNIX signal event source object */ 41 | typedef struct pa_signal_event pa_signal_event; 42 | 43 | /** Callback prototype for signal events */ 44 | typedef void (*pa_signal_cb_t) (pa_mainloop_api *api, pa_signal_event*e, int sig, void *userdata); 45 | 46 | /** Destroy callback prototype for signal events */ 47 | typedef void (*pa_signal_destroy_cb_t) (pa_mainloop_api *api, pa_signal_event*e, void *userdata); 48 | 49 | /** Initialize the UNIX signal subsystem and bind it to the specified main loop */ 50 | int pa_signal_init(pa_mainloop_api *api); 51 | 52 | /** Cleanup the signal subsystem */ 53 | void pa_signal_done(void); 54 | 55 | /** Create a new UNIX signal event source object */ 56 | pa_signal_event* pa_signal_new(int sig, pa_signal_cb_t callback, void *userdata); 57 | 58 | /** Free a UNIX signal event source object */ 59 | void pa_signal_free(pa_signal_event *e); 60 | 61 | /** Set a function that is called when the signal event source is destroyed. Use this to free the userdata argument if required */ 62 | void pa_signal_set_destroy(pa_signal_event *e, pa_signal_destroy_cb_t callback); 63 | 64 | PA_C_DECL_END 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/mainloop.h: -------------------------------------------------------------------------------- 1 | #ifndef foomainloophfoo 2 | #define foomainloophfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | 29 | PA_C_DECL_BEGIN 30 | 31 | struct pollfd; 32 | 33 | /** \page mainloop Main Loop 34 | * 35 | * \section overv_sec Overview 36 | * 37 | * The built-in main loop implementation is based on the poll() system call. 38 | * It supports the functions defined in the main loop abstraction and very 39 | * little else. 40 | * 41 | * The main loop is created using pa_mainloop_new() and destroyed using 42 | * pa_mainloop_free(). To get access to the main loop abstraction, 43 | * pa_mainloop_get_api() is used. 44 | * 45 | * \section iter_sec Iteration 46 | * 47 | * The main loop is designed around the concept of iterations. Each iteration 48 | * consists of three steps that repeat during the application's entire 49 | * lifetime: 50 | * 51 | * -# Prepare - Build a list of file descriptors 52 | * that need to be monitored and calculate the next timeout. 53 | * -# Poll - Execute the actual poll() system call. 54 | * -# Dispatch - Dispatch any events that have fired. 55 | * 56 | * When using the main loop, the application can either execute each 57 | * iteration, one at a time, using pa_mainloop_iterate(), or let the library 58 | * iterate automatically using pa_mainloop_run(). 59 | * 60 | * \section thread_sec Threads 61 | * 62 | * The main loop functions are designed to be thread safe, but the objects 63 | * are not. What this means is that multiple main loops can be used, but only 64 | * one object per thread. 65 | * 66 | */ 67 | 68 | /** \file 69 | * 70 | * A minimal main loop implementation based on the C library's poll() 71 | * function. Using the routines defined herein you may create a simple 72 | * main loop supporting the generic main loop abstraction layer as 73 | * defined in \ref mainloop-api.h. This implementation is thread safe 74 | * as long as you access the main loop object from a single thread only. 75 | * 76 | * See also \subpage mainloop 77 | */ 78 | 79 | /** An opaque main loop object */ 80 | typedef struct pa_mainloop pa_mainloop; 81 | 82 | /** Allocate a new main loop object */ 83 | pa_mainloop *pa_mainloop_new(void); 84 | 85 | /** Free a main loop object */ 86 | void pa_mainloop_free(pa_mainloop* m); 87 | 88 | /** Prepare for a single iteration of the main loop. Returns a negative value 89 | on error or exit request. timeout specifies a maximum timeout for the subsequent 90 | poll, or -1 for blocking behaviour. .*/ 91 | int pa_mainloop_prepare(pa_mainloop *m, int timeout); 92 | 93 | /** Execute the previously prepared poll. Returns a negative value on error.*/ 94 | int pa_mainloop_poll(pa_mainloop *m); 95 | 96 | /** Dispatch timeout, io and deferred events from the previously executed poll. Returns 97 | a negative value on error. On success returns the number of source dispatched. */ 98 | int pa_mainloop_dispatch(pa_mainloop *m); 99 | 100 | /** Return the return value as specified with the main loop's quit() routine. */ 101 | int pa_mainloop_get_retval(pa_mainloop *m); 102 | 103 | /** Run a single iteration of the main loop. This is a convenience function 104 | for pa_mainloop_prepare(), pa_mainloop_poll() and pa_mainloop_dispatch(). 105 | Returns a negative value on error or exit request. If block is nonzero, 106 | block for events if none are queued. Optionally return the return value as 107 | specified with the main loop's quit() routine in the integer variable retval points 108 | to. On success returns the number of sources dispatched in this iteration. */ 109 | int pa_mainloop_iterate(pa_mainloop *m, int block, int *retval); 110 | 111 | /** Run unlimited iterations of the main loop object until the main loop's quit() routine is called. */ 112 | int pa_mainloop_run(pa_mainloop *m, int *retval); 113 | 114 | /** Return the abstract main loop abstraction layer vtable for this 115 | main loop. No need to free the API as it is owned by the loop 116 | and is destroyed when the loop is freed. */ 117 | pa_mainloop_api* pa_mainloop_get_api(pa_mainloop*m); 118 | 119 | /** Shutdown the main loop */ 120 | void pa_mainloop_quit(pa_mainloop *m, int r); 121 | 122 | /** Interrupt a running poll (for threaded systems) */ 123 | void pa_mainloop_wakeup(pa_mainloop *m); 124 | 125 | /** Generic prototype of a poll() like function */ 126 | typedef int (*pa_poll_func)(struct pollfd *ufds, unsigned long nfds, int timeout, void*userdata); 127 | 128 | /** Change the poll() implementation */ 129 | void pa_mainloop_set_poll_func(pa_mainloop *m, pa_poll_func poll_func, void *userdata); 130 | 131 | PA_C_DECL_END 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/operation.h: -------------------------------------------------------------------------------- 1 | #ifndef foooperationhfoo 2 | #define foooperationhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | /** \file 30 | * Asynchronous operations */ 31 | 32 | PA_C_DECL_BEGIN 33 | 34 | /** An asynchronous operation object */ 35 | typedef struct pa_operation pa_operation; 36 | 37 | /** Increase the reference count by one */ 38 | pa_operation *pa_operation_ref(pa_operation *o); 39 | 40 | /** Decrease the reference count by one */ 41 | void pa_operation_unref(pa_operation *o); 42 | 43 | /** Cancel the operation. Beware! This will not necessarily cancel the 44 | * execution of the operation on the server side. However it will make 45 | * sure that the callback associated with this operation will not be 46 | * called anymore, effectively disabling the operation from the client 47 | * side's view. */ 48 | void pa_operation_cancel(pa_operation *o); 49 | 50 | /** Return the current status of the operation */ 51 | pa_operation_state_t pa_operation_get_state(pa_operation *o); 52 | 53 | PA_C_DECL_END 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/pulseaudio.h: -------------------------------------------------------------------------------- 1 | #ifndef foopulseaudiohfoo 2 | #define foopulseaudiohfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | /** \file 51 | * Include all libpulse header files at once. The following files are 52 | * included: \ref mainloop-api.h, \ref sample.h, \ref def.h, \ref 53 | * context.h, \ref stream.h, \ref introspect.h, \ref subscribe.h, \ref 54 | * scache.h, \ref version.h, \ref error.h, \ref channelmap.h, \ref 55 | * operation.h,\ref volume.h, \ref xmalloc.h, \ref utf8.h, \ref 56 | * thread-mainloop.h, \ref mainloop.h, \ref util.h, \ref proplist.h, 57 | * \ref timeval.h, \ref rtclock.h and \ref mainloop-signal.h at 58 | * once */ 59 | 60 | /** \mainpage 61 | * 62 | * \section intro_sec Introduction 63 | * 64 | * This document describes the client API for the PulseAudio sound 65 | * server. The API comes in two flavours to accommodate different styles 66 | * of applications and different needs in complexity: 67 | * 68 | * \li The complete but somewhat complicated to use asynchronous API 69 | * \li The simplified, easy to use, but limited synchronous API 70 | * 71 | * All strings in PulseAudio are in the UTF-8 encoding, regardless of current 72 | * locale. Some functions will filter invalid sequences from the string, some 73 | * will simply fail. To ensure reliable behaviour, make sure everything you 74 | * pass to the API is already in UTF-8. 75 | 76 | * \section simple_sec Simple API 77 | * 78 | * Use this if you develop your program in synchronous style and just 79 | * need a way to play or record data on the sound server. See 80 | * \subpage simple for more details. 81 | * 82 | * \section async_sec Asynchronous API 83 | * 84 | * Use this if you develop your programs in asynchronous, event loop 85 | * based style or if you want to use the advanced features of the 86 | * PulseAudio API. A guide can be found in \subpage async. 87 | * 88 | * By using the built-in threaded main loop, it is possible to achieve a 89 | * pseudo-synchronous API, which can be useful in synchronous applications 90 | * where the simple API is insufficient. See the \ref async page for 91 | * details. 92 | * 93 | * \section thread_sec Threads 94 | * 95 | * The PulseAudio client libraries are not designed to be directly 96 | * thread-safe. They are however designed to be reentrant and 97 | * threads-aware. 98 | * 99 | * To use the libraries in a threaded environment, you must assure that 100 | * all objects are only used in one thread at a time. Normally, this means 101 | * that all objects belonging to a single context must be accessed from the 102 | * same thread. 103 | * 104 | * The included main loop implementation is also not thread safe. Take care 105 | * to make sure event objects are not manipulated when any other code is 106 | * using the main loop. 107 | * 108 | * \section pkgconfig pkg-config 109 | * 110 | * The PulseAudio libraries provide pkg-config snippets for the different 111 | * modules: 112 | * 113 | * \li libpulse - The asynchronous API and the internal main loop implementation. 114 | * \li libpulse-mainloop-glib - GLIB 2.x main loop bindings. 115 | * \li libpulse-simple - The simple PulseAudio API. 116 | */ 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/rtclock.h: -------------------------------------------------------------------------------- 1 | #ifndef foortclockfoo 2 | #define foortclockfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2009 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as 11 | published by the Free Software Foundation; either version 2.1 of the 12 | License, or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public 20 | License along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | 28 | /** \file 29 | * Monotonic clock utilities. */ 30 | 31 | PA_C_DECL_BEGIN 32 | 33 | /** Return the current monotonic system time in usec, if such a clock 34 | * is available. If it is not available this will return the 35 | * wallclock time instead. \since 0.9.16 */ 36 | pa_usec_t pa_rtclock_now(void); 37 | 38 | PA_C_DECL_END 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/scache.h: -------------------------------------------------------------------------------- 1 | #ifndef fooscachehfoo 2 | #define fooscachehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | /** \page scache Sample Cache 34 | * 35 | * \section overv_sec Overview 36 | * 37 | * The sample cache provides a simple way of overcoming high network latencies 38 | * and reducing bandwidth. Instead of streaming a sound precisely when it 39 | * should be played, it is stored on the server and only the command to start 40 | * playing it needs to be sent. 41 | * 42 | * \section create_sec Creation 43 | * 44 | * To create a sample, the normal stream API is used (see \ref streams). The 45 | * function pa_stream_connect_upload() will make sure the stream is stored as 46 | * a sample on the server. 47 | * 48 | * To complete the upload, pa_stream_finish_upload() is called and the sample 49 | * will receive the same name as the stream. If the upload should be aborted, 50 | * simply call pa_stream_disconnect(). 51 | * 52 | * \section play_sec Playing samples 53 | * 54 | * To play back a sample, simply call pa_context_play_sample(): 55 | * 56 | * \code 57 | * pa_operation *o; 58 | * 59 | * o = pa_context_play_sample(my_context, 60 | * "sample2", // Name of my sample 61 | * NULL, // Use default sink 62 | * PA_VOLUME_NORM, // Full volume 63 | * NULL, // Don't need a callback 64 | * NULL 65 | * ); 66 | * if (o) 67 | * pa_operation_unref(o); 68 | * \endcode 69 | * 70 | * \section rem_sec Removing samples 71 | * 72 | * When a sample is no longer needed, it should be removed on the server to 73 | * save resources. The sample is deleted using pa_context_remove_sample(). 74 | */ 75 | 76 | /** \file 77 | * All sample cache related routines 78 | * 79 | * See also \subpage scache 80 | */ 81 | 82 | PA_C_DECL_BEGIN 83 | 84 | /** Callback prototype for pa_context_play_sample_with_proplist(). The 85 | * idx value is the index of the sink input object, or 86 | * PA_INVALID_INDEX on failure. \since 0.9.11 */ 87 | typedef void (*pa_context_play_sample_cb_t)(pa_context *c, uint32_t idx, void *userdata); 88 | 89 | /** Make this stream a sample upload stream */ 90 | int pa_stream_connect_upload(pa_stream *s, size_t length); 91 | 92 | /** Finish the sample upload, the stream name will become the sample 93 | * name. You cancel a sample upload by issuing 94 | * pa_stream_disconnect() */ 95 | int pa_stream_finish_upload(pa_stream *s); 96 | 97 | /** Remove a sample from the sample cache. Returns an operation object which may be used to cancel the operation while it is running */ 98 | pa_operation* pa_context_remove_sample(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata); 99 | 100 | /** Play a sample from the sample cache to the specified device. If 101 | * the latter is NULL use the default sink. Returns an operation 102 | * object */ 103 | pa_operation* pa_context_play_sample( 104 | pa_context *c /**< Context */, 105 | const char *name /**< Name of the sample to play */, 106 | const char *dev /**< Sink to play this sample on */, 107 | pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ , 108 | pa_context_success_cb_t cb /**< Call this function after successfully starting playback, or NULL */, 109 | void *userdata /**< Userdata to pass to the callback */); 110 | 111 | /** Play a sample from the sample cache to the specified device, 112 | * allowing specification of a property list for the playback 113 | * stream. If the latter is NULL use the default sink. Returns an 114 | * operation object. \since 0.9.11 */ 115 | pa_operation* pa_context_play_sample_with_proplist( 116 | pa_context *c /**< Context */, 117 | const char *name /**< Name of the sample to play */, 118 | const char *dev /**< Sink to play this sample on */, 119 | pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ , 120 | pa_proplist *proplist /**< Property list for this sound. The property list of the cached entry will be merged into this property list */, 121 | pa_context_play_sample_cb_t cb /**< Call this function after successfully starting playback, or NULL */, 122 | void *userdata /**< Userdata to pass to the callback */); 123 | 124 | PA_C_DECL_END 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/subscribe.h: -------------------------------------------------------------------------------- 1 | #ifndef foosubscribehfoo 2 | #define foosubscribehfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2.1 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | /** \page subscribe Event Subscription 34 | * 35 | * \section overv_sec Overview 36 | * 37 | * The application can be notified, asynchronously, whenever the internal 38 | * layout of the server changes. Possible notifications are described in the 39 | * \ref pa_subscription_event_type and \ref pa_subscription_mask 40 | * enumerations. 41 | * 42 | * The application sets the notification mask using pa_context_subscribe() 43 | * and the function that will be called whenever a notification occurs using 44 | * pa_context_set_subscribe_callback(). 45 | * 46 | * The callback will be called with a \ref pa_subscription_event_type_t 47 | * representing the event that caused the callback. Clients can examine what 48 | * object changed using \ref PA_SUBSCRIPTION_EVENT_FACILITY_MASK. The actual 49 | * event type can then be extracted with \ref PA_SUBSCRIPTION_EVENT_TYPE_MASK. 50 | * Please note that the masked values are integers, not flags (so you will 51 | * check the object/event type using a comparison not a binary AND). For 52 | * example, the callback might look something like: 53 | * 54 | @verbatim 55 | void my_subscription_callback(pa_context *c, pa_subscription_event_type_t t, 56 | uint32_t idx, void *userdata) 57 | { 58 | if ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE) { 59 | if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) { 60 | ... a source was added, let's do stuff! ... 61 | } 62 | } 63 | } 64 | @endverbatim 65 | */ 66 | 67 | /** \file 68 | * Daemon introspection event subscription subsystem. 69 | * 70 | * See also \subpage subscribe 71 | */ 72 | 73 | PA_C_DECL_BEGIN 74 | 75 | /** Subscription event callback prototype */ 76 | typedef void (*pa_context_subscribe_cb_t)(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata); 77 | 78 | /** Enable event notification */ 79 | pa_operation* pa_context_subscribe(pa_context *c, pa_subscription_mask_t m, pa_context_success_cb_t cb, void *userdata); 80 | 81 | /** Set the context specific call back function that is called whenever the state of the daemon changes */ 82 | void pa_context_set_subscribe_callback(pa_context *c, pa_context_subscribe_cb_t cb, void *userdata); 83 | 84 | PA_C_DECL_END 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/timeval.h: -------------------------------------------------------------------------------- 1 | #ifndef footimevalhfoo 2 | #define footimevalhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | /** \file 32 | * Utility functions for handling timeval calculations */ 33 | 34 | PA_C_DECL_BEGIN 35 | 36 | /** The number of milliseconds in a second */ 37 | #define PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL) 38 | 39 | /** The number of microseconds in a second */ 40 | #define PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL) 41 | 42 | /** The number of nanoseconds in a second */ 43 | #define PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL) 44 | 45 | /** The number of microseconds in a millisecond */ 46 | #define PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL) 47 | 48 | /** The number of nanoseconds in a millisecond */ 49 | #define PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL) 50 | 51 | /** The number of nanoseconds in a microsecond */ 52 | #define PA_NSEC_PER_USEC ((unsigned long long) 1000ULL) 53 | 54 | /** Invalid time in usec. \since 0.9.15 */ 55 | #define PA_USEC_INVALID ((pa_usec_t) -1) 56 | 57 | /** Biggest time in usec. \since 0.9.18 */ 58 | #define PA_USEC_MAX ((pa_usec_t) -2) 59 | 60 | struct timeval; 61 | 62 | /** Return the current wallclock timestamp, just like UNIX gettimeofday(). */ 63 | struct timeval *pa_gettimeofday(struct timeval *tv); 64 | 65 | /** Calculate the difference between the two specified timeval 66 | * structs. */ 67 | pa_usec_t pa_timeval_diff(const struct timeval *a, const struct timeval *b) PA_GCC_PURE; 68 | 69 | /** Compare the two timeval structs and return 0 when equal, negative when a < b, positive otherwise */ 70 | int pa_timeval_cmp(const struct timeval *a, const struct timeval *b) PA_GCC_PURE; 71 | 72 | /** Return the time difference between now and the specified timestamp */ 73 | pa_usec_t pa_timeval_age(const struct timeval *tv); 74 | 75 | /** Add the specified time in microseconds to the specified timeval structure */ 76 | struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v); 77 | 78 | /** Subtract the specified time in microseconds to the specified timeval structure. \since 0.9.11 */ 79 | struct timeval* pa_timeval_sub(struct timeval *tv, pa_usec_t v); 80 | 81 | /** Store the specified usec value in the timeval struct. \since 0.9.7 */ 82 | struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v); 83 | 84 | /** Load the specified tv value and return it in usec. \since 0.9.7 */ 85 | pa_usec_t pa_timeval_load(const struct timeval *tv); 86 | 87 | PA_C_DECL_END 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/utf8.h: -------------------------------------------------------------------------------- 1 | #ifndef fooutf8hfoo 2 | #define fooutf8hfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | /** \file 31 | * UTF-8 validation functions 32 | */ 33 | 34 | PA_C_DECL_BEGIN 35 | 36 | /** Test if the specified strings qualifies as valid UTF8. Return the string if so, otherwise NULL */ 37 | char *pa_utf8_valid(const char *str) PA_GCC_PURE; 38 | 39 | /** Test if the specified strings qualifies as valid 7-bit ASCII. Return the string if so, otherwise NULL. \since 0.9.15 */ 40 | char *pa_ascii_valid(const char *str) PA_GCC_PURE; 41 | 42 | /** Filter all invalid UTF8 characters from the specified string, returning a new fully UTF8 valid string. Don't forget to free the returned string with pa_xfree() */ 43 | char *pa_utf8_filter(const char *str); 44 | 45 | /** Filter all invalid ASCII characters from the specified string, returning a new fully ASCII valid string. Don't forget to free the returned string with pa_xfree(). \since 0.9.15 */ 46 | char *pa_ascii_filter(const char *str); 47 | 48 | /** Convert a UTF-8 string to the current locale. Free the string using pa_xfree(). */ 49 | char* pa_utf8_to_locale (const char *str); 50 | 51 | /** Convert a string in the current locale to UTF-8. Free the string using pa_xfree(). */ 52 | char* pa_locale_to_utf8 (const char *str); 53 | 54 | PA_C_DECL_END 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/util.h: -------------------------------------------------------------------------------- 1 | #ifndef fooutilhfoo 2 | #define fooutilhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as 12 | published by the Free Software Foundation; either version 2.1 of the 13 | License, or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public 21 | License along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | /** \file 32 | * Assorted utility functions */ 33 | 34 | PA_C_DECL_BEGIN 35 | 36 | /** Return the current username in the specified string buffer. */ 37 | char *pa_get_user_name(char *s, size_t l); 38 | 39 | /** Return the current hostname in the specified buffer. */ 40 | char *pa_get_host_name(char *s, size_t l); 41 | 42 | /** Return the fully qualified domain name in s */ 43 | char *pa_get_fqdn(char *s, size_t l); 44 | 45 | /** Return the home directory of the current user */ 46 | char *pa_get_home_dir(char *s, size_t l); 47 | 48 | /** Return the binary file name of the current process. This is not 49 | * supported on all architectures, in which case NULL is returned. */ 50 | char *pa_get_binary_name(char *s, size_t l); 51 | 52 | /** Return a pointer to the filename inside a path (which is the last 53 | * component). If passed NULL will return NULL. */ 54 | char *pa_path_get_filename(const char *p); 55 | 56 | /** Wait t milliseconds */ 57 | int pa_msleep(unsigned long t); 58 | 59 | PA_C_DECL_END 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/version.h: -------------------------------------------------------------------------------- 1 | #ifndef fooversionhfoo /*-*-C-*-*/ 2 | #define fooversionhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | Copyright 2006 Pierre Ossman for Cendio AB 9 | 10 | PulseAudio is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU Lesser General Public License as published 12 | by the Free Software Foundation; either version 2 of the License, 13 | or (at your option) any later version. 14 | 15 | PulseAudio is distributed in the hope that it will be useful, but 16 | WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | General Public License for more details. 19 | 20 | You should have received a copy of the GNU Lesser General Public License 21 | along with PulseAudio; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 23 | USA. 24 | ***/ 25 | 26 | /* WARNING: Make sure to edit the real source file version.h.in! */ 27 | 28 | #include 29 | 30 | /** \file 31 | * Define header version */ 32 | 33 | PA_C_DECL_BEGIN 34 | 35 | /** Return the version of the header files. Keep in mind that this is 36 | a macro and not a function, so it is impossible to get the pointer of 37 | it. */ 38 | #define pa_get_headers_version() ("UNKNOWN.UNKNOWN.0") 39 | 40 | /** Return the version of the library the current application is 41 | * linked to. */ 42 | const char* pa_get_library_version(void); 43 | 44 | /** The current API version. Version 6 relates to Polypaudio 45 | * 0.6. Prior versions (i.e. Polypaudio 0.5.1 and older) have 46 | * PA_API_VERSION undefined. Please note that this is only ever 47 | * increased on incompatible API changes! */ 48 | #define PA_API_VERSION 12 49 | 50 | /** The current protocol version. Version 8 relates to Polypaudio 51 | * 0.8/PulseAudio 0.9. */ 52 | #define PA_PROTOCOL_VERSION 25 53 | 54 | /** The major version of PA. \since 0.9.15 */ 55 | #define PA_MAJOR UNKNOWN 56 | 57 | /** The minor version of PA. \since 0.9.15 */ 58 | #define PA_MINOR UNKNOWN 59 | 60 | /** The micro version of PA (will always be 0 from v1.0 onwards). \since 0.9.15 */ 61 | #define PA_MICRO 0 62 | 63 | /** Evaluates to TRUE if the PulseAudio library version is equal or 64 | * newer than the specified. \since 0.9.16 */ 65 | #define PA_CHECK_VERSION(major,minor,micro) \ 66 | ((PA_MAJOR > (major)) || \ 67 | (PA_MAJOR == (major) && PA_MINOR > (minor)) || \ 68 | (PA_MAJOR == (major) && PA_MINOR == (minor) && PA_MICRO >= (micro))) 69 | 70 | PA_C_DECL_END 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/include/pulse/xmalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef foomemoryhfoo 2 | #define foomemoryhfoo 3 | 4 | /*** 5 | This file is part of PulseAudio. 6 | 7 | Copyright 2004-2006 Lennart Poettering 8 | 9 | PulseAudio is free software; you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published 11 | by the Free Software Foundation; either version 2.1 of the License, 12 | or (at your option) any later version. 13 | 14 | PulseAudio is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with PulseAudio; if not, write to the Free Software 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 22 | USA. 23 | ***/ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | /** \file 35 | * Memory allocation functions. 36 | */ 37 | 38 | PA_C_DECL_BEGIN 39 | 40 | /** Allocate the specified number of bytes, just like malloc() does. However, in case of OOM, terminate */ 41 | void* pa_xmalloc(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1); 42 | 43 | /** Same as pa_xmalloc(), but initialize allocated memory to 0 */ 44 | void *pa_xmalloc0(size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(1); 45 | 46 | /** The combination of pa_xmalloc() and realloc() */ 47 | void *pa_xrealloc(void *ptr, size_t size) PA_GCC_ALLOC_SIZE(2); 48 | 49 | /** Free allocated memory */ 50 | void pa_xfree(void *p); 51 | 52 | /** Duplicate the specified string, allocating memory with pa_xmalloc() */ 53 | char *pa_xstrdup(const char *s) PA_GCC_MALLOC; 54 | 55 | /** Duplicate the specified string, but truncate after l characters */ 56 | char *pa_xstrndup(const char *s, size_t l) PA_GCC_MALLOC; 57 | 58 | /** Duplicate the specified memory block */ 59 | void* pa_xmemdup(const void *p, size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(2); 60 | 61 | /** Internal helper for pa_xnew() */ 62 | static void* _pa_xnew_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2); 63 | 64 | static inline void* _pa_xnew_internal(size_t n, size_t k) { 65 | assert(n < INT_MAX/k); 66 | return pa_xmalloc(n*k); 67 | } 68 | 69 | /** Allocate n new structures of the specified type. */ 70 | #define pa_xnew(type, n) ((type*) _pa_xnew_internal((n), sizeof(type))) 71 | 72 | /** Internal helper for pa_xnew0() */ 73 | static void* _pa_xnew0_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2); 74 | 75 | static inline void* _pa_xnew0_internal(size_t n, size_t k) { 76 | assert(n < INT_MAX/k); 77 | return pa_xmalloc0(n*k); 78 | } 79 | 80 | /** Same as pa_xnew() but set the memory to zero */ 81 | #define pa_xnew0(type, n) ((type*) _pa_xnew0_internal((n), sizeof(type))) 82 | 83 | /** Internal helper for pa_xnew0() */ 84 | static void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3); 85 | 86 | static inline void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) { 87 | assert(n < INT_MAX/k); 88 | return pa_xmemdup(p, n*k); 89 | } 90 | 91 | /** Same as pa_xnew() but duplicate the specified data */ 92 | #define pa_xnewdup(type, p, n) ((type*) _pa_xnewdup_internal((p), (n), sizeof(type))) 93 | 94 | /** Internal helper for pa_xrenew() */ 95 | static void* _pa_xrenew_internal(void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3); 96 | 97 | static inline void* _pa_xrenew_internal(void *p, size_t n, size_t k) { 98 | assert(n < INT_MAX/k); 99 | return pa_xrealloc(p, n*k); 100 | } 101 | 102 | /** Reallocate n new structures of the specified type. */ 103 | #define pa_xrenew(type, p, n) ((type*) _pa_xrenew_internal(p, (n), sizeof(type))) 104 | 105 | PA_C_DECL_END 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /src/main/jni/libpulsecommon/lib/libpulsecommon-UNKNOWN.UNKNOWN.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/jni/libpulsecommon/lib/libpulsecommon-UNKNOWN.UNKNOWN.so -------------------------------------------------------------------------------- /src/main/jni/libsndfile/Android.mk: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Copyright (c) 2012 Harrison Chapman. 3 | # 4 | # This file is part of Reverb. 5 | # 6 | # Reverb is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Reverb is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with Reverb. If not, see . 18 | # 19 | # Contributors: 20 | # Harrison Chapman - initial API and implementation 21 | #------------------------------------------------------------------------------- 22 | # LiveStreams/jni/librtmp/Android.mk 23 | LOCAL_PATH := $(call my-dir) 24 | 25 | include $(CLEAR_VARS) 26 | 27 | LOCAL_MODULE := libsndfile 28 | 29 | LOCAL_SRC_FILES := lib/libsndfile.so 30 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include 31 | 32 | include $(PREBUILT_SHARED_LIBRARY) 33 | -------------------------------------------------------------------------------- /src/main/jni/libsndfile/lib/libsndfile.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/jni/libsndfile/lib/libsndfile.so -------------------------------------------------------------------------------- /src/main/jni/logging.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #include "logging.h" 24 | 25 | void dlog(int level, const char *fmt, ...) { 26 | va_list args; 27 | 28 | va_start(args, fmt); 29 | __android_log_vprint(ANDROID_LOG_DEBUG, "libpulse-android", fmt, args); 30 | va_end(args); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/jni/logging.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #ifndef __PA_JNI_LOGGING_H 24 | #define __PA_JNI_LOGGING_H 25 | 26 | #include 27 | #include 28 | 29 | #define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "ReverbJNI", __VA_ARGS__) 30 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG , "ReverbJNI", __VA_ARGS__) 31 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO , "ReverbJNI", __VA_ARGS__) 32 | #define LOGW(...) __android_log_print(ANDROID_LOG_WARN , "ReverbJNI", __VA_ARGS__) 33 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR , "ReverbJNI", __VA_ARGS__) 34 | 35 | void dlog(int level, const char *fmt, ...); 36 | 37 | #endif /* __PA_JNI_LOGGING_H */ 38 | -------------------------------------------------------------------------------- /src/main/jni/mainloop.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/jni/mainloop.c -------------------------------------------------------------------------------- /src/main/jni/pulse-android.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /src/main/jni/pulse.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #ifndef __PA_PULSE_H 24 | #define __PA_PULSE_H 25 | 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/main/jni/pulse_interface.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #include 24 | -------------------------------------------------------------------------------- /src/main/jni/stream.c: -------------------------------------------------------------------------------- 1 | /* 2 | * stream.c 3 | * 4 | * Created on: May 23, 2012 5 | * Author: harrcharr 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | #include "logging.h" 12 | #include "jni_core.h" 13 | 14 | extern jclass jcls_stream; 15 | 16 | jobject get_stream_cb_globalref(JNIEnv *jenv, jobject stream, jobject ref) { 17 | return (*jenv)->NewGlobalRef(jenv, ref); 18 | // LOGD("About to get method id to store our ptr"); 19 | // jclass cls = (*jenv)->GetObjectClass(jenv, ref); 20 | // LOGD("About to get method id to store our ptr 2"); 21 | // jfieldID mid = (*jenv)->GetMethodID(jenv, cls, "storeGlobal", "(Lcom/harrcharr/pulse/PulseContext;J)V"); 22 | // 23 | // if (mid == NULL) 24 | // return; // We're in trouble 25 | // 26 | // (*jenv)->CallVoidMethod(jenv, ref, mid, c, (jlong)global); 27 | // LOGD("Ptr stored"); 28 | // 29 | // return global; 30 | } 31 | 32 | jni_pa_cb_info_t *new_stream_cbinfo(JNIEnv *jenv, jobject jobj, jobject jcb, void *to_free) { 33 | jni_pa_cb_info_t *cbinfo = (jni_pa_cb_info_t*)malloc(sizeof(jni_pa_cb_info_t)); 34 | if (jcb != NULL) { 35 | cbinfo->cb_runnable = get_stream_cb_globalref(jenv, jobj, jcb); 36 | } else { 37 | cbinfo->cb_runnable = NULL; 38 | } 39 | cbinfo->m = NULL; 40 | cbinfo->to_free = to_free; 41 | 42 | return cbinfo; 43 | } 44 | 45 | pa_stream *get_stream_ptr(JNIEnv *jenv, jobject jstream) { 46 | jfieldID fid = (*jenv)->GetFieldID(jenv, jcls_stream, "mPointer", "J"); 47 | if (fid == NULL) 48 | return; 49 | 50 | return (*jenv)->GetLongField(jenv, jstream, fid); 51 | } 52 | 53 | pa_stream_request_cb_t read_cb(pa_stream *stream, size_t nbytes, void* userdata) { 54 | JNIEnv *env; 55 | jclass cls; 56 | jmethodID mid; 57 | jenv_status_t status; 58 | 59 | const void *data; 60 | double v; 61 | 62 | jni_pa_cb_info_t *cbdata = (jni_pa_cb_info_t*)userdata; 63 | 64 | if (cbdata->cb_runnable == NULL) { 65 | return; 66 | } 67 | 68 | if ((status = get_jnienv(&env)) == JENV_UNSUCCESSFUL) { 69 | return; 70 | } 71 | 72 | if (pa_stream_peek(stream, &data, &nbytes) < 0) { 73 | LOGE("Peek error."); 74 | return; 75 | } 76 | 77 | assert(length > 0); 78 | assert(length % sizeof(float) == 0); 79 | 80 | v = ((const float*) data)[nbytes / sizeof(float) -1]; 81 | 82 | pa_stream_drop(stream); 83 | 84 | if (v < 0) 85 | v = 0; 86 | if (v > 1) 87 | v = 1; 88 | 89 | if ((cls = (*env)->GetObjectClass(env, cbdata->cb_runnable))) { 90 | if ((mid = (*env)->GetMethodID(env, cls, "run", "(D)V"))) { 91 | // Run the actual Java callback method 92 | (*env)->CallVoidMethod(env, cbdata->cb_runnable, mid, v); 93 | } 94 | } 95 | 96 | detach_jnienv(status); 97 | } 98 | 99 | JNIEXPORT jlong JNICALL 100 | Java_com_harrcharr_pulse_Stream_JNINewStream( 101 | JNIEnv *jenv, jclass jcls, jlong c, jstring server) { 102 | pa_sample_spec ss; 103 | pa_stream *stream; 104 | 105 | ss.channels = 1; 106 | ss.format = PA_SAMPLE_FLOAT32; 107 | ss.rate = 25; 108 | 109 | pa_proplist *p = pa_proplist_new(); 110 | pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, "Reverb PulseAudio Remote"); 111 | 112 | const char *sname; 113 | sname = (*jenv)->GetStringUTFChars(jenv, server, NULL); 114 | if (sname == NULL) { 115 | return NULL; /* OutOfMemoryError already thrown */ 116 | } 117 | 118 | if (!(stream = pa_stream_new_with_proplist((pa_context*)c, sname, &ss, NULL, p))) { 119 | LOGE("Failed to create new stream"); 120 | stream = NULL; 121 | } 122 | 123 | (*jenv)->ReleaseStringUTFChars(jenv, server, sname); 124 | return stream; 125 | } 126 | 127 | JNIEXPORT void JNICALL 128 | Java_com_harrcharr_pulse_Stream_setMonitorStream( 129 | JNIEnv *jenv, jobject jstream, uint32_t index) { 130 | pa_stream *stream = get_stream_ptr(jenv, jstream); 131 | pa_stream_set_monitor_stream(stream, index); 132 | } 133 | 134 | 135 | JNIEXPORT void JNICALL 136 | Java_com_harrcharr_pulse_Stream_connectRecord( 137 | JNIEnv *jenv, jobject jstream, jstring jdev) { 138 | pa_buffer_attr attr; 139 | pa_stream *stream = get_stream_ptr(jenv, jstream); 140 | 141 | memset(&attr, 0, sizeof(attr)); 142 | attr.fragsize = sizeof(float); 143 | attr.maxlength = (uint32_t) -1; 144 | 145 | const char *dev; 146 | dev = (*jenv)->GetStringUTFChars(jenv, jdev, NULL); 147 | if (dev == NULL) { 148 | return; /* OutOfMemoryError already thrown */ 149 | } 150 | 151 | if (pa_stream_connect_record(stream, dev, &attr, 152 | (pa_stream_flags_t) (PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND| 153 | PA_STREAM_DONT_MOVE|PA_STREAM_PEAK_DETECT| 154 | PA_STREAM_ADJUST_LATENCY)) < 0) { 155 | LOGE("Failed to connect to stream"); 156 | // Throw an exception to java 157 | } 158 | 159 | (*jenv)->ReleaseStringUTFChars(jenv, jdev, dev); 160 | } 161 | 162 | JNIEXPORT void JNICALL 163 | Java_com_harrcharr_pulse_Stream_disconnect( 164 | JNIEnv *jenv, jobject jstream) { 165 | pa_stream *stream = get_stream_ptr(jenv, jstream); 166 | 167 | if (pa_stream_disconnect(stream) < 0) { 168 | LOGE("Failed to disconnect from stream"); 169 | // Throw an exception to java 170 | } 171 | 172 | pa_stream_unref(stream); 173 | } 174 | 175 | JNIEXPORT void JNICALL 176 | Java_com_harrcharr_pulse_Stream_setReadCallback( 177 | JNIEnv *jenv, jobject jstream, jobject jcb) { 178 | pa_stream *stream = get_stream_ptr(jenv, jstream); 179 | 180 | jni_pa_cb_info_t *userdata = new_stream_cbinfo(jenv, jstream, jcb, NULL); 181 | pa_stream_set_read_callback(stream, read_cb, userdata); 182 | } 183 | -------------------------------------------------------------------------------- /src/main/jni/volume.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | *Copyright (c) 2012 Harrison Chapman. 3 | * 4 | *This file is part of Reverb. 5 | * 6 | * Reverb is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Reverb is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Reverb. If not, see . 18 | * 19 | *Contributors: 20 | * Harrison Chapman - initial API and implementation 21 | *******************************************************************************/ 22 | 23 | #include "jni_core.h" 24 | #include "logging.h" 25 | 26 | #include 27 | 28 | JNIEXPORT jint JNICALL 29 | Java_com_harrcharr_pulse_Volume_getMax( 30 | JNIEnv *jenv, jobject jobj) { 31 | pa_cvolume *v = (pa_cvolume*)get_obj_ptr(jenv, jobj); 32 | return pa_cvolume_max(v); 33 | } 34 | 35 | JNIEXPORT void JNICALL 36 | Java_com_harrcharr_pulse_Volume_free( 37 | JNIEnv *jenv, jobject jobj) { 38 | } 39 | -------------------------------------------------------------------------------- /src/main/jni/wrap_struct.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/jni/wrap_struct.c -------------------------------------------------------------------------------- /src/main/jniLibs/armeabi-v7a: -------------------------------------------------------------------------------- 1 | ../libs/armeabi -------------------------------------------------------------------------------- /src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/main/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hchapman/libpulse-android/dfa4d9903f1f70c2ac128ae243079ea97743366b/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Hello World! 5 | Libpulse-android 6 | 7 | --------------------------------------------------------------------------------