Skip to content

ComputerVisionWorks/libsourcey

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LibSourcey

Homepage: http://sourcey.com/libsourcey
Licence: LGPL

Circle CI

LibSourcey is a collection of open source cross platform C++11 modules and classes that provide developers with a flexible high performance arsenal for the rapid development of realtime messaging and live media streaming applications. Think of it as the power of libuv combined with the ease and readability of the stl (C++ Standard Library).

Features

  • Event-based IO — Core modules are built on top of libuv (the underlying C library that powers Node.js) and use event-based asynchronous IO throughout to maximise performance and minimise concurrency reliance for building mission critical native and server-side apps.

  • Cross platform — The codebase is cross platform and should compile on any system with access to a modern C++11 compiler. We have compiled and used LibSourcey on the following platforms; Linux(gcc), Mac(Xcode, gcc), Windows(msys, vs), Android and iOS.

  • Clean readable code — Modern C++11 design principles have been used for clear, readable code, and simple integration into your existing projects.

  • Networking layer — The networking layer provides TCP, SSL and UDP socket implementations that combine the use of libuv for blazing fast networking, and openssl for security and encryption.

  • Elegant PacketStream API — The PacketStream API allows LibSourcey modules to pipe and process arbitrary data packets through a dynamic delegate chain. This dynamic method of layering packet processors makes it possible to develop complex data processing applications quickly and easily. Check out this writeup on how the PacketSteram API can be used for encoding H.264 on the fly: http://sourcey.com/libsourcey-packetstream-api/

  • Media streaming and encoding — The media library consists of thin wrappers around FFmpeg and OpenCV for media capture, encoding, recording, streaming, analysis and more. The Media API makes full use of the PacketStream API so that encoders, processors and broadcasters can be dynamically added and removed from any media source - a great base for building a media server.

  • Realtime messaging — LibSourcey aims to bridge the gap between desktop, mobile and web by providing performance oriented messaging solutions that work across all platforms.

    • Socket.IO — Socket.IO C++ client that supports the latest protocol revision 4 (>- 1.0). Read more about Socket.IO.
    • Symple — Sourcey's home grown realtime messaging protocol that works over the top of Socket.IO to provide rostering, presence and many other features necessary for building online games and chat applications. [More about Symple](<http://sourcey.com/symple).
  • Web servers and clients — A HTTP stack is included that supports HTTP servers, clients, WebSockets, media streaming, file transfers, and authentication. The HTTP parser is based on the super-fast C code used by nginx.

  • Full ICE stack — The ICE module is a complete implementation of RFC 5245 (Interactive Connectivity Establishment) based on LibSourcey architecture.

Dependencies

  • LibUV (required, >= 1.8.0) Networking, filesystem and cross platform utilities
  • OpenSSL (required, >= 1.0.1g) SSL networking layer and encryption
  • FFmpeg (optional, >= 2.8.3) Media encoding and streaming
  • OpenCV (optional, >= 3.0) Video capture and computer vision algorithms
  • RtAudio (optional, >= 4.1.2) Audio capture
  • WebRTC (optional) Peer-to-peer video conferencing

Installation

LibSourcey uses CMake to build the project files for the compiler on your platform, and should build on any system with a modern C++11 compiler.

Note: To compile LibSourcey with video and streaming capabilities enabled you should install the latest version of both FFmpeg and OpenCV, otherwise modules and features dependent on those libraries will be disabled by default.

Installing on Linux

This guide is written for Ubuntu 14.04, although installation should be fairly portable across most flavours of Linux.

Install Dependencies
sudo apt-get update
sudo apt-get install -y build-essential pkg-config git cmake openssl libssl-dev jackd2 libjack-jackd2-dev

Install LibUV:

cd ~/tmp
git clone https://github.com/libuv/libuv.git
cd libuv
sh autogen.sh
./configure
make
# make check
sudo make install

Install FFmpeg (optional):

FFmpeg is an optional but recommended dependency that's required to make use of LibSourcey's media encoding capabilities.

Please follow the official guide for installing FFmpeg which works out of the box with LibSourcey.

Install OpenCV (optional):

OpenCV is an optional dependecy that's used by LibSourcey for it's video capture, video analysis and computer vision algorithms. Note that if you're compiling FFmpeg yourself (as above), then you should compile OpenCV with WITH_FFMPEG=OFF otherwise conflicting FFmpeg libraries may be installed on your system.

cd ~/tmp
wget https://github.com/Itseez/opencv/archive/3.0.0.zip -O opencv-3.0.0.zip
unzip opencv-3.0.0.zip
cd opencv-3.0.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_FFMPEG=OFF ..
make -j $(nproc)
sudo make install
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
Install LibSourcey
cd ~/tmp
git clone https://github.com/sourcey/libsourcey.git
cd libsourcey
mkdir build
cd build
cmake .. -D CMAKE_BUILD_TYPE=RELEASE # extra cmake commands here...
make
sudo make install

