Skip to content

Latest commit

 

History

History
86 lines (75 loc) · 2.81 KB

README.md

File metadata and controls

86 lines (75 loc) · 2.81 KB

JSDP : Simple library implementation of Session Description Protocol (SDP)

Simple library implementation of Session Description Protocol RFC 4566 # SDP: Session Description Protocol. This library provides parsing and generating of SDP that can be used with other session protocols such as SIP.

Supported Operated Systems

jSdp currently support building on Linux and MacOs.

Dependencies for Running Locally

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory in the top level directory: mkdir build && cd build
  3. Compile: export CXX=<path_to_g++9> && export CC=<path_to_gcc9> && cmake .. && make
  4. Link generated library to you project

Examples

#include "Sdp.h"
....

auto _sdp = Sdp(R"(v=0
o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5
s=SDP Seminar
i=A Seminar on the session description protocol
u=http://www.example.com/seminars/sdp.pdf
[email protected] (Jane Doe)
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
a=recvonly
m=audio 49170 RTP/AVP 0
m=video 51372 RTP/AVP 99
a=rtpmap:99 h263-1998/90000)"
);

if(_sdp.IsValid())
{
    auto m = MediaDescription();
    m.SetMediaDescription("audio 12345 RTP/AVP 0");
    m.SetMediaTitle("meeting stream");
    m.AddMediaConnectionData("IN IP4 224.2.14.12/127");
    m.SetMediaAttribute("recvonly");
    _sdp.AddMediaSession(m);

    std::cout << _sdp.Serialize() ;
    /*
        v=0
        o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5
        s=SDP Seminar
        i=A Seminar on the session description protocol
        u=http://www.example.com/seminars/sdp.pdf
        [email protected] (Jane Doe)
        c=IN IP4 224.2.17.12/127
        t=2873397496 2873404696
        a=recvonly
        m=audio 49170 RTP/AVP 0
        m=video 51372 RTP/AVP 99
        a=rtpmap:99 h263-1998/90000
        m=audio 12345 RTP/AVP 0
        i=meeting stream
        c=IN IP4 224.2.14.12/127
        a=recvonly
    */
    std::cout << "version is " << _sdp.GetVersion() << "\n";
    //version is 0
    std::cout << "Session name is " << _sdp.GetSessionName() << "\n";
    //Session name is SDP Seminar
    std::cout << "timing is " << _sdp.GetTiming() << "\n";
    //timing is 2873397496 2873404696
}

else
{
    std::cout << "Sdp is invalid , reason := " << _sdp._invalid_reason << "\n";
}