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
9bf66bda
Commit
9bf66bda
authored
Nov 20, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
control/media_list.c: Send WillAddItem and WillDeleteItem events.
parent
4425f55e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
11 deletions
+52
-11
include/vlc/libvlc_structures.h
include/vlc/libvlc_structures.h
+12
-0
src/control/media_list.c
src/control/media_list.c
+40
-11
No files found.
include/vlc/libvlc_structures.h
View file @
9bf66bda
...
@@ -306,7 +306,9 @@ typedef enum libvlc_event_type_t {
...
@@ -306,7 +306,9 @@ typedef enum libvlc_event_type_t {
libvlc_MediaInstancePositionChanged
,
libvlc_MediaInstancePositionChanged
,
libvlc_MediaListItemAdded
,
libvlc_MediaListItemAdded
,
libvlc_MediaListWillAddItem
,
libvlc_MediaListItemDeleted
,
libvlc_MediaListItemDeleted
,
libvlc_MediaListWillDeleteItem
,
libvlc_MediaListPlayerPlayed
,
libvlc_MediaListPlayerPlayed
,
libvlc_MediaListPlayerNextItemSet
,
libvlc_MediaListPlayerNextItemSet
,
...
@@ -362,10 +364,20 @@ typedef struct libvlc_event_t
...
@@ -362,10 +364,20 @@ typedef struct libvlc_event_t
int
index
;
int
index
;
}
media_list_item_added
;
}
media_list_item_added
;
struct
struct
{
libvlc_media_descriptor_t
*
item
;
int
index
;
}
media_list_will_add_item
;
struct
{
{
libvlc_media_descriptor_t
*
item
;
libvlc_media_descriptor_t
*
item
;
int
index
;
int
index
;
}
media_list_item_deleted
;
}
media_list_item_deleted
;
struct
{
libvlc_media_descriptor_t
*
item
;
int
index
;
}
media_list_will_delete_item
;
}
u
;
}
u
;
}
libvlc_event_t
;
}
libvlc_event_t
;
...
...
src/control/media_list.c
View file @
9bf66bda
...
@@ -26,6 +26,11 @@
...
@@ -26,6 +26,11 @@
#include <assert.h>
#include <assert.h>
#include "vlc_arrays.h"
#include "vlc_arrays.h"
typedef
enum
EventPlaceInTime
{
EventWillHappen
,
EventDidHappen
}
EventPlaceInTime
;
/*
/*
* Private functions
* Private functions
*/
*/
...
@@ -40,14 +45,24 @@
...
@@ -40,14 +45,24 @@
static
void
static
void
notify_item_addition
(
libvlc_media_list_t
*
p_mlist
,
notify_item_addition
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_descriptor_t
*
p_md
,
libvlc_media_descriptor_t
*
p_md
,
int
index
)
int
index
,
EventPlaceInTime
event_status
)
{
{
libvlc_event_t
event
;
libvlc_event_t
event
;
/* Construct the event */
/* Construct the event */
if
(
event_status
==
EventDidHappen
)
{
event
.
type
=
libvlc_MediaListItemAdded
;
event
.
type
=
libvlc_MediaListItemAdded
;
event
.
u
.
media_list_item_added
.
item
=
p_md
;
event
.
u
.
media_list_item_added
.
item
=
p_md
;
event
.
u
.
media_list_item_added
.
index
=
index
;
event
.
u
.
media_list_item_added
.
index
=
index
;
}
else
/* if( event_status == EventWillHappen ) */
{
event
.
type
=
libvlc_MediaListWillAddItem
;
event
.
u
.
media_list_will_add_item
.
item
=
p_md
;
event
.
u
.
media_list_will_add_item
.
index
=
index
;
}
/* Send the event */
/* Send the event */
libvlc_event_send
(
p_mlist
->
p_event_manager
,
&
event
);
libvlc_event_send
(
p_mlist
->
p_event_manager
,
&
event
);
...
@@ -61,14 +76,24 @@ notify_item_addition( libvlc_media_list_t * p_mlist,
...
@@ -61,14 +76,24 @@ notify_item_addition( libvlc_media_list_t * p_mlist,
static
void
static
void
notify_item_deletion
(
libvlc_media_list_t
*
p_mlist
,
notify_item_deletion
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_descriptor_t
*
p_md
,
libvlc_media_descriptor_t
*
p_md
,
int
index
)
int
index
,
EventPlaceInTime
event_status
)
{
{
libvlc_event_t
event
;
libvlc_event_t
event
;
/* Construct the event */
/* Construct the event */
if
(
event_status
==
EventDidHappen
)
{
event
.
type
=
libvlc_MediaListItemDeleted
;
event
.
type
=
libvlc_MediaListItemDeleted
;
event
.
u
.
media_list_item_deleted
.
item
=
p_md
;
event
.
u
.
media_list_item_deleted
.
item
=
p_md
;
event
.
u
.
media_list_item_deleted
.
index
=
index
;
event
.
u
.
media_list_item_deleted
.
index
=
index
;
}
else
/* if( event_status == EventWillHappen ) */
{
event
.
type
=
libvlc_MediaListWillDeleteItem
;
event
.
u
.
media_list_will_delete_item
.
item
=
p_md
;
event
.
u
.
media_list_will_delete_item
.
index
=
index
;
}
/* Send the event */
/* Send the event */
libvlc_event_send
(
p_mlist
->
p_event_manager
,
&
event
);
libvlc_event_send
(
p_mlist
->
p_event_manager
,
&
event
);
...
@@ -277,8 +302,10 @@ void libvlc_media_list_add_media_descriptor(
...
@@ -277,8 +302,10 @@ void libvlc_media_list_add_media_descriptor(
{
{
(
void
)
p_e
;
(
void
)
p_e
;
libvlc_media_descriptor_retain
(
p_md
);
libvlc_media_descriptor_retain
(
p_md
);
notify_item_addition
(
p_mlist
,
p_md
,
vlc_array_count
(
&
p_mlist
->
items
),
EventWillHappen
);
vlc_array_append
(
&
p_mlist
->
items
,
p_md
);
vlc_array_append
(
&
p_mlist
->
items
,
p_md
);
notify_item_addition
(
p_mlist
,
p_md
,
vlc_array_count
(
&
p_mlist
->
items
)
-
1
);
notify_item_addition
(
p_mlist
,
p_md
,
vlc_array_count
(
&
p_mlist
->
items
)
-
1
,
EventDidHappen
);
}
}
/**************************************************************************
/**************************************************************************
...
@@ -295,8 +322,9 @@ void libvlc_media_list_insert_media_descriptor(
...
@@ -295,8 +322,9 @@ void libvlc_media_list_insert_media_descriptor(
(
void
)
p_e
;
(
void
)
p_e
;
libvlc_media_descriptor_retain
(
p_md
);
libvlc_media_descriptor_retain
(
p_md
);
notify_item_addition
(
p_mlist
,
p_md
,
index
,
EventWillHappen
);
vlc_array_insert
(
&
p_mlist
->
items
,
p_md
,
index
);
vlc_array_insert
(
&
p_mlist
->
items
,
p_md
,
index
);
notify_item_addition
(
p_mlist
,
p_md
,
index
);
notify_item_addition
(
p_mlist
,
p_md
,
index
,
EventDidHappen
);
}
}
/**************************************************************************
/**************************************************************************
...
@@ -312,8 +340,9 @@ void libvlc_media_list_remove_index( libvlc_media_list_t * p_mlist,
...
@@ -312,8 +340,9 @@ void libvlc_media_list_remove_index( libvlc_media_list_t * p_mlist,
p_md
=
vlc_array_item_at_index
(
&
p_mlist
->
items
,
index
);
p_md
=
vlc_array_item_at_index
(
&
p_mlist
->
items
,
index
);
notify_item_deletion
(
p_mlist
,
p_md
,
index
,
EventWillHappen
);
vlc_array_remove
(
&
p_mlist
->
items
,
index
);
vlc_array_remove
(
&
p_mlist
->
items
,
index
);
notify_item_deletion
(
p_mlist
,
p_md
,
index
);
notify_item_deletion
(
p_mlist
,
p_md
,
index
,
EventDidHappen
);
libvlc_media_descriptor_release
(
p_md
);
libvlc_media_descriptor_release
(
p_md
);
}
}
...
...
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