1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2009 Laurent Aimar
6 * Authors: Laurent Aimar < fenrir _AT_ videolan _DOT_ org>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 /*****************************************************************************
25 *****************************************************************************/
30 #include <vlc_common.h>
32 #include "vlm_internal.h"
33 #include "vlm_event.h"
37 static void Trigger( vlm_t
*, int i_type
, int64_t id
, const char *psz_name
);
38 static void TriggerInstanceState( vlm_t
*, int i_type
, int64_t id
, const char *psz_name
, const char *psz_instance_name
, input_state_e input_state
);
40 /*****************************************************************************
42 *****************************************************************************/
43 void vlm_SendEventMediaAdded( vlm_t
*p_vlm
, int64_t id
, const char *psz_name
)
45 Trigger( p_vlm
, VLM_EVENT_MEDIA_ADDED
, id
, psz_name
);
47 void vlm_SendEventMediaRemoved( vlm_t
*p_vlm
, int64_t id
, const char *psz_name
)
49 Trigger( p_vlm
, VLM_EVENT_MEDIA_REMOVED
, id
, psz_name
);
51 void vlm_SendEventMediaChanged( vlm_t
*p_vlm
, int64_t id
, const char *psz_name
)
53 Trigger( p_vlm
, VLM_EVENT_MEDIA_CHANGED
, id
, psz_name
);
56 void vlm_SendEventMediaInstanceStarted( vlm_t
*p_vlm
, int64_t id
, const char *psz_name
)
58 Trigger( p_vlm
, VLM_EVENT_MEDIA_INSTANCE_STARTED
, id
, psz_name
);
60 void vlm_SendEventMediaInstanceStopped( vlm_t
*p_vlm
, int64_t id
, const char *psz_name
)
62 Trigger( p_vlm
, VLM_EVENT_MEDIA_INSTANCE_STOPPED
, id
, psz_name
);
65 void vlm_SendEventMediaInstanceState( vlm_t
*p_vlm
, int64_t id
, const char *psz_name
, const char *psz_instance_name
, input_state_e state
)
67 TriggerInstanceState( p_vlm
, VLM_EVENT_MEDIA_INSTANCE_STATE
, id
, psz_name
, psz_instance_name
, state
);
70 /*****************************************************************************
72 *****************************************************************************/
73 static void Trigger( vlm_t
*p_vlm
, int i_type
, int64_t id
, const char *psz_name
)
77 event
.i_type
= i_type
;
79 event
.psz_name
= psz_name
;
80 event
.input_state
= 0;
81 event
.psz_instance_name
= NULL
;
82 var_SetAddress( p_vlm
, "intf-event", &event
);
85 static void TriggerInstanceState( vlm_t
*p_vlm
, int i_type
, int64_t id
, const char *psz_name
, const char *psz_instance_name
, input_state_e input_state
)
89 event
.i_type
= i_type
;
91 event
.psz_name
= psz_name
;
92 event
.input_state
= input_state
;
93 event
.psz_instance_name
= psz_instance_name
;
94 var_SetAddress( p_vlm
, "intf-event", &event
);