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
2f63e68b
Commit
2f63e68b
authored
Feb 20, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reimplement libvlc_event_type_name
parent
8fa0ec3c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
3 deletions
+92
-3
include/vlc/libvlc.h
include/vlc/libvlc.h
+7
-0
include/vlc/libvlc_events.h
include/vlc/libvlc_events.h
+3
-2
src/control/event.c
src/control/event.c
+81
-1
src/libvlc.sym
src/libvlc.sym
+1
-0
No files found.
include/vlc/libvlc.h
View file @
2f63e68b
...
...
@@ -242,6 +242,13 @@ VLC_PUBLIC_API void libvlc_event_detach( libvlc_event_manager_t *p_event_manager
libvlc_callback_t
f_callback
,
void
*
p_user_data
);
/**
* Get an event's type name.
*
* \param event_type the desired event
*/
VLC_PUBLIC_API
const
char
*
libvlc_event_type_name
(
libvlc_event_type_t
event_type
);
/** @} */
/** \defgroup libvlc_log LibVLC logging
...
...
include/vlc/libvlc_events.h
View file @
2f63e68b
...
...
@@ -43,8 +43,9 @@ extern "C" {
* Event types
*/
enum
libvlc_event_e
{
/* Append new event types at the end. Do not remove, insert or
* re-order any entry. The cpp will prepend libvlc_ to the symbols. */
/* Append new event types at the end of a category.
* Do not remove, insert or re-order any entry.
* Keep this in sync with src/control/event.c:libvlc_event_type_name(). */
libvlc_MediaMetaChanged
=
0
,
libvlc_MediaSubItemAdded
,
libvlc_MediaDurationChanged
,
...
...
src/control/event.c
View file @
2f63e68b
...
...
@@ -240,6 +240,85 @@ void libvlc_event_send( libvlc_event_manager_t * p_em,
* Public libvlc functions
*/
#define DEF( a ) { libvlc_##a, #a, },
typedef
struct
{
int
type
;
const
char
name
[
40
];
}
event_name_t
;
static
const
event_name_t
event_list
[]
=
{
DEF
(
MediaMetaChanged
)
DEF
(
MediaSubItemAdded
)
DEF
(
MediaDurationChanged
)
DEF
(
MediaPreparsedChanged
)
DEF
(
MediaFreed
)
DEF
(
MediaStateChanged
)
DEF
(
MediaPlayerMediaChanged
)
DEF
(
MediaPlayerNothingSpecial
)
DEF
(
MediaPlayerOpening
)
DEF
(
MediaPlayerBuffering
)
DEF
(
MediaPlayerPlaying
)
DEF
(
MediaPlayerPaused
)
DEF
(
MediaPlayerStopped
)
DEF
(
MediaPlayerForward
)
DEF
(
MediaPlayerBackward
)
DEF
(
MediaPlayerEndReached
)
DEF
(
MediaPlayerEncounteredError
)
DEF
(
MediaPlayerTimeChanged
)
DEF
(
MediaPlayerPositionChanged
)
DEF
(
MediaPlayerSeekableChanged
)
DEF
(
MediaPlayerPausableChanged
)
DEF
(
MediaPlayerTitleChanged
)
DEF
(
MediaPlayerSnapshotTaken
)
DEF
(
MediaPlayerLengthChanged
)
DEF
(
MediaListItemAdded
)
DEF
(
MediaListWillAddItem
)
DEF
(
MediaListItemDeleted
)
DEF
(
MediaListWillDeleteItem
)
DEF
(
MediaListViewItemAdded
)
DEF
(
MediaListViewWillAddItem
)
DEF
(
MediaListViewItemDeleted
)
DEF
(
MediaListViewWillDeleteItem
)
DEF
(
MediaListPlayerPlayed
)
DEF
(
MediaListPlayerNextItemSet
)
DEF
(
MediaListPlayerStopped
)
DEF
(
MediaDiscovererStarted
)
DEF
(
MediaDiscovererEnded
)
DEF
(
VlmMediaAdded
)
DEF
(
VlmMediaRemoved
)
DEF
(
VlmMediaChanged
)
DEF
(
VlmMediaInstanceStarted
)
DEF
(
VlmMediaInstanceStopped
)
DEF
(
VlmMediaInstanceStatusInit
)
DEF
(
VlmMediaInstanceStatusOpening
)
};
#undef DEF
static
const
char
unknown_event_name
[]
=
"Unknown Event"
;
static
int
evcmp
(
const
void
*
a
,
const
void
*
b
)
{
return
(
*
(
const
int
*
)
a
)
-
((
event_name_t
*
)
b
)
->
type
;
}
const
char
*
libvlc_event_type_name
(
int
event_type
)
{
const
event_name_t
*
p
;
p
=
bsearch
(
&
event_type
,
event_list
,
sizeof
(
event_list
)
/
sizeof
(
event_list
[
0
]),
sizeof
(
*
p
),
evcmp
);
return
p
?
p
->
name
:
unknown_event_name
;
}
/**************************************************************************
* event_attach (internal) :
*
...
...
@@ -278,7 +357,8 @@ int event_attach( libvlc_event_manager_t * p_event_manager,
vlc_mutex_unlock
(
&
p_event_manager
->
object_lock
);
free
(
listener
);
fprintf
(
stderr
,
"Unknown event type %d"
,
event_type
);
fprintf
(
stderr
,
"This object event manager doesn't know about '%s' events"
,
libvlc_event_type_name
(
event_type
)
);
assert
(
0
);
return
-
1
;
}
...
...
src/libvlc.sym
View file @
2f63e68b
...
...
@@ -29,6 +29,7 @@ libvlc_event_manager_new
libvlc_event_manager_register_event_type
libvlc_event_manager_release
libvlc_event_send
libvlc_event_type_name
libvlc_get_changeset
libvlc_get_compiler
libvlc_get_fullscreen
...
...
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