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
556953c4
Commit
556953c4
authored
Jan 25, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc_event_manager: remove exceptions
parent
6b53f6b7
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
144 additions
and
124 deletions
+144
-124
include/vlc/libvlc.h
include/vlc/libvlc.h
+5
-6
src/control/event.c
src/control/event.c
+18
-33
src/control/hierarchical_media_list_view.c
src/control/hierarchical_media_list_view.c
+4
-4
src/control/hierarchical_node_media_list_view.c
src/control/hierarchical_node_media_list_view.c
+5
-5
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+3
-6
src/control/media.c
src/control/media.c
+11
-6
src/control/media_discoverer.c
src/control/media_discoverer.c
+8
-4
src/control/media_library.c
src/control/media_library.c
+6
-1
src/control/media_list.c
src/control/media_list.c
+14
-13
src/control/media_list_player.c
src/control/media_list_player.c
+14
-5
src/control/media_list_view.c
src/control/media_list_view.c
+21
-13
src/control/media_player.c
src/control/media_player.c
+4
-5
src/control/vlm.c
src/control/vlm.c
+14
-13
test/libvlc/events.c
test/libvlc/events.c
+14
-8
test/libvlc/media_list_player.c
test/libvlc/media_list_player.c
+3
-2
No files found.
include/vlc/libvlc.h
View file @
556953c4
...
...
@@ -294,13 +294,12 @@ typedef void ( *libvlc_callback_t )( const libvlc_event_t *, void * );
* \param i_event_type the desired event to which we want to listen
* \param f_callback the function to call when i_event_type occurs
* \param user_data user provided data to carry with the event
* \
param p_e an initialized exception pointe
r
* \
return 0 on success, ENOMEM on erro
r
*/
VLC_PUBLIC_API
void
libvlc_event_attach
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
i_event_type
,
libvlc_callback_t
f_callback
,
void
*
user_data
,
libvlc_exception_t
*
p_e
);
VLC_PUBLIC_API
int
libvlc_event_attach
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
i_event_type
,
libvlc_callback_t
f_callback
,
void
*
user_data
);
/**
* Unregister an event notification.
...
...
src/control/event.c
View file @
556953c4
...
...
@@ -32,6 +32,7 @@
#include "libvlc_internal.h"
#include "event_internal.h"
#include <assert.h>
#include <errno.h>
typedef
struct
libvlc_event_listeners_group_t
{
...
...
@@ -67,15 +68,13 @@ group_contains_listener( libvlc_event_listeners_group_t * group,
* Init an object's event manager.
**************************************************************************/
libvlc_event_manager_t
*
libvlc_event_manager_new
(
void
*
p_obj
,
libvlc_instance_t
*
p_libvlc_inst
,
libvlc_exception_t
*
p_e
)
libvlc_event_manager_new
(
void
*
p_obj
,
libvlc_instance_t
*
p_libvlc_inst
)
{
libvlc_event_manager_t
*
p_em
;
p_em
=
malloc
(
sizeof
(
libvlc_event_manager_t
));
if
(
!
p_em
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
...
...
@@ -129,18 +128,10 @@ void libvlc_event_manager_release( libvlc_event_manager_t * p_em )
**************************************************************************/
void
libvlc_event_manager_register_event_type
(
libvlc_event_manager_t
*
p_em
,
libvlc_event_type_t
event_type
,
libvlc_exception_t
*
p_e
)
libvlc_event_type_t
event_type
)
{
libvlc_event_listeners_group_t
*
listeners_group
;
listeners_group
=
malloc
(
sizeof
(
libvlc_event_listeners_group_t
));
if
(
!
listeners_group
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Not enough memory"
);
return
;
}
listeners_group
=
xmalloc
(
sizeof
(
libvlc_event_listeners_group_t
));
listeners_group
->
event_type
=
event_type
;
vlc_array_init
(
&
listeners_group
->
listeners
);
...
...
@@ -276,24 +267,18 @@ const char * libvlc_event_type_name( libvlc_event_type_t event_type )
* Add a callback for an event.
**************************************************************************/
static
void
event_attach
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
event_type
,
libvlc_callback_t
pf_callback
,
void
*
p_user_data
,
bool
is_asynchronous
,
libvlc_exception_t
*
p_e
)
int
event_attach
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
event_type
,
libvlc_callback_t
pf_callback
,
void
*
p_user_data
,
bool
is_asynchronous
)
{
libvlc_event_listeners_group_t
*
listeners_group
;
libvlc_event_listener_t
*
listener
;
int
i
;
listener
=
malloc
(
sizeof
(
libvlc_event_listener_t
));
if
(
!
listener
)
{
libvlc_exception_raise
(
p_e
);
libvlc_printerr
(
"Not enough memory"
);
return
;
}
if
(
unlikely
(
listener
==
NULL
)
)
return
ENOMEM
;
listener
->
event_type
=
event_type
;
listener
->
p_user_data
=
p_user_data
;
...
...
@@ -308,7 +293,7 @@ void event_attach( libvlc_event_manager_t * p_event_manager,
{
vlc_array_append
(
&
listeners_group
->
listeners
,
listener
);
vlc_mutex_unlock
(
&
p_event_manager
->
object_lock
);
return
;
return
0
;
}
}
vlc_mutex_unlock
(
&
p_event_manager
->
object_lock
);
...
...
@@ -324,13 +309,13 @@ void event_attach( libvlc_event_manager_t * p_event_manager,
*
* Add a callback for an event.
**************************************************************************/
void
libvlc_event_attach
(
libvlc_event_manager_t
*
p_event_manager
,
int
libvlc_event_attach
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
event_type
,
libvlc_callback_t
pf_callback
,
void
*
p_user_data
,
libvlc_exception_t
*
p_e
)
void
*
p_user_data
)
{
event_attach
(
p_event_manager
,
event_type
,
pf_callback
,
p_user_data
,
false
/* synchronous */
,
p_e
);
return
event_attach
(
p_event_manager
,
event_type
,
pf_callback
,
p_user_data
,
false
/* synchronous */
);
}
/**************************************************************************
...
...
@@ -341,10 +326,10 @@ void libvlc_event_attach( libvlc_event_manager_t * p_event_manager,
void
libvlc_event_attach_async
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
event_type
,
libvlc_callback_t
pf_callback
,
void
*
p_user_data
,
libvlc_exception_t
*
p_e
)
void
*
p_user_data
)
{
event_attach
(
p_event_manager
,
event_type
,
pf_callback
,
p_user_data
,
true
/* asynchronous */
,
p_e
);
event_attach
(
p_event_manager
,
event_type
,
pf_callback
,
p_user_data
,
true
/* asynchronous */
);
}
/**************************************************************************
...
...
src/control/hierarchical_media_list_view.c
View file @
556953c4
...
...
@@ -178,16 +178,16 @@ libvlc_media_list_hierarchical_view( libvlc_media_list_t * p_mlist,
libvlc_media_list_lock
(
p_mlist
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
media_list_item_added
,
p_mlv
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListWillAddItem
,
media_list_will_add_item
,
p_mlv
,
NULL
);
media_list_will_add_item
,
p_mlv
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_deleted
,
p_mlv
,
NULL
);
media_list_item_deleted
,
p_mlv
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListWillDeleteItem
,
media_list_will_delete_item
,
p_mlv
,
NULL
);
media_list_will_delete_item
,
p_mlv
);
libvlc_media_list_unlock
(
p_mlist
);
return
p_mlv
;
}
src/control/hierarchical_node_media_list_view.c
View file @
556953c4
...
...
@@ -208,7 +208,7 @@ media_list_item_added( const libvlc_event_t * p_event, void * user_data )
if
(
index
>=
0
)
libvlc_media_list_view_item_added
(
p_mlv
,
p_md
,
index
);
libvlc_event_attach
(
p_md
->
p_event_manager
,
libvlc_MediaSubItemAdded
,
items_subitems_added
,
p_mlv
,
NULL
);
items_subitems_added
,
p_mlv
);
}
static
void
...
...
@@ -298,16 +298,16 @@ libvlc_media_list_hierarchical_node_view( libvlc_media_list_t * p_mlist,
libvlc_media_list_lock
(
p_mlist
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
media_list_item_added
,
p_mlv
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListWillAddItem
,
media_list_will_add_item
,
p_mlv
,
NULL
);
media_list_will_add_item
,
p_mlv
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_deleted
,
p_mlv
,
NULL
);
media_list_item_deleted
,
p_mlv
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListWillDeleteItem
,
media_list_will_delete_item
,
p_mlv
,
NULL
);
media_list_will_delete_item
,
p_mlv
);
libvlc_media_list_unlock
(
p_mlist
);
return
p_mlv
;
}
src/control/libvlc_internal.h
View file @
556953c4
...
...
@@ -81,16 +81,14 @@ void libvlc_deinit_threads (void);
/* Events */
libvlc_event_manager_t
*
libvlc_event_manager_new
(
void
*
p_obj
,
libvlc_instance_t
*
p_libvlc_inst
,
libvlc_exception_t
*
p_e
);
void
*
p_obj
,
libvlc_instance_t
*
p_libvlc_inst
);
void
libvlc_event_manager_release
(
libvlc_event_manager_t
*
p_em
);
void
libvlc_event_manager_register_event_type
(
libvlc_event_manager_t
*
p_em
,
libvlc_event_type_t
event_type
,
libvlc_exception_t
*
p_e
);
libvlc_event_type_t
event_type
);
void
libvlc_event_send
(
libvlc_event_manager_t
*
p_em
,
...
...
@@ -99,8 +97,7 @@ void libvlc_event_send(
void
libvlc_event_attach_async
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
event_type
,
libvlc_callback_t
pf_callback
,
void
*
p_user_data
,
libvlc_exception_t
*
p_e
);
void
*
p_user_data
);
/* Exception shorcuts */
...
...
src/control/media.c
View file @
556953c4
...
...
@@ -270,17 +270,22 @@ libvlc_media_t * libvlc_media_new_from_input_item(
* It can give a bunch of item to read. */
p_md
->
p_subitems
=
NULL
;
p_md
->
p_event_manager
=
libvlc_event_manager_new
(
p_md
,
p_instance
,
p_e
);
p_md
->
p_event_manager
=
libvlc_event_manager_new
(
p_md
,
p_instance
);
if
(
unlikely
(
p_md
->
p_event_manager
==
NULL
)
)
{
free
(
p_md
);
return
NULL
;
}
libvlc_event_manager_register_event_type
(
p_md
->
p_event_manager
,
libvlc_MediaMetaChanged
,
p_e
);
libvlc_MediaMetaChanged
);
libvlc_event_manager_register_event_type
(
p_md
->
p_event_manager
,
libvlc_MediaSubItemAdded
,
p_e
);
libvlc_MediaSubItemAdded
);
libvlc_event_manager_register_event_type
(
p_md
->
p_event_manager
,
libvlc_MediaFreed
,
p_e
);
libvlc_MediaFreed
);
libvlc_event_manager_register_event_type
(
p_md
->
p_event_manager
,
libvlc_MediaDurationChanged
,
p_e
);
libvlc_MediaDurationChanged
);
libvlc_event_manager_register_event_type
(
p_md
->
p_event_manager
,
libvlc_MediaStateChanged
,
p_e
);
libvlc_MediaStateChanged
);
vlc_gc_incref
(
p_md
->
p_input_item
);
...
...
src/control/media_discoverer.c
View file @
556953c4
...
...
@@ -190,13 +190,17 @@ libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,
vlc_dictionary_init
(
&
p_mdis
->
catname_to_submedialist
,
0
);
p_mdis
->
p_event_manager
=
libvlc_event_manager_new
(
p_mdis
,
p_inst
,
NULL
);
p_mdis
->
p_event_manager
=
libvlc_event_manager_new
(
p_mdis
,
p_inst
);
if
(
unlikely
(
p_mdis
->
p_event_manager
==
NULL
)
)
{
free
(
p_mdis
);
return
NULL
;
}
libvlc_event_manager_register_event_type
(
p_mdis
->
p_event_manager
,
libvlc_MediaDiscovererStarted
,
NULL
);
libvlc_MediaDiscovererStarted
);
libvlc_event_manager_register_event_type
(
p_mdis
->
p_event_manager
,
libvlc_MediaDiscovererEnded
,
NULL
);
libvlc_MediaDiscovererEnded
);
p_mdis
->
p_sd
=
vlc_sd_Create
(
(
vlc_object_t
*
)
p_inst
->
p_libvlc_int
);
...
...
src/control/media_library.c
View file @
556953c4
...
...
@@ -71,7 +71,12 @@ libvlc_media_library_new( libvlc_instance_t * p_inst,
p_mlib
->
i_refcount
=
1
;
p_mlib
->
p_mlist
=
NULL
;
p_mlib
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlib
,
p_inst
,
p_e
);
p_mlib
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlib
,
p_inst
);
if
(
unlikely
(
p_mlib
->
p_event_manager
==
NULL
)
)
{
free
(
p_mlib
);
return
NULL
;
}
return
p_mlib
;
}
...
...
src/control/media_list.c
View file @
556953c4
...
...
@@ -157,31 +157,32 @@ libvlc_media_list_new( libvlc_instance_t * p_inst,
libvlc_media_list_t
*
p_mlist
;
p_mlist
=
malloc
(
sizeof
(
libvlc_media_list_t
));
if
(
!
p_mlist
)
if
(
unlikely
(
p_mlist
==
NULL
)
)
{
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
p_mlist
->
p_libvlc_instance
=
p_inst
;
p_mlist
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlist
,
p_inst
,
p_e
);
p_mlist
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlist
,
p_inst
);
if
(
unlikely
(
p_mlist
->
p_event_manager
==
NULL
)
)
{
free
(
p_mlist
);
return
NULL
;
}
/* Code for that one should be handled in flat_media_list.c */
p_mlist
->
p_flat_mlist
=
NULL
;
p_mlist
->
b_read_only
=
false
;
libvlc_event_manager_register_event_type
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
p_e
);
libvlc_MediaListItemAdded
);
libvlc_event_manager_register_event_type
(
p_mlist
->
p_event_manager
,
libvlc_MediaListWillAddItem
,
p_e
);
libvlc_MediaListWillAddItem
);
libvlc_event_manager_register_event_type
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
p_e
);
libvlc_MediaListItemDeleted
);
libvlc_event_manager_register_event_type
(
p_mlist
->
p_event_manager
,
libvlc_MediaListWillDeleteItem
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
{
libvlc_event_manager_release
(
p_mlist
->
p_event_manager
);
free
(
p_mlist
);
return
NULL
;
}
libvlc_MediaListWillDeleteItem
);
vlc_mutex_init
(
&
p_mlist
->
object_lock
);
vlc_mutex_init
(
&
p_mlist
->
refcount_lock
);
// FIXME: spinlock?
...
...
src/control/media_list_player.c
View file @
556953c4
...
...
@@ -358,7 +358,7 @@ static void
install_playlist_observer
(
libvlc_media_list_player_t
*
p_mlp
)
{
assert_locked
(
p_mlp
);
libvlc_event_attach
(
mlist_em
(
p_mlp
),
libvlc_MediaListItemDeleted
,
mlist_item_deleted
,
p_mlp
,
NULL
);
libvlc_event_attach
(
mlist_em
(
p_mlp
),
libvlc_MediaListItemDeleted
,
mlist_item_deleted
,
p_mlp
);
}
/**************************************************************************
...
...
@@ -379,7 +379,7 @@ static void
install_media_player_observer
(
libvlc_media_list_player_t
*
p_mlp
)
{
assert_locked
(
p_mlp
);
libvlc_event_attach_async
(
mplayer_em
(
p_mlp
),
libvlc_MediaPlayerEndReached
,
media_player_reached_end
,
p_mlp
,
NULL
);
libvlc_event_attach_async
(
mplayer_em
(
p_mlp
),
libvlc_MediaPlayerEndReached
,
media_player_reached_end
,
p_mlp
);
}
...
...
@@ -459,16 +459,25 @@ libvlc_media_list_player_new(libvlc_instance_t * p_instance, libvlc_exception_t
(
void
)
p_e
;
libvlc_media_list_player_t
*
p_mlp
;
p_mlp
=
calloc
(
1
,
sizeof
(
libvlc_media_list_player_t
)
);
if
(
!
p_mlp
)
if
(
unlikely
(
p_mlp
==
NULL
))
{
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
p_mlp
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlp
,
p_instance
);
if
(
unlikely
(
p_mlp
->
p_event_manager
==
NULL
))
{
free
(
p_mlp
);
return
NULL
;
}
libvlc_retain
(
p_instance
);
p_mlp
->
p_libvlc_instance
=
p_instance
;
p_mlp
->
i_refcount
=
1
;
vlc_mutex_init
(
&
p_mlp
->
object_lock
);
vlc_mutex_init
(
&
p_mlp
->
mp_callback_lock
);
p_mlp
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlp
,
p_instance
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mlp
->
p_event_manager
,
libvlc_MediaListPlayerNextItemSet
,
p_e
);
libvlc_event_manager_register_event_type
(
p_mlp
->
p_event_manager
,
libvlc_MediaListPlayerNextItemSet
);
p_mlp
->
e_playback_mode
=
libvlc_playback_mode_default
;
return
p_mlp
;
...
...
src/control/media_list_view.c
View file @
556953c4
...
...
@@ -82,10 +82,10 @@ install_md_listener( libvlc_media_list_view_t * p_mlv,
}
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
media_list_item_added
,
p_mlv
);
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
,
NULL
);
media_list_item_removed
,
p_mlv
);
libvlc_media_list_unlock
(
p_mlist
);
libvlc_media_list_release
(
p_mlist
);
}
...
...
@@ -94,7 +94,7 @@ install_md_listener( libvlc_media_list_view_t * p_mlv,
/* No mlist, wait for a subitem added event */
libvlc_event_attach
(
p_md
->
p_event_manager
,
libvlc_MediaSubItemAdded
,
media_list_subitem_added
,
p_mlv
,
NULL
);
media_list_subitem_added
,
p_mlv
);
}
}
...
...
@@ -167,10 +167,10 @@ media_list_subitem_added( const libvlc_event_t * p_event, void * p_user_data )
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
media_list_item_added
,
p_mlv
);
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
,
NULL
);
media_list_item_removed
,
p_mlv
);
libvlc_media_list_unlock
(
p_mlist
);
libvlc_media_list_release
(
p_mlist
);
}
...
...
@@ -199,10 +199,10 @@ libvlc_media_list_view_set_ml_notification_callback(
p_mlv
->
pf_ml_item_removed
=
item_removed
;
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
media_list_item_added
,
p_mlv
);
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
,
NULL
);
media_list_item_removed
,
p_mlv
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -308,21 +308,29 @@ libvlc_media_list_view_new( libvlc_media_list_t * p_mlist,
{
libvlc_media_list_view_t
*
p_mlv
;
p_mlv
=
calloc
(
1
,
sizeof
(
libvlc_media_list_view_t
)
);
if
(
!
p_mlv
)
if
(
unlikely
(
p_mlv
==
NULL
)
)
{
libvlc_printerr
(
"Not enough memory"
);
return
NULL
;
}
p_mlv
->
p_libvlc_instance
=
p_mlist
->
p_libvlc_instance
;
p_mlv
->
p_event_manager
=
libvlc_event_manager_new
(
p_mlist
,
p_mlv
->
p_libvlc_instance
,
p_e
);
p_mlv
->
p_libvlc_instance
);
if
(
unlikely
(
p_mlv
->
p_event_manager
==
NULL
)
)
{
free
(
p_mlv
);
return
NULL
;
}
libvlc_event_manager_register_event_type
(
p_mlv
->
p_event_manager
,
libvlc_MediaListViewItemAdded
,
p_e
);
libvlc_MediaListViewItemAdded
);
libvlc_event_manager_register_event_type
(
p_mlv
->
p_event_manager
,
libvlc_MediaListViewWillAddItem
,
p_e
);
libvlc_MediaListViewWillAddItem
);
libvlc_event_manager_register_event_type
(
p_mlv
->
p_event_manager
,
libvlc_MediaListViewItemDeleted
,
p_e
);
libvlc_MediaListViewItemDeleted
);
libvlc_event_manager_register_event_type
(
p_mlv
->
p_event_manager
,
libvlc_MediaListViewWillDeleteItem
,
p_e
);
libvlc_MediaListViewWillDeleteItem
);
libvlc_media_list_retain
(
p_mlist
);
p_mlv
->
p_mlist
=
p_mlist
;
...
...
src/control/media_player.c
View file @
556953c4
...
...
@@ -67,7 +67,7 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi );
#define register_event(a, b) __register_event(a, libvlc_MediaPlayer ## b)
static
inline
void
__register_event
(
libvlc_media_player_t
*
mp
,
libvlc_event_type_t
type
)
{
libvlc_event_manager_register_event_type
(
mp
->
p_event_manager
,
type
,
NULL
);
libvlc_event_manager_register_event_type
(
mp
->
p_event_manager
,
type
);
}
static
inline
void
lock
(
libvlc_media_player_t
*
mp
)
...
...
@@ -361,14 +361,13 @@ libvlc_media_player_new( libvlc_instance_t *instance, libvlc_exception_t *e )
mp
->
p_input_thread
=
NULL
;
mp
->
p_input_resource
=
NULL
;
mp
->
i_refcount
=
1
;
vlc_mutex_init
(
&
mp
->
object_lock
);
mp
->
p_event_manager
=
libvlc_event_manager_new
(
mp
,
instance
,
e
);
if
(
libvlc_exception_raised
(
e
))
mp
->
p_event_manager
=
libvlc_event_manager_new
(
mp
,
instance
);
if
(
unlikely
(
mp
->
p_event_manager
==
NULL
))
{
vlc_mutex_destroy
(
&
mp
->
object_lock
);
free
(
mp
);
return
NULL
;
}
vlc_mutex_init
(
&
mp
->
object_lock
);
register_event
(
mp
,
NothingSpecial
);
register_event
(
mp
,
Opening
);
...
...
src/control/vlm.c
View file @
556953c4
...
...
@@ -125,41 +125,42 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance,
if
(
!
p_instance
->
libvlc_vlm
.
p_event_manager
)
{
p_instance
->
libvlc_vlm
.
p_event_manager
=
libvlc_event_manager_new
(
p_instance
->
libvlc_vlm
.
p_vlm
,
p_instance
,
p_exception
);
libvlc_event_manager_new
(
p_instance
->
libvlc_vlm
.
p_vlm
,
p_instance
);
if
(
unlikely
(
p_instance
->
libvlc_vlm
.
p_event_manager
==
NULL
)
)
return
VLC_ENOMEM
;
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaAdded
,
NULL
);
libvlc_VlmMediaAdded
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaRemoved
,
NULL
);
libvlc_VlmMediaRemoved
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaChanged
,
NULL
);
libvlc_VlmMediaChanged
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStarted
,
NULL
);
libvlc_VlmMediaInstanceStarted
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStopped
,
NULL
);
libvlc_VlmMediaInstanceStopped
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStatusInit
,
NULL
);
libvlc_VlmMediaInstanceStatusInit
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStatusOpening
,
NULL
);
libvlc_VlmMediaInstanceStatusOpening
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStatusPlaying
,
NULL
);
libvlc_VlmMediaInstanceStatusPlaying
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStatusPause
,
NULL
);
libvlc_VlmMediaInstanceStatusPause
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStatusEnd
,
NULL
);
libvlc_VlmMediaInstanceStatusEnd
);
libvlc_event_manager_register_event_type
(
p_instance
->
libvlc_vlm
.
p_event_manager
,
libvlc_VlmMediaInstanceStatusError
,
NULL
);
libvlc_VlmMediaInstanceStatusError
);
}
if
(
!
p_instance
->
libvlc_vlm
.
p_vlm
)
...
...
test/libvlc/events.c
View file @
556953c4
...
...
@@ -70,7 +70,7 @@ static void test_events (const char ** argv, int argc)
libvlc_MediaPlayerTimeChanged
,
libvlc_MediaPlayerPositionChanged
,
};
int
i
,
mi_events_len
=
sizeof
(
mi_events
)
/
sizeof
(
*
mi_events
);
int
mi_events_len
=
sizeof
(
mi_events
)
/
sizeof
(
*
mi_events
);
log
(
"Testing events
\n
"
);
...
...
@@ -85,14 +85,18 @@ static void test_events (const char ** argv, int argc)
log
(
"+ Testing attaching to Media Instance
\n
"
);
for
(
i
=
0
;
i
<
mi_events_len
;
i
++
)
{
libvlc_event_attach
(
em
,
mi_events
[
i
],
test_events_dummy_callback
,
&
callback_was_called
,
&
ex
);
catch
();
for
(
int
i
=
0
;
i
<
mi_events_len
;
i
++
)
{
int
ret
;
ret
=
libvlc_event_attach
(
em
,
mi_events
[
i
],
test_events_dummy_callback
,
&
callback_was_called
);
assert
(
ret
==
0
);
}
log
(
"+ Testing event reception
\n
"
);
for
(
i
=
0
;
i
<
mi_events_len
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
mi_events_len
;
i
++
)
test_event_type_reception
(
em
,
mi_events
[
i
],
&
callback_was_called
);
log
(
"+ Testing event detaching while in the event callback
\n
"
);
...
...
@@ -103,8 +107,10 @@ static void test_events (const char ** argv, int argc)
libvlc_event_detach
(
em
,
mi_events
[
mi_events_len
-
1
],
test_events_dummy_callback
,
&
callback_was_called
);
libvlc_event_attach
(
em
,
mi_events
[
mi_events_len
-
1
],
test_events_callback_and_detach
,
&
callback_was_called
,
&
ex
);
catch
();
int
val
=
libvlc_event_attach
(
em
,
mi_events
[
mi_events_len
-
1
],
test_events_callback_and_detach
,
&
callback_was_called
);
assert
(
val
==
0
);
libvlc_event_send
(
em
,
&
event
);
assert
(
callback_was_called
);
...
...
@@ -115,7 +121,7 @@ static void test_events (const char ** argv, int argc)
log
(
"+ Testing regular detach()
\n
"
);
for
(
i
=
0
;
i
<
mi_events_len
-
1
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
mi_events_len
-
1
;
i
++
)
libvlc_event_detach
(
em
,
mi_events
[
i
],
test_events_dummy_callback
,
&
callback_was_called
);
libvlc_media_player_release
(
mi
);
...
...
test/libvlc/media_list_player.c
View file @
556953c4
...
...
@@ -142,8 +142,9 @@ static void test_media_list_player_items_queue(const char** argv, int argc)
libvlc_media_list_player_set_media_list
(
mlp
,
ml
);
libvlc_event_manager_t
*
em
=
libvlc_media_list_player_event_manager
(
mlp
);
libvlc_event_attach
(
em
,
libvlc_MediaListPlayerNextItemSet
,
check_items_order_callback
,
&
check
,
&
ex
);
catch
();
int
val
=
libvlc_event_attach
(
em
,
libvlc_MediaListPlayerNextItemSet
,
check_items_order_callback
,
&
check
);
assert
(
val
==
0
);
libvlc_media_list_player_play
(
mlp
,
&
ex
);
catch
();
...
...
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