diff --git a/test/Makefile.am b/test/Makefile.am index 1d2f30a3b73afd6cff73cb8c4af85479332d00fb..afb18d2913d824e9f5367dbcc2095480abb7a539 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -138,7 +138,8 @@ FORCE: .PHONY: FORCE -libvlc_demux_run_la_SOURCES = src/input/demux-run.c src/input/demux-run.h +libvlc_demux_run_la_SOURCES = src/input/demux-run.c src/input/demux-run.h \ + src/input/common.c src/input/common.h libvlc_demux_run_la_CPPFLAGS = $(AM_CPPFLAGS) \ -DTOP_BUILDDIR=\"$$(cd "$(top_builddir)"; pwd)\" \ -DTOP_SRCDIR=\"$$(cd "$(top_srcdir)"; pwd)\" diff --git a/test/src/input/common.c b/test/src/input/common.c new file mode 100644 index 0000000000000000000000000000000000000000..4f9d3d0aaa45b6528421c7b4356aa8d8f27e4dda --- /dev/null +++ b/test/src/input/common.c @@ -0,0 +1,42 @@ +/***************************************************************************** + * common.c + ***************************************************************************** + * Copyright (C) 2017 VLC authors and VideoLAN + * + * 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. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "../lib/libvlc_internal.h" + +#include "common.h" + +libvlc_instance_t *libvlc_create(void) +{ +#ifdef TOP_BUILDDIR +# ifndef HAVE_STATIC_MODULES + setenv("VLC_PLUGIN_PATH", TOP_BUILDDIR"/modules", 1); +# endif + setenv("VLC_DATA_PATH", TOP_SRCDIR"/share", 1); +#endif + + libvlc_instance_t *vlc = libvlc_new(0, NULL); + if (vlc == NULL) + fprintf(stderr, "Error: cannot initialize LibVLC.\n"); + return vlc; +} diff --git a/test/src/input/common.h b/test/src/input/common.h new file mode 100644 index 0000000000000000000000000000000000000000..79e3378a4ac51e6aacfaba135e2e228c8ee019e8 --- /dev/null +++ b/test/src/input/common.h @@ -0,0 +1,29 @@ +/***************************************************************************** + * common.h + ***************************************************************************** + * Copyright (C) 2017 VLC authors and VideoLAN + * + * 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. + *****************************************************************************/ + +#include + +#if 0 +#define debug(...) printf(__VA_ARGS__) +#else +#define debug(...) (void)0 +#endif + +libvlc_instance_t *libvlc_create(void); diff --git a/test/src/input/demux-run.c b/test/src/input/demux-run.c index 70f6cc3eece3d215e4842a9f25d27dc246ec46b8..3b9f1fdb97b1146bc9fb347c7f54ed29151a1667 100644 --- a/test/src/input/demux-run.c +++ b/test/src/input/demux-run.c @@ -46,12 +46,6 @@ #include "demux-run.h" -#if 0 -#define debug(...) printf(__VA_ARGS__) -#else -#define debug(...) (void)0 -#endif - struct test_es_out_t { struct es_out_t out; @@ -230,26 +224,6 @@ static int demux_process_stream(const char *name, stream_t *s) return val == VLC_DEMUXER_EOF ? 0 : -1; } -static libvlc_instance_t *libvlc_create(void) -{ - const char *argv[] = { - NULL - }; - unsigned argc = (sizeof (argv) / sizeof (*argv)) - 1; - -#ifdef TOP_BUILDDIR -# ifndef HAVE_STATIC_MODULES - setenv("VLC_PLUGIN_PATH", TOP_BUILDDIR"/modules", 1); -# endif - setenv("VLC_DATA_PATH", TOP_SRCDIR"/share", 1); -#endif - - libvlc_instance_t *vlc = libvlc_new(argc, argv); - if (vlc == NULL) - fprintf(stderr, "Error: cannot initialize LibVLC.\n"); - return vlc; -} - int vlc_demux_process_url(const char *demux, const char *url) { libvlc_instance_t *vlc = libvlc_create(); diff --git a/test/src/input/demux-run.h b/test/src/input/demux-run.h index e4c10f4f072e98e417e4cdbef3c4d1aa67234e4a..b9b8bac4d451355d5f48efb0d435f2c40af3d68f 100644 --- a/test/src/input/demux-run.h +++ b/test/src/input/demux-run.h @@ -24,6 +24,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#include "common.h" int vlc_demux_process_url(const char *demux, const char *url); int vlc_demux_process_path(const char *demux, const char *path);