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
91721c03
Commit
91721c03
authored
Sep 03, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vout macosx: drop legacy NSAutoreleasePool pattern
parent
c39e826c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
172 additions
and
164 deletions
+172
-164
modules/video_output/macosx.m
modules/video_output/macosx.m
+172
-164
No files found.
modules/video_output/macosx.m
View file @
91721c03
...
...
@@ -138,11 +138,11 @@ static int Open (vlc_object_t *this)
{
vout_display_t
*
vd
=
(
vout_display_t
*
)
this
;
vout_display_sys_t
*
sys
=
calloc
(
1
,
sizeof
(
*
sys
));
NSAutoreleasePool
*
nsPool
=
nil
;
if
(
!
sys
)
return
VLC_ENOMEM
;
@autoreleasepool
{
if
(
!
CGDisplayUsesOpenGLAcceleration
(
kCGDirectMainDisplay
))
msg_Err
(
this
,
"no OpenGL hardware acceleration found. this can lead to slow output and unexpected results"
);
...
...
@@ -171,9 +171,9 @@ static int Open (vlc_object_t *this)
sys
->
container
=
[
container
retain
];
/* Get our main view*/
nsPool
=
[[
NSAutoreleasePool
alloc
]
init
];
[
VLCOpenGLVideoView
performSelectorOnMainThread
:
@selector
(
getNewView
:)
withObject
:
[
NSValue
valueWithPointer
:
&
sys
->
glView
]
waitUntilDone
:
YES
];
[
VLCOpenGLVideoView
performSelectorOnMainThread
:
@selector
(
getNewView
:)
withObject:
[
NSValue
valueWithPointer
:
&
sys
->
glView
]
waitUntilDone:
YES
];
if
(
!
sys
->
glView
)
{
msg_Err
(
vd
,
"Initialization of open gl view failed"
);
goto
error
;
...
...
@@ -185,20 +185,22 @@ static int Open (vlc_object_t *this)
* container.
* That's why we'll release on main thread in Close(). */
if
([(
id
)
container
respondsToSelector
:
@selector
(
addVoutSubview
:)])
[(
id
)
container
performSelectorOnMainThread
:
@selector
(
addVoutSubview
:)
withObject
:
sys
->
glView
waitUntilDone
:
NO
];
[(
id
)
container
performSelectorOnMainThread
:
@selector
(
addVoutSubview
:)
withObject:
sys
->
glView
waitUntilDone:
NO
];
else
if
([
container
isKindOfClass
:[
NSView
class
]])
{
NSView
*
parentView
=
container
;
[
parentView
performSelectorOnMainThread
:
@selector
(
addSubview
:)
withObject
:
sys
->
glView
waitUntilDone
:
NO
];
[
sys
->
glView
performSelectorOnMainThread
:
@selector
(
setFrameToBoundsOfView
:)
withObject
:
[
NSValue
valueWithPointer
:
parentView
]
waitUntilDone
:
NO
];
[
parentView
performSelectorOnMainThread
:
@selector
(
addSubview
:)
withObject:
sys
->
glView
waitUntilDone:
NO
];
[
sys
->
glView
performSelectorOnMainThread
:
@selector
(
setFrameToBoundsOfView
:)
withObject:
[
NSValue
valueWithPointer
:
parentView
]
waitUntilDone:
NO
];
}
else
{
msg_Err
(
vd
,
"Invalid drawable-nsobject object. drawable-nsobject must either be an NSView or comply to the @protocol VLCOpenGLVideoViewEmbedding."
);
goto
error
;
}
[
nsPool
release
];
nsPool
=
nil
;
/* Initialize common OpenGL video display */
sys
->
gl
.
lock
=
OpenglLock
;
sys
->
gl
.
unlock
=
OpenglUnlock
;
...
...
@@ -234,10 +236,10 @@ static int Open (vlc_object_t *this)
return
VLC_SUCCESS
;
error:
[
nsPool
release
];
error:
Close
(
this
);
return
VLC_EGENERIC
;
}
}
void
Close
(
vlc_object_t
*
this
)
...
...
@@ -245,16 +247,23 @@ void Close (vlc_object_t *this)
vout_display_t
*
vd
=
(
vout_display_t
*
)
this
;
vout_display_sys_t
*
sys
=
vd
->
sys
;
@autoreleasepool
{
[
sys
->
glView
setVoutDisplay
:
nil
];
var_Destroy
(
vd
,
"drawable-nsobject"
);
if
([(
id
)
sys
->
container
respondsToSelector
:
@selector
(
removeVoutSubview
:)])
/* This will retain sys->glView */
[(
id
)
sys
->
container
performSelectorOnMainThread
:
@selector
(
removeVoutSubview
:)
withObject
:
sys
->
glView
waitUntilDone
:
NO
];
[(
id
)
sys
->
container
performSelectorOnMainThread
:
@selector
(
removeVoutSubview
:)
withObject:
sys
->
glView
waitUntilDone:
NO
];
/* release on main thread as explained in Open() */
[(
id
)
sys
->
container
performSelectorOnMainThread
:
@selector
(
release
)
withObject
:
nil
waitUntilDone
:
NO
];
[
sys
->
glView
performSelectorOnMainThread
:
@selector
(
removeFromSuperview
)
withObject
:
nil
waitUntilDone
:
NO
];
[(
id
)
sys
->
container
performSelectorOnMainThread
:
@selector
(
release
)
withObject:
nil
waitUntilDone:
NO
];
[
sys
->
glView
performSelectorOnMainThread
:
@selector
(
removeFromSuperview
)
withObject:
nil
waitUntilDone:
NO
];
if
(
sys
->
gl
.
sys
!=
NULL
)
vout_display_opengl_Delete
(
sys
->
vgl
);
...
...
@@ -264,6 +273,7 @@ void Close (vlc_object_t *this)
if
(
sys
->
embed
)
vout_display_DeleteWindow
(
vd
,
sys
->
embed
);
free
(
sys
);
}
}
/*****************************************************************************
...
...
@@ -311,6 +321,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
if
(
!
sys
->
embed
)
return
VLC_EGENERIC
;
@autoreleasepool
{
switch
(
query
)
{
case
VOUT_DISPLAY_CHANGE_DISPLAY_FILLED
:
...
...
@@ -319,11 +330,9 @@ static int Control (vout_display_t *vd, int query, va_list ap)
case
VOUT_DISPLAY_CHANGE_SOURCE_CROP
:
case
VOUT_DISPLAY_CHANGE_DISPLAY_SIZE
:
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
id
o_window
=
[
sys
->
glView
window
];
if
(
!
o_window
)
{
[
o_pool
release
];
return
VLC_SUCCESS
;
// this is okay, since the event will occur again when we have a window
}
...
...
@@ -364,8 +373,6 @@ static int Control (vout_display_t *vd, int query, va_list ap)
// x / y are top left corner, but we need the lower left one
glViewport
(
place
.
x
,
cfg_tmp
.
display
.
height
-
(
place
.
y
+
place
.
height
),
place
.
width
,
place
.
height
);
[
o_pool
release
];
return
VLC_SUCCESS
;
}
...
...
@@ -381,6 +388,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
msg_Err
(
vd
,
"Unknown request in Mac OS X vout display"
);
return
VLC_EGENERIC
;
}
}
}
/*****************************************************************************
...
...
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