Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
680faa3c
Commit
680faa3c
authored
Jun 14, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc_media_player: Use the input event instead of "state" var callback.
parent
1f145937
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
23 deletions
+21
-23
src/control/media_player.c
src/control/media_player.c
+21
-23
No files found.
src/control/media_player.c
View file @
680faa3c
...
@@ -29,10 +29,9 @@
...
@@ -29,10 +29,9 @@
#include <vlc_vout.h>
#include <vlc_vout.h>
#include "libvlc.h"
#include "libvlc.h"
static
int
static
void
input_state_changed
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
input_state_changed
(
const
vlc_event_t
*
event
,
void
*
p_userdata
);
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_userdata
);
static
int
static
int
input_seekable_changed
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
input_seekable_changed
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
...
@@ -86,7 +85,8 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
...
@@ -86,7 +85,8 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
/* No one is tracking this input_thread appart us. Destroy it */
/* No one is tracking this input_thread appart us. Destroy it */
if
(
p_mi
->
b_own_its_input_thread
)
if
(
p_mi
->
b_own_its_input_thread
)
{
{
var_DelCallback
(
p_input_thread
,
"state"
,
input_state_changed
,
p_mi
);
vlc_event_manager_t
*
p_em
=
input_get_event_manager
(
p_input_thread
);
vlc_event_detach
(
p_em
,
vlc_InputStateChanged
,
input_state_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"seekable"
,
input_seekable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"seekable"
,
input_seekable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"pausable"
,
input_pausable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"pausable"
,
input_pausable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"intf-change"
,
input_position_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"intf-change"
,
input_position_changed
,
p_mi
);
...
@@ -133,44 +133,39 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
...
@@ -133,44 +133,39 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
}
}
/*
/*
* input_state_changed (Private) (
input var "state" C
allback)
* input_state_changed (Private) (
vlc_InputStateChanged c
allback)
*/
*/
static
int
static
void
input_state_changed
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
input_state_changed
(
const
vlc_event_t
*
event
,
void
*
p_userdata
)
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_userdata
)
{
{
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
p_this
);
VLC_UNUSED
(
psz_cmd
);
libvlc_media_player_t
*
p_mi
=
p_userdata
;
libvlc_media_player_t
*
p_mi
=
p_userdata
;
libvlc_event_t
event
;
libvlc_event_t
forwarded_
event
;
libvlc_event_type_t
type
=
newval
.
i_int
;
libvlc_event_type_t
type
=
event
->
u
.
vlc_input_state_changed
.
new_state
;
switch
(
type
)
switch
(
type
)
{
{
case
END_S
:
case
END_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_NothingSpecial
,
NULL
);
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_NothingSpecial
,
NULL
);
event
.
type
=
libvlc_MediaPlayerEndReached
;
forwarded_
event
.
type
=
libvlc_MediaPlayerEndReached
;
break
;
break
;
case
PAUSE_S
:
case
PAUSE_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Playing
,
NULL
);
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Playing
,
NULL
);
event
.
type
=
libvlc_MediaPlayerPaused
;
forwarded_
event
.
type
=
libvlc_MediaPlayerPaused
;
break
;
break
;
case
PLAYING_S
:
case
PLAYING_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Playing
,
NULL
);
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Playing
,
NULL
);
event
.
type
=
libvlc_MediaPlayerPlayed
;
forwarded_
event
.
type
=
libvlc_MediaPlayerPlayed
;
break
;
break
;
case
ERROR_S
:
case
ERROR_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Error
,
NULL
);
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Error
,
NULL
);
event
.
type
=
libvlc_MediaPlayerEncounteredError
;
forwarded_
event
.
type
=
libvlc_MediaPlayerEncounteredError
;
break
;
break
;
default:
default:
return
VLC_SUCCESS
;
return
;
}
}
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
forwarded_
event
);
return
VLC_SUCCESS
;
return
;
}
}
static
int
static
int
...
@@ -592,7 +587,10 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
...
@@ -592,7 +587,10 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
var_Create
(
p_input_thread
,
"drawable"
,
VLC_VAR_DOINHERIT
);
var_Create
(
p_input_thread
,
"drawable"
,
VLC_VAR_DOINHERIT
);
var_Set
(
p_input_thread
,
"drawable"
,
val
);
var_Set
(
p_input_thread
,
"drawable"
,
val
);
}
}
var_AddCallback
(
p_input_thread
,
"state"
,
input_state_changed
,
p_mi
);
vlc_event_manager_t
*
p_em
=
input_get_event_manager
(
p_input_thread
);
vlc_event_attach
(
p_em
,
vlc_InputStateChanged
,
input_state_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"seekable"
,
input_seekable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"seekable"
,
input_seekable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"pausable"
,
input_pausable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"pausable"
,
input_pausable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"intf-change"
,
input_position_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"intf-change"
,
input_position_changed
,
p_mi
);
...
...
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