Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
cd728cd0
Commit
cd728cd0
authored
Dec 11, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use 2 event manager in input.
parent
b64c0866
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
128 deletions
+70
-128
include/vlc_input.h
include/vlc_input.h
+0
-7
src/control/media_player.c
src/control/media_player.c
+51
-66
src/input/event.c
src/input/event.c
+0
-12
src/input/input.c
src/input/input.c
+0
-15
src/input/input_internal.h
src/input/input_internal.h
+0
-3
src/libvlccore.sym
src/libvlccore.sym
+0
-1
src/playlist/engine.c
src/playlist/engine.c
+19
-24
No files found.
include/vlc_input.h
View file @
cd728cd0
...
@@ -673,13 +673,6 @@ static inline int input_AddSubtitle( input_thread_t *p_input, const char *psz_ur
...
@@ -673,13 +673,6 @@ static inline int input_AddSubtitle( input_thread_t *p_input, const char *psz_ur
return
input_Control
(
p_input
,
INPUT_ADD_SUBTITLE
,
psz_url
,
b_check_extension
);
return
input_Control
(
p_input
,
INPUT_ADD_SUBTITLE
,
psz_url
,
b_check_extension
);
}
}
/**
* It will return the input event manager.
*
* You are advised to use "intf-event" instead if you want completness.
*/
VLC_EXPORT
(
vlc_event_manager_t
*
,
input_GetEventManager
,
(
input_thread_t
*
)
);
/* */
/* */
typedef
struct
input_clock_t
input_clock_t
;
typedef
struct
input_clock_t
input_clock_t
;
VLC_EXPORT
(
decoder_t
*
,
input_DecoderNew
,
(
input_thread_t
*
,
es_format_t
*
,
input_clock_t
*
,
sout_instance_t
*
)
);
VLC_EXPORT
(
decoder_t
*
,
input_DecoderNew
,
(
input_thread_t
*
,
es_format_t
*
,
input_clock_t
*
,
sout_instance_t
*
)
);
...
...
src/control/media_player.c
View file @
cd728cd0
...
@@ -29,9 +29,6 @@
...
@@ -29,9 +29,6 @@
#include <vlc_vout.h>
#include <vlc_vout.h>
#include "libvlc.h"
#include "libvlc.h"
static
void
input_state_changed
(
const
vlc_event_t
*
event
,
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
,
...
@@ -83,8 +80,6 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
...
@@ -83,8 +80,6 @@ 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
)
{
{
vlc_event_manager_t
*
p_em
=
input_GetEventManager
(
p_input_thread
);
vlc_event_detach
(
p_em
,
vlc_InputStateChanged
,
input_state_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"can-seek"
,
input_seekable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"can-seek"
,
input_seekable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"can-pause"
,
input_pausable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"can-pause"
,
input_pausable_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"intf-event"
,
input_event_changed
,
p_mi
);
var_DelCallback
(
p_input_thread
,
"intf-event"
,
input_event_changed
,
p_mi
);
...
@@ -130,51 +125,6 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
...
@@ -130,51 +125,6 @@ input_thread_t *libvlc_get_input_thread( libvlc_media_player_t *p_mi,
return
p_input_thread
;
return
p_input_thread
;
}
}
/*
* input_state_changed (Private) (vlc_InputStateChanged callback)
*/
static
void
input_state_changed
(
const
vlc_event_t
*
event
,
void
*
p_userdata
)
{
libvlc_media_player_t
*
p_mi
=
p_userdata
;
libvlc_event_t
forwarded_event
;
libvlc_event_type_t
type
=
event
->
u
.
input_state_changed
.
new_state
;
switch
(
type
)
{
case
INIT_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_NothingSpecial
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerNothingSpecial
;
break
;
case
OPENING_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Opening
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerOpening
;
break
;
case
PLAYING_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Playing
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerPlaying
;
break
;
case
PAUSE_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Paused
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerPaused
;
break
;
case
END_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Ended
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerEndReached
;
break
;
case
ERROR_S
:
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_Error
,
NULL
);
forwarded_event
.
type
=
libvlc_MediaPlayerEncounteredError
;
break
;
default:
return
;
}
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
forwarded_event
);
return
;
}
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
,
...
@@ -223,23 +173,61 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
...
@@ -223,23 +173,61 @@ input_event_changed( vlc_object_t * p_this, char const * 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
event
;
if
(
newval
.
i_int
!=
INPUT_EVENT_TIMES
)
assert
(
!
strcmp
(
psz_cmd
,
"intf-event"
)
);
return
VLC_EGENERIC
;
assert
(
!
strcmp
(
psz_cmd
,
"intf-event"
)
);
if
(
newval
.
i_int
==
INPUT_EVENT_STATE
)
{
libvlc_state_t
libvlc_state
;
if
(
var_GetInteger
(
p_input
,
"state"
)
!=
PLAYING_S
)
switch
(
var_GetInteger
(
p_input
,
"state"
)
)
return
VLC_SUCCESS
;
/* Don't send the position while stopped */
{
case
INIT_S
:
libvlc_state
=
libvlc_NothingSpecial
;
event
.
type
=
libvlc_MediaPlayerNothingSpecial
;
break
;
case
OPENING_S
:
libvlc_state
=
libvlc_Opening
;
event
.
type
=
libvlc_MediaPlayerOpening
;
break
;
case
PLAYING_S
:
libvlc_state
=
libvlc_Playing
;
event
.
type
=
libvlc_MediaPlayerPlaying
;
break
;
case
PAUSE_S
:
libvlc_state
=
libvlc_Paused
;
event
.
type
=
libvlc_MediaPlayerPaused
;
break
;
case
END_S
:
libvlc_state
=
libvlc_Ended
;
event
.
type
=
libvlc_MediaPlayerEndReached
;
break
;
case
ERROR_S
:
libvlc_state
=
libvlc_Error
;
event
.
type
=
libvlc_MediaPlayerEncounteredError
;
break
;
default:
return
VLC_SUCCESS
;
}
/* */
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_state
,
NULL
);
event
.
type
=
libvlc_MediaPlayerPositionChanged
;
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
event
.
u
.
media_player_position_changed
.
new_position
=
var_GetFloat
(
p_input
,
"position"
);;
}
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
else
if
(
newval
.
i_int
==
INPUT_EVENT_TIMES
)
{
if
(
var_GetInteger
(
p_input
,
"state"
)
!=
PLAYING_S
)
return
VLC_SUCCESS
;
/* Don't send the position while stopped */
/* */
/* */
event
.
type
=
libvlc_MediaPlayerTimeChanged
;
event
.
type
=
libvlc_MediaPlayerPositionChanged
;
event
.
u
.
media_player_time_changed
.
new_time
=
var_GetTime
(
p_input
,
"time"
);
event
.
u
.
media_player_position_changed
.
new_position
=
var_GetFloat
(
p_input
,
"position"
);;
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
/* */
event
.
type
=
libvlc_MediaPlayerTimeChanged
;
event
.
u
.
media_player_time_changed
.
new_time
=
var_GetTime
(
p_input
,
"time"
);
libvlc_event_send
(
p_mi
->
p_event_manager
,
&
event
);
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
@@ -611,9 +599,6 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
...
@@ -611,9 +599,6 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
var_Set
(
p_input_thread
,
"drawable"
,
val
);
var_Set
(
p_input_thread
,
"drawable"
,
val
);
}
}
vlc_event_manager_t
*
p_em
=
input_GetEventManager
(
p_input_thread
);
vlc_event_attach
(
p_em
,
vlc_InputStateChanged
,
input_state_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"can-seek"
,
input_seekable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"can-seek"
,
input_seekable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"can-pause"
,
input_pausable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"can-pause"
,
input_pausable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"intf-event"
,
input_event_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"intf-event"
,
input_event_changed
,
p_mi
);
...
...
src/input/event.c
View file @
cd728cd0
...
@@ -147,13 +147,6 @@ void input_SendEventState( input_thread_t *p_input, int i_state )
...
@@ -147,13 +147,6 @@ void input_SendEventState( input_thread_t *p_input, int i_state )
var_Change
(
p_input
,
"state"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
var_Change
(
p_input
,
"state"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
Trigger
(
p_input
,
INPUT_EVENT_STATE
);
Trigger
(
p_input
,
INPUT_EVENT_STATE
);
/* FIXME remove this ugliness */
vlc_event_t
event
;
event
.
type
=
vlc_InputStateChanged
;
event
.
u
.
input_state_changed
.
new_state
=
i_state
;
vlc_event_send
(
&
p_input
->
p
->
event_manager
,
&
event
);
}
}
void
input_SendEventCache
(
input_thread_t
*
p_input
,
double
f_level
)
void
input_SendEventCache
(
input_thread_t
*
p_input
,
double
f_level
)
...
@@ -301,11 +294,6 @@ void input_SendEventEsSelect( input_thread_t *p_input, int i_cat, int i_id )
...
@@ -301,11 +294,6 @@ void input_SendEventEsSelect( input_thread_t *p_input, int i_cat, int i_id )
var_Change
(
p_input
,
GetEsVarName
(
i_cat
),
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
var_Change
(
p_input
,
GetEsVarName
(
i_cat
),
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
Trigger
(
p_input
,
INPUT_EVENT_ES
);
Trigger
(
p_input
,
INPUT_EVENT_ES
);
/* FIXME to remove this ugliness */
vlc_event_t
event
;
event
.
type
=
vlc_InputSelectedStreamChanged
;
vlc_event_send
(
&
p_input
->
p
->
event_manager
,
&
event
);
}
}
void
input_SendEventTeletext
(
input_thread_t
*
p_input
,
int
i_id
)
void
input_SendEventTeletext
(
input_thread_t
*
p_input
,
int
i_id
)
...
...
src/input/input.c
View file @
cd728cd0
...
@@ -162,12 +162,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
...
@@ -162,12 +162,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
p_input
->
b_preparsing
=
b_quick
;
p_input
->
b_preparsing
=
b_quick
;
p_input
->
psz_header
=
psz_header
?
strdup
(
psz_header
)
:
NULL
;
p_input
->
psz_header
=
psz_header
?
strdup
(
psz_header
)
:
NULL
;
/* Init events */
vlc_event_manager_t
*
p_em
=
&
p_input
->
p
->
event_manager
;
vlc_event_manager_init_with_vlc_object
(
p_em
,
p_input
);
vlc_event_manager_register_event_type
(
p_em
,
vlc_InputStateChanged
);
vlc_event_manager_register_event_type
(
p_em
,
vlc_InputSelectedStreamChanged
);
/* Init Common fields */
/* Init Common fields */
p_input
->
b_eof
=
false
;
p_input
->
b_eof
=
false
;
p_input
->
b_can_pace_control
=
true
;
p_input
->
b_can_pace_control
=
true
;
...
@@ -324,8 +318,6 @@ static void Destructor( input_thread_t * p_input )
...
@@ -324,8 +318,6 @@ static void Destructor( input_thread_t * p_input )
free
(
psz_name
);
free
(
psz_name
);
#endif
#endif
vlc_event_manager_fini
(
&
p_input
->
p
->
event_manager
);
stats_TimerDump
(
p_input
,
STATS_TIMER_INPUT_LAUNCHING
);
stats_TimerDump
(
p_input
,
STATS_TIMER_INPUT_LAUNCHING
);
stats_TimerClean
(
p_input
,
STATS_TIMER_INPUT_LAUNCHING
);
stats_TimerClean
(
p_input
,
STATS_TIMER_INPUT_LAUNCHING
);
#ifdef ENABLE_SOUT
#ifdef ENABLE_SOUT
...
@@ -3185,13 +3177,6 @@ void input_UpdateStatistic( input_thread_t *p_input,
...
@@ -3185,13 +3177,6 @@ void input_UpdateStatistic( input_thread_t *p_input,
}
}
vlc_mutex_unlock
(
&
p_input
->
p
->
counters
.
counters_lock
);
vlc_mutex_unlock
(
&
p_input
->
p
->
counters
.
counters_lock
);
}
}
/*****************************************************************************
* input_GetEventManager
*****************************************************************************/
vlc_event_manager_t
*
input_GetEventManager
(
input_thread_t
*
p_input
)
{
return
&
p_input
->
p
->
event_manager
;
}
/**/
/**/
/* TODO FIXME nearly the same logic that snapshot code */
/* TODO FIXME nearly the same logic that snapshot code */
...
...
src/input/input_internal.h
View file @
cd728cd0
...
@@ -75,9 +75,6 @@ typedef struct
...
@@ -75,9 +75,6 @@ typedef struct
/** Private input fields */
/** Private input fields */
struct
input_thread_private_t
struct
input_thread_private_t
{
{
/* Object's event manager */
vlc_event_manager_t
event_manager
;
/* Global properties */
/* Global properties */
bool
b_can_pause
;
bool
b_can_pause
;
bool
b_can_rate_control
;
bool
b_can_rate_control
;
...
...
src/libvlccore.sym
View file @
cd728cd0
...
@@ -160,7 +160,6 @@ __input_CreateThread
...
@@ -160,7 +160,6 @@ __input_CreateThread
input_DecoderDecode
input_DecoderDecode
input_DecoderDelete
input_DecoderDelete
input_DecoderNew
input_DecoderNew
input_GetEventManager
input_GetItem
input_GetItem
input_item_AddInfo
input_item_AddInfo
input_item_AddOpt
input_item_AddOpt
...
...
src/playlist/engine.c
View file @
cd728cd0
...
@@ -224,22 +224,24 @@ static void ObjectGarbageCollector( playlist_t *p_playlist, bool b_force )
...
@@ -224,22 +224,24 @@ static void ObjectGarbageCollector( playlist_t *p_playlist, bool b_force )
}
}
/* Input Callback */
/* Input Callback */
static
void
input_state_changed
(
const
vlc_event_t
*
event
,
void
*
data
)
static
int
InputEvent
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
{
(
void
)
event
;
VLC_UNUSED
(
p_this
);
VLC_UNUSED
(
psz_cmd
);
VLC_UNUSED
(
oldval
);
playlist_t
*
p_playlist
=
data
;
playlist_t
*
p_playlist
=
p_data
;
playlist_Signal
(
p_playlist
);
}
/* Input Callback */
if
(
newval
.
i_int
==
INPUT_EVENT_STATE
)
static
void
input_selected_stream_changed
(
const
vlc_event_t
*
event
,
void
*
data
)
{
{
playlist_Signal
(
p_playlist
);
(
void
)
event
;
}
playlist_t
*
p_playlist
=
data
;
else
if
(
newval
.
i_int
==
INPUT_EVENT_ES
)
PL_LOCK
;
{
pl_priv
(
p_playlist
)
->
gc_date
=
mdate
();
PL_LOCK
;
vlc_object_signal_unlocked
(
p_playlist
);
pl_priv
(
p_playlist
)
->
gc_date
=
mdate
();
PL_UNLOCK
;
vlc_object_signal_unlocked
(
p_playlist
);
PL_UNLOCK
;
}
return
VLC_SUCCESS
;
}
}
/* Internals */
/* Internals */
...
@@ -250,12 +252,8 @@ void playlist_release_current_input( playlist_t * p_playlist )
...
@@ -250,12 +252,8 @@ void playlist_release_current_input( playlist_t * p_playlist )
if
(
!
pl_priv
(
p_playlist
)
->
p_input
)
return
;
if
(
!
pl_priv
(
p_playlist
)
->
p_input
)
return
;
input_thread_t
*
p_input
=
pl_priv
(
p_playlist
)
->
p_input
;
input_thread_t
*
p_input
=
pl_priv
(
p_playlist
)
->
p_input
;
vlc_event_manager_t
*
p_em
=
input_GetEventManager
(
p_input
);
vlc_event_detach
(
p_em
,
vlc_InputStateChanged
,
var_DelCallback
(
p_input
,
"intf-event"
,
InputEvent
,
p_playlist
);
input_state_changed
,
p_playlist
);
vlc_event_detach
(
p_em
,
vlc_InputSelectedStreamChanged
,
input_selected_stream_changed
,
p_playlist
);
pl_priv
(
p_playlist
)
->
p_input
=
NULL
;
pl_priv
(
p_playlist
)
->
p_input
=
NULL
;
/* Release the playlist lock, because we may get stuck
/* Release the playlist lock, because we may get stuck
...
@@ -277,11 +275,8 @@ void playlist_set_current_input(
...
@@ -277,11 +275,8 @@ void playlist_set_current_input(
{
{
vlc_object_hold
(
p_input
);
vlc_object_hold
(
p_input
);
pl_priv
(
p_playlist
)
->
p_input
=
p_input
;
pl_priv
(
p_playlist
)
->
p_input
=
p_input
;
vlc_event_manager_t
*
p_em
=
input_GetEventManager
(
p_input
);
vlc_event_attach
(
p_em
,
vlc_InputStateChanged
,
var_AddCallback
(
p_input
,
"intf-event"
,
InputEvent
,
p_playlist
);
input_state_changed
,
p_playlist
);
vlc_event_attach
(
p_em
,
vlc_InputSelectedStreamChanged
,
input_selected_stream_changed
,
p_playlist
);
}
}
}
}
...
...
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