Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
8236d4c9
Commit
8236d4c9
authored
Mar 09, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a INPUT_EVENT_ABORT event to detect user requested abort.
parent
0715fa58
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
18 deletions
+42
-18
include/vlc_input.h
include/vlc_input.h
+15
-3
modules/services_discovery/podcast.c
modules/services_discovery/podcast.c
+2
-2
src/control/media_player.c
src/control/media_player.c
+11
-6
src/input/event.c
src/input/event.c
+4
-0
src/input/event.h
src/input/event.h
+1
-0
src/input/input.c
src/input/input.c
+3
-1
src/input/vlm.c
src/input/vlm.c
+3
-3
src/playlist/item.c
src/playlist/item.c
+1
-1
src/playlist/thread.c
src/playlist/thread.c
+2
-2
No files found.
include/vlc_input.h
View file @
8236d4c9
...
...
@@ -375,6 +375,8 @@ typedef enum input_event_type_e
INPUT_EVENT_STATE
,
/* b_dead is true */
INPUT_EVENT_DEAD
,
/* a *user* abort has been requested */
INPUT_EVENT_ABORT
,
/* "rate" has changed */
INPUT_EVENT_RATE
,
...
...
@@ -435,12 +437,22 @@ typedef enum input_event_type_e
* Prototypes
*****************************************************************************/
/* input_CreateThread
* Release the returned input_thread_t using vlc_object_release() */
/**
* It will create a new input thread.
*
* You must call input_StopThread() on it and then vlc_object_release().
*/
#define input_CreateThread(a,b) __input_CreateThread(VLC_OBJECT(a),b)
VLC_EXPORT
(
input_thread_t
*
,
__input_CreateThread
,
(
vlc_object_t
*
,
input_item_t
*
)
);
VLC_EXPORT
(
void
,
input_StopThread
,
(
input_thread_t
*
)
);
/**
* It will ask a input_thread_t to stop.
*
* b_abort must be true when a user stop is requested and not because you have
* detected an error or an eof. It will be used to properly send the
* INPUT_EVENT_ABORT event.
*/
VLC_EXPORT
(
void
,
input_StopThread
,
(
input_thread_t
*
,
bool
b_abort
)
);
#define input_Read(a,b,c) __input_Read(VLC_OBJECT(a),b, c)
VLC_EXPORT
(
int
,
__input_Read
,
(
vlc_object_t
*
,
input_item_t
*
,
bool
)
);
...
...
modules/services_discovery/podcast.c
View file @
8236d4c9
...
...
@@ -158,7 +158,7 @@ static void Close( vlc_object_t *p_this )
{
if
(
p_sd
->
p_sys
->
pp_input
[
i
]
)
{
input_StopThread
(
p_sd
->
p_sys
->
pp_input
[
i
]
);
input_StopThread
(
p_sd
->
p_sys
->
pp_input
[
i
]
,
true
);
vlc_object_release
(
p_sd
->
p_sys
->
pp_input
[
i
]
);
p_sd
->
p_sys
->
pp_input
[
i
]
=
NULL
;
}
...
...
@@ -197,7 +197,7 @@ static void *Run( void *data )
if
(
p_sd
->
p_sys
->
pp_input
[
i
]
->
b_eof
||
p_sd
->
p_sys
->
pp_input
[
i
]
->
b_error
)
{
input_StopThread
(
p_sd
->
p_sys
->
pp_input
[
i
]
);
input_StopThread
(
p_sd
->
p_sys
->
pp_input
[
i
]
,
false
);
vlc_object_release
(
p_sd
->
p_sys
->
pp_input
[
i
]
);
p_sd
->
p_sys
->
pp_input
[
i
]
=
NULL
;
REMOVE_ELEM
(
p_sys
->
pp_input
,
p_sys
->
i_input
,
i
);
...
...
src/control/media_player.c
View file @
8236d4c9
...
...
@@ -69,7 +69,7 @@ static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
*
* Object lock is NOT held.
*/
static
void
release_input_thread
(
libvlc_media_player_t
*
p_mi
)
static
void
release_input_thread
(
libvlc_media_player_t
*
p_mi
,
bool
b_input_abort
)
{
input_thread_t
*
p_input_thread
;
...
...
@@ -89,7 +89,7 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
input_event_changed
,
p_mi
);
/* We owned this one */
input_StopThread
(
p_input_thread
);
input_StopThread
(
p_input_thread
,
b_input_abort
);
vlc_thread_join
(
p_input_thread
);
var_Destroy
(
p_input_thread
,
"drawable-hwnd"
);
...
...
@@ -455,7 +455,7 @@ void libvlc_media_player_release( libvlc_media_player_t *p_mi )
vlc_mutex_unlock
(
&
p_mi
->
object_lock
);
vlc_mutex_destroy
(
&
p_mi
->
object_lock
);
release_input_thread
(
p_mi
);
release_input_thread
(
p_mi
,
true
);
libvlc_event_manager_release
(
p_mi
->
p_event_manager
);
...
...
@@ -494,7 +494,12 @@ void libvlc_media_player_set_media(
vlc_mutex_lock
(
&
p_mi
->
object_lock
);
release_input_thread
(
p_mi
);
/* FIXME I am not sure if it is a user request or on die(eof/error)
* request here */
release_input_thread
(
p_mi
,
p_mi
->
p_input_thread
&&
!
p_mi
->
p_input_thread
->
b_eof
&&
!
p_mi
->
p_input_thread
->
b_error
);
if
(
p_mi
->
p_md
)
libvlc_media_set_state
(
p_mi
->
p_md
,
libvlc_NothingSpecial
,
p_e
);
...
...
@@ -703,7 +708,7 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
if
(
p_mi
->
b_own_its_input_thread
)
{
vlc_mutex_lock
(
&
p_mi
->
object_lock
);
release_input_thread
(
p_mi
);
/* This will stop the input thread */
release_input_thread
(
p_mi
,
true
);
/* This will stop the input thread */
vlc_mutex_unlock
(
&
p_mi
->
object_lock
);
}
else
...
...
@@ -713,7 +718,7 @@ void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
if
(
!
p_input_thread
)
return
;
input_StopThread
(
p_input_thread
);
input_StopThread
(
p_input_thread
,
true
);
vlc_object_release
(
p_input_thread
);
}
}
...
...
src/input/event.c
View file @
8236d4c9
...
...
@@ -55,6 +55,10 @@ void input_SendEventDead( input_thread_t *p_input )
Trigger
(
p_input
,
INPUT_EVENT_DEAD
);
}
void
input_SendEventAbort
(
input_thread_t
*
p_input
)
{
Trigger
(
p_input
,
INPUT_EVENT_ABORT
);
}
void
input_SendEventTimes
(
input_thread_t
*
p_input
,
double
f_position
,
mtime_t
i_time
,
mtime_t
i_length
)
...
...
src/input/event.h
View file @
8236d4c9
...
...
@@ -34,6 +34,7 @@
* Event for input.c
*****************************************************************************/
void
input_SendEventDead
(
input_thread_t
*
p_input
);
void
input_SendEventAbort
(
input_thread_t
*
p_input
);
void
input_SendEventTimes
(
input_thread_t
*
p_input
,
double
f_position
,
mtime_t
i_time
,
mtime_t
i_length
);
void
input_SendEventStatistics
(
input_thread_t
*
p_input
);
void
input_SendEventRate
(
input_thread_t
*
p_input
,
int
i_rate
);
...
...
src/input/input.c
View file @
8236d4c9
...
...
@@ -430,7 +430,7 @@ int input_Preparse( vlc_object_t *p_parent, input_item_t *p_item )
*
* \param the input thread to stop
*/
void
input_StopThread
(
input_thread_t
*
p_input
)
void
input_StopThread
(
input_thread_t
*
p_input
,
bool
b_abort
)
{
/* Set die for input and ALL of this childrens (even (grand-)grand-childrens)
* It is needed here even if it is done in INPUT_CONTROL_SET_DIE handler to
...
...
@@ -438,6 +438,8 @@ void input_StopThread( input_thread_t *p_input )
ObjectKillChildrens
(
p_input
,
VLC_OBJECT
(
p_input
)
);
input_ControlPush
(
p_input
,
INPUT_CONTROL_SET_DIE
,
NULL
);
if
(
b_abort
)
input_SendEventAbort
(
p_input
);
}
input_resource_t
*
input_DetachResource
(
input_thread_t
*
p_input
)
...
...
src/input/vlm.c
View file @
8236d4c9
...
...
@@ -536,7 +536,7 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
while
(
!
p_input
->
b_eof
&&
!
p_input
->
b_error
)
msleep
(
100000
);
input_StopThread
(
p_input
);
input_StopThread
(
p_input
,
false
);
vlc_thread_join
(
p_input
);
vlc_object_release
(
p_input
);
}
...
...
@@ -777,7 +777,7 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
{
input_resource_t
*
p_resource
;
input_StopThread
(
p_input
);
input_StopThread
(
p_input
,
true
);
vlc_thread_join
(
p_input
);
p_resource
=
input_DetachResource
(
p_input
);
...
...
@@ -860,7 +860,7 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
return
VLC_SUCCESS
;
}
input_StopThread
(
p_input
);
input_StopThread
(
p_input
,
!
p_input
->
b_eof
&&
!
p_input
->
b_error
);
vlc_thread_join
(
p_input
);
p_instance
->
p_input_resource
=
input_DetachResource
(
p_input
);
...
...
src/playlist/item.c
View file @
8236d4c9
...
...
@@ -823,7 +823,7 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
pl_priv
(
p_playlist
)
->
request
.
i_skip
=
0
;
pl_priv
(
p_playlist
)
->
request
.
p_item
=
p_toplay
;
if
(
pl_priv
(
p_playlist
)
->
p_input
)
input_StopThread
(
pl_priv
(
p_playlist
)
->
p_input
);
input_StopThread
(
pl_priv
(
p_playlist
)
->
p_input
,
true
);
pl_priv
(
p_playlist
)
->
request
.
i_status
=
PLAYLIST_RUNNING
;
vlc_cond_signal
(
&
pl_priv
(
p_playlist
)
->
signal
);
}
...
...
src/playlist/thread.c
View file @
8236d4c9
...
...
@@ -473,7 +473,7 @@ static int LoopInput( playlist_t *p_playlist )
if
(
(
p_sys
->
request
.
b_request
||
!
vlc_object_alive
(
p_playlist
)
)
&&
!
p_input
->
b_die
)
{
PL_DEBUG
(
"incoming request - stopping current input"
);
input_StopThread
(
p_input
);
input_StopThread
(
p_input
,
true
);
}
/* This input is dead. Remove it ! */
...
...
@@ -514,7 +514,7 @@ static int LoopInput( playlist_t *p_playlist )
else
if
(
p_input
->
b_error
||
p_input
->
b_eof
)
{
PL_DEBUG
(
"finished input"
);
input_StopThread
(
p_input
);
input_StopThread
(
p_input
,
false
);
}
return
VLC_SUCCESS
;
}
...
...
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