diff --git a/src/audio/audio_capture.c b/src/audio/audio_capture.c index 100624ae5..c50711eb9 100644 --- a/src/audio/audio_capture.c +++ b/src/audio/audio_capture.c @@ -52,30 +52,13 @@ #include "audio/audio_capture.h" #include "audio/audio.h" -#include "audio/capture/coreaudio.h" -#include "audio/capture/none.h" #include "audio/capture/sdi.h" -#include "audio/capture/testcard.h" /* vidcap flags */ #include "video_capture.h" #include "lib_common.h" -static void init_static_acap() __attribute__((constructor)); -static void init_static_acap() { -#ifndef UV_IN_YURI - register_library("embedded", &acap_sdi_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); - register_library("AESEBU", &acap_sdi_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); - register_library("analog", &acap_sdi_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); -#if defined HAVE_COREAUDIO - register_library("coreaudio", &acap_coreaudio_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); -#endif - register_library("testcard", &acap_testcard_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); -#endif - register_library("none", &acap_none_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); -}; - struct state_audio_capture { char name[128]; const struct audio_capture_info *funcs; diff --git a/src/audio/audio_playback.c b/src/audio/audio_playback.c index a6cbe4163..4cba75c86 100644 --- a/src/audio/audio_playback.c +++ b/src/audio/audio_playback.c @@ -49,9 +49,6 @@ #include "audio/audio.h" #include "audio/audio_playback.h" -#include "audio/playback/coreaudio.h" -#include "audio/playback/dummy.h" -#include "audio/playback/none.h" #include "audio/playback/sdi.h" #include "lib_common.h" @@ -64,20 +61,6 @@ struct state_audio_playback { void *state; }; -static void init_static_aplay() __attribute__((constructor)); -static void init_static_aplay() { -#ifndef UV_IN_YURI - register_library("embedded", &aplay_sdi_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); - register_library("AESEBU", &aplay_sdi_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); - register_library("analog", &aplay_sdi_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -#if defined HAVE_COREAUDIO - register_library("coreaudio", &aplay_coreaudio_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -#endif - register_library("dummy", &aplay_dummy_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -#endif - register_library("none", &aplay_none_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -}; - void audio_playback_help() { printf("Available audio playback devices:\n"); diff --git a/src/audio/capture/alsa.c b/src/audio/capture/alsa.c index bd6e1ad1c..3c952abd9 100644 --- a/src/audio/capture/alsa.c +++ b/src/audio/capture/alsa.c @@ -395,11 +395,6 @@ static const struct audio_capture_info acap_alsa_info = { audio_cap_alsa_done }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("alsa", &acap_alsa_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(alsa, &acap_alsa_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); #endif /* HAVE_ALSA */ diff --git a/src/audio/capture/coreaudio.c b/src/audio/capture/coreaudio.c index d40da7b96..d202ea3c1 100644 --- a/src/audio/capture/coreaudio.c +++ b/src/audio/capture/coreaudio.c @@ -43,9 +43,9 @@ #include "audio/audio.h" #include "audio/audio_capture.h" #include "audio/utils.h" -#include "audio/capture/coreaudio.h" #include "utils/ring_buffer.h" #include "debug.h" +#include "lib_common.h" #include #include #include @@ -493,13 +493,14 @@ static void audio_cap_ca_done(void *state) free(s); } -const struct audio_capture_info acap_coreaudio_info = { +static const struct audio_capture_info acap_coreaudio_info = { audio_cap_ca_help, audio_cap_ca_init, audio_cap_ca_read, audio_cap_ca_done }; +MODULE_REGISTER(coreaudio, &acap_coreaudio_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); #endif /* HAVE_COREAUDIO */ diff --git a/src/audio/capture/coreaudio.h b/src/audio/capture/coreaudio.h deleted file mode 100644 index 73684ff20..000000000 --- a/src/audio/capture/coreaudio.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * FILE: audio/capture/coreaudio.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -struct audio_capture_info; -extern const struct audio_capture_info acap_coreaudio_info; - diff --git a/src/audio/capture/jack.c b/src/audio/capture/jack.c index c04684573..417941b6a 100644 --- a/src/audio/capture/jack.c +++ b/src/audio/capture/jack.c @@ -283,10 +283,5 @@ static const struct audio_capture_info acap_jack_info = { audio_cap_jack_done }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("jack", &acap_jack_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(jack, &acap_jack_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); diff --git a/src/audio/capture/none.c b/src/audio/capture/none.c index 215f63b8e..f3ccf3934 100644 --- a/src/audio/capture/none.c +++ b/src/audio/capture/none.c @@ -52,9 +52,8 @@ #endif #include "audio/audio_capture.h" -#include "audio/capture/none.h" - #include "debug.h" +#include "lib_common.h" #include #include #include @@ -95,10 +94,12 @@ static void audio_cap_none_done(void *state) free(s); } -const struct audio_capture_info acap_none_info = { +static const struct audio_capture_info acap_none_info = { audio_cap_none_help, audio_cap_none_init, audio_cap_none_read, audio_cap_none_done }; +REGISTER_MODULE(none, &acap_none_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); + diff --git a/src/audio/capture/none.h b/src/audio/capture/none.h deleted file mode 100644 index fe12e29b9..000000000 --- a/src/audio/capture/none.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * FILE: audio/capture/none.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -struct audio_capture_info; -extern const struct audio_capture_info acap_none_info; - diff --git a/src/audio/capture/portaudio.c b/src/audio/capture/portaudio.c index ffe994c09..5b8e694b9 100644 --- a/src/audio/capture/portaudio.c +++ b/src/audio/capture/portaudio.c @@ -370,10 +370,5 @@ static const struct audio_capture_info acap_portaudio_info = { audio_cap_portaudio_done }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("portaudio", &acap_portaudio_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(portaudio, &acap_portaudio_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); diff --git a/src/audio/capture/sdi.cpp b/src/audio/capture/sdi.cpp index d0be71c76..25ea59029 100644 --- a/src/audio/capture/sdi.cpp +++ b/src/audio/capture/sdi.cpp @@ -48,6 +48,7 @@ #include "compat/platform_semaphore.h" #include "debug.h" #include "host.h" +#include "lib_common.h" #include #include @@ -172,11 +173,15 @@ void sdi_capture_new_incoming_frame(void *state, struct audio_frame *frame) } -const struct audio_capture_info acap_sdi_info = { +static const struct audio_capture_info acap_sdi_info = { audio_cap_sdi_help, audio_cap_sdi_init, audio_cap_sdi_read, audio_cap_sdi_done }; +REGISTER_MODULE(embedded, &acap_sdi_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); +REGISTER_MODULE(AESEBU, &acap_sdi_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); +REGISTER_MODULE(analog, &acap_sdi_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); + /* vim: set expandtab: sw=8 */ diff --git a/src/audio/capture/sdi.h b/src/audio/capture/sdi.h index 28982ceff..0f2453498 100644 --- a/src/audio/capture/sdi.h +++ b/src/audio/capture/sdi.h @@ -46,9 +46,6 @@ * */ -struct audio_capture_info; -extern const struct audio_capture_info acap_sdi_info; - #ifdef __cplusplus extern "C" { #endif diff --git a/src/audio/capture/testcard.cpp b/src/audio/capture/testcard.cpp index ce6686ee4..12fdbaba3 100644 --- a/src/audio/capture/testcard.cpp +++ b/src/audio/capture/testcard.cpp @@ -44,14 +44,12 @@ #endif #include "audio/audio_capture.h" -#include "audio/capture/testcard.h" - #include "audio/audio.h" - #include "audio/utils.h" #include "audio/wav_reader.h" #include "debug.h" #include "host.h" +#include "lib_common.h" #include #include @@ -282,10 +280,12 @@ static void audio_cap_testcard_done(void *state) delete s; } -const struct audio_capture_info acap_testcard_info = { +static const struct audio_capture_info acap_testcard_info = { audio_cap_testcard_help, audio_cap_testcard_init, audio_cap_testcard_read, audio_cap_testcard_done }; +REGISTER_MODULE(testcard, &acap_testcard_info, LIBRARY_CLASS_AUDIO_CAPTURE, AUDIO_CAPTURE_ABI_VERSION); + diff --git a/src/audio/capture/testcard.h b/src/audio/capture/testcard.h deleted file mode 100644 index d262ff306..000000000 --- a/src/audio/capture/testcard.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * FILE: audio/capture/testcard.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -struct audio_capture_info; -extern const struct audio_capture_info acap_testcard_info; - diff --git a/src/audio/playback/alsa.c b/src/audio/playback/alsa.c index f5c943a52..f52ee1124 100644 --- a/src/audio/playback/alsa.c +++ b/src/audio/playback/alsa.c @@ -589,11 +589,6 @@ static const struct audio_playback_info aplay_alsa_info = { audio_play_alsa_done }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("alsa", &aplay_alsa_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -} +REGISTER_MODULE(alsa, &aplay_alsa_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); #endif /* HAVE_ALSA */ diff --git a/src/audio/playback/coreaudio.cpp b/src/audio/playback/coreaudio.cpp index b1b4f5981..3dc534e5d 100644 --- a/src/audio/playback/coreaudio.cpp +++ b/src/audio/playback/coreaudio.cpp @@ -41,9 +41,9 @@ #include "audio/audio.h" #include "audio/audio_playback.h" -#include "audio/playback/coreaudio.h" #include "utils/ring_buffer.h" #include "debug.h" +#include "lib_common.h" #include #include #include @@ -347,7 +347,7 @@ static void audio_play_ca_done(void *state) delete s; } -const struct audio_playback_info aplay_coreaudio_info = { +static const struct audio_playback_info aplay_coreaudio_info = { audio_play_ca_help, audio_play_ca_init, audio_play_ca_put_frame, @@ -356,5 +356,7 @@ const struct audio_playback_info aplay_coreaudio_info = { audio_play_ca_done }; +REGISTER_MODULE(coreaudio, &aplay_coreaudio_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); + #endif /* HAVE_COREAUDIO */ diff --git a/src/audio/playback/coreaudio.h b/src/audio/playback/coreaudio.h deleted file mode 100644 index 2f136c7af..000000000 --- a/src/audio/playback/coreaudio.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * FILE: audio/playback/coreaudio.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -struct audio_playback_info; -extern const struct audio_playback_info aplay_coreaudio_info; - diff --git a/src/audio/playback/decklink.cpp b/src/audio/playback/decklink.cpp index c48dc3a6b..90eaff132 100644 --- a/src/audio/playback/decklink.cpp +++ b/src/audio/playback/decklink.cpp @@ -567,11 +567,5 @@ static const struct audio_playback_info aplay_decklink_info = { audio_play_decklink_done }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("decklink", &aplay_decklink_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -} - +REGISTER_MODULE(decklink, &aplay_decklink_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); diff --git a/src/audio/playback/dummy.cpp b/src/audio/playback/dummy.cpp index 430f470bd..757228872 100644 --- a/src/audio/playback/dummy.cpp +++ b/src/audio/playback/dummy.cpp @@ -43,7 +43,7 @@ #include "audio/audio.h" #include "audio/audio_playback.h" -#include "audio/playback/dummy.h" +#include "lib_common.h" static int state; @@ -75,7 +75,7 @@ static int audio_play_dummy_reconfigure(void *, struct audio_desc) return TRUE; } -const struct audio_playback_info aplay_dummy_info = { +static const struct audio_playback_info aplay_dummy_info = { audio_play_dummy_help, audio_play_dummy_init, audio_play_dummy_put_frame, @@ -84,3 +84,5 @@ const struct audio_playback_info aplay_dummy_info = { audio_play_dummy_done }; +REGISTER_MODULE(dummy, &aplay_dummy_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); + diff --git a/src/audio/playback/dummy.h b/src/audio/playback/dummy.h deleted file mode 100644 index 4a3619e81..000000000 --- a/src/audio/playback/dummy.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file audio/playback/dummy.h - * @author Martin Pulec - */ -/* - * Copyright (c) 2015 CESNET, z. s. p. o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -struct audio_playback_info; -extern const struct audio_playback_info aplay_dummy_info; - diff --git a/src/audio/playback/jack.c b/src/audio/playback/jack.c index 278a76a76..d919a7ad6 100644 --- a/src/audio/playback/jack.c +++ b/src/audio/playback/jack.c @@ -350,11 +350,5 @@ static const struct audio_playback_info aplay_jack_info = { audio_play_jack_done }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("jack", &aplay_jack_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -} - +REGISTER_MODULE(jack, &aplay_jack_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); diff --git a/src/audio/playback/none.c b/src/audio/playback/none.c index cd0547aa8..01c61c936 100644 --- a/src/audio/playback/none.c +++ b/src/audio/playback/none.c @@ -54,8 +54,8 @@ #include "audio/audio.h" #include "audio/audio_playback.h" -#include "audio/playback/none.h" #include "debug.h" +#include "lib_common.h" #include #include @@ -116,7 +116,7 @@ static int audio_play_none_reconfigure(void *state, struct audio_desc desc) return TRUE; } -const struct audio_playback_info aplay_none_info = { +static const struct audio_playback_info aplay_none_info = { audio_play_none_help, audio_play_none_init, audio_play_none_put_frame, @@ -125,3 +125,5 @@ const struct audio_playback_info aplay_none_info = { audio_play_none_done }; +REGISTER_MODULE(none, &aplay_none_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); + diff --git a/src/audio/playback/none.h b/src/audio/playback/none.h deleted file mode 100644 index a92bb5a45..000000000 --- a/src/audio/playback/none.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * FILE: audio/playback/none.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -struct audio_playback_info; -extern const struct audio_playback_info aplay_none_info; - diff --git a/src/audio/playback/portaudio.cpp b/src/audio/playback/portaudio.cpp index cc464fde9..8d088b71b 100644 --- a/src/audio/playback/portaudio.cpp +++ b/src/audio/playback/portaudio.cpp @@ -441,11 +441,5 @@ static const struct audio_playback_info aplay_portaudio_info = { audio_play_portaudio_done }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("portaudio", &aplay_portaudio_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); -} - +REGISTER_MODULE(portaudio, &aplay_portaudio_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); diff --git a/src/audio/playback/sdi.c b/src/audio/playback/sdi.c index c1434d65b..230dd0fe3 100644 --- a/src/audio/playback/sdi.c +++ b/src/audio/playback/sdi.c @@ -56,6 +56,7 @@ #include "audio/audio_playback.h" #include "audio/playback/sdi.h" #include "debug.h" +#include "lib_common.h" #include "video_display.h" #include @@ -145,7 +146,7 @@ static void audio_play_sdi_done(void *s) UNUSED(s); } -const struct audio_playback_info aplay_sdi_info = { +static const struct audio_playback_info aplay_sdi_info = { audio_play_sdi_help, audio_play_sdi_init, audio_play_sdi_put_frame, @@ -154,6 +155,10 @@ const struct audio_playback_info aplay_sdi_info = { audio_play_sdi_done }; +REGISTER_MODULE(embedded, &aplay_sdi_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); +REGISTER_MODULE(AESEBU, &aplay_sdi_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); +REGISTER_MODULE(analog, &aplay_sdi_info, LIBRARY_CLASS_AUDIO_PLAYBACK, AUDIO_PLAYBACK_ABI_VERSION); + /* vim: set expandtab: sw=8 */ diff --git a/src/audio/playback/sdi.h b/src/audio/playback/sdi.h index c172dc612..d3e158b8a 100644 --- a/src/audio/playback/sdi.h +++ b/src/audio/playback/sdi.h @@ -55,9 +55,6 @@ void sdi_register_display_callbacks(void *state, void *udata, void (*putf)(void int (*get_property)(void *, int, void *, size_t *) ); -struct audio_playback_info; -extern const struct audio_playback_info aplay_sdi_info; - #ifdef __cplusplus } #endif diff --git a/src/capture_filter.cpp b/src/capture_filter.cpp index de28d698c..f6617b751 100644 --- a/src/capture_filter.cpp +++ b/src/capture_filter.cpp @@ -50,24 +50,10 @@ #include "utils/list.h" #include "video.h" -#include "capture_filter/blank.h" -#include "capture_filter/every.h" -#include "capture_filter/logo.h" -#include "capture_filter/none.h" -#include "capture_filter/scale.h" - #include using namespace std; -static void init_capture_filters() __attribute__((constructor)); -static void init_capture_filters() { - register_library("every", &capture_filter_every, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); - register_library("logo", &capture_filter_logo, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); - register_library("none", &capture_filter_none, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); - register_library("scale", &capture_filter_scale, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); -}; - struct capture_filter { struct module mod; struct simple_linked_list *filters; diff --git a/src/capture_filter/blank.cpp b/src/capture_filter/blank.cpp index eda4c755b..2271f922f 100644 --- a/src/capture_filter/blank.cpp +++ b/src/capture_filter/blank.cpp @@ -289,17 +289,12 @@ static struct video_frame *filter(void *state, struct video_frame *in) return in; } -struct capture_filter_info capture_filter_blank = { +static const struct capture_filter_info capture_filter_blank = { .name = "blank", .init = init, .done = done, .filter = filter, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("capture_filter_blank", &capture_filter_blank, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); -} +REGISTER_MODULE(blank, &capture_filter_blank, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); diff --git a/src/capture_filter/blank.h b/src/capture_filter/blank.h deleted file mode 100644 index 5a6b61ff6..000000000 --- a/src/capture_filter/blank.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * FILE: capture_filter/blank.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -#ifndef CAPTURE_FILTER_BLANK_H_ -#define CAPTURE_FILTER_BLANK_H_ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#include "config_win32.h" -#include "config_unix.h" -#endif // HAVE_CONFIG_H - -struct capture_filter_info; -extern struct capture_filter_info capture_filter_blank; - -#endif // CAPTURE_FILTER_BLANK_H_ diff --git a/src/capture_filter/every.c b/src/capture_filter/every.c index 83e9f26eb..a2fa5638e 100644 --- a/src/capture_filter/every.c +++ b/src/capture_filter/every.c @@ -55,6 +55,7 @@ #include "capture_filter.h" #include "debug.h" +#include "lib_common.h" #include "video.h" #include "video_codec.h" @@ -139,10 +140,12 @@ static struct video_frame *filter(void *state, struct video_frame *in) } } -struct capture_filter_info capture_filter_every = { +static const struct capture_filter_info capture_filter_every = { .name = "every", .init = init, .done = done, .filter = filter, }; +REGISTER_MODULE(every, &capture_filter_every, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); + diff --git a/src/capture_filter/every.h b/src/capture_filter/every.h deleted file mode 100644 index 1b570a7bb..000000000 --- a/src/capture_filter/every.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * FILE: capture_filter/every.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -#ifndef CAPTURE_FILTER_EVERY_H_ -#define CAPTURE_FILTER_EVERY_H_ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#include "config_win32.h" -#include "config_unix.h" -#endif // HAVE_CONFIG_H - -struct capture_filter_info; -extern struct capture_filter_info capture_filter_every; - -#endif // CAPTURE_FILTER_EVERY_H_ diff --git a/src/capture_filter/logo.cpp b/src/capture_filter/logo.cpp index dc7c0a204..6b8c8b9ac 100644 --- a/src/capture_filter/logo.cpp +++ b/src/capture_filter/logo.cpp @@ -45,9 +45,8 @@ #include #include "capture_filter.h" - #include "debug.h" - +#include "lib_common.h" #include "video.h" #include "video_codec.h" @@ -251,10 +250,12 @@ static struct video_frame *filter(void *state, struct video_frame *in) return in; } -struct capture_filter_info capture_filter_logo = { +static const struct capture_filter_info capture_filter_logo = { "logo", init, done, filter, }; +REGISTER_MODULE(logo, &capture_filter_logo, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); + diff --git a/src/capture_filter/logo.h b/src/capture_filter/logo.h deleted file mode 100644 index e059e5d6e..000000000 --- a/src/capture_filter/logo.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file capture_filter/logo.h - * @author Martin Pulec - */ -/* - * Copyright (c) 2013 CESNET z.s.p.o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#ifndef CAPTURE_FILTER_LOGO_H_ -#define CAPTURE_FILTER_LOGO_H_ - -struct capture_filter_info; -extern struct capture_filter_info capture_filter_logo; - -#endif // CAPTURE_FILTER_LOGO_H_ - diff --git a/src/capture_filter/none.c b/src/capture_filter/none.c index 9ef30551a..37f1b1e75 100644 --- a/src/capture_filter/none.c +++ b/src/capture_filter/none.c @@ -42,9 +42,8 @@ #endif /* HAVE_CONFIG_H */ #include "capture_filter.h" - #include "debug.h" - +#include "lib_common.h" #include "video.h" #include "video_codec.h" @@ -77,10 +76,12 @@ static struct video_frame *filter(void *state, struct video_frame *in) return in; } -struct capture_filter_info capture_filter_none = { +static const struct capture_filter_info capture_filter_none = { .name = "none", .init = init, .done = done, .filter = filter, }; +REGISTER_MODULE(none, &capture_filter_none, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); + diff --git a/src/capture_filter/none.h b/src/capture_filter/none.h deleted file mode 100644 index 5f69fce0a..000000000 --- a/src/capture_filter/none.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file capture_filter/none.h - * @author Martin Pulec - * Copyright (c) 2005-2010 CESNET z.s.p.o. - */ -/* - * Copyright (c) 2013 CESNET z.s.p.o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CAPTURE_FILTER_NONE_H_ -#define CAPTURE_FILTER_NONE_H_ - -struct capture_filter_info; -extern struct capture_filter_info capture_filter_none; - -#endif // CAPTURE_FILTER_NONE_H_ diff --git a/src/capture_filter/resize.cpp b/src/capture_filter/resize.cpp index 18aeb3a6d..5f198f76f 100644 --- a/src/capture_filter/resize.cpp +++ b/src/capture_filter/resize.cpp @@ -190,11 +190,6 @@ static struct capture_filter_info capture_filter_resize = { } #endif -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("capture_filter_resize", &capture_filter_resize, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); -} +REGISTER_MODULE(resize, &capture_filter_resize, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); /* vim: set expandtab: sw=4 */ diff --git a/src/capture_filter/scale.c b/src/capture_filter/scale.c index ef143b08e..d61dd4fb6 100644 --- a/src/capture_filter/scale.c +++ b/src/capture_filter/scale.c @@ -53,9 +53,8 @@ #endif /* HAVE_CONFIG_H */ #include "capture_filter.h" - #include "debug.h" - +#include "lib_common.h" #include "video.h" #include "video_codec.h" #include "utils/video_frame_pool.h" @@ -120,10 +119,12 @@ static struct video_frame *filter(void *state, struct video_frame *in_frame) return s->frame; } -struct capture_filter_info capture_filter_scale = { +static const struct capture_filter_info capture_filter_scale = { .name = "scale", .init = init, .done = done, .filter = filter, }; +REGISTER_MODULE(scale, &capture_filter_scale, LIBRARY_CLASS_CAPTURE_FILTER, CAPTURE_FILTER_ABI_VERSION); + diff --git a/src/capture_filter/scale.h b/src/capture_filter/scale.h deleted file mode 100644 index aedff3790..000000000 --- a/src/capture_filter/scale.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * FILE: capture_filter/every.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -#ifndef CAPTURE_FILTER_SCALE_H_ -#define CAPTURE_FILTER_SCALE_H_ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#include "config_win32.h" -#include "config_unix.h" -#endif // HAVE_CONFIG_H - -struct capture_filter_info; -extern struct capture_filter_info capture_filter_scale; - -#endif // CAPTURE_FILTER_SCALE_H_ - diff --git a/src/crypto/openssl_decrypt.cpp b/src/crypto/openssl_decrypt.cpp index 3f0c63b79..ec01d579b 100644 --- a/src/crypto/openssl_decrypt.cpp +++ b/src/crypto/openssl_decrypt.cpp @@ -163,16 +163,11 @@ static int openssl_decrypt(struct openssl_decrypt *decrypt, return data_len; } -static struct openssl_decrypt_info functions = { +static const struct openssl_decrypt_info functions = { openssl_decrypt_init, openssl_decrypt_destroy, openssl_decrypt, }; -static void init(void) __attribute__((constructor)); - -static void init(void) -{ - register_library("openssl_decrypt", &functions, LIBRARY_CLASS_UNDEFINED, OPENSSL_DECRYPT_ABI_VERSION); -} +REGISTER_MODULE(openssl_decrypt, &functions, LIBRARY_CLASS_UNDEFINED, OPENSSL_DECRYPT_ABI_VERSION); diff --git a/src/crypto/openssl_encrypt.cpp b/src/crypto/openssl_encrypt.cpp index 5c1735521..dad4bdf3c 100644 --- a/src/crypto/openssl_encrypt.cpp +++ b/src/crypto/openssl_encrypt.cpp @@ -164,17 +164,12 @@ static int openssl_get_overhead(struct openssl_encrypt *s) } } -static struct openssl_encrypt_info functions = { +static const struct openssl_encrypt_info functions = { openssl_encrypt_init, openssl_encrypt_destroy, openssl_encrypt, openssl_get_overhead, }; -static void init(void) __attribute__((constructor)); - -static void init(void) -{ - register_library("openssl_encrypt", &functions, LIBRARY_CLASS_UNDEFINED, OPENSSL_ENCRYPT_ABI_VERSION); -} +REGISTER_MODULE(openssl_encrypt, &functions, LIBRARY_CLASS_UNDEFINED, OPENSSL_ENCRYPT_ABI_VERSION); diff --git a/src/lib_common.h b/src/lib_common.h index 53370487a..d9680b785 100644 --- a/src/lib_common.h +++ b/src/lib_common.h @@ -89,5 +89,26 @@ void list_all_modules(); std::map get_libraries_for_class(enum library_class cls, int abi_version); #endif +/** + * @brief Registers module to global modules' registry + * @param name name of the module to be used to load the module (Note that + * it has to be without quotation marks!) + * @param info pointer to structure with the (class specific) info about module + * @param lclass member of @ref library_class + * @param abi ABI version of info parameter, usually defined per class + * in appropriate class header (eg. video_display.h) + * @note + * Mangling of the constructor function name is because some files may define + * multiple modules (eg. audio playback SDI) and without that, function would + * be defined multiple times under the same name. + */ +#define REGISTER_MODULE(name, info, lclass, abi) static void mod_reg_##lclass##_##name(void) __attribute__((constructor));\ +\ +static void mod_reg_##lclass##_##name(void)\ +{\ + register_library(#name, info, lclass, abi);\ +}\ +struct NOT_DEFINED_STRUCT_THAT_SWALLOWS_SEMICOLON + #endif // defined LIB_COMMON_H diff --git a/src/rtp/ldgm_gpu.cpp b/src/rtp/ldgm_gpu.cpp index 8fd847296..e8c3525b9 100644 --- a/src/rtp/ldgm_gpu.cpp +++ b/src/rtp/ldgm_gpu.cpp @@ -6,10 +6,5 @@ static LDGM_session_gpu *new_ldgm_session_gpu() { return new LDGM_session_gpu(); } -static void init(void) __attribute__((constructor)); -static void init(void) -{ - register_library("ldgm_gpu", reinterpret_cast(new_ldgm_session_gpu), LIBRARY_CLASS_UNDEFINED, - LDGM_GPU_API_VERSION); -} +REGISTER_MODULE(ldgm_gpu, reinterpret_cast(new_ldgm_session_gpu), LIBRARY_CLASS_UNDEFINED, LDGM_GPU_API_VERSION); diff --git a/src/video_capture.cpp b/src/video_capture.cpp index 02f503628..9019c31a9 100644 --- a/src/video_capture.cpp +++ b/src/video_capture.cpp @@ -63,11 +63,6 @@ #include "module.h" #include "utils/config_file.h" #include "video_capture.h" -#include "video_capture/aggregate.h" -#include "video_capture/import.h" -#include "video_capture/null.h" -#include "video_capture/switcher.h" -#include "video_capture/ug_input.h" #include @@ -107,17 +102,6 @@ struct vidcap { struct capture_filter *capture_filter; ///< capture_filter_state }; -static void init_static_vidcap() __attribute__((constructor)); -static void init_static_vidcap() { -#ifndef UV_IN_YURI - register_library("aggregate", &vidcap_aggregate_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); - register_library("import", &vidcap_import_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); - register_library("switcher", &vidcap_switcher_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); - register_library("none", &vidcap_null_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); - register_library("ug_input", &vidcap_null_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -#endif -} - /* API for probing capture devices ****************************************************************/ void list_video_capture_devices() { diff --git a/src/video_capture/DirectShowGrabber.cpp b/src/video_capture/DirectShowGrabber.cpp index a576f403c..6357f70a0 100644 --- a/src/video_capture/DirectShowGrabber.cpp +++ b/src/video_capture/DirectShowGrabber.cpp @@ -1295,12 +1295,7 @@ static const struct video_capture_info vidcap_dshow_info = { vidcap_dshow_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("dshow", &vidcap_dshow_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(dshow, &vidcap_dshow_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); /* vim: set noexpandtab: */ diff --git a/src/video_capture/aggregate.c b/src/video_capture/aggregate.c index f408de339..2a5c3d32a 100644 --- a/src/video_capture/aggregate.c +++ b/src/video_capture/aggregate.c @@ -42,12 +42,12 @@ #include "config_win32.h" #include "debug.h" +#include "lib_common.h" #include "video.h" #include "video_capture.h" #include "tv.h" -#include "video_capture/aggregate.h" #include "audio/audio.h" #include @@ -240,10 +240,12 @@ vidcap_aggregate_grab(void *state, struct audio_frame **audio) return s->frame; } -const struct video_capture_info vidcap_aggregate_info = { +static const struct video_capture_info vidcap_aggregate_info = { vidcap_aggregate_probe, vidcap_aggregate_init, vidcap_aggregate_done, vidcap_aggregate_grab, }; +REGISTER_MODULE(aggregate, &vidcap_aggregate_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); + diff --git a/src/video_capture/aggregate.h b/src/video_capture/aggregate.h deleted file mode 100644 index 7192f2374..000000000 --- a/src/video_capture/aggregate.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * FILE: aggregate.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of the CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -struct video_capture_info; -extern const struct video_capture_info vidcap_aggregate_info; - diff --git a/src/video_capture/aja.cpp b/src/video_capture/aja.cpp index 2a4acc209..778dcaf9e 100644 --- a/src/video_capture/aja.cpp +++ b/src/video_capture/aja.cpp @@ -635,10 +635,5 @@ static const struct video_capture_info vidcap_aja_info = { vidcap_aja_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("aja", &vidcap_aja_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(aja, &vidcap_aja_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/avfoundation.mm b/src/video_capture/avfoundation.mm index a23aa1164..c106ad25b 100644 --- a/src/video_capture/avfoundation.mm +++ b/src/video_capture/avfoundation.mm @@ -515,10 +515,5 @@ static const struct video_capture_info vidcap_avfoundation_info = { vidcap_avfoundation_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("avfoundation", &vidcap_avfoundation_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(avfoundation, &vidcap_avfoundation_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/bluefish444.cpp b/src/video_capture/bluefish444.cpp index 0103043a3..dc114f21c 100644 --- a/src/video_capture/bluefish444.cpp +++ b/src/video_capture/bluefish444.cpp @@ -1090,10 +1090,5 @@ static const struct video_capture_info vidcap_bluefish444_info = { vidcap_bluefish444_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("bluefish444", &vidcap_bluefish444_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(bluefish444, &vidcap_bluefish444_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/decklink.cpp b/src/video_capture/decklink.cpp index b8b10d341..63a7035d3 100644 --- a/src/video_capture/decklink.cpp +++ b/src/video_capture/decklink.cpp @@ -1463,11 +1463,6 @@ static const struct video_capture_info vidcap_decklink_info = { vidcap_decklink_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("decklink", &vidcap_decklink_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(decklink, &vidcap_decklink_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); #endif /* HAVE_DECKLINK */ diff --git a/src/video_capture/deltacast.cpp b/src/video_capture/deltacast.cpp index e2bc35359..6fa38793a 100644 --- a/src/video_capture/deltacast.cpp +++ b/src/video_capture/deltacast.cpp @@ -577,10 +577,5 @@ static const struct video_capture_info vidcap_deltacast_info = { vidcap_deltacast_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("deltacast", &vidcap_deltacast_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(deltacast, &vidcap_deltacast_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/deltacast_dvi.cpp b/src/video_capture/deltacast_dvi.cpp index 45a7096dd..24d42cc46 100644 --- a/src/video_capture/deltacast_dvi.cpp +++ b/src/video_capture/deltacast_dvi.cpp @@ -773,10 +773,5 @@ static const struct video_capture_info vidcap_deltacast_dvi_info = { vidcap_deltacast_dvi_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("deltacast_dvi", &vidcap_deltacast_dvi_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(deltacast_dvi, &vidcap_deltacast_dvi_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/dvs.c b/src/video_capture/dvs.c index 83390270c..bedec423d 100644 --- a/src/video_capture/dvs.c +++ b/src/video_capture/dvs.c @@ -651,12 +651,7 @@ static const struct video_capture_info vidcap_dvs_info = { vidcap_dvs_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("dvs", &vidcap_dvs_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(dvs, &vidcap_dvs_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); #endif /* HAVE_DVS */ diff --git a/src/video_capture/import.cpp b/src/video_capture/import.cpp index 326b9dbb7..3176e0993 100644 --- a/src/video_capture/import.cpp +++ b/src/video_capture/import.cpp @@ -43,6 +43,7 @@ #include "debug.h" #include "host.h" +#include "lib_common.h" #include "video.h" #include "video_capture.h" @@ -53,7 +54,6 @@ #include "utils/ring_buffer.h" #include "utils/worker.h" #include "video_export.h" -#include "video_capture/import.h" //#include "audio/audio.h" #include @@ -1254,10 +1254,12 @@ vidcap_import_grab(void *state, struct audio_frame **audio) return ret; } -const struct video_capture_info vidcap_import_info = { +static const struct video_capture_info vidcap_import_info = { vidcap_import_probe, vidcap_import_init, vidcap_import_done, vidcap_import_grab, }; +REGISTER_MODULE(import, &vidcap_import_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); + diff --git a/src/video_capture/import.h b/src/video_capture/import.h deleted file mode 100644 index ab3ffed56..000000000 --- a/src/video_capture/import.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * FILE: import.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2010 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of the CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -struct video_capture_info; -extern const struct video_capture_info vidcap_import_info; - diff --git a/src/video_capture/null.c b/src/video_capture/null.c index 0b2a60d86..86d1d6b14 100644 --- a/src/video_capture/null.c +++ b/src/video_capture/null.c @@ -52,9 +52,9 @@ #include "config_unix.h" #include "config_win32.h" #include "debug.h" +#include "lib_common.h" #include "video.h" #include "video_capture.h" -#include "video_capture/null.h" static int capture_state = 0; @@ -90,10 +90,12 @@ static struct vidcap_type *vidcap_null_probe(bool verbose) return vt; } -const struct video_capture_info vidcap_null_info = { +static const struct video_capture_info vidcap_null_info = { vidcap_null_probe, vidcap_null_init, vidcap_null_done, vidcap_null_grab, }; +REGISTER_MODULE(none, &vidcap_null_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); + diff --git a/src/video_capture/null.h b/src/video_capture/null.h deleted file mode 100644 index 56cff66b3..000000000 --- a/src/video_capture/null.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * FILE: vidcap_null.h - * AUTHOR: Colin Perkins - * - * Copyright (c) 2002 University of Southern California - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by the University of Southern - * California Information Sciences Institute. - * - * 4. Neither the name of the University nor of the Institute may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Revision: 1.3 $ - * $Date: 2009/12/02 10:37:30 $ - * - */ - -struct video_capture_info; -extern const struct video_capture_info vidcap_null_info; - diff --git a/src/video_capture/quicktime.c b/src/video_capture/quicktime.c index 54602a2c8..fd26cc58a 100644 --- a/src/video_capture/quicktime.c +++ b/src/video_capture/quicktime.c @@ -1217,11 +1217,6 @@ static const struct video_capture_info vidcap_quicktime_info = { vidcap_quicktime_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("quicktime", &vidcap_quicktime_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(quicktime, &vidcap_quicktime_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); #endif /* HAVE_MACOSX */ diff --git a/src/video_capture/rtsp.cpp b/src/video_capture/rtsp.cpp index 90f1980e6..c3cd5dc24 100644 --- a/src/video_capture/rtsp.cpp +++ b/src/video_capture/rtsp.cpp @@ -1195,10 +1195,5 @@ static const struct video_capture_info vidcap_rtsp_info = { vidcap_rtsp_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("rtsp", &vidcap_rtsp_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(rtsp, &vidcap_rtsp_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/screen_osx.c b/src/video_capture/screen_osx.c index dae9f6012..5d72bf15d 100644 --- a/src/video_capture/screen_osx.c +++ b/src/video_capture/screen_osx.c @@ -243,10 +243,5 @@ static const struct video_capture_info vidcap_screen_osx_info = { vidcap_screen_osx_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("screen", &vidcap_screen_osx_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(screen, &vidcap_screen_osx_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/screen_x11.c b/src/video_capture/screen_x11.c index 6ed180c65..c0620f4dc 100644 --- a/src/video_capture/screen_x11.c +++ b/src/video_capture/screen_x11.c @@ -426,10 +426,5 @@ static const struct video_capture_info vidcap_screen_x11_info = { vidcap_screen_x11_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("screen", &vidcap_screen_x11_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(screen, &vidcap_screen_x11_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/switcher.c b/src/video_capture/switcher.c index 48905d4bc..b89507538 100644 --- a/src/video_capture/switcher.c +++ b/src/video_capture/switcher.c @@ -40,12 +40,12 @@ #include "config_win32.h" #include "debug.h" +#include "lib_common.h" #include "video.h" #include "video_capture.h" #include "tv.h" -#include "video_capture/switcher.h" #include "audio/audio.h" #include "module.h" @@ -239,10 +239,12 @@ vidcap_switcher_grab(void *state, struct audio_frame **audio) return frame; } -const struct video_capture_info vidcap_switcher_info = { +static const struct video_capture_info vidcap_switcher_info = { vidcap_switcher_probe, vidcap_switcher_init, vidcap_switcher_done, vidcap_switcher_grab, }; +REGISTER_MODULE(switcher, &vidcap_switcher_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); + diff --git a/src/video_capture/switcher.h b/src/video_capture/switcher.h deleted file mode 100644 index 52e0ee765..000000000 --- a/src/video_capture/switcher.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file video_capture/switcher.h - * @author Martin Pulec - */ -/* - * Copyright (c) 2014 CESNET z.s.p.o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -struct video_capture_info; -extern const struct video_capture_info vidcap_switcher_info; - diff --git a/src/video_capture/swmix.cpp b/src/video_capture/swmix.cpp index 5f23fb21f..d9d8f70c5 100644 --- a/src/video_capture/swmix.cpp +++ b/src/video_capture/swmix.cpp @@ -1329,10 +1329,5 @@ static const struct video_capture_info vidcap_swmix_info = { vidcap_swmix_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("swmix", &vidcap_swmix_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(swmix, &vidcap_swmix_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_capture/testcard.cpp b/src/video_capture/testcard.cpp index ca77d772f..7a53fdf84 100644 --- a/src/video_capture/testcard.cpp +++ b/src/video_capture/testcard.cpp @@ -712,11 +712,6 @@ static const struct video_capture_info vidcap_testcard_info = { vidcap_testcard_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("testcard", &vidcap_testcard_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(testcard, &vidcap_testcard_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); /* vim: set expandtab: sw=8 */ diff --git a/src/video_capture/testcard2.c b/src/video_capture/testcard2.c index ea5f98e28..b7b13e2b4 100644 --- a/src/video_capture/testcard2.c +++ b/src/video_capture/testcard2.c @@ -548,11 +548,6 @@ static const struct video_capture_info vidcap_testcard2_info = { vidcap_testcard2_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("testcard2", &vidcap_testcard2_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(testcard2, &vidcap_testcard2_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); #endif diff --git a/src/video_capture/ug_input.cpp b/src/video_capture/ug_input.cpp index c55910ef3..b4b54551e 100644 --- a/src/video_capture/ug_input.cpp +++ b/src/video_capture/ug_input.cpp @@ -41,9 +41,9 @@ #include "debug.h" #include "host.h" #include "hd-rum-translator/hd-rum-decompress.h" // frame_recv_delegate +#include "lib_common.h" #include "video.h" #include "video_capture.h" -#include "video_capture/ug_input.h" #include "video_display.h" #include "video_rxtx.h" #include "video_rxtx/ultragrid_rtp.h" @@ -181,10 +181,12 @@ static struct vidcap_type *vidcap_ug_input_probe(bool /* verbose */) return vt; } -const struct video_capture_info vidcap_ug_input_info = { +static const struct video_capture_info vidcap_ug_input_info = { vidcap_ug_input_probe, vidcap_ug_input_init, vidcap_ug_input_done, vidcap_ug_input_grab, }; +REGISTER_MODULE(ug_input, &vidcap_ug_input_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); + diff --git a/src/video_capture/ug_input.h b/src/video_capture/ug_input.h deleted file mode 100644 index c59762bae..000000000 --- a/src/video_capture/ug_input.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file video_capture/ug_input.h - * @author Martin Pulec - */ -/* - * Copyright (c) 2014 CESNET, z. s. p. o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -struct video_capture_info; -extern const struct video_capture_info vidcap_ug_input_info; - diff --git a/src/video_capture/v4l2.c b/src/video_capture/v4l2.c index bc5d3ae18..6258ee215 100644 --- a/src/video_capture/v4l2.c +++ b/src/video_capture/v4l2.c @@ -698,10 +698,5 @@ static const struct video_capture_info vidcap_v4l2_info = { vidcap_v4l2_grab, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("v4l2", &vidcap_v4l2_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); -} +REGISTER_MODULE(v4l2, &vidcap_v4l2_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); diff --git a/src/video_display.c b/src/video_display.c index 91ed5695f..f035b6004 100644 --- a/src/video_display.c +++ b/src/video_display.c @@ -62,12 +62,6 @@ #include "perf.h" #include "video_display.h" -#include "video_display/aggregate.h" -#include "video_display/dummy.h" -#include "video_display/null.h" -#include "video_display/pipe.h" -#include "video_display/proxy.h" - #define DISPLAY_MAGIC 0x01ba7ef1 /// @brief This struct represents initialized video display state. @@ -82,17 +76,6 @@ struct display { * of module was successful but no state was created (eg. when driver had displayed help). */ int display_init_noerr; -static void init_static_display() __attribute__((constructor)); -static void init_static_display() { -#ifndef UV_IN_YURI - register_library("aggregate", &display_aggregate_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -#endif - register_library("dummy", &display_dummy_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); - register_library("none", &display_null_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); - register_library("pipe", &display_pipe_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); - register_library("proxy", &display_proxy_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} - void list_video_display_devices() { printf("Available display devices:\n"); diff --git a/src/video_display/aggregate.c b/src/video_display/aggregate.c index 70b356af6..9a79265da 100644 --- a/src/video_display/aggregate.c +++ b/src/video_display/aggregate.c @@ -44,10 +44,10 @@ #include "debug.h" #include "host.h" +#include "lib_common.h" #include "tv.h" #include "video.h" #include "video_display.h" -#include "video_display/aggregate.h" #include #include @@ -85,7 +85,7 @@ static void show_help() { printf("\t\twhere devn_config is a complete configuration string of device involved in an aggregate device\n"); } -void display_aggregate_run(void *state) +static void display_aggregate_run(void *state) { struct display_aggregate_state *s = (struct display_aggregate_state *) state; unsigned int i; @@ -99,7 +99,7 @@ void display_aggregate_run(void *state) } } -void *display_aggregate_init(struct module *parent, const char *fmt, unsigned int flags) +static void *display_aggregate_init(struct module *parent, const char *fmt, unsigned int flags) { UNUSED(parent); struct display_aggregate_state *s; @@ -178,7 +178,7 @@ error: return NULL; } -void display_aggregate_done(void *state) +static void display_aggregate_done(void *state) { struct display_aggregate_state *s = (struct display_aggregate_state *) state; @@ -197,7 +197,7 @@ void display_aggregate_done(void *state) free(s); } -struct video_frame *display_aggregate_getf(void *state) +static struct video_frame *display_aggregate_getf(void *state) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; unsigned int i; @@ -217,7 +217,7 @@ struct video_frame *display_aggregate_getf(void *state) return s->frame; } -int display_aggregate_putf(void *state, struct video_frame *frame, int nonblock) +static int display_aggregate_putf(void *state, struct video_frame *frame, int nonblock) { unsigned int i; struct display_aggregate_state *s = (struct display_aggregate_state *)state; @@ -235,7 +235,7 @@ int display_aggregate_putf(void *state, struct video_frame *frame, int nonblock) return 0; } -int display_aggregate_reconfigure(void *state, struct video_desc desc) +static int display_aggregate_reconfigure(void *state, struct video_desc desc) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; unsigned int i; @@ -257,7 +257,7 @@ int display_aggregate_reconfigure(void *state, struct video_desc desc) return ret; } -int display_aggregate_get_property(void *state, int property, void *val, size_t *len) +static int display_aggregate_get_property(void *state, int property, void *val, size_t *len) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; unsigned int i; @@ -357,7 +357,7 @@ err: return TRUE; } -void display_aggregate_put_audio_frame(void *state, struct audio_frame *frame) +static void display_aggregate_put_audio_frame(void *state, struct audio_frame *frame) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; double seconds = tv_diff(s->t, s->t0); @@ -372,14 +372,14 @@ void display_aggregate_put_audio_frame(void *state, struct audio_frame *frame) display_put_audio_frame(s->devices[0], frame); } -int display_aggregate_reconfigure_audio(void *state, int quant_samples, int channels, +static int display_aggregate_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; return display_reconfigure_audio(s->devices[0], quant_samples, channels, sample_rate); } -const struct video_display_info display_aggregate_info = { +static const struct video_display_info display_aggregate_info = { display_aggregate_init, display_aggregate_run, display_aggregate_done, @@ -391,4 +391,5 @@ const struct video_display_info display_aggregate_info = { display_aggregate_reconfigure_audio, }; +REGISTER_MODULE(aggregate, &display_aggregate_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); diff --git a/src/video_display/aggregate.h b/src/video_display/aggregate.h deleted file mode 100644 index c88cf8c78..000000000 --- a/src/video_display/aggregate.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * FILE: video_display/aggregate.h - * AUTHORS: Martin Benes - * Lukas Hejtmanek - * Petr Holub - * Milos Liska - * Jiri Matela - * Dalibor Matura <255899@mail.muni.cz> - * Ian Wesley-Smith - * - * Copyright (c) 2005-2209 CESNET z.s.p.o. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by CESNET z.s.p.o. - * - * 4. Neither the name of CESNET nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -struct audio_frame; -struct module; -struct video_desc; -struct video_frame; - -void *display_aggregate_init(struct module *parent, const char *fmt, unsigned int flags); -void display_aggregate_run(void *state); -void display_aggregate_done(void *state); -struct video_frame *display_aggregate_getf(void *state); -int display_aggregate_putf(void *state, struct video_frame *frame, int nonblock); -int display_aggregate_reconfigure(void *state, struct video_desc desc); -int display_aggregate_get_property(void *state, int property, void *val, size_t *len); - -void display_aggregate_put_audio_frame(void *state, struct audio_frame *frame); -int display_aggregate_reconfigure_audio(void *state, int quant_samples, int channels, - int sample_rate); - -struct video_display_info; -extern const struct video_display_info display_aggregate_info; - diff --git a/src/video_display/bluefish444.cpp b/src/video_display/bluefish444.cpp index f7bd1b9da..a58aa8366 100644 --- a/src/video_display/bluefish444.cpp +++ b/src/video_display/bluefish444.cpp @@ -1031,10 +1031,5 @@ static const struct video_display_info display_bluefish444_info = { display_bluefish444_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("bluefish444", &display_bluefish444_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} +REGISTER_MODULE(bluefish444, &display_bluefish444_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); diff --git a/src/video_display/decklink.cpp b/src/video_display/decklink.cpp index 815af7f26..a471656ee 100644 --- a/src/video_display/decklink.cpp +++ b/src/video_display/decklink.cpp @@ -1462,11 +1462,5 @@ static const struct video_display_info display_decklink_info = { display_decklink_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("decklink", &display_decklink_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} - +REGISTER_MODULE(decklink, &display_decklink_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); diff --git a/src/video_display/deltacast.cpp b/src/video_display/deltacast.cpp index d7181972e..05856a015 100644 --- a/src/video_display/deltacast.cpp +++ b/src/video_display/deltacast.cpp @@ -598,10 +598,5 @@ static const struct video_display_info display_deltacast_info = { display_deltacast_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("deltacast", &display_deltacast_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} +REGISTER_MODULE(deltacast, &display_deltacast_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); diff --git a/src/video_display/dummy.cpp b/src/video_display/dummy.cpp index 85b75a2dc..c2f1a03fe 100644 --- a/src/video_display/dummy.cpp +++ b/src/video_display/dummy.cpp @@ -40,40 +40,40 @@ #include "config.h" #include "config_unix.h" #include "config_win32.h" +#include "lib_common.h" #include "video.h" #include "video_display.h" -#include "video_display/dummy.h" struct dummy_display_state { struct video_desc desc; }; -void *display_dummy_init(struct module *, const char *, unsigned int) +static void *display_dummy_init(struct module *, const char *, unsigned int) { return new dummy_display_state(); } -void display_dummy_run(void *) +static void display_dummy_run(void *) { } -void display_dummy_done(void *state) +static void display_dummy_done(void *state) { delete (dummy_display_state *) state; } -struct video_frame *display_dummy_getf(void *state) +static struct video_frame *display_dummy_getf(void *state) { return vf_alloc_desc_data(((dummy_display_state *) state)->desc); } -int display_dummy_putf(void *, struct video_frame *frame, int) +static int display_dummy_putf(void *, struct video_frame *frame, int) { vf_free(frame); return 0; } -int display_dummy_get_property(void *, int property, void *val, size_t *len) +static int display_dummy_get_property(void *, int property, void *val, size_t *len) { codec_t codecs[] = {UYVY, YUYV, v210, RGBA, RGB, BGR}; @@ -93,23 +93,23 @@ int display_dummy_get_property(void *, int property, void *val, size_t *len) return TRUE; } -int display_dummy_reconfigure(void *state, struct video_desc desc) +static int display_dummy_reconfigure(void *state, struct video_desc desc) { ((dummy_display_state *) state)->desc = desc; return TRUE; } -void display_dummy_put_audio_frame(void *, struct audio_frame *) +static void display_dummy_put_audio_frame(void *, struct audio_frame *) { } -int display_dummy_reconfigure_audio(void *, int, int, int) +static int display_dummy_reconfigure_audio(void *, int, int, int) { return FALSE; } -const struct video_display_info display_dummy_info = { +static const struct video_display_info display_dummy_info = { display_dummy_init, display_dummy_run, display_dummy_done, @@ -121,3 +121,5 @@ const struct video_display_info display_dummy_info = { display_dummy_reconfigure_audio, }; +REGISTER_MODULE(dummy, &display_dummy_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); + diff --git a/src/video_display/dummy.h b/src/video_display/dummy.h deleted file mode 100644 index 95f63074d..000000000 --- a/src/video_display/dummy.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file video_display/dummy.h - * @author Martin Pulec - * - * @brief This is an umbrella header for video functions. - */ -/* - * Copyright (c) 2015 CESNET z.s.p.o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -struct audio_frame; -struct video_desc; -struct video_frame; - -#ifdef __cplusplus -extern "C" { -#endif - -void *display_dummy_init(struct module *parent, const char *fmt, unsigned int flags); -void display_dummy_run(void *state); -void display_dummy_done(void *state); -struct video_frame *display_dummy_getf(void *state); -int display_dummy_putf(void *state, struct video_frame *frame, - int nonblock); -int display_dummy_reconfigure(void *state, struct video_desc desc); -int display_dummy_get_property(void *state, int property, void *val, size_t *len); - -void display_dummy_put_audio_frame(void *state, struct audio_frame *frame); -int display_dummy_reconfigure_audio(void *state, int quant_samples, int channels, - int sample_rate); - -struct video_display_info; -extern const struct video_display_info display_dummy_info; - -#ifdef __cplusplus -} -#endif - diff --git a/src/video_display/dvs.c b/src/video_display/dvs.c index b0b6cbf18..a88b35328 100644 --- a/src/video_display/dvs.c +++ b/src/video_display/dvs.c @@ -971,11 +971,6 @@ static const struct video_display_info display_dvs_info = { display_dvs_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("dvs", &display_dvs_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} +REGISTER_MODULE(dvs, &display_dvs_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); #endif /* HAVE_DVS */ diff --git a/src/video_display/gl.cpp b/src/video_display/gl.cpp index f9ec3d982..1116a974b 100644 --- a/src/video_display/gl.cpp +++ b/src/video_display/gl.cpp @@ -1189,10 +1189,5 @@ static const struct video_display_info display_gl_info = { display_gl_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("gl", &display_gl_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} +REGISTER_MODULE(gl, &display_gl_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); diff --git a/src/video_display/null.c b/src/video_display/null.c index 1b4c8730d..02a2e067d 100644 --- a/src/video_display/null.c +++ b/src/video_display/null.c @@ -47,9 +47,9 @@ #include "config_unix.h" #include "config_win32.h" #include "debug.h" +#include "lib_common.h" #include "video.h" #include "video_display.h" -#include "video_display/null.h" #define MAGIC_NULL 0x17bad83f @@ -57,7 +57,7 @@ struct state_null { uint32_t magic; }; -void *display_null_init(struct module *parent, const char *fmt, unsigned int flags) +static void *display_null_init(struct module *parent, const char *fmt, unsigned int flags) { UNUSED(fmt); UNUSED(flags); @@ -71,26 +71,26 @@ void *display_null_init(struct module *parent, const char *fmt, unsigned int fla return s; } -void display_null_run(void *arg) +static void display_null_run(void *arg) { UNUSED(arg); } -void display_null_done(void *state) +static void display_null_done(void *state) { struct state_null *s = (struct state_null *)state; assert(s->magic == MAGIC_NULL); free(s); } -struct video_frame *display_null_getf(void *state) +static struct video_frame *display_null_getf(void *state) { struct state_null *s = (struct state_null *)state; assert(s->magic == MAGIC_NULL); return NULL; } -int display_null_putf(void *state, struct video_frame *frame, int nonblock) +static int display_null_putf(void *state, struct video_frame *frame, int nonblock) { struct state_null *s = (struct state_null *)state; assert(s->magic == MAGIC_NULL); @@ -99,7 +99,7 @@ int display_null_putf(void *state, struct video_frame *frame, int nonblock) return 0; } -int display_null_get_property(void *state, int property, void *val, size_t *len) +static int display_null_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); UNUSED(property); @@ -109,7 +109,7 @@ int display_null_get_property(void *state, int property, void *val, size_t *len) return TRUE; } -int display_null_reconfigure(void *state, struct video_desc desc) +static int display_null_reconfigure(void *state, struct video_desc desc) { UNUSED(desc); struct state_null *s = (struct state_null *)state; @@ -118,13 +118,13 @@ int display_null_reconfigure(void *state, struct video_desc desc) return TRUE; } -void display_null_put_audio_frame(void *state, struct audio_frame *frame) +static void display_null_put_audio_frame(void *state, struct audio_frame *frame) { UNUSED(state); UNUSED(frame); } -int display_null_reconfigure_audio(void *state, int quant_samples, int channels, +static int display_null_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -135,7 +135,7 @@ int display_null_reconfigure_audio(void *state, int quant_samples, int channels, return FALSE; } -const struct video_display_info display_null_info = { +static const struct video_display_info display_null_info = { display_null_init, display_null_run, display_null_done, @@ -147,3 +147,5 @@ const struct video_display_info display_null_info = { display_null_reconfigure_audio, }; +REGISTER_MODULE(none, &display_null_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); + diff --git a/src/video_display/null.h b/src/video_display/null.h deleted file mode 100644 index 86966f334..000000000 --- a/src/video_display/null.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * FILE: display_null.h - * AUTHOR: Colin Perkins - * - * Copyright (c) 2001-2003 University of Southern California - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * - * This product includes software developed by the University of Southern - * California Information Sciences Institute. - * - * 4. Neither the name of the University nor of the Institute may be used - * to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Revision: 1.1 $ - * $Date: 2007/11/08 09:48:59 $ - * - */ - -struct audio_frame; -struct video_desc; -struct video_frame; - -void *display_null_init(struct module *parent, const char *fmt, unsigned int flags); -void display_null_run(void *state); -void display_null_done(void *state); -struct video_frame *display_null_getf(void *state); -int display_null_putf(void *state, struct video_frame *frame, - int nonblock); -int display_null_reconfigure(void *state, struct video_desc desc); -int display_null_get_property(void *state, int property, void *val, size_t *len); - -void display_null_put_audio_frame(void *state, struct audio_frame *frame); -int display_null_reconfigure_audio(void *state, int quant_samples, int channels, - int sample_rate); - -struct video_display_info; -extern const struct video_display_info display_null_info; - diff --git a/src/video_display/pipe.cpp b/src/video_display/pipe.cpp index 367d5cfab..5cf0dc41d 100644 --- a/src/video_display/pipe.cpp +++ b/src/video_display/pipe.cpp @@ -40,10 +40,10 @@ #include "config.h" #include "config_unix.h" #include "config_win32.h" +#include "lib_common.h" #include "debug.h" #include "video.h" #include "video_display.h" -#include "video_display/pipe.h" #include "hd-rum-translator/hd-rum-decompress.h" @@ -65,7 +65,7 @@ static struct display *display_pipe_fork(void *state) if (rc == 0) return out; else return NULL; } -void *display_pipe_init(struct module *parent, const char *fmt, unsigned int flags) +static void *display_pipe_init(struct module *parent, const char *fmt, unsigned int flags) { UNUSED(flags); frame_recv_delegate *delegate; @@ -82,20 +82,20 @@ void *display_pipe_init(struct module *parent, const char *fmt, unsigned int fla return s; } -void display_pipe_done(void *state) +static void display_pipe_done(void *state) { struct state_pipe *s = (struct state_pipe *)state; delete s; } -struct video_frame *display_pipe_getf(void *state) +static struct video_frame *display_pipe_getf(void *state) { struct state_pipe *s = (struct state_pipe *)state; return vf_alloc_desc_data(s->desc); } -int display_pipe_putf(void *state, struct video_frame *frame, int flags) +static int display_pipe_putf(void *state, struct video_frame *frame, int flags) { struct state_pipe *s = (struct state_pipe *) state; @@ -106,12 +106,12 @@ int display_pipe_putf(void *state, struct video_frame *frame, int flags) return TRUE; } -void display_pipe_run(void *state) +static void display_pipe_run(void *state) { UNUSED(state); } -int display_pipe_get_property(void *state, int property, void *val, size_t *len) +static int display_pipe_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); codec_t codecs[] = {UYVY}; @@ -163,7 +163,7 @@ int display_pipe_get_property(void *state, int property, void *val, size_t *len) return TRUE; } -int display_pipe_reconfigure(void *state, struct video_desc desc) +static int display_pipe_reconfigure(void *state, struct video_desc desc) { struct state_pipe *s = (struct state_pipe *) state; @@ -172,13 +172,13 @@ int display_pipe_reconfigure(void *state, struct video_desc desc) return 1; } -void display_pipe_put_audio_frame(void *state, struct audio_frame *frame) +static void display_pipe_put_audio_frame(void *state, struct audio_frame *frame) { UNUSED(state); UNUSED(frame); } -int display_pipe_reconfigure_audio(void *state, int quant_samples, int channels, +static int display_pipe_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -189,7 +189,7 @@ int display_pipe_reconfigure_audio(void *state, int quant_samples, int channels, return FALSE; } -const struct video_display_info display_pipe_info = { +static const struct video_display_info display_pipe_info = { display_pipe_init, display_pipe_run, display_pipe_done, @@ -201,4 +201,5 @@ const struct video_display_info display_pipe_info = { display_pipe_reconfigure_audio, }; +REGISTER_MODULE(pipe, &display_pipe_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); diff --git a/src/video_display/pipe.h b/src/video_display/pipe.h deleted file mode 100644 index 600275189..000000000 --- a/src/video_display/pipe.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file video_display/pipe.h - * @author Martin Pulec - */ -/* - * Copyright (c) 2014 CESNET, z. s. p. o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -struct audio_frame; -struct video_desc; -struct video_frame; - -#ifdef __cplusplus -extern "C" { -#endif - -void *display_pipe_init(struct module *parent, const char *fmt, unsigned int flags); -void display_pipe_run(void *state); -void display_pipe_done(void *state); -struct video_frame *display_pipe_getf(void *state); -int display_pipe_putf(void *state, struct video_frame *frame, - int nonblock); -int display_pipe_reconfigure(void *state, struct video_desc desc); -int display_pipe_get_property(void *state, int property, void *val, size_t *len); - -void display_pipe_put_audio_frame(void *state, struct audio_frame *frame); -int display_pipe_reconfigure_audio(void *state, int quant_samples, int channels, - int sample_rate); - -struct video_display_info; -extern const struct video_display_info display_pipe_info; - -#ifdef __cplusplus -} -#endif - diff --git a/src/video_display/proxy.cpp b/src/video_display/proxy.cpp index 16201eeda..df29fdc9e 100644 --- a/src/video_display/proxy.cpp +++ b/src/video_display/proxy.cpp @@ -41,9 +41,9 @@ #include "config_unix.h" #include "config_win32.h" #include "debug.h" +#include "lib_common.h" #include "video.h" #include "video_display.h" -#include "video_display/proxy.h" #include #include @@ -111,7 +111,7 @@ static struct display *display_proxy_fork(void *state) return out; } -void *display_proxy_init(struct module *parent, const char *fmt, unsigned int flags) +static void *display_proxy_init(struct module *parent, const char *fmt, unsigned int flags) { struct state_proxy *s; char *fmt_copy = NULL; @@ -157,7 +157,7 @@ static void check_reconf(struct state_proxy_common *s, struct video_desc desc) } } -void display_proxy_run(void *state) +static void display_proxy_run(void *state) { shared_ptr s = ((struct state_proxy *)state)->common; bool prefill = false; @@ -306,20 +306,20 @@ void display_proxy_run(void *state) pthread_join(s->thread_id, NULL); } -void display_proxy_done(void *state) +static void display_proxy_done(void *state) { struct state_proxy *s = (struct state_proxy *)state; delete s; } -struct video_frame *display_proxy_getf(void *state) +static struct video_frame *display_proxy_getf(void *state) { struct state_proxy *s = (struct state_proxy *)state; return vf_alloc_desc_data(s->desc); } -int display_proxy_putf(void *state, struct video_frame *frame, int flags) +static int display_proxy_putf(void *state, struct video_frame *frame, int flags) { shared_ptr s = ((struct state_proxy *)state)->common; @@ -342,7 +342,7 @@ int display_proxy_putf(void *state, struct video_frame *frame, int flags) return 0; } -int display_proxy_get_property(void *state, int property, void *val, size_t *len) +static int display_proxy_get_property(void *state, int property, void *val, size_t *len) { shared_ptr s = ((struct state_proxy *)state)->common; if (property == DISPLAY_PROPERTY_SUPPORTS_MULTI_SOURCES) { @@ -357,7 +357,7 @@ int display_proxy_get_property(void *state, int property, void *val, size_t *len } } -int display_proxy_reconfigure(void *state, struct video_desc desc) +static int display_proxy_reconfigure(void *state, struct video_desc desc) { struct state_proxy *s = (struct state_proxy *) state; @@ -366,13 +366,13 @@ int display_proxy_reconfigure(void *state, struct video_desc desc) return 1; } -void display_proxy_put_audio_frame(void *state, struct audio_frame *frame) +static void display_proxy_put_audio_frame(void *state, struct audio_frame *frame) { UNUSED(state); UNUSED(frame); } -int display_proxy_reconfigure_audio(void *state, int quant_samples, int channels, +static int display_proxy_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -383,7 +383,7 @@ int display_proxy_reconfigure_audio(void *state, int quant_samples, int channels return FALSE; } -const struct video_display_info display_proxy_info = { +static const struct video_display_info display_proxy_info = { display_proxy_init, display_proxy_run, display_proxy_done, @@ -395,3 +395,5 @@ const struct video_display_info display_proxy_info = { display_proxy_reconfigure_audio, }; +REGISTER_MODULE(proxy, &display_proxy_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); + diff --git a/src/video_display/proxy.h b/src/video_display/proxy.h deleted file mode 100644 index 7474f7ba4..000000000 --- a/src/video_display/proxy.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file video_display/proxy.h - * @author Martin Pulec - */ -/* - * Copyright (c) 2014 CESNET, z. s. p. o. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, is permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of CESNET nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -struct audio_frame; -struct video_desc; -struct video_frame; - -#ifdef __cplusplus -extern "C" { -#endif - -void *display_proxy_init(struct module *parent, const char *fmt, unsigned int flags); -void display_proxy_run(void *state); -void display_proxy_done(void *state); -struct video_frame *display_proxy_getf(void *state); -int display_proxy_putf(void *state, struct video_frame *frame, - int nonblock); -int display_proxy_reconfigure(void *state, struct video_desc desc); -int display_proxy_get_property(void *state, int property, void *val, size_t *len); - -void display_proxy_put_audio_frame(void *state, struct audio_frame *frame); -int display_proxy_reconfigure_audio(void *state, int quant_samples, int channels, - int sample_rate); - -struct video_display_info; -extern const struct video_display_info display_proxy_info; - - -#ifdef __cplusplus -} -#endif - diff --git a/src/video_display/quicktime.c b/src/video_display/quicktime.c index 7a0ce2286..0f3ba82e7 100644 --- a/src/video_display/quicktime.c +++ b/src/video_display/quicktime.c @@ -1309,12 +1309,7 @@ static const struct video_display_info display_quicktime_info = { display_quicktime_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("quicktime", &display_quicktime_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} +REGISTER_MODULE(quicktime, &display_quicktime_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); #endif /* HAVE_MACOSX */ diff --git a/src/video_display/sage.cpp b/src/video_display/sage.cpp index bd5f45cfe..80ffd3de6 100644 --- a/src/video_display/sage.cpp +++ b/src/video_display/sage.cpp @@ -559,10 +559,5 @@ static const struct video_display_info display_sage_info = { display_sage_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("sage", &display_sage_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} +REGISTER_MODULE(sage, &display_sage_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); diff --git a/src/video_display/sdl.cpp b/src/video_display/sdl.cpp index 4faf85b39..9bc7d6fa0 100644 --- a/src/video_display/sdl.cpp +++ b/src/video_display/sdl.cpp @@ -802,10 +802,5 @@ static const struct video_display_info display_sdl_info = { display_sdl_reconfigure_audio, }; -static void mod_reg(void) __attribute__((constructor)); - -static void mod_reg(void) -{ - register_library("sdl", &display_sdl_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION); -} +REGISTER_MODULE(sdl, &display_sdl_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION);