Changeset 8e65c917b65fd1d419853f42d9440de260c9a52d
- Timestamp:
- 05/07/08 16:34:32
(2 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1210170872 +0300
- git-parent:
[7b556d013fc72822b26d03158c1e5c6328be1071]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1210170683 +0300
- Message:
Undo --sout-udp-auto-mcast
(was not in previous release, so not adding _obsolete).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rb2b9fb4 |
r8e65c91 |
|
| 75 | 75 | "helps reducing the scheduling load on " \ |
|---|
| 76 | 76 | "heavily-loaded systems." ) |
|---|
| 77 | | #define AUTO_MCAST_TEXT N_("Automatic multicast streaming") |
|---|
| 78 | | #define AUTO_MCAST_LONGTEXT N_("Allocates an outbound multicast address " \ |
|---|
| 79 | | "automatically.") |
|---|
| 80 | 77 | |
|---|
| 81 | 78 | vlc_module_begin(); |
|---|
| … | … | |
| 89 | 86 | add_obsolete_integer( SOUT_CFG_PREFIX "late" ); |
|---|
| 90 | 87 | add_obsolete_bool( SOUT_CFG_PREFIX "raw" ); |
|---|
| 91 | | add_bool( SOUT_CFG_PREFIX "auto-mcast", false, NULL, AUTO_MCAST_TEXT, |
|---|
| 92 | | AUTO_MCAST_LONGTEXT, true ); |
|---|
| 93 | 88 | |
|---|
| 94 | 89 | set_capability( "sout access", 100 ); |
|---|
| … | … | |
| 102 | 97 | |
|---|
| 103 | 98 | static const char *const ppsz_sout_options[] = { |
|---|
| 104 | | "auto-mcast", |
|---|
| 105 | 99 | "caching", |
|---|
| 106 | 100 | "group", |
|---|
| … | … | |
| 187 | 181 | |
|---|
| 188 | 182 | i_dst_port = DEFAULT_PORT; |
|---|
| 189 | | if (var_GetBool (p_access, SOUT_CFG_PREFIX"auto-mcast")) |
|---|
| 190 | | { |
|---|
| 191 | | char buf[INET6_ADDRSTRLEN]; |
|---|
| 192 | | if (MakeRandMulticast (AF_INET, buf, sizeof (buf)) != NULL) |
|---|
| 193 | | psz_dst_addr = strdup (buf); |
|---|
| 194 | | } |
|---|
| 195 | | else |
|---|
| 196 | | { |
|---|
| 197 | | char *psz_parser = psz_dst_addr = strdup( p_access->psz_path ); |
|---|
| 198 | | |
|---|
| 199 | | if (psz_parser[0] == '[') |
|---|
| 200 | | psz_parser = strchr (psz_parser, ']'); |
|---|
| 201 | | |
|---|
| 202 | | psz_parser = strchr (psz_parser ?: psz_dst_addr, ':'); |
|---|
| 203 | | if (psz_parser != NULL) |
|---|
| 204 | | { |
|---|
| 205 | | *psz_parser++ = '\0'; |
|---|
| 206 | | i_dst_port = atoi (psz_parser); |
|---|
| 207 | | } |
|---|
| | 183 | char *psz_parser = psz_dst_addr = strdup( p_access->psz_path ); |
|---|
| | 184 | |
|---|
| | 185 | if (psz_parser[0] == '[') |
|---|
| | 186 | psz_parser = strchr (psz_parser, ']'); |
|---|
| | 187 | |
|---|
| | 188 | psz_parser = strchr (psz_parser ?: psz_dst_addr, ':'); |
|---|
| | 189 | if (psz_parser != NULL) |
|---|
| | 190 | { |
|---|
| | 191 | *psz_parser++ = '\0'; |
|---|
| | 192 | i_dst_port = atoi (psz_parser); |
|---|
| 208 | 193 | } |
|---|
| 209 | 194 | |
|---|
| … | … | |
| 535 | 520 | } |
|---|
| 536 | 521 | } |
|---|
| 537 | | |
|---|
| 538 | | |
|---|
| 539 | | static const char *MakeRandMulticast (int family, char *buf, size_t buflen) |
|---|
| 540 | | { |
|---|
| 541 | | uint32_t rand = (getpid() & 0xffff) |
|---|
| 542 | | | (uint32_t)(((mdate () >> 10) & 0xffff) << 16); |
|---|
| 543 | | |
|---|
| 544 | | switch (family) |
|---|
| 545 | | { |
|---|
| 546 | | #ifdef AF_INET6 |
|---|
| 547 | | case AF_INET6: |
|---|
| 548 | | { |
|---|
| 549 | | struct in6_addr addr; |
|---|
| 550 | | memcpy (&addr, "\xff\x38\x00\x00" "\x00\x00\x00\x00" |
|---|
| 551 | | "\x00\x00\x00\x00", 12); |
|---|
| 552 | | rand |= 0x80000000; |
|---|
| 553 | | memcpy (addr.s6_addr + 12, &(uint32_t){ htonl (rand) }, 4); |
|---|
| 554 | | return inet_ntop (family, &addr, buf, buflen); |
|---|
| 555 | | } |
|---|
| 556 | | #endif |
|---|
| 557 | | |
|---|
| 558 | | case AF_INET: |
|---|
| 559 | | { |
|---|
| 560 | | struct in_addr addr; |
|---|
| 561 | | addr.s_addr = htonl ((rand & 0xffffff) | 0xe8000000); |
|---|
| 562 | | return inet_ntop (family, &addr, buf, buflen); |
|---|
| 563 | | } |
|---|
| 564 | | } |
|---|
| 565 | | #ifdef EAFNOSUPPORT |
|---|
| 566 | | errno = EAFNOSUPPORT; |
|---|
| 567 | | #endif |
|---|
| 568 | | return NULL; |
|---|
| 569 | | } |
|---|