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
5c8f6f54
Commit
5c8f6f54
authored
Nov 20, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MacOSX/Framework/VLCMediaList.m: Be KVC compliant.
parent
85be5949
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
5 deletions
+33
-5
extras/MacOSX/Framework/Sources/VLCMediaList.m
extras/MacOSX/Framework/Sources/VLCMediaList.m
+33
-5
No files found.
extras/MacOSX/Framework/Sources/VLCMediaList.m
View file @
5c8f6f54
...
...
@@ -47,10 +47,8 @@ NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
static
void
HandleMediaListItemAdded
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
id
self
=
user_data
;
// Check to see if the last item added is this item we're trying to introduce
// If no, then add the item to the local list, otherwise, the item has already
// been added
int
index
=
event
->
u
.
media_list_item_added
.
index
;
[
self
didChange
:
NSKeyValueChangeInsertion
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"Media"
];
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaListItemAdded
:)
withArgumentAsObject:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
...
...
@@ -58,11 +56,19 @@ static void HandleMediaListItemAdded(const libvlc_event_t *event, void *user_dat
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_added
.
index
],
@"index"
,
nil
]];
}
static
void
HandleMediaListWillAddItem
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
id
self
=
user_data
;
int
index
=
event
->
u
.
media_list_will_add_item
.
index
;
[
self
willChange
:
NSKeyValueChangeInsertion
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"Media"
];
}
static
void
HandleMediaListItemDeleted
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
id
self
=
user_data
;
int
index
=
event
->
u
.
media_list_will_add_item
.
index
;
[
self
didChange
:
NSKeyValueChangeRemoval
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"Media"
];
// Check to see if the last item deleted is this item we're trying delete now.
// If no, then delete the item from the local list, otherwise, the item has already
// been deleted
...
...
@@ -71,6 +77,26 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
withArgumentAsObject:
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_deleted
.
index
]];
}
static
void
HandleMediaListWillDeleteItem
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
id
self
=
user_data
;
int
index
=
event
->
u
.
media_list_will_add_item
.
index
;
[
self
willChange
:
NSKeyValueChangeRemoval
valuesAtIndexes
:[
NSIndexSet
indexSetWithIndex
:
index
]
forKey
:
@"Media"
];
}
@implementation
VLCMediaList
(
KeyValueCodingCompliance
)
/* For the @"Media" key */
-
(
int
)
countOfMedia
{
return
[
self
count
];
}
-
(
id
)
objectInMediaAtIndex
:(
int
)
i
{
return
[
self
mediaAtIndex
:
i
];
}
@end
@implementation
VLCMediaList
-
(
id
)
init
{
...
...
@@ -100,7 +126,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
* Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t
*
p_em
=
libvlc_media_list_event_manager
(
p_mlist
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaListItemDeleted
,
HandleMediaListItemDeleted
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaListWillDeleteItem
,
HandleMediaListWillDeleteItem
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaListItemAdded
,
HandleMediaListItemAdded
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaListWillAddItem
,
HandleMediaListWillAddItem
,
self
,
NULL
);
}
[
super
release
];
}
...
...
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