Commit ec2ddeba authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

RTP announce support

originally based on Marian Durkovic <md@bts.sk>
yet completely rewritten because his patches wouldn't apply to trunk
parent a3d4a196
......@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
......@@ -145,8 +146,11 @@ void Message::AddProgram(Program *p)
((int64_t)tv.tv_sec*1000000 + tv.tv_usec));
string v="v=0\n"; // SDP version
string o="o="+p->GetUser()+ id +" IN IP4 "+
p->GetMachine()+"\n";
string ver="";
stringstream ssin(ver);
ssin << version;
ver = ssin.str();
string o="o="+p->GetUser()+" "+ver+" 1 IN IP4 "+p->GetMachine()+"\n";
string s="s="+p->GetName()+"\n";
string u="u="+p->GetSite()+"\n";
string t;
......@@ -161,7 +165,8 @@ void Message::AddProgram(Program *p)
fprintf(stderr, "Non permanent program not supported ...\n");
fprintf(stderr, "Announcing permanent session instead\n");
}
string m="m=video "+p->GetPort()+" udp 33\n";
string m = "m=video " + p->GetPort() + " "
+ (p->IsRTP() ? "RTP/AVP" : "udp") +" 33\n";
string c;
......@@ -171,9 +176,10 @@ void Message::AddProgram(Program *p)
c="c=IN IP4 "+p->GetAddress()+"/"+p->GetTTL()+"\n";
// TODO ttl type should be specified
string a= "a=type:udp\n";
a+= "a=mux:m2t\n";
a+= "a=packetformat:RAW\n";
string a = p->IsRTP()
? "a=rtpmap:33 MP2T/90000\n"
: "a=type:udp\na=mux:m2t\na=packetformat:RAW\n";
a+= "a=tool:"+(string)PACKAGE_STRING+"\n";
if( p->HasPlGroup() )
......
......@@ -340,6 +340,11 @@ int Config::Parse()
pp->SetHasPlGroup(true);
}
if(strstr(line,"type=") && strstr(line,"rtp") )
{
pp->SetRTP(true);
}
if(strstr(line,"user="))
{
strgeta(line,tline,'=');
......
......@@ -33,7 +33,7 @@ using namespace std;
#include "program.h"
Program::Program() : b_has_pl_group(false)
Program::Program() : b_rtp(false), b_has_pl_group(false)
{
/* Set default Values */
address="";
......@@ -44,7 +44,6 @@ Program::Program() : b_has_pl_group(false)
machine = "localhost";
user = "VideoLAN";
site = "http://www.videolan.org";
return;
}
Program::~Program() {return;}
......@@ -60,6 +59,7 @@ string Program::GetPlGroup(void){return pl_group;}
int Program::GetIPVersion(void){return program_ipversion;};
bool Program::IsPermanent(void){return permanent;}
bool Program::IsRTP(void){return b_rtp;}
bool Program::HasPlGroup(void){return b_has_pl_group;}
void Program::SetName(char* n){name=n;}
......@@ -68,6 +68,7 @@ void Program::SetMachine(char* m){machine=m;}
void Program::SetSite(char* s){site=s;}
void Program::SetAddress(char* a){address=a;}
void Program::SetPlGroup(char *h){pl_group=h;}
void Program::SetRTP(bool b){b_rtp = b;}
void Program::SetHasPlGroup(bool b){b_has_pl_group = b ;}
void Program::SetPort(char* p)
{
......
......@@ -51,8 +51,10 @@ class Program
void SetPlGroup(char *);
void SetHasPlGroup(bool);
void SetIPVersion(char *);
void SetRTP(bool);
bool IsPermanent();
bool IsRTP();
bool HasPlGroup();
private:
......@@ -66,6 +68,7 @@ class Program
string pl_group;
int program_ipversion;
bool permanent;
bool b_rtp;
bool b_has_pl_group;
uint32_t start_time;
uint32_t stop_time;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment