[vlc-devel] [PATCH 1/1] Supporting ONVIF PRofile-G recording playback

Rémi Denis-Courmont remi at remlab.net
Mon Aug 4 19:47:11 CEST 2014


Le lundi 4 août 2014, 13:31:28 David R. Robison a écrit :
> diff --git a/include/vlc_variables.h b/include/vlc_variables.h
> index 420f0b4..4f7c432 100644
> --- a/include/vlc_variables.h
> +++ b/include/vlc_variables.h
> @@ -60,6 +60,7 @@
>   #define VLC_VAR_TIME      0x0060
>   #define VLC_VAR_ADDRESS   0x0070
>   #define VLC_VAR_COORDS    0x00A0
> +#define VLC_VAR_TIMERNG   0x00B0

Why do you need a new variable type?

That's a lot of code for just one variable.

>   /**@}*/
> 
>   /** \defgroup var_flags Additive flags

> diff --git a/lib/libvlc.sym b/lib/libvlc.sym
> index c0c66dd..858af30 100644
> --- a/lib/libvlc.sym
> +++ b/lib/libvlc.sym
> @@ -173,6 +173,7 @@ libvlc_media_player_set_nsobject
>   libvlc_media_player_set_position
>   libvlc_media_player_set_rate
>   libvlc_media_player_set_time
> +libvlc_media_player_set_timerng

Maybe just me, but that does not sound very evocative as a function name.

Plus RNG means Random Number Generator in IT context.

>   libvlc_media_player_set_title
>   libvlc_media_player_set_xwindow
>   libvlc_media_player_stop
> diff --git a/lib/media_player.c b/lib/media_player.c
> index b31a832..a440cba 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -1070,6 +1070,19 @@ void libvlc_media_player_set_time(
> libvlc_media_player_t *p_mi,
>       vlc_object_release( p_input_thread );
>   }
> 
> +void libvlc_media_player_set_timerng( libvlc_media_player_t *p_mi,
> +                                   libvlc_time_t i_time_f,
> libvlc_time_t i_time_t )
> +{
> +    input_thread_t *p_input_thread;
> +
> +    p_input_thread = libvlc_get_input_thread ( p_mi );
> +    if( !p_input_thread )
> +        return;
> +
> +    var_SetTimeRng( p_input_thread, "timerng", to_mtime(i_time_f),
> to_mtime(i_time_t) );
> +    vlc_object_release( p_input_thread );
> +}

How is that different from setting (start-)time *and* end-time?

> +
>   void libvlc_media_player_set_position( libvlc_media_player_t *p_mi,
>                                          float position )
>   {
> diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
> index b14898c..cfbc95a 100644
> --- a/modules/access/live555.cpp
> +++ b/modules/access/live555.cpp
> @@ -233,6 +233,8 @@ struct demux_sys_t
>       int              i_live555_ret; /* live555 callback return code */
> 
>       float            f_seek_request;/* In case we receive a seek
> request while paused*/
> +    mtime_t          i_timerng_request_f;/* In case we receive a set
> time range request while paused*/
> +    mtime_t          i_timerng_request_t;/* In case we receive a set
> time range request while paused*/
>   };
> 
> 
> @@ -317,6 +319,8 @@ static int  Open ( vlc_object_t *p_this )
>       p_sys->psz_path = strdup( p_demux->psz_location );
>       p_sys->b_force_mcast = var_InheritBool( p_demux, "rtsp-mcast" );
>       p_sys->f_seek_request = -1;
> +    p_sys->i_timerng_request_f = -1;
> +    p_sys->i_timerng_request_t = -1;
> 
>       /* parse URL for rtsp://[user:[passwd]@]serverip:port/options */
>       vlc_UrlParse( &p_sys->url, p_sys->psz_path, 0 );
> @@ -1415,6 +1419,16 @@ static int Demux( demux_t *p_demux )
>   }
> 
>  
> /**************************************************************************
> *** + * Format a time string for the RTSP header
> +
> ****************************************************************************
> */ +static char* makeRtspTime(char* buf, int buflen, mtime_t msecs) { +   
> time_t secs = msecs / 1000;
> +    if (secs <= 0) return NULL;
> +    strftime(buf, buflen, "%Y%m%dT%H%M%S.000Z", gmtime(&secs));
> +    return buf;

Not reentrant.

> +}
> +
> +/**************************************************************************
> *** * Control:
> ****************************************************************************
> */ static int Control( demux_t *p_demux, int i_query, va_list args ) @@
> -1521,6 +1535,62 @@ static int Control( demux_t *p_demux, int
> i_query, va_list args )
>               }
>               return VLC_EGENERIC;
> 
> +        case DEMUX_SET_TIMERNG:
> +            if( p_sys->rtsp )
> +            {
> +                int i;
> +                mtime_t timerng_f = (mtime_t)va_arg( args, mtime_t );
> +                mtime_t timerng_t = (mtime_t)va_arg( args, mtime_t );

What's the cast for? And confusing variable names IMHO.

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




More information about the vlc-devel mailing list