https://github.com/medooze/sdp-cpp
C++ SDP library with ABNF strict parsing
https://github.com/medooze/sdp-cpp
Last synced: about 1 month ago
JSON representation
C++ SDP library with ABNF strict parsing
- Host: GitHub
- URL: https://github.com/medooze/sdp-cpp
- Owner: medooze
- License: mit
- Archived: true
- Created: 2017-12-31T09:23:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-23T16:54:05.000Z (almost 3 years ago)
- Last Synced: 2025-04-04T02:14:35.641Z (about 2 months ago)
- Language: C++
- Homepage:
- Size: 454 KB
- Stars: 42
- Watchers: 3
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sdp++
ABNF C++ SDP library## Compile
Just download source code and:
```
make -j 4 -f Makefile CONF=Release
```The library should be then availeble at `dist/Release//libsdp-cpp.so`
## Usage
Just include the `SessionDescription.h` header from the `include` directory
### Parsing an sdp string
```
#include "SessionDescription.h"void main()
{
try {
auto sdp = sdp::SessionDescription::parse("v=0\r\n"
"o=- 3803220250780278427 2 IN IP4 127.0.0.1\r\n"
"s=-\r\n"
"t=0 0\r\n"
"a=msid-semantic: WMS\r\n"
"m=application 50895 DTLS/SCTP 5000\r\n"
"a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:CoKH4lo5t34SYU0pqeJGwes2gJCEWKFmLUv/q0sN|2^48\r\n"
"a=sctpmap:5000 webrtc-datachannel 1024\r\n");
} catch (const std::exception& e) {
std::cout << e.what();
}
}
```### Createing and serializing an sdp object
```
#include "SessionDescription.h"void main()
{
sdp::SessionDescription sdp;
auto origin = std::make_shared("-", 0, 0, "IN", "IP4", "127.0.0.1");
sdp.setOrigin(origin);
sdp.setSessionName("test");
auto audio = std::make_shared("audio", 9, "UDP/AVP");
sdp.addMedia(audio);std::cout << sdp.toString();
}
```## License
MIT