Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
31b1e909
Commit
31b1e909
authored
Jul 06, 2009
by
Sébastien Escudier
Committed by
Laurent Aimar
Jul 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VLM add input events
Signed-off-by:
Laurent Aimar
<
fenrir@videolan.org
>
parent
91d60a7c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
13 deletions
+65
-13
include/vlc_vlm.h
include/vlc_vlm.h
+6
-3
src/input/vlm.c
src/input/vlm.c
+39
-9
src/input/vlm_event.c
src/input/vlm_event.c
+19
-0
src/input/vlm_event.h
src/input/vlm_event.h
+1
-1
No files found.
include/vlc_vlm.h
View file @
31b1e909
...
@@ -102,13 +102,16 @@ enum vlm_event_type_e
...
@@ -102,13 +102,16 @@ enum vlm_event_type_e
/* */
/* */
VLM_EVENT_MEDIA_INSTANCE_STARTED
=
0x200
,
VLM_EVENT_MEDIA_INSTANCE_STARTED
=
0x200
,
VLM_EVENT_MEDIA_INSTANCE_STOPPED
,
VLM_EVENT_MEDIA_INSTANCE_STOPPED
,
VLM_EVENT_MEDIA_INSTANCE_STATE
,
};
};
typedef
struct
typedef
struct
{
{
int
i_type
;
/* a vlm_event_type_e value */
int
i_type
;
/* a vlm_event_type_e value */
int64_t
id
;
/* Media ID */
int64_t
id
;
/* Media ID */
const
char
*
psz_name
;
/* Media name */
const
char
*
psz_name
;
/* Media name */
const
char
*
psz_instance_name
;
/* Instance name or NULL */
input_state_e
input_state
;
/* input instance event type */
}
vlm_event_t
;
}
vlm_event_t
;
/** VLM control query */
/** VLM control query */
...
...
src/input/vlm.c
View file @
31b1e909
...
@@ -69,6 +69,30 @@ static void vlm_Destructor( vlm_t *p_vlm );
...
@@ -69,6 +69,30 @@ static void vlm_Destructor( vlm_t *p_vlm );
static
void
*
Manage
(
void
*
);
static
void
*
Manage
(
void
*
);
static
int
vlm_MediaVodControl
(
void
*
,
vod_media_t
*
,
const
char
*
,
int
,
va_list
);
static
int
vlm_MediaVodControl
(
void
*
,
vod_media_t
*
,
const
char
*
,
int
,
va_list
);
static
int
InputEvent
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
vlm_t
*
p_vlm
=
libvlc_priv
(
p_input
->
p_libvlc
)
->
p_vlm
;
vlm_media_sys_t
*
p_media
=
p_data
;
const
char
*
psz_instance_name
=
NULL
;
if
(
newval
.
i_int
==
INPUT_EVENT_STATE
)
{
for
(
int
i
=
0
;
i
<
p_media
->
i_instance
;
i
++
)
{
if
(
p_media
->
instance
[
i
]
->
p_input
==
p_input
)
{
psz_instance_name
=
p_media
->
instance
[
i
]
->
psz_name
;
break
;
}
}
vlm_SendEventMediaInstanceState
(
p_vlm
,
p_media
->
cfg
.
id
,
p_media
->
cfg
.
psz_name
,
psz_instance_name
,
var_GetInteger
(
p_input
,
"state"
)
);
}
return
VLC_SUCCESS
;
}
/*****************************************************************************
/*****************************************************************************
* vlm_New:
* vlm_New:
*****************************************************************************/
*****************************************************************************/
...
@@ -168,14 +192,13 @@ void vlm_Delete( vlm_t *p_vlm )
...
@@ -168,14 +192,13 @@ void vlm_Delete( vlm_t *p_vlm )
*****************************************************************************/
*****************************************************************************/
static
void
vlm_Destructor
(
vlm_t
*
p_vlm
)
static
void
vlm_Destructor
(
vlm_t
*
p_vlm
)
{
{
libvlc_priv
(
p_vlm
->
p_libvlc
)
->
p_vlm
=
NULL
;
vlm_ControlInternal
(
p_vlm
,
VLM_CLEAR_MEDIAS
);
vlm_ControlInternal
(
p_vlm
,
VLM_CLEAR_MEDIAS
);
TAB_CLEAN
(
p_vlm
->
i_media
,
p_vlm
->
media
);
TAB_CLEAN
(
p_vlm
->
i_media
,
p_vlm
->
media
);
vlm_ControlInternal
(
p_vlm
,
VLM_CLEAR_SCHEDULES
);
vlm_ControlInternal
(
p_vlm
,
VLM_CLEAR_SCHEDULES
);
TAB_CLEAN
(
p_vlm
->
schedule
,
p_vlm
->
schedule
);
TAB_CLEAN
(
p_vlm
->
schedule
,
p_vlm
->
schedule
);
libvlc_priv
(
p_vlm
->
p_libvlc
)
->
p_vlm
=
NULL
;
vlc_object_kill
(
p_vlm
);
vlc_object_kill
(
p_vlm
);
/*vlc_cancel( p_vlm->thread ); */
/*vlc_cancel( p_vlm->thread ); */
vlc_join
(
p_vlm
->
thread
,
NULL
);
vlc_join
(
p_vlm
->
thread
,
NULL
);
...
@@ -771,7 +794,7 @@ static vlm_media_instance_sys_t *vlm_MediaInstanceNew( vlm_t *p_vlm, const char
...
@@ -771,7 +794,7 @@ static vlm_media_instance_sys_t *vlm_MediaInstanceNew( vlm_t *p_vlm, const char
return
p_instance
;
return
p_instance
;
}
}
static
void
vlm_MediaInstanceDelete
(
vlm_t
*
p_vlm
,
int64_t
id
,
vlm_media_instance_sys_t
*
p_instance
,
const
char
*
psz_name
)
static
void
vlm_MediaInstanceDelete
(
vlm_t
*
p_vlm
,
int64_t
id
,
vlm_media_instance_sys_t
*
p_instance
,
vlm_media_sys_t
*
p_media
)
{
{
input_thread_t
*
p_input
=
p_instance
->
p_input
;
input_thread_t
*
p_input
=
p_instance
->
p_input
;
if
(
p_input
)
if
(
p_input
)
...
@@ -780,13 +803,14 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
...
@@ -780,13 +803,14 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
input_Stop
(
p_input
,
true
);
input_Stop
(
p_input
,
true
);
vlc_thread_join
(
p_input
);
vlc_thread_join
(
p_input
);
var_DelCallback
(
p_instance
->
p_input
,
"intf-event"
,
InputEvent
,
p_media
);
p_resource
=
input_DetachResource
(
p_input
);
p_resource
=
input_DetachResource
(
p_input
);
input_resource_Delete
(
p_resource
);
input_resource_Delete
(
p_resource
);
vlc_object_release
(
p_input
);
vlc_object_release
(
p_input
);
vlm_SendEventMediaInstanceStopped
(
p_vlm
,
id
,
psz_name
);
vlm_SendEventMediaInstanceStopped
(
p_vlm
,
id
,
p
_media
->
cfg
.
p
sz_name
);
}
}
if
(
p_instance
->
p_input_resource
)
if
(
p_instance
->
p_input_resource
)
input_resource_Delete
(
p_instance
->
p_input_resource
);
input_resource_Delete
(
p_instance
->
p_input_resource
);
...
@@ -863,6 +887,7 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
...
@@ -863,6 +887,7 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
input_Stop
(
p_input
,
!
p_input
->
b_eof
&&
!
p_input
->
b_error
);
input_Stop
(
p_input
,
!
p_input
->
b_eof
&&
!
p_input
->
b_error
);
vlc_thread_join
(
p_input
);
vlc_thread_join
(
p_input
);
var_DelCallback
(
p_instance
->
p_input
,
"intf-event"
,
InputEvent
,
p_media
);
p_instance
->
p_input_resource
=
input_DetachResource
(
p_input
);
p_instance
->
p_input_resource
=
input_DetachResource
(
p_input
);
...
@@ -883,17 +908,22 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
...
@@ -883,17 +908,22 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
{
{
p_instance
->
p_input
=
input_Create
(
p_vlm
->
p_libvlc
,
p_instance
->
p_item
,
p_instance
->
p_input
=
input_Create
(
p_vlm
->
p_libvlc
,
p_instance
->
p_item
,
psz_log
,
p_instance
->
p_input_resource
);
psz_log
,
p_instance
->
p_input_resource
);
if
(
p_instance
->
p_input
&&
input_Start
(
p_instance
->
p_input
)
)
if
(
p_instance
->
p_input
)
{
{
vlc_object_release
(
p_instance
->
p_input
);
var_AddCallback
(
p_instance
->
p_input
,
"intf-event"
,
InputEvent
,
p_media
);
p_instance
->
p_input
=
NULL
;
if
(
input_Start
(
p_instance
->
p_input
)
!=
VLC_SUCCESS
)
{
var_DelCallback
(
p_instance
->
p_input
,
"intf-event"
,
InputEvent
,
p_media
);
vlc_object_release
(
p_instance
->
p_input
);
p_instance
->
p_input
=
NULL
;
}
}
}
p_instance
->
p_input_resource
=
NULL
;
p_instance
->
p_input_resource
=
NULL
;
if
(
!
p_instance
->
p_input
)
if
(
!
p_instance
->
p_input
)
{
{
TAB_REMOVE
(
p_media
->
i_instance
,
p_media
->
instance
,
p_instance
);
TAB_REMOVE
(
p_media
->
i_instance
,
p_media
->
instance
,
p_instance
);
vlm_MediaInstanceDelete
(
p_vlm
,
id
,
p_instance
,
p_media
->
cfg
.
psz_name
);
vlm_MediaInstanceDelete
(
p_vlm
,
id
,
p_instance
,
p_media
);
}
}
else
else
{
{
...
@@ -919,7 +949,7 @@ static int vlm_ControlMediaInstanceStop( vlm_t *p_vlm, int64_t id, const char *p
...
@@ -919,7 +949,7 @@ static int vlm_ControlMediaInstanceStop( vlm_t *p_vlm, int64_t id, const char *p
TAB_REMOVE
(
p_media
->
i_instance
,
p_media
->
instance
,
p_instance
);
TAB_REMOVE
(
p_media
->
i_instance
,
p_media
->
instance
,
p_instance
);
vlm_MediaInstanceDelete
(
p_vlm
,
id
,
p_instance
,
p_media
->
cfg
.
psz_name
);
vlm_MediaInstanceDelete
(
p_vlm
,
id
,
p_instance
,
p_media
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
src/input/vlm_event.c
View file @
31b1e909
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
/* */
/* */
static
void
Trigger
(
vlm_t
*
,
int
i_type
,
int64_t
id
,
const
char
*
psz_name
);
static
void
Trigger
(
vlm_t
*
,
int
i_type
,
int64_t
id
,
const
char
*
psz_name
);
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
);
/*****************************************************************************
/*****************************************************************************
*
*
...
@@ -62,6 +63,11 @@ void vlm_SendEventMediaInstanceStopped( vlm_t *p_vlm, int64_t id, const char *ps
...
@@ -62,6 +63,11 @@ void vlm_SendEventMediaInstanceStopped( vlm_t *p_vlm, int64_t id, const char *ps
Trigger
(
p_vlm
,
VLM_EVENT_MEDIA_INSTANCE_STOPPED
,
id
,
psz_name
);
Trigger
(
p_vlm
,
VLM_EVENT_MEDIA_INSTANCE_STOPPED
,
id
,
psz_name
);
}
}
void
vlm_SendEventMediaInstanceState
(
vlm_t
*
p_vlm
,
int64_t
id
,
const
char
*
psz_name
,
const
char
*
psz_instance_name
,
input_state_e
state
)
{
TriggerInstanceState
(
p_vlm
,
VLM_EVENT_MEDIA_INSTANCE_STATE
,
id
,
psz_name
,
psz_instance_name
,
state
);
}
/*****************************************************************************
/*****************************************************************************
*
*
*****************************************************************************/
*****************************************************************************/
...
@@ -72,6 +78,19 @@ static void Trigger( vlm_t *p_vlm, int i_type, int64_t id, const char *psz_name
...
@@ -72,6 +78,19 @@ static void Trigger( vlm_t *p_vlm, int i_type, int64_t id, const char *psz_name
event
.
i_type
=
i_type
;
event
.
i_type
=
i_type
;
event
.
id
=
id
;
event
.
id
=
id
;
event
.
psz_name
=
psz_name
;
event
.
psz_name
=
psz_name
;
event
.
input_state
=
0
;
event
.
psz_instance_name
=
NULL
;
var_SetAddress
(
p_vlm
,
"intf-event"
,
&
event
);
var_SetAddress
(
p_vlm
,
"intf-event"
,
&
event
);
}
}
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
)
{
vlm_event_t
event
;
event
.
i_type
=
i_type
;
event
.
id
=
id
;
event
.
psz_name
=
psz_name
;
event
.
input_state
=
input_state
;
event
.
psz_instance_name
=
psz_instance_name
;
var_SetAddress
(
p_vlm
,
"intf-event"
,
&
event
);
}
src/input/vlm_event.h
View file @
31b1e909
...
@@ -39,7 +39,7 @@ void vlm_SendEventMediaChanged( vlm_t *, int64_t id, const char *psz_name );
...
@@ -39,7 +39,7 @@ void vlm_SendEventMediaChanged( vlm_t *, int64_t id, const char *psz_name );
void
vlm_SendEventMediaInstanceStarted
(
vlm_t
*
,
int64_t
id
,
const
char
*
psz_name
);
void
vlm_SendEventMediaInstanceStarted
(
vlm_t
*
,
int64_t
id
,
const
char
*
psz_name
);
void
vlm_SendEventMediaInstanceStopped
(
vlm_t
*
,
int64_t
id
,
const
char
*
psz_name
);
void
vlm_SendEventMediaInstanceStopped
(
vlm_t
*
,
int64_t
id
,
const
char
*
psz_name
);
void
vlm_SendEventMediaInstanceState
(
vlm_t
*
,
int64_t
id
,
const
char
*
psz_name
,
const
char
*
psz_instance_name
,
input_state_e
state
);
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment