[vlc-devel] [RFC PATCH 1/3] options: add stream-cache

Rémi Denis-Courmont remi at remlab.net
Tue Oct 20 21:43:01 CEST 2015


On Tuesday 20 October 2015 20:27:05 Thomas Guillem wrote:
> Maybe, we could use stream-filter option instead ?
> ---
>  src/input/access.c  | 10 ++++++++++
>  src/input/var.c     |  1 +
>  src/libvlc-module.c |  6 ++++++
>  3 files changed, 17 insertions(+)
> 
> diff --git a/src/input/access.c b/src/input/access.c
> index 18b8357..a6f5cd6 100644
> --- a/src/input/access.c
> +++ b/src/input/access.c
> @@ -380,6 +380,15 @@ stream_t *stream_AccessNew(vlc_object_t *parent,
> input_thread_t *input, cachename = NULL;
>      }
> 
> +    char *cache_option = var_GetNonEmptyString(parent, "stream-cache");

I am not sure if/why this is needed, but in any case, I suspect this does not 
work properly with(in) stream_UrlNew().

> +    if (cache_option != NULL)
> +    {
> +        if (strcmp(cache_option, "none") == 0)
> +            cachename = NULL;
> +        else
> +            cachename = cache_option;
> +    }
> +
>      if (sys->access->pf_readdir != NULL)
>          s->pf_readdir = AStreamReadDir;
>      else
> @@ -391,6 +400,7 @@ stream_t *stream_AccessNew(vlc_object_t *parent,
> input_thread_t *input,
> 
>      if (cachename != NULL)
>          s = stream_FilterChainNew(s, cachename);
> +    free(cache_option);
>      return s;
>  error:
>      free(sys);
> diff --git a/src/input/var.c b/src/input/var.c
> index 47f4b88..a82b16c 100644
> --- a/src/input/var.c
> +++ b/src/input/var.c
> @@ -497,6 +497,7 @@ void input_ConfigVarInit ( input_thread_t *p_input )
>      var_Create( p_input, "access", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
>      var_Create( p_input, "demux", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
>      var_Create( p_input, "stream-filter", VLC_VAR_STRING |
> VLC_VAR_DOINHERIT ); +    var_Create( p_input, "stream-cache",
> VLC_VAR_STRING | VLC_VAR_DOINHERIT );
> 
>      /* Meta */
>      var_Create( p_input, "meta-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT
> ); diff --git a/src/libvlc-module.c b/src/libvlc-module.c
> index a13093d..0e95ae5 100644
> --- a/src/libvlc-module.c
> +++ b/src/libvlc-module.c
> @@ -988,6 +988,10 @@ static const char *const ppsz_prefres[] = {
>  #define STREAM_FILTER_LONGTEXT N_( \
>      "Stream filters are used to modify the stream that is being read. " )
> 
> +#define STREAM_CACHE_TEXT N_("Stream cache filter module")
> +#define STREAM_CACHE_LONGTEXT N_( \
> +    "Stream cache filters are used to cache the stream that is being read.
> " ) +
>  #define DEMUX_TEXT N_("Demux module")
>  #define DEMUX_LONGTEXT N_( \
>      "Demultiplexers are used to separate the \"elementary\" streams " \
> @@ -1871,6 +1875,8 @@ vlc_module_begin ()
>      set_subcategory( SUBCAT_INPUT_STREAM_FILTER )
>      add_module_list( "stream-filter", "stream_filter", NULL,
>                       STREAM_FILTER_TEXT, STREAM_FILTER_LONGTEXT, false )
> +    add_module_list( "stream-cache", "stream_cache", NULL,
> +                     STREAM_CACHE_TEXT, STREAM_CACHE_LONGTEXT, false )
> 
> 
>  /* Stream output options */

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



More information about the vlc-devel mailing list