This is a library for setting up broadcasts and streaming on Caffeine.tv.
Libcaffeine is licensed under the GNU GPL version 2. See LICENSE.txt for details.
For information on contributing to this project, see CONTRIBUTING.md.
TODO: More Documentation
Minimal Example:
// Callbacks
void started(void *myContext) {
// Start capturing audio & video
}
void failed(void *myContext, caff_Result result) {
// Handle error
// Stop capturing if necessary
}
// Once on startup
caff_initialize("example", "1.0", caff_SeverityDebug, NULL);
// Starting a broadcast
caff_InstanceHandle instance = caff_createInstance();
caff_Result result = caff_signIn(instance, "Myuser", "|\\/|Yp455WYrd", NULL);
if (result != caff_ResultSuccess) return -1;
result = caff_startBroadcast(instance, &myContext, "My title!", caff_RatingNone, NULL, started, failed);
// On your video/audio capture thread(s)
caff_sendVideo(
instance, caff_VideoFormatNv12, pixels, pixelBytes, width, height, caff_TimestampGenerate);
caff_sendAudio(instance, samples, 2);
// When it's over:
caff_endBroadcast(instance);
caff_freeInstance(&instance);
Prereqs:
Steps:
WEBRTC_ROOT_DIR
environment variable to the directory you extracted the files toDepsPath
environment variable to directory you extracted files to. This is needed to get curl mkdir build64
cmake -H. -Bbuild64 -G "Visual Studio 16 2019" -A "x64" -T "ClangCL" -D BUILD_TESTS=OFF -DWEBRTC_ROOT_DIR="%WEBRTC_ROOT_DIR%" -DDepsPath="%DepsPath%\win64\include" -DCMAKE_INSTALL_PREFIX=dist -DCMAKE_C_COMPILER="%VSINSTALLATION%/VC/Tools/Llvm/bin/clang.exe" -DCMAKE_CXX_COMPILER="%VSINSTALLATION%/VC/Tools/Llvm/bin/clang++.exe"
start libcaffeine.sln
Prereqs:
Steps:
WEBRTC_ROOT_DIR
environment variable to the directory you extracted the files tomkdir build
cd build
cmake .. -G Xcode
Note: if the cmake command above fails, it may be due to the XCode commandline tools being selected. To resolve this, reset your XCode selection and retry: sudo xcode-select -r
TODO: Linux
To run the build
brew install p7zip
Change directory to be the libcaffeine directory.
build.bat [OPTION]
Run the automated script in Terminal
sh build.sh [OPTION]
Supported options
Options | Usage |
---|---|
-check | To check project prerequisites |
-build | Builds the project |
-package | Packages libcaffein with 7z |
-buildAndPackage | Builds and packages libcaffeine. |
The packaged output will be in build
directory in Mac and dist directory in Windows.
CMakeFiles/Export/libXX/cmake
folder copy libcaffeineTarget.cmake
, libcaffeineTarget-debug.cmake
, libcaffeineTarget-debug.cmake
into libXX/cmakecaffeine.h
into includelibcaffeine.dylib
into binXXlibcaffeined.a
(static lib) and libcaffeined.dylib
into libXXlibcaffeine.a
(static lib) and libcaffeine.dylib
into libXXCMakeFiles/Export/libXX/cmake
folder copy libcaffeineTarget.cmake
, libcaffeineTarget-debug.cmake
, libcaffeineTarget-relwithdebinfo.cmake
into libXX/cmake