Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dvblast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
dvblast
Commits
e3e4ade7
Commit
e3e4ade7
authored
Aug 16, 2010
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* dvblast.c, output.c: New /ttl= output option. * demux.c: Miscellaneous cosmetics.
parent
ca44fe14
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
41 deletions
+53
-41
README
README
+1
-0
demux.c
demux.c
+13
-10
dvblast.c
dvblast.c
+15
-9
dvblast.h
dvblast.h
+1
-1
output.c
output.c
+23
-21
No files found.
README
View file @
e3e4ade7
...
...
@@ -119,6 +119,7 @@ Available options include :
/tsid=XXX (sets the transport stream ID)
/retention=XXX (see -E)
/latency=XXX (see -L)
/ttl=XX (see -t)
Several options can be appended, for instance:
239.255.0.1:1234/udp/epg/tsid=42
...
...
demux.c
View file @
e3e4ade7
...
...
@@ -1445,14 +1445,13 @@ static void HandlePAT( mtime_t i_dts )
const
uint8_t
*
p_old_program
=
NULL
;
uint16_t
i_sid
=
patn_get_program
(
p_program
);
uint16_t
i_pid
=
patn_get_pid
(
p_program
);
int
i_pmt
;
j
++
;
if
(
i_sid
==
0
)
{
if
(
i_pid
!=
NIT_PID
)
msg_Warn
(
NULL
,
"NIT is carried on PID %u which isn't DVB compliant"
,
"NIT is carried on PID %
h
u which isn't DVB compliant"
,
i_pid
);
continue
;
/* NIT */
}
...
...
@@ -1463,6 +1462,7 @@ static void HandlePAT( mtime_t i_dts )
||
patn_get_pid
(
p_old_program
)
!=
i_pid
||
b_change
)
{
int
i_pmt
;
b_display
=
true
;
if
(
p_old_program
!=
NULL
)
...
...
@@ -1538,7 +1538,7 @@ static void HandlePATSection( uint16_t i_pid, uint8_t *p_section,
{
if
(
i_pid
!=
PAT_PID
||
!
pat_validate
(
p_section
)
)
{
msg_Warn
(
NULL
,
"invalid PAT section received on PID %u"
,
i_pid
);
msg_Warn
(
NULL
,
"invalid PAT section received on PID %
h
u"
,
i_pid
);
free
(
p_section
);
return
;
}
...
...
@@ -1578,7 +1578,7 @@ static void HandlePMT( uint16_t i_pid, uint8_t *p_pmt, mtime_t i_dts )
if
(
i_pid
!=
p_sid
->
i_pmt_pid
)
{
msg_Warn
(
NULL
,
"invalid PMT section received on PID %u"
,
i_pid
);
msg_Warn
(
NULL
,
"invalid PMT section received on PID %
h
u"
,
i_pid
);
free
(
p_pmt
);
return
;
}
...
...
@@ -1593,7 +1593,7 @@ static void HandlePMT( uint16_t i_pid, uint8_t *p_pmt, mtime_t i_dts )
if
(
!
pmt_validate
(
p_pmt
)
)
{
msg_Warn
(
NULL
,
"invalid PMT section received on PID %u"
,
i_pid
);
msg_Warn
(
NULL
,
"invalid PMT section received on PID %
h
u"
,
i_pid
);
free
(
p_pmt
);
goto
out_pmt
;
}
...
...
@@ -1733,12 +1733,15 @@ out_nit:
;
}
/*****************************************************************************
* HandleNITSection
*****************************************************************************/
static
void
HandleNITSection
(
uint16_t
i_pid
,
uint8_t
*
p_section
,
mtime_t
i_dts
)
{
if
(
i_pid
!=
NIT_PID
||
!
nit_validate
(
p_section
)
)
{
msg_Warn
(
NULL
,
"invalid NIT section received on PID %u"
,
i_pid
);
msg_Warn
(
NULL
,
"invalid NIT section received on PID %
h
u"
,
i_pid
);
free
(
p_section
);
return
;
}
...
...
@@ -1767,7 +1770,7 @@ static void HandleSDT( mtime_t i_dts )
if
(
psi_table_validate
(
pp_current_sdt_sections
)
&&
psi_table_compare
(
pp_current_sdt_sections
,
pp_next_sdt_sections
)
)
{
/* Identical
sdt
. Shortcut. */
/* Identical
SDT
. Shortcut. */
psi_table_free
(
pp_next_sdt_sections
);
psi_table_init
(
pp_next_sdt_sections
);
goto
out_sdt
;
...
...
@@ -1853,7 +1856,7 @@ static void HandleSDTSection( uint16_t i_pid, uint8_t *p_section,
{
if
(
i_pid
!=
SDT_PID
||
!
sdt_validate
(
p_section
)
)
{
msg_Warn
(
NULL
,
"invalid SDT section received on PID %u"
,
i_pid
);
msg_Warn
(
NULL
,
"invalid SDT section received on PID %
h
u"
,
i_pid
);
free
(
p_section
);
return
;
}
...
...
@@ -1887,7 +1890,7 @@ static void HandleEIT( uint16_t i_pid, uint8_t *p_eit, mtime_t i_dts )
if
(
i_pid
!=
EIT_PID
||
!
eit_validate
(
p_eit
)
)
{
msg_Warn
(
NULL
,
"invalid EIT section received on PID %u"
,
i_pid
);
msg_Warn
(
NULL
,
"invalid EIT section received on PID %
h
u"
,
i_pid
);
free
(
p_eit
);
return
;
}
...
...
@@ -1905,7 +1908,7 @@ static void HandleSection( uint16_t i_pid, uint8_t *p_section, mtime_t i_dts )
if
(
!
psi_validate
(
p_section
)
)
{
msg_Warn
(
NULL
,
"invalid section on PID %u"
,
i_pid
);
msg_Warn
(
NULL
,
"invalid section on PID %
h
u"
,
i_pid
);
free
(
p_section
);
return
;
}
...
...
dvblast.c
View file @
e3e4ade7
...
...
@@ -48,7 +48,6 @@ int i_nb_outputs = 0;
output_t
output_dup
=
{
0
};
static
char
*
psz_conf_file
=
NULL
;
char
*
psz_srv_socket
=
NULL
;
int
i_ttl
=
64
;
in_addr_t
i_ssrc
=
0
;
static
int
i_priority
=
-
1
;
int
i_adapter
=
0
;
...
...
@@ -79,6 +78,7 @@ static int b_dvb_global = 0;
static
int
b_epg_global
=
0
;
static
mtime_t
i_latency_global
=
DEFAULT_OUTPUT_LATENCY
;
static
mtime_t
i_retention_global
=
DEFAULT_MAX_RETENTION
;
static
int
i_ttl_global
=
64
;
void
(
*
pf_Open
)(
void
)
=
NULL
;
block_t
*
(
*
pf_Read
)(
mtime_t
i_poll_timeout
)
=
NULL
;
...
...
@@ -123,6 +123,7 @@ static void ReadConfiguration( char *psz_file )
mtime_t
i_retention
=
i_retention_global
;
mtime_t
i_latency
=
i_latency_global
;
int
i_tsid
=
-
1
;
int
i_ttl
=
i_ttl_global
;
snprintf
(
sz_port
,
sizeof
(
sz_port
),
"%d"
,
DEFAULT_PORT
);
...
...
@@ -149,6 +150,8 @@ static void ReadConfiguration( char *psz_file )
i_retention
=
strtoll
(
psz_token2
+
10
,
NULL
,
0
)
*
1000
;
else
if
(
!
strncasecmp
(
psz_token2
,
"latency="
,
8
)
)
i_latency
=
strtoll
(
psz_token2
+
8
,
NULL
,
0
)
*
1000
;
else
if
(
!
strncasecmp
(
psz_token2
,
"ttl="
,
4
)
)
i_ttl
=
strtol
(
psz_token2
+
4
,
NULL
,
0
);
else
msg_Warn
(
NULL
,
"unrecognized option %s"
,
psz_token2
);
}
...
...
@@ -246,13 +249,14 @@ static void ReadConfiguration( char *psz_file )
}
}
msg_Dbg
(
NULL
,
"conf: %s config=0x%x sid=%d pids[%d]=%d,%d,%d,%d,%d..."
,
psz_displayname
,
i_config
,
i_sid
,
i_nb_pids
,
i_nb_pids
<
1
?
-
1
:
pi_pids
[
0
],
i_nb_pids
<
2
?
-
1
:
pi_pids
[
1
],
i_nb_pids
<
3
?
-
1
:
pi_pids
[
2
],
i_nb_pids
<
4
?
-
1
:
pi_pids
[
3
],
i_nb_pids
<
5
?
-
1
:
pi_pids
[
4
]
);
msg_Dbg
(
NULL
,
"conf: %s config=0x%x ttl=%d sid=%d pids[%d]=%d,%d,%d,%d,%d..."
,
psz_displayname
,
i_config
,
i_ttl
,
i_sid
,
i_nb_pids
,
i_nb_pids
<
1
?
-
1
:
pi_pids
[
0
],
i_nb_pids
<
2
?
-
1
:
pi_pids
[
1
],
i_nb_pids
<
3
?
-
1
:
pi_pids
[
2
],
i_nb_pids
<
4
?
-
1
:
pi_pids
[
3
],
i_nb_pids
<
5
?
-
1
:
pi_pids
[
4
]
);
for
(
i
=
0
;
i
<
i_nb_outputs
;
i
++
)
{
...
...
@@ -294,6 +298,8 @@ static void ReadConfiguration( char *psz_file )
p_output
->
i_output_latency
=
i_latency
;
p_output
->
i_max_retention
=
i_retention
;
demux_Change
(
p_output
,
i_tsid
,
i_sid
,
pi_pids
,
i_nb_pids
);
if
(
p_output
->
i_ttl
!=
i_ttl
)
output_SetTTL
(
p_output
,
i_ttl
);
}
free
(
psz_displayname
);
...
...
@@ -479,7 +485,7 @@ int main( int i_argc, char **pp_argv )
break
;
case
't'
:
i_ttl
=
strtol
(
optarg
,
NULL
,
0
);
i_ttl
_global
=
strtol
(
optarg
,
NULL
,
0
);
break
;
case
'o'
:
...
...
dvblast.h
View file @
e3e4ade7
...
...
@@ -119,7 +119,6 @@ extern output_t **pp_outputs;
extern
int
i_nb_outputs
;
extern
output_t
output_dup
;
extern
char
*
psz_srv_socket
;
extern
int
i_ttl
;
extern
in_addr_t
i_ssrc
;
extern
int
i_adapter
;
extern
int
i_fenum
;
...
...
@@ -199,6 +198,7 @@ int output_Init( output_t *p_output, const char *psz_displayname,
void
output_Close
(
output_t
*
p_output
);
void
output_Put
(
output_t
*
p_output
,
block_t
*
p_block
);
mtime_t
output_Send
(
void
);
void
output_SetTTL
(
output_t
*
p_output
,
int
i_ttl
);
void
comm_Open
(
void
);
void
comm_Read
(
void
);
...
...
output.c
View file @
e3e4ade7
...
...
@@ -148,6 +148,7 @@ int output_Init( output_t *p_output, const char *psz_displayname,
p_output
->
i_ref_wallclock
=
0
;
p_output
->
i_config
=
0
;
p_output
->
i_ttl
=
0
;
p_output
->
psz_displayname
=
strdup
(
psz_displayname
);
p_output
->
i_addrlen
=
p_ai
->
ai_addrlen
;
...
...
@@ -336,38 +337,39 @@ mtime_t output_Send( void )
}
/*****************************************************************************
*
net_Open
*
output_SetTTL : set the TTL of an output socket
*****************************************************************************/
static
int
net_Open
(
output_t
*
p_output
)
void
output_SetTTL
(
output_t
*
p_output
,
int
i_ttl
)
{
int
i_handle
=
socket
(
p_output
->
p_addr
->
ss_family
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
i_handle
<
0
)
{
msg_Err
(
NULL
,
"couldn't create socket for %s (%s)"
,
p_output
->
psz_displayname
,
strerror
(
errno
)
);
return
-
errno
;
}
if
(
p_output
->
p_addr
->
ss_family
==
AF_INET6
)
{
struct
sockaddr_in6
*
addr
=
(
struct
sockaddr_in6
*
)
p_output
->
p_addr
;
if
(
IN6_IS_ADDR_MULTICAST
(
addr
->
sin6_addr
.
s6_addr
)
)
{
int
i
=
i_ttl
;
setsockopt
(
i_handle
,
IPPROTO_IPV6
,
IPV6_MULTICAST_HOPS
,
(
void
*
)
&
i
,
sizeof
(
i
)
);
}
setsockopt
(
p_output
->
i_handle
,
IPPROTO_IPV6
,
IPV6_MULTICAST_HOPS
,
(
void
*
)
&
i_ttl
,
sizeof
(
i_ttl
)
);
}
else
if
(
p_output
->
p_addr
->
ss_family
==
AF_INET
)
{
struct
sockaddr_in
*
addr
=
(
struct
sockaddr_in
*
)
p_output
->
p_addr
;
if
(
IN_MULTICAST
(
ntohl
(
addr
->
sin_addr
.
s_addr
)
)
)
{
int
i
=
i_ttl
;
setsockopt
(
i_handle
,
IPPROTO_IP
,
IP_MULTICAST_TTL
,
(
void
*
)
&
i
,
sizeof
(
i
)
);
}
setsockopt
(
p_output
->
i_handle
,
IPPROTO_IP
,
IP_MULTICAST_TTL
,
(
void
*
)
&
i_ttl
,
sizeof
(
i_ttl
)
);
}
p_output
->
i_ttl
=
i_ttl
;
}
/*****************************************************************************
* net_Open
*****************************************************************************/
static
int
net_Open
(
output_t
*
p_output
)
{
int
i_handle
=
socket
(
p_output
->
p_addr
->
ss_family
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
i_handle
<
0
)
{
msg_Err
(
NULL
,
"couldn't create socket for %s (%s)"
,
p_output
->
psz_displayname
,
strerror
(
errno
)
);
return
-
errno
;
}
if
(
connect
(
i_handle
,
(
struct
sockaddr
*
)
p_output
->
p_addr
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment