[vlc-devel] [PATCH] add controls tweaking modules
Rémi Denis-Courmont
remi at remlab.net
Mon Jul 20 12:21:07 CEST 2015
Le 2015-07-17 22:18, Francois Cartegnie a écrit :
> Because we have too many access/demux misbehaving with
> seekable and non seekable cases, some developers only
> options could be really useful.
>
> module built only using invisible configure option
> --enable-devtools
> ---
> configure.ac | 6 ++
> modules/stream_filter/Makefile.am | 5 ++
> modules/stream_filter/tweakcontrols.c | 107
> ++++++++++++++++++++++++++++++++++
> 3 files changed, 118 insertions(+)
> create mode 100644 modules/stream_filter/tweakcontrols.c
>
> diff --git a/configure.ac b/configure.ac
> index b82f197..0dee8c5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -897,6 +897,12 @@ AS_IF([test "${enable_debug}" != "no"], [
> ])
>
> dnl
> +dnl Developers helper modules
> +dnl
> +AC_ARG_ENABLE(DEVTOOLS)
> +AM_CONDITIONAL(DEVTOOLS, [test "$enable_devtools" = "yes"])
IMHO, either there is no option at all, or there is a
disabled-by-default option.
> +
> +dnl
> dnl Profiling
> dnl
> AC_ARG_ENABLE(gprof,
> diff --git a/modules/stream_filter/Makefile.am
> b/modules/stream_filter/Makefile.am
> index bab3ddb..8192f0c 100644
> --- a/modules/stream_filter/Makefile.am
> +++ b/modules/stream_filter/Makefile.am
> @@ -36,3 +36,8 @@ libaribcam_plugin_la_LDFLAGS = $(AM_LDFLAGS)
> $(ARIBB25_LDFLAGS) -rpath '$(stream
> libaribcam_plugin_la_LIBADD = $(ARIBB25_LIBS)
> stream_filter_LTLIBRARIES += $(LTLIBaribcam)
> EXTRA_LTLIBRARIES += libaribcam_plugin.la
> +
> +libtweakcontrols_plugin_la_SOURCES = stream_filter/tweakcontrols.c
> +if DEVTOOLS
> +stream_filter_LTLIBRARIES += libtweakcontrols_plugin.la
> +endif
> diff --git a/modules/stream_filter/tweakcontrols.c
> b/modules/stream_filter/tweakcontrols.c
> new file mode 100644
> index 0000000..6b6f0b2
> --- /dev/null
> +++ b/modules/stream_filter/tweakcontrols.c
> @@ -0,0 +1,107 @@
>
> +/*****************************************************************************
> + * tweakcontrols.c Access controls tweaking debug stream filter
> +
>
> *****************************************************************************
> + * Copyright (C) 2015 VideoLAN Authors
> + *
> + * This program is free software; you can redistribute it and/or
> modify it
> + * under the terms of the GNU Lesser General Public License as
> published by
> + * the Free Software Foundation; either version 2.1 of the License,
> or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> License
> + * along with this program; if not, write to the Free Software
> Foundation,
> + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> +
>
> *****************************************************************************/
> +
>
> +/*****************************************************************************
> + * Preamble
> +
>
> *****************************************************************************/
> +#ifdef HAVE_CONFIG_H
> +# include "config.h"
> +#endif
> +
> +#include <vlc_common.h>
> +#include <vlc_plugin.h>
> +#include <vlc_stream.h>
> +
> +static int Open(vlc_object_t *);
> +static void Close(vlc_object_t *);
> +
> +vlc_module_begin ()
set_shortname
> + set_category (CAT_INPUT)
> + set_subcategory (SUBCAT_INPUT_STREAM_FILTER)
> + set_capability ("stream_filter", 0)
> + add_shortcut("tweakcontrols")
> + set_description ("Access controls tweaking debug stream filter")
Makes no sense.
> + set_callbacks (Open, Close)
> +
> + add_bool ("seek", true, "CAN_SEEK", NULL, false)
change_volatile
And "CAN_SEEK" is no help text.
> + add_bool ("fastseek", true, "CAN_FASTSEEK", NULL, false)
Ditto
> +vlc_module_end ()
> +
> +struct stream_sys_t
> +{
> + bool b_seek;
> + bool b_fastseek;
> +};
> +
> +/**
> + *
> + */
> +static int Control( stream_t *p_stream, int i_query, va_list args )
> +{
> + stream_sys_t *p_sys = p_stream->p_sys;
> +
> + switch( i_query )
> + {
> + case STREAM_CAN_FASTSEEK:
> + if( !p_sys->b_fastseek )
> + return VLC_EGENERIC;
The customs says to set the value to false and return VLC_SUCCESS.
(I am aware that returning VLC_SUCCESS/VLC_EGENERIC would be simpler,
but that is not for this patch to change.)
> + break;
> + case STREAM_CAN_SEEK:
Ditto.
> + case STREAM_SET_POSITION:
> + if( !p_sys->b_seek )
> + return VLC_EGENERIC;
> + // ft
> + default:
> + break;
> + }
> +
> + return stream_vaControl( p_stream->p_source, i_query, args );
> +}
> +
> +static int Read( stream_t *s, void *buffer, unsigned i_read )
> +{
> + return s->p_source->pf_read( s->p_source, buffer, i_read );
stream_Read
> +}
> +
> +static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned
> i_peek )
> +{
> + return s->p_source->pf_peek( s->p_source, pp_peek, i_peek );
stream_Peek
> +}
> +
> +static int Open( vlc_object_t *p_object )
> +{
> + stream_t *p_stream = (stream_t *) p_object;
> +
> + stream_sys_t *p_sys = p_stream->p_sys = calloc( 1,
> sizeof(*p_sys) );
malloc
> + if (p_sys == NULL)
unlikely
> + return VLC_ENOMEM;
> +
> + p_stream->pf_read = Read;
> + p_stream->pf_peek = Peek;
> + p_stream->pf_control = Control;
> +
> + return VLC_SUCCESS;
> +}
> +
> +static void Close ( vlc_object_t *p_object )
> +{
> + stream_t *p_stream = (stream_t *)p_object;
> + free( p_stream->p_sys );
> +}
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list