[FFmpeg-devel] [PATCH 2/8] ffserver: Implement lua config file reader

Michael Niedermayer michael at niedermayer.cc
Tue May 29 00:56:30 EEST 2018


On Mon, May 28, 2018 at 08:18:53PM +0200, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes <klaxa1337 at googlemail.com>
> ---
>  configreader.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  configreader.h |  47 ++++++++++++
>  2 files changed, 282 insertions(+)
>  create mode 100644 configreader.c
>  create mode 100644 configreader.h
> 
> diff --git a/configreader.c b/configreader.c
> new file mode 100644
> index 0000000..3580fc5
> --- /dev/null
> +++ b/configreader.c
> @@ -0,0 +1,235 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg 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.
> + *
> + * FFmpeg 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 FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#include "configreader.h"
> +#include "httpd.h"
> +#include <stdio.h>
> +#include <string.h>
> +#include <lua.h>
> +#include <lauxlib.h>
> +#include <lualib.h>
> +
> +#include <libavutil/mem.h>
> +#include <libavutil/error.h>
> +
> +const char *stream_format_names[] = { "mkv" };
> +
> +static struct HTTPDConfig *parsed_configs = NULL;
> +
> +void stream_free(struct StreamConfig *stream)
> +{
> +    if (stream->stream_name)
> +        av_free(stream->stream_name);
> +    if (stream->input_uri)
> +        av_free(stream->input_uri);
> +    if (stream->formats)
> +        av_free(stream->formats);

the null checks arent needed
also av_freep() may be better as it does not leave the freed pointer but
replaces with with NULL


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180528/c791c9c7/attachment.sig>


More information about the ffmpeg-devel mailing list