[vlc-devel] [PATCH] access: add rfb/vnc viewonly module.

Rémi Denis-Courmont remi at remlab.net
Tue Feb 26 18:17:06 CET 2013


Le mardi 26 février 2013 14:55:24, Francois Cartegnie a écrit :
> +static rfbCredential* getCredentialHandler( rfbClient *p_client, int
> i_credentialType ) +{
> +    demux_t *p_demux = (demux_t *) rfbClientGetClientData( p_client,
> DemuxThread ); +
> +    rfbCredential *credential = calloc( 1, sizeof(rfbCredential) );
> +    if ( !credential ) return NULL;
> +
> +    switch( i_credentialType )
> +    {
> +        case rfbCredentialTypeX509:
> +            credential->x509Credential.x509CACertFile =
> +                    var_InheritString( p_demux, "http-ca" );
> +            credential->x509Credential.x509ClientCertFile =
> +                    var_InheritString( p_demux, "http-cert" );
> +            credential->x509Credential.x509ClientKeyFile =
> +                    var_InheritString( p_demux, "http-key" );
> +            credential->x509Credential.x509CACrlFile =
> +                    var_InheritString( p_demux, "http-crl" );

You are really being annoying. You keep complaining about the lack of 
documentation and consistency. And then you ignore existing documentation and 
violate consistency.

These settings are documented and that's not what they are meant for.

> +            break;
> +
> +        case rfbCredentialTypeUser:
> +            credential->userCredential.username =
> +                    var_InheritString( p_demux, CFG_PREFIX "user" );
> +            credential->userCredential.password =
> +                    var_InheritString( p_demux, CFG_PREFIX "password" );
> +            break;
> +
> +        default:
> +            free( credential );
> +            return NULL; /* Unsupported Auth */
> +    }
> +    /* freed by libvnc */
> +    return credential;
> +}
> +
> +/*************************************************************************
> **** + * Control:
> +
> **************************************************************************
> ***/ +static int Control( demux_t *p_demux, int i_query, va_list args ) +{
> +    bool *pb;
> +    int64_t *pi64;
> +    double *p_dbl;
> +    vlc_meta_t *p_meta;
> +
> +    switch( i_query )
> +    {
> +        case DEMUX_CAN_PAUSE:
> +        case DEMUX_CAN_SEEK:
> +        case DEMUX_CAN_CONTROL_PACE:
> +        case DEMUX_CAN_CONTROL_RATE:
> +        case DEMUX_HAS_UNSUPPORTED_META:
> +            pb = (bool*)va_arg( args, bool * );
> +            *pb = false;
> +            return VLC_SUCCESS;
> +
> +        case DEMUX_CAN_RECORD:
> +            pb = (bool*)va_arg( args, bool * );
> +            *pb = true;
> +            return VLC_SUCCESS;
> +
> +        case DEMUX_GET_PTS_DELAY:
> +            pi64 = (int64_t*)va_arg( args, int64_t * );
> +            *pi64 = INT64_C(1000)
> +                  * var_InheritInteger( p_demux, "network-caching" );
> +            return VLC_SUCCESS;
> +
> +        case DEMUX_GET_TIME:
> +            pi64 = (int64_t*)va_arg( args, int64_t * );
> +            *pi64 = mdate() - p_demux->p_sys->i_starttime;
> +            return VLC_SUCCESS;
> +
> +        case DEMUX_GET_LENGTH:
> +            pi64 = (int64_t*)va_arg( args, int64_t * );
> +            *pi64 = 0;
> +            return VLC_SUCCESS;
> +
> +        case DEMUX_GET_FPS:
> +            p_dbl = (double*)va_arg( args, double * );
> +            *p_dbl = p_demux->p_sys->f_fps;
> +            return VLC_SUCCESS;
> +
> +        case DEMUX_GET_META:
> +            p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
> +            vlc_meta_Set( p_meta, vlc_meta_Title, p_demux->psz_location );
> +            return VLC_SUCCESS;
> +
> +        default:
> +            return VLC_EGENERIC;
> +    }
> +}
> +
> +/*************************************************************************
> **** + * Demux:
> +
> **************************************************************************
> ***/ +
> +static void *DemuxThread( void *p_data )
> +{
> +    demux_t *p_demux = (demux_t *) p_data;
> +    demux_sys_t  *p_sys = p_demux->p_sys;
> +
> +    for(;;)
> +    {
> +        if (! p_sys->p_block )
> +        {
> +            p_sys->p_block = block_Alloc( p_sys->i_framebuffersize );
> +            msleep( p_sys->i_frame_interval );

WTF is this non-sense?

I'm stopping here.
Come back when you've applied your critics to your own self.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list