Changeset c88f8414bc19e430d4f7dc2ff704b7e6568434fb

Show
Ignore:
Timestamp:
06/15/08 13:13:23 (3 months ago)
Author:
Rémi Denis-Courmont <rdenis@simphalempin.com>
git-committer:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1213528403 +0300
git-parent:

[66bffcc5a3b8544635d4bfbe261ef381d577502a]

git-author:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1213528275 +0300
Message:

RTMP output: restore listen/accept and remove ENOSYS connect

Revert "Remove non-sensical connect->listen transition"
This reverts commit e1b146414f8b85755fb917bbac941367fb3c4e15

Files:

Legend:

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

    r3561b9b rc88f841  
    4242 *****************************************************************************/ 
    4343 
    44 #define URL_TEXT N_( "Destination" ) 
    45 #define URL_LONGTEXT N_( \ 
    46     "This is the output URL that will be used." ) 
     44#define RTMP_CONNECT_TEXT N_( "Active TCP connection" ) 
     45#define RTMP_CONNECT_LONGTEXT N_( \ 
     46    "If enabled, VLC will connect to a remote destination instead of " \ 
     47    "waiting for an incoming connection." ) 
    4748 
    4849static int  Open ( vlc_object_t * ); 
     
    5960    add_shortcut( "rtmp" ); 
    6061    set_callbacks( Open, Close ); 
     62    add_bool( "rtmp-connect", false, NULL, RTMP_CONNECT_TEXT, 
     63              RTMP_CONNECT_LONGTEXT, false ); 
    6164vlc_module_end(); 
    6265 
     
    178181    p_sys->p_thread->result_play = 1; 
    179182    p_sys->p_thread->result_stop = 0; 
     183    p_sys->p_thread->fd = -1; 
    180184 
    181185    /* Open connection */ 
    182     p_sys->p_thread->fd = net_ConnectTCP( p_access, p_sys->p_thread->url.psz_host, p_sys->p_thread->url.i_port ); 
    183     if( p_sys->p_thread->fd == -1 ) 
     186    if( var_CreateGetBool( p_access, "rtmp-connect" ) > 0 ) 
     187    { 
     188#if 0 
     189        p_sys->p_thread->fd = net_ConnectTCP( p_access, 
     190                                              p_sys->p_thread->url.psz_host, 
     191                                              p_sys->p_thread->url.i_port ); 
     192#endif 
     193        msg_Err( p_access, "to be implemented" ); 
    184194        goto error2; 
     195    } 
     196    else 
     197    { 
     198        int *p_fd_listen; 
     199 
     200        p_sys->active = 0; 
     201        p_fd_listen = net_ListenTCP( p_access, p_sys->p_thread->url.psz_host, 
     202                                     p_sys->p_thread->url.i_port ); 
     203        if( p_fd_listen == NULL ) 
     204        { 
     205            msg_Warn( p_access, "cannot listen to %s port %i", 
     206                      p_sys->p_thread->url.psz_host, 
     207                      p_sys->p_thread->url.i_port ); 
     208            goto error2; 
     209        } 
     210 
     211        do 
     212            p_sys->p_thread->fd = net_Accept( p_access, p_fd_listen, -1 ); 
     213        while( p_sys->p_thread->fd == -1 ); 
     214        net_ListenClose( p_fd_listen ); 
     215 
     216        if( rtmp_handshake_passive( p_this, p_sys->p_thread->fd ) < 0 ) 
     217        { 
     218            msg_Err( p_access, "handshake passive failed"); 
     219            goto error2; 
     220        } 
     221    } 
    185222 
    186223    if( vlc_thread_create( p_sys->p_thread, "rtmp control thread", ThreadControl, 
     
    212249    free( p_sys->p_thread->psz_media ); 
    213250 
    214     net_Close( p_sys->p_thread->fd ); 
     251    if( p_sys->p_thread->fd != -1 ) 
     252        net_Close( p_sys->p_thread->fd ); 
    215253error: 
    216254    vlc_object_detach( p_sys->p_thread );