vlc | branch: master | Thomas Guillem <[email protected]> | Tue Sep 4 18:53:22 2018 +0200| [1df423f6954ac9772d9ac7e7ed8201293b1afb3d] | committer: Thomas Guillem
input: inline input_SendEvent* functions > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1df423f6954ac9772d9ac7e7ed8201293b1afb3d --- src/Makefile.am | 1 - src/input/event.c | 257 ---------------------------------------------------- src/input/event.h | 263 +++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 232 insertions(+), 289 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 1802dedf58..83e2e3b152 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -240,7 +240,6 @@ libvlccore_la_SOURCES = \ input/demux_chained.c \ input/es_out.c \ input/es_out_timeshift.c \ - input/event.c \ input/input.c \ input/info.h \ input/meta.c \ diff --git a/src/input/event.c b/src/input/event.c deleted file mode 100644 index 2095b3e25f..0000000000 --- a/src/input/event.c +++ /dev/null @@ -1,257 +0,0 @@ -/***************************************************************************** - * event.c: Events - ***************************************************************************** - * Copyright (C) 2008 Laurent Aimar - * $Id$ - * - * Authors: Laurent Aimar < fenrir _AT_ videolan _DOT_ org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <vlc_common.h> -#include <vlc_input.h> -#include "input_internal.h" -#include "event.h" -#include <assert.h> - -static void input_SendEvent( input_thread_t *p_input, - const struct vlc_input_event *event ) -{ - input_thread_private_t *priv = input_priv(p_input); - if( priv->events_cb ) - priv->events_cb( p_input, event, priv->events_data ); -} - -void input_SendEventDead( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_DEAD, - }); -} - -void input_SendEventCapabilities( input_thread_t *p_input, int i_capabilities ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_CAPABILITIES, - .capabilities = i_capabilities - }); -} -void input_SendEventPosition( input_thread_t *p_input, double f_position, - vlc_tick_t i_time ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_POSITION, - .position = { f_position, i_time } - }); -} -void input_SendEventLength( input_thread_t *p_input, vlc_tick_t i_length ) -{ - input_item_SetDuration( input_priv(p_input)->p_item, i_length ); - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_LENGTH, - .length = i_length, - }); -} -void input_SendEventStatistics( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_STATISTICS, - }); -} -void input_SendEventRate( input_thread_t *p_input, int i_rate ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_RATE, - .rate = (float)INPUT_RATE_DEFAULT / (float)i_rate, - }); -} -void input_SendEventAudioDelay( input_thread_t *p_input, vlc_tick_t i_delay ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_AUDIO_DELAY, - .audio_delay = i_delay, - }); -} - -void input_SendEventSubtitleDelay( input_thread_t *p_input, vlc_tick_t i_delay ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_SUBTITLE_DELAY, - .subtitle_delay = i_delay, - }); -} - -/* TODO and file name ? */ -void input_SendEventRecord( input_thread_t *p_input, bool b_recording ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_RECORD, - .record = b_recording - }); -} - -void input_SendEventTitle( input_thread_t *p_input, int i_title ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_TITLE, - .title = i_title - }); -} - -void input_SendEventSeekpoint( input_thread_t *p_input, int i_title, int i_seekpoint ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_CHAPTER, - .chapter = { i_title, i_seekpoint } - }); -} - -void input_SendEventSignal( input_thread_t *p_input, double f_quality, - double f_strength ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_SIGNAL, - .signal = { f_quality, f_strength } - }); -} - -void input_SendEventState( input_thread_t *p_input, int i_state ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_STATE, - .state = i_state - }); -} - -void input_SendEventCache( input_thread_t *p_input, double f_level ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_CACHE, - .cache = f_level - }); -} - -void input_SendEventMeta( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_ITEM_META, - }); -} - -void input_SendEventMetaInfo( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_ITEM_INFO, - }); -} - -void input_SendEventMetaEpg( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_ITEM_EPG, - }); -} -/***************************************************************************** - * Event for es_out.c - *****************************************************************************/ -void input_SendEventProgramAdd( input_thread_t *p_input, - int i_program, const char *psz_text ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_PROGRAM, - .program = { - .action = VLC_INPUT_PROGRAM_ADDED, - .id = i_program, - .title = psz_text - } - }); -} -void input_SendEventProgramDel( input_thread_t *p_input, int i_program ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_PROGRAM, - .program = { - .action = VLC_INPUT_PROGRAM_DELETED, - .id = i_program - } - }); -} -void input_SendEventProgramSelect( input_thread_t *p_input, int i_program ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_PROGRAM, - .program = { - .action = VLC_INPUT_PROGRAM_SELECTED, - .id = i_program - } - }); -} -void input_SendEventProgramScrambled( input_thread_t *p_input, int i_group, bool b_scrambled ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_PROGRAM, - .program = { - .action = VLC_INPUT_PROGRAM_SCRAMBLED, - .id = i_group, - .scrambled = b_scrambled - } - }); -} - -void input_SendEventEs( input_thread_t *p_input, - const struct vlc_input_event_es *es_event ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_ES, - .es = *es_event, - }); -} - -void input_SendEventVout( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_VOUT - }); -} - -void input_SendEventAout( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_AOUT - }); -} - -void input_SendEventBookmark( input_thread_t *p_input ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_BOOKMARK - }); -} - -void input_SendEventParsing( input_thread_t *p_input, input_item_node_t *p_root ) -{ - input_SendEvent( p_input, &(struct vlc_input_event) { - .type = INPUT_EVENT_SUBITEMS, - .subitems = p_root, - }); -} diff --git a/src/input/event.h b/src/input/event.h index a2fcfe5541..8aa2059b7e 100644 --- a/src/input/event.h +++ b/src/input/event.h @@ -2,7 +2,6 @@ * event.h: Input event functions ***************************************************************************** * Copyright (C) 2008 Laurent Aimar - * $Id$ * * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ fr> * @@ -25,52 +24,254 @@ #define LIBVLC_INPUT_EVENT_H 1 #include <vlc_common.h> +#include <vlc_input.h> +#include "input_internal.h" + +static inline void input_SendEvent(input_thread_t *p_input, + const struct vlc_input_event *event) +{ + input_thread_private_t *priv = input_priv(p_input); + if(priv->events_cb) + priv->events_cb(p_input, event, priv->events_data); +} /***************************************************************************** * Event for input.c *****************************************************************************/ -void input_SendEventDead( input_thread_t *p_input ); -void input_SendEventPosition( input_thread_t *p_input, double f_position, vlc_tick_t i_time ); -void input_SendEventLength( input_thread_t *p_input, vlc_tick_t i_length ); -void input_SendEventStatistics( input_thread_t *p_input ); -void input_SendEventRate( input_thread_t *p_input, int i_rate ); -void input_SendEventCapabilities( input_thread_t *p_input, int capabilities ); -void input_SendEventAudioDelay( input_thread_t *p_input, vlc_tick_t i_delay ); -void input_SendEventSubtitleDelay( input_thread_t *p_input, vlc_tick_t i_delay ); -void input_SendEventRecord( input_thread_t *p_input, bool b_recording ); -void input_SendEventTitle( input_thread_t *p_input, int i_title ); -void input_SendEventSeekpoint( input_thread_t *p_input, int i_title, int i_seekpoint ); -void input_SendEventSignal( input_thread_t *p_input, double f_quality, double f_strength ); -void input_SendEventState( input_thread_t *p_input, int i_state ); -void input_SendEventCache( input_thread_t *p_input, double f_level ); - -/* TODO rename Item* */ -void input_SendEventMeta( input_thread_t *p_input ); -void input_SendEventMetaInfo( input_thread_t *p_input ); -void input_SendEventMetaEpg( input_thread_t *p_input ); - -void input_SendEventParsing( input_thread_t *p_input, input_item_node_t *p_root ); +static inline void input_SendEventDead(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_DEAD, + }); +} + +static inline void input_SendEventCapabilities(input_thread_t *p_input, + int i_capabilities) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_CAPABILITIES, + .capabilities = i_capabilities + }); +} + +static inline void input_SendEventPosition(input_thread_t *p_input, + double f_position, + vlc_tick_t i_time) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_POSITION, + .position = { f_position, i_time } + }); +} + +static inline void input_SendEventLength(input_thread_t *p_input, + vlc_tick_t i_length) +{ + input_item_SetDuration(input_priv(p_input)->p_item, i_length); + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_LENGTH, + .length = i_length, + }); +} + +static inline void input_SendEventStatistics(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_STATISTICS, + }); +} + +static inline void input_SendEventRate(input_thread_t *p_input, int i_rate) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_RATE, + .rate = (float)INPUT_RATE_DEFAULT / (float)i_rate, + }); +} + +static inline void input_SendEventAudioDelay(input_thread_t *p_input, + vlc_tick_t i_delay) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_AUDIO_DELAY, + .audio_delay = i_delay, + }); +} + +static inline void input_SendEventSubtitleDelay(input_thread_t *p_input, + vlc_tick_t i_delay) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_SUBTITLE_DELAY, + .subtitle_delay = i_delay, + }); +} + +static inline void input_SendEventRecord(input_thread_t *p_input, + bool b_recording) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_RECORD, + .record = b_recording + }); +} + +static inline void input_SendEventTitle(input_thread_t *p_input, int i_title) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_TITLE, + .title = i_title + }); +} + +static inline void input_SendEventSeekpoint(input_thread_t *p_input, + int i_title, int i_seekpoint) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_CHAPTER, + .chapter = { i_title, i_seekpoint } + }); +} + +static inline void input_SendEventSignal(input_thread_t *p_input, + double f_quality, double f_strength) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_SIGNAL, + .signal = { f_quality, f_strength } + }); +} + +static inline void input_SendEventState(input_thread_t *p_input, int i_state) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_STATE, + .state = i_state + }); +} + +static inline void input_SendEventCache(input_thread_t *p_input, double f_level) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_CACHE, + .cache = f_level + }); +} + +static inline void input_SendEventMeta(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_ITEM_META, + }); +} + +static inline void input_SendEventMetaInfo(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_ITEM_INFO, + }); +} + +static inline void input_SendEventMetaEpg(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_ITEM_EPG, + }); +} /***************************************************************************** * Event for es_out.c *****************************************************************************/ -void input_SendEventProgramAdd( input_thread_t *p_input, - int i_program, const char *psz_text ); -void input_SendEventProgramDel( input_thread_t *p_input, int i_program ); -void input_SendEventProgramSelect( input_thread_t *p_input, int i_program ); -void input_SendEventProgramScrambled( input_thread_t *p_input, int i_group, bool b_scrambled ); +static inline void input_SendEventProgramAdd(input_thread_t *p_input, + int i_program, const char *psz_text) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_PROGRAM, + .program = { + .action = VLC_INPUT_PROGRAM_ADDED, + .id = i_program, + .title = psz_text + } + }); +} +static inline void input_SendEventProgramDel(input_thread_t *p_input, + int i_program) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_PROGRAM, + .program = { + .action = VLC_INPUT_PROGRAM_DELETED, + .id = i_program + } + }); +} +static inline void input_SendEventProgramSelect(input_thread_t *p_input, + int i_program) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_PROGRAM, + .program = { + .action = VLC_INPUT_PROGRAM_SELECTED, + .id = i_program + } + }); +} +static inline void input_SendEventProgramScrambled(input_thread_t *p_input, + int i_group, bool b_scrambled) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_PROGRAM, + .program = { + .action = VLC_INPUT_PROGRAM_SCRAMBLED, + .id = i_group, + .scrambled = b_scrambled + } + }); +} -void input_SendEventEs( input_thread_t *p_input, const struct vlc_input_event_es *es_event ); +static inline void input_SendEventEs(input_thread_t *p_input, + const struct vlc_input_event_es *es_event) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_ES, + .es = *es_event, + }); +} + +static inline void input_SendEventParsing(input_thread_t *p_input, + input_item_node_t *p_root) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_SUBITEMS, + .subitems = p_root, + }); +} /***************************************************************************** * Event for decoder.c *****************************************************************************/ -void input_SendEventVout( input_thread_t *p_input ); -void input_SendEventAout( input_thread_t *p_input ); +static inline void input_SendEventVout(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_VOUT + }); +} + +static inline void input_SendEventAout(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_AOUT + }); +} /***************************************************************************** * Event for control.c/input.c *****************************************************************************/ -void input_SendEventBookmark( input_thread_t *p_input ); +static inline void input_SendEventBookmark(input_thread_t *p_input) +{ + input_SendEvent(p_input, &(struct vlc_input_event) { + .type = INPUT_EVENT_BOOKMARK + }); +} #endif _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
