Receive program id from SAP?

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
eug950
New Cone
New Cone
Posts: 8
Joined: 27 Jan 2011 12:26

Receive program id from SAP?

Postby eug950 » 27 Jan 2011 12:53

Is it possible to receive stream program ID from SAP announcement?
Like It is in XSPF playlist via

Code: Select all

<vlc:option>program=6102</vlc:option>
line.

I'm setting up streaming of some FTA satellite channels to my LAN.
Hardware DVB-S streamer puts full program table from original sat stream into each multicast stream no matter how much channels are retransmitted in it.
When using hand-edited XSPF playlist Playback-Program menu is disabled and each channel opens from playlist.
But with SAP some channels need to be selected twice - first from playlist and then from Playback-Program menu and it is not possible to make entries for several channels in one multicast stream.

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Receive program id from SAP?

Postby Rémi Denis-Courmont » 27 Jan 2011 17:39

That wouldn't make much sense, would it? If the entire transponder is transmitted as a single RTP session, you might as well use the user interface to select the right program.

Normally, multicast IPTV is such that there is only one program per multicast address (and one SAP announce).
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

eug950
New Cone
New Cone
Posts: 8
Joined: 27 Jan 2011 12:26

Re: Receive program id from SAP?

Postby eug950 » 28 Jan 2011 11:14

There are 2 cases, which need this:
1) single program is present in multicast stream, but program table contains all entries from transponder. Some such streams are opened correctly and some not, so you have to find correct program in Program menu. It is counterintuitive especially if name in playlist differs from name in program table. And whether it was opened correctly or not, presence of Program menu is disorientating.
2) several programs in one multicast stream, several radio channels with relatively low bitrate for example. This saves me IP output streams on the hw streamer, but then they can't have separate entries in sap announce.
Of course we can blame hw streamer (PBI DMM-1400P-S2) for those but I'll try to add this feature (program selector in sap) as a patch to vlc and minisapserver.
Next week possibly.

eug950
New Cone
New Cone
Posts: 8
Joined: 27 Jan 2011 12:26

Re: Receive program id from SAP?

Postby eug950 » 28 Jan 2011 18:51

OK, I've created a quick hack:

Code: Select all

--- modules/services_discovery/sap.c.old 2010-06-01 13:21:02 +0000 +++ modules/services_discovery/sap.c 2011-01-28 17:08:24 +0000 @@ -898,7 +898,16 @@ sap_announce_t *CreateAnnounce( services input_item_AddInfo( p_input, _("Session"), _("User"), "%s", p_sdp->username ); } - + psz_value = GetAttribute( p_sap->p_sdp->pp_attributes, p_sap->p_sdp->i_attributes, "x-program" ); + if( psz_value != NULL ) + { + char *program; + if( asprintf( &program, "program=%s", psz_value ) != -1 ) + { + input_item_AddOption( p_input, program, 0 ); + free( program ); + } + } /* Handle group */ if (p_sap->p_sdp->mediac >= 1) psz_value = FindAttribute (p_sap->p_sdp, 0, "x-plgroup");
and for minisapserver:

Code: Select all

--- message.cpp.old 2011-01-28 19:22:59.000000000 +0200 +++ message.cpp 2011-01-28 19:24:31.000000000 +0200 @@ -129,6 +129,9 @@ bool Message::AddProgram(Program *p) if (p->HasPlGroup()) sdp += "a=x-plgroup:" + p->GetPlGroup() + "\r\n"; + if (p->HasXProg()) + sdp += "a=x-program:" + p->GetXProg() + "\r\n"; + /* Media and media-level attributes */ sdp += "a=type:broadcast\r\n"; sdp += "a=charset:UTF-8\r\n"; --- program.cpp.old 2011-01-28 19:26:25.000000000 +0200 +++ program.cpp 2011-01-28 19:28:28.000000000 +0200 @@ -33,7 +33,7 @@ using namespace std; #include "program.h" -Program::Program() : b_rtp(false), b_has_pl_group(false) +Program::Program() : b_rtp(false), b_has_pl_group(false), b_has_xprog(false) { /* Set default Values */ address=""; @@ -54,10 +54,12 @@ string Program::GetAddress(void){return string Program::GetPort(void){return port;} string Program::GetTTL(void){return program_ttl;} string Program::GetPlGroup(void){return pl_group;} +string Program::GetXProg(void){return xprog;} bool Program::IsPermanent(void){return permanent;} bool Program::IsRTP(void){return b_rtp;} bool Program::HasPlGroup(void){return b_has_pl_group;} +bool Program::HasXProg(void){return b_has_xprog;} void Program::SetName(char* n){name=n;} void Program::SetUser(char* u){user=u;} @@ -65,8 +67,10 @@ void Program::SetMachine(char* m){machin void Program::SetSite(char* s){site=s;} void Program::SetAddress(char* a){address=a;} void Program::SetPlGroup(char *h){pl_group=h;} +void Program::SetXProg(char *h){xprog=h;} void Program::SetRTP(bool b){b_rtp = b;} void Program::SetHasPlGroup(bool b){b_has_pl_group = b ;} +void Program::SetHasXProg(bool b){b_has_xprog = b ;} void Program::SetPort(char* p) { int i_port=atoi(p); --- program.h.old 2011-01-28 19:24:45.000000000 +0200 +++ program.h 2011-01-28 19:34:01.000000000 +0200 @@ -37,6 +37,7 @@ class Program string GetAddress(); string GetPort(); string GetTTL(); + string GetXProg(); string GetPlGroup(); /* Functions to set the values */ @@ -49,11 +50,14 @@ class Program void SetTTL(char *); void SetPlGroup(char *); void SetHasPlGroup(bool); + void SetXProg(char *); + void SetHasXProg(bool); void SetRTP(bool); bool IsPermanent(); bool IsRTP(); bool HasPlGroup(); + bool HasXProg(); private: string name; @@ -64,9 +68,11 @@ class Program string port; string program_ttl; string pl_group; + string xprog; bool permanent; bool b_rtp; bool b_has_pl_group; + bool b_has_xprog; uint32_t start_time; uint32_t stop_time; /* TODO support for periodical programs */
It compiles and does what I need.
What's your opinion?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Receive program id from SAP?

Postby Rémi Denis-Courmont » 29 Jan 2011 10:41

I am a bit puzzled how your HW manufacturer expects this stuff to work?!
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

eug950
New Cone
New Cone
Posts: 8
Joined: 27 Jan 2011 12:26

Re: Receive program id from SAP?

Postby eug950 » 31 Jan 2011 19:36

Sorry, I've lost part of patch to minisapserver in previous post.
This is the complete version of it:

Code: Select all

