Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
7b565326
Commit
7b565326
authored
Dec 31, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
media_list_view.c: Properly forward all items added events.
parent
0dbfd625
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
6 deletions
+54
-6
src/control/media_list_view.c
src/control/media_list_view.c
+54
-6
No files found.
src/control/media_list_view.c
View file @
7b565326
...
...
@@ -56,17 +56,35 @@ install_md_listener( libvlc_media_list_view_t * p_mlv,
int
i
,
count
=
libvlc_media_list_count
(
p_mlist
,
NULL
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
libvlc_event_t
added_event
;
libvlc_media_descriptor_t
*
p_submd
;
p_submd
=
libvlc_media_list_item_at_index
(
p_mlist
,
i
,
NULL
);
/* Install our listeners */
install_md_listener
(
p_mlv
,
p_submd
);
/* For each item, send a notification to the mlv subclasses */
added_event
.
u
.
media_list_item_added
.
item
=
p_submd
;
added_event
.
u
.
media_list_item_added
.
index
=
0
;
if
(
p_mlv
->
pf_ml_item_added
)
p_mlv
->
pf_ml_item_added
(
&
added_event
,
p_mlv
);
libvlc_media_descriptor_release
(
p_submd
);
}
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
,
NULL
);
libvlc_media_list_unlock
(
p_mlist
);
libvlc_media_list_release
(
p_mlist
);
}
else
{
/* No mlist, wait for a subitem added event */
libvlc_event_attach
(
p_md
->
p_event_manager
,
libvlc_MediaDescriptorSubItemAdded
,
media_list_subitem_added
,
p_mlv
,
NULL
);
}
}
static
void
...
...
@@ -84,6 +102,13 @@ uninstall_md_listener( libvlc_media_list_view_t * p_mlv,
if
((
p_mlist
=
libvlc_media_descriptor_subitems
(
p_md
,
NULL
)))
{
libvlc_media_list_lock
(
p_mlist
);
libvlc_event_detach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
libvlc_event_detach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
,
NULL
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlist
,
NULL
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -103,6 +128,7 @@ media_list_item_added( const libvlc_event_t * p_event, void * p_user_data )
libvlc_media_list_view_t
*
p_mlv
=
p_user_data
;
libvlc_media_descriptor_t
*
p_md
=
p_event
->
u
.
media_list_item_added
.
item
;
install_md_listener
(
p_mlv
,
p_md
);
printf
(
"media_list_item_added
\n
"
);
if
(
p_mlv
->
pf_ml_item_added
)
p_mlv
->
pf_ml_item_added
(
p_event
,
p_mlv
);
}
...
...
@@ -118,12 +144,34 @@ media_list_item_removed( const libvlc_event_t * p_event, void * p_user_data )
static
void
media_list_subitem_added
(
const
libvlc_event_t
*
p_event
,
void
*
p_user_data
)
{
libvlc_media_list_t
*
p_mlist
;
libvlc_event_t
added_event
;
libvlc_media_list_view_t
*
p_mlv
=
p_user_data
;
libvlc_media_descriptor_t
*
p_md
=
p_event
->
u
.
media_descriptor_subitem_added
.
new_child
;
install_md_listener
(
p_mlv
,
p_md
);
libvlc_media_descriptor_t
*
p_submd
=
p_event
->
u
.
media_descriptor_subitem_added
.
new_child
;
libvlc_media_descriptor_t
*
p_md
=
p_event
->
p_obj
;
if
((
p_mlist
=
libvlc_media_descriptor_subitems
(
p_md
,
NULL
)))
{
/* We have a mlist to which we're going to listen to events
* thus, no need to wait for SubItemAdded events */
libvlc_event_detach
(
p_md
->
p_event_manager
,
libvlc_MediaDescriptorSubItemAdded
,
media_list_subitem_added
,
p_mlv
,
NULL
);
libvlc_media_list_lock
(
p_mlist
);
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemAdded
,
media_list_item_added
,
p_mlv
,
NULL
);
libvlc_event_attach
(
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
,
NULL
);
libvlc_media_list_unlock
(
p_mlist
);
libvlc_media_list_release
(
p_mlist
);
}
install_md_listener
(
p_mlv
,
p_submd
);
added_event
.
u
.
media_list_item_added
.
item
=
p_md
;
added_event
.
u
.
media_list_item_added
.
item
=
p_
sub
md
;
added_event
.
u
.
media_list_item_added
.
index
=
0
;
if
(
p_mlv
->
pf_ml_item_added
)
p_mlv
->
pf_ml_item_added
(
&
added_event
,
p_mlv
);
}
...
...
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