Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
82397876
Commit
82397876
authored
Jul 13, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: fix runtime exception and clean-up code
parent
56bc5203
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
71 deletions
+95
-71
modules/gui/macosx/playlistinfo.h
modules/gui/macosx/playlistinfo.h
+5
-21
modules/gui/macosx/playlistinfo.m
modules/gui/macosx/playlistinfo.m
+90
-50
No files found.
modules/gui/macosx/playlistinfo.h
View file @
82397876
/*****************************************************************************
* playlistinfo.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-201
2
VLC authors and VideoLAN
* Copyright (C) 2002-201
5
VLC authors and VideoLAN
* $Id$
*
* Authors: Benjamin Pracht <bigben at videolan dot org>
...
...
@@ -94,15 +94,8 @@
IBOutlet
id
o_video_lbl
;
IBOutlet
id
o_video_decoded_lbl
;
IBOutlet
id
o_video_decoded_txt
;
VLCInfoTreeItem
*
rootItem
;
input_item_t
*
p_item
;
BOOL
b_awakeFromNib
;
BOOL
b_stats
;
}
@property
(
readonly
)
input_item_t
*
item
;
@property
(
readonly
)
input_item_t
*
item
;
-
(
void
)
updateCocoaWindowLevel
:(
NSInteger
)
i_level
;
-
(
void
)
initPanel
;
...
...
@@ -112,7 +105,7 @@
-
(
IBAction
)
downloadCoverArt
:(
id
)
sender
;
-
(
void
)
initMediaPanelStats
;
-
(
void
)
updatePanelWithItem
:(
input_item_t
*
)
_p_item
;
-
(
void
)
setMeta
:
(
char
*
)
meta
forLabel
:
(
id
)
theItem
;
-
(
void
)
setMeta
:
(
char
*
)
meta
forLabel
:
(
id
)
theItem
;
-
(
void
)
updateMetadata
;
-
(
void
)
updateStatistics
;
...
...
@@ -120,21 +113,12 @@
@end
@interface
VLCInfoTreeItem
:
NSObject
{
NSString
*
o_name
;
NSString
*
o_value
;
int
i_object_id
;
input_item_t
*
p_item
;
VLCInfoTreeItem
*
o_parent
;
NSMutableArray
*
o_children
;
}
@property
(
readonly
)
int
numberOfChildren
;
@property
(
readonly
)
NSString
*
name
;
@property
(
readonly
)
NSString
*
value
;
@property
(
readonly
)
NSString
*
name
;
@property
(
readonly
)
NSString
*
value
;
-
(
VLCInfoTreeItem
*
)
childAtIndex
:(
NSUInteger
)
i_index
;
-
(
void
)
refresh
;
@end
modules/gui/macosx/playlistinfo.m
View file @
82397876
/*****************************************************************************
r playlistinfo.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-201
2
VLC authors and VideoLAN
* Copyright (C) 2002-201
5
VLC authors and VideoLAN
* $Id$
*
* Authors: Benjamin Pracht <bigben at videolan dot org>
...
...
@@ -36,6 +36,17 @@
* VLCPlaylistInfo Implementation
*****************************************************************************/
@interface
VLCInfo
()
{
VLCInfoTreeItem
*
rootItem
;
input_item_t
*
p_item
;
BOOL
b_awakeFromNib
;
BOOL
b_stats
;
}
@end
@implementation
VLCInfo
static
VLCInfo
*
_o_sharedInstance
=
nil
;
...
...
@@ -423,24 +434,36 @@ error:
@end
@implementation
VLCInfoTreeItem
@interface
VLCInfoTreeItem
()
{
NSString
*
_name
;
NSString
*
_value
;
int
i_object_id
;
input_item_t
*
p_item
;
VLCInfoTreeItem
*
_parent
;
NSMutableArray
*
_children
;
BOOL
_isALeafNode
;
}
@synthesize
name
=
o_name
,
value
=
o_value
;
@end
@implementation
VLCInfoTreeItem
#define IsALeafNode ((id)-1)
@synthesize
name
=
_name
,
value
=
_value
;
-
(
id
)
initWithName
:
(
NSString
*
)
o_item_name
value
:
(
NSString
*
)
o_item_value
ID
:
(
int
)
i_id
parent
:(
VLCInfoTreeItem
*
)
o_parent_item
-
(
id
)
initWithName
:(
NSString
*
)
item_name
value
:(
NSString
*
)
item_value
ID
:(
int
)
i_id
parent
:(
VLCInfoTreeItem
*
)
parent_item
{
self
=
[
super
init
];
if
(
self
!=
nil
)
{
o_name
=
[
o_
item_name
copy
];
o_value
=
[
o_
item_value
copy
];
_name
=
[
item_name
copy
];
_value
=
[
item_value
copy
];
i_object_id
=
i_id
;
o_parent
=
o_
parent_item
;
_parent
=
parent_item
;
p_item
=
[(
VLCInfo
*
)[[
VLCMain
sharedInstance
]
info
]
item
];
o_children
=
nil
;
}
return
self
;
}
...
...
@@ -452,48 +475,60 @@ error:
-
(
void
)
dealloc
{
if
(
o_children
!=
IsALeafNode
)
[
o_children
release
];
[
o_name
release
];
[
o_value
release
];
if
(
p_item
)
vlc_gc_decref
(
p_item
);
if
(
_children
)
[
_children
release
];
[
_name
release
];
[
_value
release
];
if
(
p_item
)
vlc_gc_decref
(
p_item
);
[
super
dealloc
];
}
/* Creates and returns the array of children
* Loads children incrementally */
-
(
NSArray
*
)
c
hildren
-
(
void
)
_updateC
hildren
{
if
(
!
p_item
)
return
nil
;
if
(
o_children
==
NULL
)
{
o_children
=
[[
NSMutableArray
alloc
]
init
];
if
(
i_object_id
==
-
1
)
{
vlc_mutex_lock
(
&
p_item
->
lock
);
for
(
int
i
=
0
;
i
<
p_item
->
i_categories
;
i
++
)
{
NSString
*
name
=
[
NSString
stringWithUTF8String
:
p_item
->
pp_categories
[
i
]
->
psz_name
];
VLCInfoTreeItem
*
item
=
[[
VLCInfoTreeItem
alloc
]
initWithName
:
name
value
:
@""
ID
:
i
parent
:
self
];
[
item
autorelease
];
[
o_children
addObject
:
item
];
}
vlc_mutex_unlock
(
&
p_item
->
lock
);
return
;
if
(
_children
!=
nil
)
return
;
_children
=
[[
NSMutableArray
alloc
]
init
];
if
(
i_object_id
==
-
1
)
{
vlc_mutex_lock
(
&
p_item
->
lock
);
for
(
int
i
=
0
;
i
<
p_item
->
i_categories
;
i
++
)
{
NSString
*
name
=
[
NSString
stringWithUTF8String
:
p_item
->
pp_categories
[
i
]
->
psz_name
];
VLCInfoTreeItem
*
item
=
[[
VLCInfoTreeItem
alloc
]
initWithName:
name
value:
@""
ID:
i
parent:
self
];
[
item
autorelease
];
[
_children
addObject
:
item
];
}
else
if
(
o_parent
->
i_object_id
==
-
1
)
{
vlc_mutex_lock
(
&
p_item
->
lock
);
info_category_t
*
cat
=
p_item
->
pp_categories
[
i_object_id
];
for
(
int
i
=
0
;
i
<
cat
->
i_infos
;
i
++
)
{
NSString
*
name
=
[
NSString
stringWithUTF8String
:
cat
->
pp_infos
[
i
]
->
psz_name
];
NSString
*
value
=
[
NSString
stringWithUTF8String
:
cat
->
pp_infos
[
i
]
->
psz_value
?
:
""
];
VLCInfoTreeItem
*
item
=
[[
VLCInfoTreeItem
alloc
]
initWithName
:
name
value
:
value
ID
:
i
parent
:
self
];
[
item
autorelease
];
[
o_children
addObject
:
item
];
}
vlc_mutex_unlock
(
&
p_item
->
lock
);
vlc_mutex_unlock
(
&
p_item
->
lock
);
_isALeafNode
=
NO
;
}
else
if
(
_parent
->
i_object_id
==
-
1
)
{
vlc_mutex_lock
(
&
p_item
->
lock
);
info_category_t
*
cat
=
p_item
->
pp_categories
[
i_object_id
];
for
(
int
i
=
0
;
i
<
cat
->
i_infos
;
i
++
)
{
NSString
*
name
=
[
NSString
stringWithUTF8String
:
cat
->
pp_infos
[
i
]
->
psz_name
];
NSString
*
value
=
[
NSString
stringWithUTF8String
:
cat
->
pp_infos
[
i
]
->
psz_value
?
:
""
];
VLCInfoTreeItem
*
item
=
[[
VLCInfoTreeItem
alloc
]
initWithName:
name
value:
value
ID:
i
parent:
self
];
[
item
autorelease
];
[
_children
addObject
:
item
];
}
else
o_children
=
IsALeafNode
;
vlc_mutex_unlock
(
&
p_item
->
lock
);
_isALeafNode
=
NO
;
}
return
o_children
;
else
_isALeafNode
=
YES
;
}
-
(
void
)
refresh
...
...
@@ -501,20 +536,25 @@ error:
if
(
p_item
)
vlc_gc_decref
(
p_item
);
p_item
=
[
(
VLCInfo
*
)[[
VLCMain
sharedInstance
]
info
]
item
];
p_item
=
[
[
VLCInfo
sharedInstance
]
item
];
[
o
_children
release
];
o
_children
=
nil
;
[
_children
release
];
_children
=
nil
;
}
-
(
VLCInfoTreeItem
*
)
childAtIndex
:(
NSUInteger
)
i_index
{
return
[[
self
children
]
objectAtIndex
:
i_index
];
-
(
VLCInfoTreeItem
*
)
childAtIndex
:(
NSUInteger
)
i_index
{
return
[
_children
objectAtIndex
:
i_index
];
}
-
(
int
)
numberOfChildren
{
-
(
int
)
numberOfChildren
{
[
self
_updateChildren
];
if
(
_isALeafNode
)
return
-
1
;
id
i_tmp
=
[
self
children
];
return
(
i_tmp
==
IsALeafNode
)
?
(
-
1
)
:
(
int
)[
i_tmp
count
];
return
[
_children
count
];
}
@end
...
...
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