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
6fba236c
Commit
6fba236c
authored
Feb 13, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx/framework: Correctly set the children of the nodes.
parent
d206ed68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
7 deletions
+54
-7
projects/macosx/framework/Sources/VLCMediaListAspect.m
projects/macosx/framework/Sources/VLCMediaListAspect.m
+54
-7
No files found.
projects/macosx/framework/Sources/VLCMediaListAspect.m
View file @
6fba236c
...
...
@@ -43,19 +43,30 @@
@end
@implementation
VLCMediaListAspectNode
-
(
id
)
init
{
if
(
self
=
[
super
init
])
{
media
=
nil
;
children
=
nil
;
}
return
self
;
}
-
(
void
)
dealloc
{
[
media
release
];
[
children
release
];
[
super
dealloc
];
}
@synthesize
media
;
@synthesize
children
;
-
(
BOOL
)
isLeaf
{
return
self
.
children
==
NULL
;
return
self
.
children
==
nil
;
}
-
(
void
)
dealloc
{
[
self
.
children
release
];
[
super
dealloc
];
}
@end
@implementation
VLCMediaListAspect
(
KeyValueCodingCompliance
)
...
...
@@ -113,6 +124,24 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
[
parentMediaList
release
];
[
super
dealloc
];
}
-
(
void
)
release
{
@synchronized
(
self
)
{
if
([
self
retainCount
]
<=
1
)
{
/* We must make sure we won't receive new event after an upcoming dealloc
* We also may receive a -retain in some event callback that may occcur
* Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t
*
p_em
=
libvlc_media_list_view_event_manager
(
p_mlv
);
libvlc_event_detach
(
p_em
,
libvlc_MediaListViewItemDeleted
,
HandleMediaListViewItemDeleted
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaListViewItemAdded
,
HandleMediaListViewItemAdded
,
self
,
NULL
);
}
[
super
release
];
}
}
-
(
NSString
*
)
description
{
NSMutableString
*
content
=
[
NSMutableString
string
];
...
...
@@ -155,6 +184,12 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
{
VLCMediaListAspectNode
*
node
=
[[[
VLCMediaListAspectNode
alloc
]
init
]
autorelease
];
[
node
setMedia
:[
self
mediaAtIndex
:
index
]];
libvlc_media_list_view_t
*
p_sub_mlv
=
libvlc_media_list_view_children_for_item
([
self
libVLCMediaListView
],
[
node
.
media
libVLCMediaDescriptor
],
NULL
);
if
(
p_sub_mlv
)
{
[
node
setChildren
:[
VLCMediaListAspect
mediaListAspectWithLibVLCMediaListView
:
p_sub_mlv
]];
libvlc_media_list_view_release
(
p_sub_mlv
);
}
return
node
;
}
...
...
@@ -218,6 +253,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
VLCMediaListAspectNode
*
node
=
[[[
VLCMediaListAspectNode
alloc
]
init
]
autorelease
];
[
node
setMedia
:[
VLCMedia
mediaWithLibVLCMediaDescriptor
:
p_md
]];
[
node
setChildren
:
p_sub_mlv
?
[
VLCMediaListAspect
mediaListAspectWithLibVLCMediaListView
:
p_sub_mlv
]
:
nil
];
if
(
p_sub_mlv
)
NSAssert
(
!
[
node
isLeaf
],
@"Not leaf"
);
[
cachedNode
addObject
:
node
];
libvlc_media_descriptor_release
(
p_md
);
if
(
p_sub_mlv
)
libvlc_media_list_view_release
(
p_sub_mlv
);
...
...
@@ -266,7 +303,17 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
VLCMedia
*
media
=
[
args
objectForKey
:
@"media"
];
VLCMediaListAspectNode
*
node
=
[[[
VLCMediaListAspectNode
alloc
]
init
]
autorelease
];
[
node
setMedia
:
media
];
[
node
setChildren
:[
self
childrenAtIndex
:
index
]];
/* Set the sub media list view we enventually have */
libvlc_media_list_view_t
*
p_sub_mlv
=
libvlc_media_list_view_children_for_item
([
self
libVLCMediaListView
],
[
media
libVLCMediaDescriptor
],
NULL
);
if
(
p_sub_mlv
)
{
[
node
setChildren
:[
VLCMediaListAspect
mediaListAspectWithLibVLCMediaListView
:
p_sub_mlv
]];
libvlc_media_list_view_release
(
p_sub_mlv
);
NSAssert
(
!
[
node
isLeaf
],
@"Not leaf"
);
}
/* Sanity check */
if
(
index
&&
index
>
[
cachedNode
count
]
)
index
=
[
cachedNode
count
];
...
...
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