Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
8032efad
Commit
8032efad
authored
Aug 15, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/control/media_list.c: Handle meta changed event from its items.
parent
d49a678a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
5 deletions
+69
-5
src/control/media_list.c
src/control/media_list.c
+69
-5
No files found.
src/control/media_list.c
View file @
8032efad
...
...
@@ -30,10 +30,12 @@
* Private functions
*/
/**************************************************************************
* notify_item_addition (private)
*
*
Call parent playlist and send the appropriate event
.
*
Do the appropriate action when an item is deleted
.
**************************************************************************/
static
void
notify_item_addition
(
libvlc_media_list_t
*
p_mlist
,
...
...
@@ -42,17 +44,19 @@ notify_item_addition( libvlc_media_list_t * p_mlist,
{
libvlc_event_t
event
;
/* Construct the event */
event
.
type
=
libvlc_MediaListItemAdded
;
event
.
u
.
media_list_item_added
.
item
=
p_md
;
event
.
u
.
media_list_item_added
.
index
=
index
;
/* Send the event */
libvlc_event_send
(
p_mlist
->
p_event_manager
,
&
event
);
}
/**************************************************************************
* notify_item_deletion (private)
*
*
Call parent playlist and send the appropriate event
.
*
Do the appropriate action when an item is added
.
**************************************************************************/
static
void
notify_item_deletion
(
libvlc_media_list_t
*
p_mlist
,
...
...
@@ -60,14 +64,70 @@ notify_item_deletion( libvlc_media_list_t * p_mlist,
int
index
)
{
libvlc_event_t
event
;
/* Construct the event */
event
.
type
=
libvlc_MediaListItemDeleted
;
event
.
u
.
media_list_item_deleted
.
item
=
p_md
;
event
.
u
.
media_list_item_deleted
.
index
=
index
;
/* Send the event */
libvlc_event_send
(
p_mlist
->
p_event_manager
,
&
event
);
}
/**************************************************************************
* media_descriptor_changed (private) (libvlc Event Callback )
*
* An item has changed.
**************************************************************************/
static
void
media_descriptor_changed
(
const
libvlc_event_t
*
p_event
,
void
*
user_data
)
{
libvlc_media_list_t
*
p_mlist
=
user_data
;
libvlc_media_descriptor_t
*
p_md
=
p_event
->
p_obj
;
libvlc_event_t
event
;
/* Construct the new media list event */
event
.
type
=
libvlc_MediaListItemChanged
;
event
.
u
.
media_list_item_changed
.
item
=
p_md
;
/* XXX: this is not good, but there is a solution in the pipeline */
event
.
u
.
media_list_item_changed
.
index
=
libvlc_media_list_index_of_item
(
p_mlist
,
p_md
,
NULL
);
/* Send the event */
libvlc_event_send
(
p_mlist
->
p_event_manager
,
&
event
);
}
/**************************************************************************
* install_media_descriptor_observer (private)
*
* Do the appropriate action when an item is deleted.
**************************************************************************/
static
void
install_media_descriptor_observer
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_descriptor_t
*
p_md
)
{
libvlc_event_attach
(
p_md
->
p_event_manager
,
libvlc_MediaDescriptorMetaChanged
,
media_descriptor_changed
,
p_mlist
,
NULL
);
}
/**************************************************************************
* uninstall_media_descriptor_observer (private)
*
* Do the appropriate action when an item is deleted.
**************************************************************************/
static
void
uninstall_media_descriptor_observer
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_descriptor_t
*
p_md
)
{
libvlc_event_detach
(
p_md
->
p_event_manager
,
libvlc_MediaDescriptorMetaChanged
,
media_descriptor_changed
,
p_mlist
,
NULL
);
}
/**************************************************************************
* dynamic_list_propose_item (private) (Event Callback)
*
...
...
@@ -223,6 +283,7 @@ void libvlc_media_list_release( libvlc_media_list_t * p_mlist )
libvlc_event_manager_release
(
p_mlist
->
p_event_manager
);
FOREACH_ARRAY
(
p_md
,
p_mlist
->
items
)
uninstall_media_descriptor_observer
(
p_mlist
,
p_md
);
libvlc_media_descriptor_release
(
p_md
);
FOREACH_END
()
...
...
@@ -264,9 +325,9 @@ void libvlc_media_list_add_media_descriptor(
{
(
void
)
p_e
;
libvlc_media_descriptor_retain
(
p_md
);
ARRAY_APPEND
(
p_mlist
->
items
,
p_md
);
notify_item_addition
(
p_mlist
,
p_md
,
p_mlist
->
items
.
i_size
-
1
);
install_media_descriptor_observer
(
p_mlist
,
p_md
);
}
/**************************************************************************
...
...
@@ -285,6 +346,7 @@ void libvlc_media_list_insert_media_descriptor(
ARRAY_INSERT
(
p_mlist
->
items
,
p_md
,
index
);
notify_item_addition
(
p_mlist
,
p_md
,
index
);
install_media_descriptor_observer
(
p_mlist
,
p_md
);
}
/**************************************************************************
...
...
@@ -300,6 +362,8 @@ void libvlc_media_list_remove_index( libvlc_media_list_t * p_mlist,
p_md
=
ARRAY_VAL
(
p_mlist
->
items
,
index
);
uninstall_media_descriptor_observer
(
p_mlist
,
p_md
);
ARRAY_REMOVE
(
p_mlist
->
items
,
index
)
notify_item_deletion
(
p_mlist
,
p_md
,
index
);
...
...
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