Changeset 0b879fdfa25b12b2d4ca60e119cf4a1bdafe5c8b

Show
Ignore:
Timestamp:
06/03/07 16:53:43 (2 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1173196423 +0000
git-parent:

[c1432d5dc66274596ec743c608e97e6034e897df]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1173196423 +0000
Message:

Make --sout-udp-rtcp an integer carrying a port number rather than a boolean

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access_output/udp.c

    rdd78530 r0b879fd  
    103103                       "without trying to make the biggest possible packets " \ 
    104104                       "in order to improve streaming)." ) 
    105 #define RTCP_TEXT N_("Force RTCP Sender Reports") 
    106 #define RTCP_LONGTEXT N_("Sends RTCP Sender Report packets even if " \ 
    107                          "RTP encapsulation is not done") 
     105#define RTCP_TEXT N_("RTCP destination port number") 
     106#define RTCP_LONGTEXT N_("Sends RTCP packets to this port (0 = auto)") 
    108107#define AUTO_MCAST_TEXT N_("Automatic multicast streaming") 
    109108#define AUTO_MCAST_LONGTEXT N_("Allocates an outbound multicast address " \ 
     
    125124    add_bool( SOUT_CFG_PREFIX "raw",  VLC_FALSE, NULL, RAW_TEXT, RAW_LONGTEXT, 
    126125                                 VLC_TRUE ); 
    127     add_bool( SOUT_CFG_PREFIX "rtcp",  VLC_FALSE, NULL, RTCP_TEXT, RTCP_LONGTEXT, 
    128               VLC_TRUE ); 
     126    add_integer( SOUT_CFG_PREFIX "rtcp",  0, NULL, RTCP_TEXT, RTCP_LONGTEXT, 
     127                 VLC_TRUE ); 
    129128    add_bool( SOUT_CFG_PREFIX "auto-mcast", VLC_FALSE, NULL, AUTO_MCAST_TEXT, 
    130129              AUTO_MCAST_LONGTEXT, VLC_TRUE ); 
     
    211210#define RTP_HEADER_LENGTH 12 
    212211 
    213 static int OpenRTCP (sout_access_out_t *obj, int proto); 
     212static int OpenRTCP (sout_access_out_t *obj, int proto, uint16_t dport); 
    214213static void SendRTCP (sout_access_thread_t *obj, uint32_t timestamp); 
    215214static void CloseRTCP (sout_access_thread_t *obj); 
     
    224223 
    225224    char                *psz_dst_addr = NULL; 
    226     int                 i_dst_port, proto = IPPROTO_UDP; 
     225    int                 i_dst_port, i_rtcp_port = 0, proto = IPPROTO_UDP; 
    227226    const char          *protoname = "UDP"; 
    228227 
     
    230229 
    231230    vlc_value_t         val; 
    232     vlc_bool_t          b_rtcp = VLC_FALSE; 
    233231 
    234232    config_ChainParse( p_access, SOUT_CFG_PREFIX, 
     
    255253    { 
    256254        if (strcmp (p_access->psz_access, "rtp") == 0) 
    257             p_sys->b_rtpts = b_rtcp = VLC_TRUE; 
    258         else 
    259             /* This option is really only meant for the RTP streaming output 
    260              * plugin. Doing RTCP for raw UDP will yield weird results. */ 
    261             b_rtcp = var_GetBool (p_access, SOUT_CFG_PREFIX"rtcp"); 
     255            p_sys->b_rtpts = VLC_TRUE; 
    262256    } 
    263257 
     
    289283        } 
    290284    } 
     285 
     286    /* This option is really only meant for the RTP streaming output 
     287     * plugin. Doing RTCP for raw UDP will yield weird results. */ 
     288    i_rtcp_port = var_GetInteger (p_access, SOUT_CFG_PREFIX"rtcp"); 
     289    /* If RTCP port is not specified, use the default, if we do RTP/MP2 encap, 
     290     * or do not use RTCP at all otherwise. */ 
     291    if ((i_rtcp_port == 0) && (p_sys->b_rtpts)) 
     292        i_rtcp_port = i_dst_port + 1; 
    291293 
    292294    p_sys->p_thread = 
     
    378380    p_sys->i_ssrc            = rand()&0xffffffff; 
    379381 
    380     if (b_rtcp && OpenRTCP (p_access, proto)) 
     382    if (i_rtcp_port && OpenRTCP (p_access, proto, i_rtcp_port)) 
    381383    { 
    382384        msg_Err (p_access, "cannot initialize RTCP sender"); 
     
    765767 * - we do not implement any profile-specific extensions for the time being. 
    766768 */ 
    767 static int OpenRTCP (sout_access_out_t *obj, int proto
     769static int OpenRTCP (sout_access_out_t *obj, int proto, uint16_t dport
    768770{ 
    769771    sout_access_out_sys_t *p_sys = obj->p_sys; 
     
    772774 
    773775    char src[NI_MAXNUMERICHOST], dst[NI_MAXNUMERICHOST]; 
    774     int sport, dport
     776    int sport
    775777 
    776778    fd = obj->p_sys->p_thread->i_handle; 
    777779    if (net_GetSockAddress (fd, src, &sport) 
    778      || net_GetPeerAddress (fd, dst, &dport)) 
     780     || net_GetPeerAddress (fd, dst, NULL)) 
    779781        return VLC_EGENERIC; 
    780782 
    781783    sport++; 
    782     dport++; 
    783784    fd = net_OpenDgram (obj, src, sport, dst, dport, AF_UNSPEC, proto); 
    784785    if (fd == -1)