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 @@ ...@@ -29,6 +29,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string> #include <string>
#include <sstream>
#include <vector> #include <vector>
using namespace std; using namespace std;
...@@ -145,8 +146,11 @@ void Message::AddProgram(Program *p) ...@@ -145,8 +146,11 @@ void Message::AddProgram(Program *p)
((int64_t)tv.tv_sec*1000000 + tv.tv_usec)); ((int64_t)tv.tv_sec*1000000 + tv.tv_usec));
string v="v=0\n"; // SDP version string v="v=0\n"; // SDP version
string o="o="+p->GetUser()+ id +" IN IP4 "+ string ver="";
p->GetMachine()+"\n"; 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 s="s="+p->GetName()+"\n";
string u="u="+p->GetSite()+"\n"; string u="u="+p->GetSite()+"\n";
string t; string t;
...@@ -161,7 +165,8 @@ void Message::AddProgram(Program *p) ...@@ -161,7 +165,8 @@ void Message::AddProgram(Program *p)
fprintf(stderr, "Non permanent program not supported ...\n"); fprintf(stderr, "Non permanent program not supported ...\n");
fprintf(stderr, "Announcing permanent session instead\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; string c;
...@@ -171,9 +176,10 @@ void Message::AddProgram(Program *p) ...@@ -171,9 +176,10 @@ void Message::AddProgram(Program *p)
c="c=IN IP4 "+p->GetAddress()+"/"+p->GetTTL()+"\n"; c="c=IN IP4 "+p->GetAddress()+"/"+p->GetTTL()+"\n";
// TODO ttl type should be specified // TODO ttl type should be specified
string a= "a=type:udp\n"; string a = p->IsRTP()
a+= "a=mux:m2t\n"; ? "a=rtpmap:33 MP2T/90000\n"
a+= "a=packetformat:RAW\n"; : "a=type:udp\na=mux:m2t\na=packetformat:RAW\n";
a+= "a=tool:"+(string)PACKAGE_STRING+"\n"; a+= "a=tool:"+(string)PACKAGE_STRING+"\n";
if( p->HasPlGroup() ) if( p->HasPlGroup() )
......
...@@ -340,6 +340,11 @@ int Config::Parse() ...@@ -340,6 +340,11 @@ int Config::Parse()
pp->SetHasPlGroup(true); pp->SetHasPlGroup(true);
} }
if(strstr(line,"type=") && strstr(line,"rtp") )
{
pp->SetRTP(true);
}
if(strstr(line,"user=")) if(strstr(line,"user="))
{ {
strgeta(line,tline,'='); strgeta(line,tline,'=');
......
...@@ -33,7 +33,7 @@ using namespace std; ...@@ -33,7 +33,7 @@ using namespace std;
#include "program.h" #include "program.h"
Program::Program() : b_has_pl_group(false) Program::Program() : b_rtp(false), b_has_pl_group(false)
{ {
/* Set default Values */ /* Set default Values */
address=""; address="";
...@@ -44,7 +44,6 @@ Program::Program() : b_has_pl_group(false) ...@@ -44,7 +44,6 @@ Program::Program() : b_has_pl_group(false)
machine = "localhost"; machine = "localhost";
user = "VideoLAN"; user = "VideoLAN";
site = "http://www.videolan.org"; site = "http://www.videolan.org";
return;
} }
Program::~Program() {return;} Program::~Program() {return;}
...@@ -60,6 +59,7 @@ string Program::GetPlGroup(void){return pl_group;} ...@@ -60,6 +59,7 @@ string Program::GetPlGroup(void){return pl_group;}
int Program::GetIPVersion(void){return program_ipversion;}; int Program::GetIPVersion(void){return program_ipversion;};
bool Program::IsPermanent(void){return permanent;} bool Program::IsPermanent(void){return permanent;}
bool Program::IsRTP(void){return b_rtp;}
bool Program::HasPlGroup(void){return b_has_pl_group;} bool Program::HasPlGroup(void){return b_has_pl_group;}
void Program::SetName(char* n){name=n;} void Program::SetName(char* n){name=n;}
...@@ -68,6 +68,7 @@ void Program::SetMachine(char* m){machine=m;} ...@@ -68,6 +68,7 @@ void Program::SetMachine(char* m){machine=m;}
void Program::SetSite(char* s){site=s;} void Program::SetSite(char* s){site=s;}
void Program::SetAddress(char* a){address=a;} void Program::SetAddress(char* a){address=a;}
void Program::SetPlGroup(char *h){pl_group=h;} 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::SetHasPlGroup(bool b){b_has_pl_group = b ;}
void Program::SetPort(char* p) void Program::SetPort(char* p)
{ {
......
...@@ -51,8 +51,10 @@ class Program ...@@ -51,8 +51,10 @@ class Program
void SetPlGroup(char *); void SetPlGroup(char *);
void SetHasPlGroup(bool); void SetHasPlGroup(bool);
void SetIPVersion(char *); void SetIPVersion(char *);
void SetRTP(bool);
bool IsPermanent(); bool IsPermanent();
bool IsRTP();
bool HasPlGroup(); bool HasPlGroup();
private: private:
...@@ -66,6 +68,7 @@ class Program ...@@ -66,6 +68,7 @@ class Program
string pl_group; string pl_group;
int program_ipversion; int program_ipversion;
bool permanent; bool permanent;
bool b_rtp;
bool b_has_pl_group; bool b_has_pl_group;
uint32_t start_time; uint32_t start_time;
uint32_t stop_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