--- message.cpp.old 2011-01-28 19:22:59.000000000 +0200 +++ message.cpp 2011-01-28 19:24:31.000000000 +0200 @@ -129,6 +129,9 @@ bool Message::AddProgram(Program *p) if (p->HasPlGroup()) sdp += "a=x-plgroup:" + p->GetPlGroup() + "\r\n"; + if (p->HasXProg()) + sdp += "a=x-program:" + p->GetXProg() + "\r\n"; + /* Media and media-level attributes */ sdp += "a=type:broadcast\r\n"; sdp += "a=charset:UTF-8\r\n"; --- parser.cpp.old 2011-01-28 19:12:59.000000000 +0200 +++ parser.cpp 2011-01-28 19:32:09.000000000 +0200 @@ -88,6 +88,16 @@ void Config::SetTTL(unsigned int t) ttl=t; } +unsigned int Config::GetXProg() +{ + return xprog; +} + +void Config::SetXProg(unsigned int t) +{ + xprog=t; +} + unsigned int Config::GetDelay() { return delay; @@ -304,6 +314,14 @@ int Config::Parse() pp->SetTTL(tline); } + if(strstr(line,"x-program=")) + { + strgeta(line,tline,'='); + something=1; + pp->SetXProg(tline); + pp->SetHasXProg(true); + } + if(strstr(line,"playlist_group=")) { ICONV_CONST char *tptr; --- parser.h.old 2011-01-28 19:16:39.000000000 +0200 +++ parser.h 2011-01-28 19:20:57.000000000 +0200 @@ -32,6 +32,8 @@ class Config int Parse(); unsigned int GetTTL(); void SetTTL(unsigned int); + unsigned int GetXProg(); + void SetXProg(unsigned int); unsigned int GetDelay(); void SetDelay(unsigned int); bool GetDaemonMode(void); @@ -49,6 +51,7 @@ class Config private: string file; int ttl; + int xprog; int delay; char * interface; int type; --- program.cpp.old 2011-01-28 19:26:25.000000000 +0200 +++ program.cpp 2011-01-28 19:28:28.000000000 +0200 @@ -33,7 +33,7 @@ using namespace std; #include "program.h" -Program::Program() : b_rtp(false), b_has_pl_group(false) +Program::Program() : b_rtp(false), b_has_pl_group(false), b_has_xprog(false) { /* Set default Values */ address=""; @@ -54,10 +54,12 @@ string Program::GetAddress(void){return string Program::GetPort(void){return port;} string Program::GetTTL(void){return program_ttl;} string Program::GetPlGroup(void){return pl_group;} +string Program::GetXProg(void){return xprog;} bool Program::IsPermanent(void){return permanent;} bool Program::IsRTP(void){return b_rtp;} bool Program::HasPlGroup(void){return b_has_pl_group;} +bool Program::HasXProg(void){return b_has_xprog;} void Program::SetName(char* n){name=n;} void Program::SetUser(char* u){user=u;} @@ -65,8 +67,10 @@ void Program::SetMachine(char* m){machin void Program::SetSite(char* s){site=s;} void Program::SetAddress(char* a){address=a;} void Program::SetPlGroup(char *h){pl_group=h;} +void Program::SetXProg(char *h){xprog=h;} void Program::SetRTP(bool b){b_rtp = b;} void Program::SetHasPlGroup(bool b){b_has_pl_group = b ;} +void Program::SetHasXProg(bool b){b_has_xprog = b ;} void Program::SetPort(char* p) { int i_port=atoi(p); --- program.h.old 2011-01-28 19:24:45.000000000 +0200 +++ program.h 2011-01-28 19:34:01.000000000 +0200 @@ -37,6 +37,7 @@ class Program string GetAddress(); string GetPort(); string GetTTL(); + string GetXProg(); string GetPlGroup(); /* Functions to set the values */ @@ -49,11 +50,14 @@ class Program void SetTTL(char *); void SetPlGroup(char *); void SetHasPlGroup(bool); + void SetXProg(char *); + void SetHasXProg(bool); void SetRTP(bool); bool IsPermanent(); bool IsRTP(); bool HasPlGroup(); + bool HasXProg(); private: string name; @@ -64,9 +68,11 @@ class Program string port; string program_ttl; string pl_group; + string xprog; bool permanent; bool b_rtp; bool b_has_pl_group; + bool b_has_xprog; uint32_t start_time; uint32_t stop_time; /* TODO support for periodical programs */
The patch for vlc itself was correct. Reposting it just for convenience:

Code: Select all

--- modules/services_discovery/sap.c.old 2010-06-01 13:21:02 +0000 +++ modules/services_discovery/sap.c 2011-01-28 17:08:24 +0000 @@ -898,7 +898,16 @@ sap_announce_t *CreateAnnounce( services input_item_AddInfo( p_input, _("Session"), _("User"), "%s", p_sdp->username ); } - + psz_value = GetAttribute( p_sap->p_sdp->pp_attributes, p_sap->p_sdp->i_attributes, "x-program" ); + if( psz_value != NULL ) + { + char *program; + if( asprintf( &program, "program=%s", psz_value ) != -1 ) + { + input_item_AddOption( p_input, program, 0 ); + free( program ); + } + } /* Handle group */ if (p_sap->p_sdp->mediac >= 1) psz_value = FindAttribute (p_sap->p_sdp, 0, "x-plgroup");


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 29 guests