All done!

See here for a complete list of build options, and here for examples.

Installing on Apple (OS X)

This guide is for written for Mac users using Homebrew.

Install Dependencies
# OpenSSL:
brew install openssl
brew link --force openssl

# CMake:
brew install cmake

Please see the Linux instructions for other optional dependencies such as FFmpeg and OpenCV.

Install LibSourcey
cd ~/tmp
git clone https://github.com/sourcey/libsourcey.git
cd libsourcey
mkdir build
cd build
cmake .. -D CMAKE_BUILD_TYPE=RELEASE # extra cmake commands here...
make
sudo make install
Generate Project Files

See linux instructions.

See here for a complete list of build options, and here for examples.

Compile with Xcode

Installing on Windows

Install Dependencies

Install Git
: Install TortoiseGit, a convenient git front-end that integrates right into Windows Explorer. MinGW users can use msysgit.

Install CMake
: CMake generates the LibSourcey project files so you can build on most platforms and compilers. Download CMake

Install OpenSSL
: Download and install the Windows OpenSSL binaries.

Download LibSourcey
: Clone the repository: git clone https://github.com/sourcey/libsourcey.git.
If you haven't got Git for some reason you can download and extract the package archive from Github.

Generate Project Files

Open the CMake GUI and set the project directory to point to the LibSourcey root directory. Execute "Configure" to do the initial configuration, then adjust any options, then press "Configure" again and then press "Generate".

See here for a complete list of build options, and here for examples.

Compile with Visual Studio
  1. Generate solutions using CMake, as described above. Make sure, you chose the proper generator (32-bit or 64-bit)
  2. Launch Visual Studio, locate and open the "libsourcey.sln" solution file in your generated build folder (eg: C:\LibSourcey\build\libsourcey.sln). Select "Debug" configuration, build the solution (Ctrl-Shift-B), and/or select "Release" and build it.
  3. Add {CMAKE_BINARY_DIR}\bin\Release, {CMAKE_BINARY_DIR}\bin\Debug (containing "libscy*.dll" and "libscy*d.dll", respectively) to the system path (My Computer--[Right button click]->Properties->Advanced->Environment Variables->Path)

CMake Build Options

The main build options you will want to configure are as follows:

  • BUILD_SHARED_LIBS: Build shared libraries (.dll/.so) instead of static ones (.lib/.a). default: NOT (WIN32 OR ANDROID OR IOS)
  • BUILD_DEPENDENCIES: Build LibSourcey in source third-party dependencies. default: ON
  • BUILD_MODULES: Build LibSourcey modules. default: ON
  • BUILD_MODULE_xxx: Enable or disable a specific module replacing xxx with the module name.
  • BUILD_APPLICATIONS: Build LibSourcey modules default: ON
  • BUILD_APPLICATION_xxx: Enable or disable a specific applications replacing xxx with the module name.
  • BUILD_MODULE_TESTS: Build module test applications default: ON
  • BUILD_MODULES_xxx: Enable or disable a specific module replacing xxx with the module name.
  • BUILD_MODULE_SAMPLES: Build module sample applications default: ON

If you are using third-party libraries is custom locations then make sure you update the CMake include paths: CMAKE_SYSTEM_PREFIX_PATH and CMAKE_LIBRARY_PATH. The only third-party libraries that may need configuring if you're using them are FFmpeg, OpenCV and WebRTC.

For an exhaustive list of options check the CMakeLists.txt in the main directory.

Examples

There is also plenty of examples available in the samples and tests folder of each module for you to cut your teeth on.

If you're interested in media streaming examples check out the mediaserver sample in the symple module. Remember, you will need to compile LibSourcey with OpenCV and FFmpeg enabled to use it: https://github.com/sourcey/libsourcey/tree/master/src/media/samples/mediaserver

For a redistributable C++ package manager, take a look at pacm, and specifically the pacmconsole application: http://sourcey.com/pacm/

Also, check out pluga, a simple C++ plugin API using LibSourcey: http://sourcey.com/pluga/

Contributing

We welcome PRs, if you make any improvements please feel free to float them back upstream.

  1. Fork LibSourcey on Github
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Issues

For bugs and issues please use the Github issue tracker.

About

C++11 evented IO for realtime video streaming and high performance networking applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 77.6%
  • HTML 16.4%
  • CMake 5.5%
  • Objective-C++ 0.3%
  • JavaScript 0.1%
  • C 0.1%