Commit 2c1cc883 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

miniSAPserver 0.2.4 (postrelease committing :)

* Bugfix in RTP payloadformat announce (now uses 33 [MPEG TS] instead of 14 [MP3])
* Added a config option to set the SAP delay
* Added a=tool SDP parameter so miniSAPserver announces can be more easily recognized
* Added a=mux:m2t and a=packetformat:RAW SDP parameters (not required, but some players like these. VBrick player comes to mind.)
* Changed a=plgroup to a=x-plgroup because it is a non standardized parameter (new style will be supported by VLC 0.7.3 and up)
* Updated the manpage
* Clarified that miniSAPserver is only supposed to work for MPEG TS streams.
* Fixed a missing newline in the -h help
parent 241987a8
......@@ -22,3 +22,11 @@ E: zorglub@via.ecp.fr
C: zorglub
D: Core
S: France
N: Derk-Jan Hartman
E: hartman at videolan dot org
C: hartman
D: Delay option
D: Standards compliance fixes
S: Netherlands
-- Changes from version 0.2.3 to version 0.2.4
* Bugfix in RTP payloadformat announce
* Added a=tool parameter so miniSAPserver can be more easily recognized
* Added a config option to set the SAP delay
* Added a=mux:m2t and a=packetformat:RAW parameters
* Changed a=plgroup to a=x-plgroup because it is a non standardized parameters
* Updated the manpage
* Clarified that miniSAPserver is only supposed to work for MPEG TS streams.
-- Changes from version 0.2.2 to version 0.2.3
* Support for VLC's playlist groups
* Support for announcing of HTTP streams
* Bugfix in IPv6 multicast support
* Bugfix in the autoconf/automake system
* Created a manpage
* Support for the SLP announcing protocol
* Bugfixes
* Improved build system
-- Changes from version 0.2.1 to version 0.2.2
......
dnl Autoconf settings for mini-SAP-server
dnl $Id: configure.ac,v 1.3 2003/10/29 00:43:39 nitrox Exp $
AC_INIT(mini-SAP-server,0.2.3-cvs,vlcs-devel@videolan.org)
AM_INIT_AUTOMAKE(mini-SAP-server,0.2.3-cvs)
AC_INIT(miniSAPserver,0.2.4-svn,streaming@videolan.org)
AM_INIT_AUTOMAKE(miniSAPserver,0.2.4-svn)
dnl ****************************
dnl Default settings
......
/*****************************************************************************
* message.cpp : SAP Message class
****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* Copyright (C) 1998-2004 VideoLAN
* $Id: message.cpp,v 1.8 2003/09/23 16:47:15 nitrox Exp $
*
* Authors: Damien Lucas <nitrox@videolan.org>
* Philippe Van Hecke <philippe.vanhecke@belnet.be>
* Derk-Jan Hartman <hartman at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -31,6 +32,7 @@
#include <vector>
using namespace std;
#include "sapserver.h"
#include "program.h"
#include "message.h"
......@@ -126,8 +128,11 @@ void Message::BuildHeader(const char* payload_type)
void Message::AddProgram(Program *p)
{
// TODO Ugly, ... more than one program ??
// RFC 2327 Compliance ?
/* FIXME */
/* Currently only announces a single mediasession
* and only a MPEG2 TS stream announce is supported
* RFC 2327 Compliance ? */
string v="v=0\n"; // SDP version
string o="o="+p->GetUser()+" 3247692199 3247895918 IN IP4 "+
p->GetMachine()+"\n";
......@@ -149,11 +154,11 @@ void Message::AddProgram(Program *p)
if( p->IsHTTP() )
{
m+="http 14\n";
m+="http 33\n";
}
else
{
m+="udp 14\n";
m+="udp 33\n";
}
string c;
......@@ -167,12 +172,20 @@ void Message::AddProgram(Program *p)
if( p->IsHTTP() )
{
a+= "a=type:http\n";
a+= "a=http-path:"+p->GetHTTPPath()+"\n";
a+= "a=type:http\n";
a+= "a=http-path:"+p->GetHTTPPath()+"\n";
}
else
{
a= "a=type:udp\n";
a= "a=type:udp\n";
}
a+= "a=mux:m2t\n";
a+= "a=packetformat:RAW\n";
a+= "a=tool:"+(string)PACKAGE_STRING+"\n";
if( p->HasPlGroup() )
{
a+= "a=x-plgroup:"+p->GetPlGroup()+"\n";
}
sdp += v + o + s + u + t + m + c + a;
......
/*****************************************************************************
* parser.cpp : SAP configuration file parser
****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* Copyright (C) 1998-2004 VideoLAN
* $Id: parser.cpp,v 1.8 2003/09/11 15:33:53 zorglub Exp $
*
* Authors: Arnaud Schauly <gitan@via.ecp.fr>
* Clment Stenac <zorglub@via.ecp.fr>
* Damien Lucas <nitrox@videolan.org>
* Philippe Van Hecke <philippe.vanhecke@belnet.be>
* Derk-Jan Hartman <hartman at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -45,11 +46,12 @@ using namespace std;
Config::Config(string f)
{
file = f;
ttl = DEFAULT_TTL;
scope = DEFAULT_SCOPE;
type = TYPE_SAP;
reverse = false;
file = f;
ttl = DEFAULT_TTL;
scope = DEFAULT_SCOPE;
delay = DEFAULT_DELAY;
type = TYPE_SAP;
reverse = false;
}
Config::~Config()
......@@ -67,6 +69,16 @@ void Config::SetTTL(unsigned int t)
ttl=t;
}
unsigned int Config::GetDelay()
{
return delay;
}
void Config::SetDelay(unsigned int d)
{
delay=d;
}
bool Config::GetDaemonMode(void)
{
return daemon;
......@@ -208,6 +220,13 @@ int Config::Parse()
ttl=atoi(tline);
}
/* Set SAP Delay (delay is a member of config) */
if(strstr(line,"sap_delay="))
{
strgeta(line,tline,'=');
delay=atoi(tline);
}
/* Set SAP IP Version (ipversion is a member of config) */
if(strstr(line,"sap_ipversion="))
{
......@@ -271,6 +290,14 @@ int Config::Parse()
pp->SetHTTPPath(tline);
}
if(strstr(line,"playlist_group="))
{
strgeta(line,tline,'=');
something=1;
pp->SetPlGroup(tline);
pp->SetHasPlGroup(true);
}
if(strstr(line,"user="))
{
strgeta(line,tline,'=');
......
/*****************************************************************************
* parser.h : SAP configuration file parser definition
****************************************************************************
* Copyright (C) 1998-2003 VideoLAN
* Copyright (C) 1998-2004 VideoLAN
* $Id: parser.h,v 1.5 2003/08/10 12:44:18 zorglub Exp $
*
* Authors: Fabrice Ollivier <cif@via.ecp.fr>
......@@ -32,6 +32,8 @@ class Config
int Parse();
unsigned int GetTTL();
void SetTTL(unsigned int);
unsigned int GetDelay();
void SetDelay(unsigned int);
bool GetDaemonMode(void);
void SetDaemonMode(bool);
bool GetReverse(void);
......@@ -48,6 +50,7 @@ class Config
private:
string file;
int ttl;
int delay;
int ipversion;
char * scope;
int type;
......
......@@ -56,11 +56,13 @@ string Program::GetAddress(void){return address;}
string Program::GetPort(void){return port;}
string Program::GetTTL(void){return program_ttl;}
string Program::GetHTTPPath(void){return http_path;}
string Program::GetPlGroup(void){return pl_group;}
int Program::GetIPVersion(void){return program_ipversion;};
bool Program::IsPermanent(void){return permanent;}
bool Program::IsHTTP(void){return b_http;}
bool Program::HasPlGroup(void){return b_has_pl_group;}
void Program::SetHTTP(bool b){b_http = b;}
void Program::SetName(char* n){name=n;}
......@@ -69,6 +71,8 @@ void Program::SetMachine(char* m){machine=m;}
void Program::SetSite(char* s){site=s;}
void Program::SetAddress(char* a){address=a;}
void Program::SetHTTPPath(char *h){http_path=h;}
void Program::SetPlGroup(char *h){pl_group=h;}
void Program::SetHasPlGroup(bool b){b_has_pl_group = b ;}
void Program::SetPort(char* p)
{
int i_port=atoi(p);
......
......@@ -38,6 +38,7 @@ class Program
string GetPort();
string GetTTL();
string GetHTTPPath();
string GetPlGroup();
int GetIPVersion();
/* Functions to set the values */
......@@ -49,11 +50,14 @@ class Program
void SetPort(char *);
void SetTTL(char *);
void SetHTTPPath(char *);
void SetPlGroup(char *);
void SetHasPlGroup(bool);
void SetIPVersion(char *);
void SetHTTP(bool);
bool IsPermanent();
bool IsHTTP();
bool HasPlGroup();
private:
string name;
......@@ -61,12 +65,14 @@ class Program
string machine;
string site;
string address;
string port;
string port;
string program_ttl;
string http_path;
string pl_group;
int program_ipversion;
bool permanent;
bool b_http;
bool b_has_pl_group;
uint32_t start_time;
uint32_t stop_time;
/* TODO support for periodical programs */
......
# sap.cfg - Configuration file of the mini SAP server
# Global miniSAPserver options
[global]
sap_ttl=255 # TTL (Time To Live) of the SAP announces. You should put 255
sap_ipversion=4 # Version of IP Protocol to use: 4 for IPv4, 6 for IPv6
ipv6_scope=8
# TTL (Time To Live) of the SAP announces. You should put 255
sap_ttl=255
# Version of IP Protocol to use: 4 for IPv4, 6 for IPv6
sap_ipversion=4
# Number of seconds between announces. 5 is default. Internet announces better use 30.
sap_delay=5
# This is the "scope" of the IPv6 announce (if it exists)
# it is between 1 and F. For link-local multicast, use 2
ipv6_scope=8
# Then you should have one "[program]" section per program announced
# IPv4 exemple
# Note that only announces for MPEG2 TS streams are supported.
# Though announces of other types of streams may work for some clients,
# they will not be compliant to the announce spec. and are not at all
# guaranteed to work.
# IPv4 example
[program]
name=Tele V1 # Name of the program (as will show up in the VLC playlist)
user=videolan # Name of the streaming entity
machine=vlcs.via.ecp.fr # Name of the streaming machine
site=www.videolan.org # Site of the streaming entity
address=239.255.12.42 # Multicast IP address of the program
port=1234 # UDP Port
program_ttl=32 # TTL for this program (15 is the default value)
program_ipversion=4 # 4 or 6 (4 is the default value)
# IPv6 exemple
# Name of the program (as it will show up in the VLC playlist)
name=TV1
# Name of the streaming entity (organisation)
user=videolan
# DNS or IP of the machine on which you run the stream
machine=streamer.domain.org
# Website of the streaming entity (organisation)
site=http://www.domain.org
# Multicast IP address of the program
address=239.255.12.42
# UDP Port
port=1234
# TTL for this program (15 is the default value)
program_ttl=32
# IP protocol stack in use. 4 or 6 (4 is the default value)
program_ipversion=4
# The name of the playlistgroup your announce will be part of in the VLC playlist
playlist_group=organisationTV
# IPv6 example
[program]
name=TV2
user=videolan
machine=vlcs.via.ecp.fr
site=www.videolan.org
machine=streamer.domain.org
site=http://www.domain.org
program_ttl=12
program_ipversion=6
address=ff08::1
port=1234
# HTTP exemple (not yet implemented)
# HTTP example
[program]
name=TV3
user=videolan
machine=vlcs.via.ecp.fr
site=www.videolan.org
program_ttl=12
program_ipversion=4
machine=streamer.domain.org
site=http://www.videolan.org
type=http
address=echo.via.ecp.fr
port=80
path=/~zorglub/2k3.avi
address=streamer.videolan.org
path=/mystream.mpeg # Path to the stream (here, it would be http://streamer.videolan.org:80/mystream.mpeg)
.TH SAPSERVER 1 "August 9, 2003" "Clément Stenac" "VideoLAN"
.TH SAPSERVER 1 "July 21 2004" "Clément Stenac" "VideoLAN"
.SH NAME
sapserver - SAP and SLP announcment for the VLC Media Player
.SH SYNOPSIS
......@@ -7,7 +7,8 @@ sapserver - SAP and SLP announcment for the VLC Media Player
.PP
.SH DESCRIPTION
.B sapserver
announces,using the SAP/SDP or the SLP protocols, streams to be played with the VLC Media Player
Announces, using the SAP/SDP or the SLP protocols, MPEG2 TS streams produced by for instance VLS. These announces can be received by the VLC Media Player o.a.
See the default configuration file for examples.
.SH OPTIONS
.TP
.B -f file
......
/*****************************************************************************
* sapserver.cpp : SAP discovery service mini-server
****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* Copyright (C) 1998-2004 VideoLAN
* $Id: sapserver.cpp,v 1.16 2003/09/23 16:47:15 nitrox Exp $
*
* Authors: Arnaud Schauly <gitan@via.ecp.fr>
......@@ -37,13 +37,11 @@
using namespace std;
#include "config.h"
#include "sapserver.h"
#include "program.h"
#include "message.h"
#include "broadcast.h"
#include "parser.h"
#include "sapserver.h"
#ifdef CONFIG_SLP
#include <slp.h>
......@@ -59,7 +57,7 @@ void help(void)
" -d Use this to daemonize the process (run in the background)\n" \
" -f Use this to give a configuration file (default is %s)\n" \
" -c Same as -f\n" \
" -t \"slp\" or \"sap\". sap is default" \
" -t \"slp\" or \"sap\". sap is default\n" \
" -h Display this help\n" \
" -s Display a dot for each packet sent\n",DEFAULT_CONF);
}
......@@ -79,7 +77,7 @@ int main(int argc, char *argv[])
SLP *slp;
#endif
fprintf(stdout, "%s Version %s - (c)1999-2003 VideoLAN\n\n",
fprintf(stdout, "%s Version %s - (c)1999-2004 VideoLAN\n\n",
PACKAGE,VERSION);
config=new Config(DEFAULT_CONF);
......@@ -177,7 +175,7 @@ int main(int argc, char *argv[])
fprintf(stdout,".");
/* Wait for next sending */
usleep(SAP_DELAY*1000000/config->Programs.size());
usleep(config->GetDelay()*1000000/config->Programs.size());
}
fflush(stdout);
}
......
/*****************************************************************************
* sapserver.h : SAP discovery service classes definition
****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* Copyright (C) 1998-2004 VideoLAN
* $Id: sapserver.h,v 1.7 2003/08/10 12:44:18 zorglub Exp $
*
* Authors: Fabrice Ollivier <cif@via.ecp.fr>
......@@ -24,7 +24,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define SAP_DELAY 1 /* wait DELAY seconds before each sending */
#include "config.h"
#define MSGBUFSIZE 256
......@@ -32,6 +32,7 @@
#define DEFAULT_TTL 10
#define DEFAULT_SCOPE "8"
#define DEFAULT_PORT "1234"
#define DEFAULT_DELAY 5 /* wait DELAY seconds before each sending */
#define TYPE_SAP 1
......
......@@ -32,10 +32,9 @@
using namespace std;
#include "sapserver.h"
#include "program.h"
#include "config.h"
#ifdef CONFIG_SLP
#include <slp.h>
#endif
......@@ -68,7 +67,7 @@ char * BuildService(Program *p)
string url="";
unsigned int i=0;
string head = "service:vlc.services.videolan://";
string head = "service:vlc.services.videolan.org://";
if(p->IsHTTP() )
{
......@@ -94,6 +93,13 @@ char * BuildService(Program *p)
url+=":";
url += p->GetPort();
#if 0
/* This code is for the new naming scheme after vlc 0.7.0 */
/* service:vlc.services.videolan.org://MRL//NAME */
url += "//";
url += p->GetName();
#endif
msg += head + url;
psz_msg = (char *)malloc( msg.size() * sizeof(char) );
......@@ -111,20 +117,20 @@ char * BuildService(Program *p)
int SLP::Register(Program *p)
{
char *psz_msg = BuildService(p);
string name;
name += p->GetName();
fprintf(stdout,"+ Registering %s (name: %s)\n",psz_msg,name.data());
SLPReg ( slp_handle,
psz_msg,
SLP_LIFETIME_MAXIMUM,
NULL,
name.data(),
SLP_TRUE,
RegReport,
NULL );
SLPReg ( slp_handle,
psz_msg,
SLP_LIFETIME_MAXIMUM,
NULL,
name.data(),
SLP_TRUE,
RegReport,
NULL );
if(psz_msg) free(psz_msg);
......
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