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
3f75f779
Commit
3f75f779
authored
Aug 05, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control/event.c: Change the event API to be per-object driven. It is not yet in use.
parent
1605af57
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
259 additions
and
328 deletions
+259
-328
include/vlc/libvlc.h
include/vlc/libvlc.h
+25
-24
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+17
-4
src/control/event.c
src/control/event.c
+137
-285
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+80
-15
No files found.
include/vlc/libvlc.h
View file @
3f75f779
...
@@ -884,49 +884,50 @@ VLC_PUBLIC_API libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterat
...
@@ -884,49 +884,50 @@ VLC_PUBLIC_API libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterat
/** @} */
/** @} */
/*****************************************************************************
/*****************************************************************************
*
Callbacks
handling
*
Event
handling
*****************************************************************************/
*****************************************************************************/
/** defgroup libvlc_callbacks Callbacks
/** defgroup libvlc_callbacks Callbacks
* \ingroup libvlc
* \ingroup libvlc
* LibVLC Event
Callback
s
* LibVLC Events
* @{
* @{
*/
*/
/**
/**
* Register for a callback notification
* Register for an event notification
* \param p_instance the libvlc instance
* \param p_event_manager the event manager to which you want to attach to
* \param i_event_type the desired event mask to which we want to listen
* Generally it is obtained by vlc_my_object_event_manager() where my_object
* Is the object you want to listen to.
* \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 f_callback the function to call when i_event_type occurs
* \param user_data user provided data to carry with the event
* \param user_data user provided data to carry with the event
* \param p_e an initialized exception pointer
* \param p_e an initialized exception pointer
*/
*/
VLC_PUBLIC_API
void
libvlc_event_a
dd_callback
(
libvlc_instance_t
*
p_instance
,
VLC_PUBLIC_API
void
libvlc_event_a
ttach
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_event_type_t
i_event_type
,
libvlc_event_type_t
i_event_type
,
libvlc_callback_t
f_callback
,
libvlc_callback_t
f_callback
,
void
*
user_data
,
void
*
user_data
,
libvlc_exception_t
*
p_e
);
libvlc_exception_t
*
p_e
);
/**
/**
* Unregister all callbacks notification from an instance
* Unregister an event notification
* \param p_instance the libvlc instance
* \param p_event_manager the event manager
* \param i_event_type the desired event to which we want to unregister
* \param f_callback the function to call when i_event_type occurs
* \param p_e an initialized exception pointer
* \param p_e an initialized exception pointer
*/
*/
VLC_PUBLIC_API
void
libvlc_event_remove_all_callbacks
(
libvlc_instance_t
*
p_instance
,
VLC_PUBLIC_API
void
libvlc_event_detach
(
libvlc_event_manager_t
*
p_event_manager
,
libvlc_exception_t
*
p_e
);
libvlc_event_type_t
i_event_type
,
libvlc_callback_t
f_callback
,
void
*
p_user_data
,
libvlc_exception_t
*
p_e
);
/**
/**
* Unregister a callback notification
* Get an event type name
* \param p_instance the libvlc instance
* \param i_event_type the desired event
* \param i_event_type the desired event mask to which we want to unregister
* \param f_callback the function to call when i_event_type occurs
* \param p_e an initialized exception pointer
*/
*/
VLC_PUBLIC_API
void
libvlc_event_remove_callback
(
libvlc_instance_t
*
p_instance
,
#define libvlc_event_type_name(a) #a
libvlc_event_type_t
i_event_type
,
libvlc_callback_t
f_callback
,
void
*
p_user_data
,
libvlc_exception_t
*
p_e
);
/** @} */
/** @} */
...
...
include/vlc/libvlc_structures.h
View file @
3f75f779
...
@@ -182,7 +182,7 @@ typedef struct libvlc_log_message_t
...
@@ -182,7 +182,7 @@ typedef struct libvlc_log_message_t
*/
*/
/**
/**
* Available events:
* Available events:
(XXX: being reworked)
* - libvlc_VolumeChanged
* - libvlc_VolumeChanged
* - libvlc_InputPositionChanged
* - libvlc_InputPositionChanged
*/
*/
...
@@ -192,9 +192,17 @@ typedef enum libvlc_event_type_t {
...
@@ -192,9 +192,17 @@ typedef enum libvlc_event_type_t {
libvlc_InputPositionChanged
,
libvlc_InputPositionChanged
,
}
libvlc_event_type_t
;
}
libvlc_event_type_t
;
/**
* An Event
* \param type the even type
* \param p_obj the sender object
* \param u Event dependent content
*/
typedef
struct
libvlc_event_t
typedef
struct
libvlc_event_t
{
{
libvlc_event_type_t
type
;
libvlc_event_type_t
type
;
void
*
p_obj
;
union
union
{
{
struct
struct
...
@@ -208,14 +216,19 @@ typedef struct libvlc_event_t
...
@@ -208,14 +216,19 @@ typedef struct libvlc_event_t
}
u
;
}
u
;
}
libvlc_event_t
;
}
libvlc_event_t
;
/**
* Event manager that belongs to a libvlc object, and from whom events can
* be received.
*/
typedef
struct
libvlc_event_manager_t
libvlc_event_manager_t
;
/**
/**
* Callback function notification
* Callback function notification
* \param p_instance the libvlc instance
* \param p_event the event triggering the callback
* \param p_event the event triggering the callback
* \param p_user_data user provided data
*/
*/
typedef
void
(
*
libvlc_callback_t
)(
struct
libvlc_instance_t
*
,
libvlc_event_t
*
,
void
*
);
typedef
void
(
*
libvlc_callback_t
)(
const
libvlc_event_t
*
);
/**@} */
/**@} */
...
...
src/control/event.c
View file @
3f75f779
This diff is collapsed.
Click to expand it.
src/control/libvlc_internal.h
View file @
3f75f779
...
@@ -32,6 +32,7 @@ extern "C" {
...
@@ -32,6 +32,7 @@ extern "C" {
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/libvlc_structures.h>
#include <vlc/libvlc_structures.h>
#include <vlc_arrays.h>
#include <vlc_input.h>
#include <vlc_input.h>
/***************************************************************************
/***************************************************************************
...
@@ -52,21 +53,6 @@ VLC_EXPORT (void, libvlc_event_fini, ( libvlc_instance_t *, libvlc_exception_t *
...
@@ -52,21 +53,6 @@ VLC_EXPORT (void, libvlc_event_fini, ( libvlc_instance_t *, libvlc_exception_t *
* Opaque structures for libvlc API
* Opaque structures for libvlc API
***************************************************************************/
***************************************************************************/
struct
libvlc_callback_entry_t
{
libvlc_instance_t
*
p_instance
;
libvlc_callback_t
f_callback
;
libvlc_event_type_t
i_event_type
;
void
*
p_user_data
;
};
struct
libvlc_callback_entry_list_t
{
struct
libvlc_callback_entry_t
*
elmt
;
struct
libvlc_callback_entry_list_t
*
next
;
struct
libvlc_callback_entry_list_t
*
prev
;
};
struct
libvlc_instance_t
struct
libvlc_instance_t
{
{
libvlc_int_t
*
p_libvlc_int
;
libvlc_int_t
*
p_libvlc_int
;
...
@@ -94,24 +80,103 @@ struct libvlc_media_instance_t
...
@@ -94,24 +80,103 @@ struct libvlc_media_instance_t
libvlc_media_descriptor_t
*
p_md
;
/* current media descriptor */
libvlc_media_descriptor_t
*
p_md
;
/* current media descriptor */
};
};
/*
* Event Handling
*/
/* Example usage
*
* struct libvlc_cool_object_t
* {
* ...
* libvlc_event_manager_t * p_event_manager;
* ...
* }
*
* libvlc_my_cool_object_new()
* {
* ...
* p_self->p_event_manager = libvlc_event_manager_init( p_self,
* p_self->p_libvlc_instance, p_e);
* libvlc_event_manager_register_event_type(p_self->p_event_manager,
* libvlc_MyCoolObjectDidSomething, p_e)
* ...
* }
*
* libvlc_my_cool_object_release()
* {
* ...
* libvlc_event_manager_release( p_self->p_event_manager );
* ...
* }
*
* libvlc_my_cool_object_do_something()
* {
* ...
* libvlc_event_t event;
* event.type = libvlc_MyCoolObjectDidSomething;
* event.my_cool_object_did_something.what_it_did = kSomething;
* libvlc_event_send( p_self->p_event_manager, &event );
* }
* */
typedef
struct
libvlc_event_listener_t
{
libvlc_event_type_t
event_type
;
void
*
p_user_data
;
libvlc_callback_t
pf_callback
;
}
libvlc_event_listener_t
;
typedef
struct
libvlc_event_listeners_group_t
{
libvlc_event_type_t
event_type
;
DECL_ARRAY
(
libvlc_event_listener_t
*
)
listeners
;
}
libvlc_event_listeners_group_t
;
typedef
struct
libvlc_event_manager_t
{
void
*
p_obj
;
struct
libvlc_instance_t
*
p_libvlc_instance
;
DECL_ARRAY
(
libvlc_event_listeners_group_t
*
)
listeners_groups
;
}
libvlc_event_sender_t
;
/***************************************************************************
/***************************************************************************
* Other internal functions
* Other internal functions
***************************************************************************/
***************************************************************************/
VLC_EXPORT
(
input_thread_t
*
,
libvlc_get_input_thread
,
VLC_EXPORT
(
input_thread_t
*
,
libvlc_get_input_thread
,
(
struct
libvlc_media_instance_t
*
,
libvlc_exception_t
*
)
);
(
struct
libvlc_media_instance_t
*
,
libvlc_exception_t
*
)
);
/* Media instance */
VLC_EXPORT
(
libvlc_media_instance_t
*
,
libvlc_media_instance_new_from_input_thread
,
VLC_EXPORT
(
libvlc_media_instance_t
*
,
libvlc_media_instance_new_from_input_thread
,
(
struct
libvlc_instance_t
*
,
input_thread_t
*
,
libvlc_exception_t
*
)
);
(
struct
libvlc_instance_t
*
,
input_thread_t
*
,
libvlc_exception_t
*
)
);
VLC_EXPORT
(
void
,
libvlc_media_instance_destroy
,
VLC_EXPORT
(
void
,
libvlc_media_instance_destroy
,
(
libvlc_media_instance_t
*
)
);
(
libvlc_media_instance_t
*
)
);
/* Media Descriptor */
VLC_EXPORT
(
libvlc_media_descriptor_t
*
,
libvlc_media_descriptor_new_from_input_item
,
VLC_EXPORT
(
libvlc_media_descriptor_t
*
,
libvlc_media_descriptor_new_from_input_item
,
(
struct
libvlc_instance_t
*
,
input_item_t
*
,
libvlc_exception_t
*
)
);
(
struct
libvlc_instance_t
*
,
input_item_t
*
,
libvlc_exception_t
*
)
);
VLC_EXPORT
(
libvlc_media_descriptor_t
*
,
libvlc_media_descriptor_duplicate
,
VLC_EXPORT
(
libvlc_media_descriptor_t
*
,
libvlc_media_descriptor_duplicate
,
(
libvlc_media_descriptor_t
*
)
);
(
libvlc_media_descriptor_t
*
)
);
/* Events */
VLC_EXPORT
(
void
,
libvlc_event_init
,
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
)
);
VLC_EXPORT
(
void
,
libvlc_event_fini
,
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
)
);
VLC_EXPORT
(
libvlc_event_manager_t
*
,
libvlc_event_manager_init
,
(
void
*
p_obj
,
libvlc_instance_t
*
p_libvlc_inst
,
libvlc_exception_t
*
p_e
)
);
VLC_EXPORT
(
void
,
libvlc_event_manager_release
,
(
libvlc_event_manager_t
*
p_em
)
);
VLC_EXPORT
(
void
,
libvlc_event_manager_register_event_type
,
(
libvlc_event_manager_t
*
p_em
,
libvlc_event_type_t
event_type
,
libvlc_exception_t
*
p_e
)
);
VLC_EXPORT
(
void
,
libvlc_event_send
,
(
libvlc_event_manager_t
*
p_em
,
libvlc_event_t
*
p_event
)
);
/* Exception shorcuts */
#define RAISENULL( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
#define RAISENULL( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
return NULL; }
return NULL; }
#define RAISEVOID( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
#define RAISEVOID( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \
...
...
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