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
c39e826c
Commit
c39e826c
authored
Sep 03, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caopengllayer: drop legacy NSAutoreleasePool pattern
parent
b8b5a70c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
83 deletions
+84
-83
modules/video_output/caopengllayer.m
modules/video_output/caopengllayer.m
+84
-83
No files found.
modules/video_output/caopengllayer.m
View file @
c39e826c
...
...
@@ -114,95 +114,96 @@ static int Open (vlc_object_t *p_this)
if
(
sys
==
NULL
)
return
VLC_EGENERIC
;
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
id
container
=
var_CreateGetAddress
(
vd
,
"drawable-nsobject"
);
if
(
container
)
vout_display_DeleteWindow
(
vd
,
NULL
);
else
{
sys
->
embed
=
vout_display_NewWindow
(
vd
,
VOUT_WINDOW_TYPE_NSOBJECT
);
if
(
sys
->
embed
)
container
=
sys
->
embed
->
handle
.
nsobject
;
if
(
!
container
)
{
msg_Err
(
vd
,
"No drawable-nsobject found!"
)
;
goto
bailout
;
@autoreleasepool
{
id
container
=
var_CreateGetAddress
(
vd
,
"drawable-nsobject"
);
if
(
container
)
vout_display_DeleteWindow
(
vd
,
NULL
);
else
{
sys
->
embed
=
vout_display_NewWindow
(
vd
,
VOUT_WINDOW_TYPE_NSOBJECT
);
if
(
sys
->
embed
)
container
=
sys
->
embed
->
handle
.
nsobject
;
if
(
!
container
)
{
msg_Err
(
vd
,
"No drawable-nsobject found!"
);
goto
bailout
;
}
}
}
/* store for later, released in Close() */
sys
->
container
=
[
container
retain
];
/* store for later, released in Close() */
sys
->
container
=
[
container
retain
];
[
CATransaction
begin
];
sys
->
cgLayer
=
[[
VLCCAOpenGLLayer
alloc
]
init
];
[
sys
->
cgLayer
setVoutDisplay
:
vd
];
[
sys
->
cgLayer
performSelectorOnMainThread
:
@selector
(
display
)
withObject:
nil
waitUntilDone:
YES
];
if
([
container
respondsToSelector
:
@selector
(
addVoutLayer
:)])
{
msg_Dbg
(
vd
,
"container implements implicit protocol"
);
[
container
addVoutLayer
:
sys
->
cgLayer
];
}
else
if
([
container
respondsToSelector
:
@selector
(
addSublayer
:)]
||
[
container
isKindOfClass
:[
CALayer
class
]])
{
msg_Dbg
(
vd
,
"container doesn't implement implicit protocol, fallback mode used"
);
[
container
addSublayer
:
sys
->
cgLayer
];
}
else
{
msg_Err
(
vd
,
"Provided NSObject container isn't compatible"
);
[
sys
->
cgLayer
release
];
sys
->
cgLayer
=
nil
;
[
CATransaction
commit
];
goto
bailout
;
}
[
CATransaction
commit
];
[
CATransaction
begin
];
sys
->
cgLayer
=
[[
VLCCAOpenGLLayer
alloc
]
init
];
[
sys
->
cgLayer
setVoutDisplay
:
vd
];
if
(
!
sys
->
cgLayer
)
goto
bailout
;
[
sys
->
cgLayer
performSelectorOnMainThread
:
@selector
(
display
)
withObject
:
nil
waitUntilDone
:
YES
];
if
(
!
sys
->
glContext
)
msg_Warn
(
vd
,
"we might not have an OpenGL context yet"
);
/* Initialize common OpenGL video display */
sys
->
gl
.
lock
=
OpenglLock
;
sys
->
gl
.
unlock
=
OpenglUnlock
;
sys
->
gl
.
swap
=
OpenglSwap
;
sys
->
gl
.
getProcAddress
=
OurGetProcAddress
;
sys
->
gl
.
sys
=
sys
;
const
vlc_fourcc_t
*
subpicture_chromas
;
video_format_t
fmt
=
vd
->
fmt
;
sys
->
vgl
=
vout_display_opengl_New
(
&
vd
->
fmt
,
&
subpicture_chromas
,
&
sys
->
gl
);
if
(
!
sys
->
vgl
)
{
msg_Err
(
vd
,
"Error while initializing opengl display."
);
sys
->
gl
.
sys
=
NULL
;
goto
bailout
;
}
if
([
container
respondsToSelector
:
@selector
(
addVoutLayer
:)])
{
msg_Dbg
(
vd
,
"container implements implicit protocol"
);
[
container
addVoutLayer
:
sys
->
cgLayer
];
}
else
if
([
container
respondsToSelector
:
@selector
(
addSublayer
:)]
||
[
container
isKindOfClass
:[
CALayer
class
]])
{
msg_Dbg
(
vd
,
"container doesn't implement implicit protocol, fallback mode used"
);
[
container
addSublayer
:
sys
->
cgLayer
];
}
else
{
msg_Err
(
vd
,
"Provided NSObject container isn't compatible"
);
[
sys
->
cgLayer
release
];
sys
->
cgLayer
=
nil
;
[
CATransaction
commit
];
goto
bailout
;
}
[
CATransaction
commit
];
if
(
!
sys
->
cgLayer
)
goto
bailout
;
if
(
!
sys
->
glContext
)
msg_Warn
(
vd
,
"we might not have an OpenGL context yet"
);
/* Initialize common OpenGL video display */
sys
->
gl
.
lock
=
OpenglLock
;
sys
->
gl
.
unlock
=
OpenglUnlock
;
sys
->
gl
.
swap
=
OpenglSwap
;
sys
->
gl
.
getProcAddress
=
OurGetProcAddress
;
sys
->
gl
.
sys
=
sys
;
const
vlc_fourcc_t
*
subpicture_chromas
;
video_format_t
fmt
=
vd
->
fmt
;
sys
->
vgl
=
vout_display_opengl_New
(
&
vd
->
fmt
,
&
subpicture_chromas
,
&
sys
->
gl
);
if
(
!
sys
->
vgl
)
{
msg_Err
(
vd
,
"Error while initializing opengl display."
);
sys
->
gl
.
sys
=
NULL
;
goto
bailout
;
/* setup vout display */
vout_display_info_t
info
=
vd
->
info
;
info
.
subpicture_chromas
=
subpicture_chromas
;
info
.
has_hide_mouse
=
true
;
vd
->
info
=
info
;
vd
->
pool
=
Pool
;
vd
->
prepare
=
PictureRender
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
/* setup initial state */
CGSize
outputSize
;
if
([
container
respondsToSelector
:
@selector
(
currentOutputSize
)])
outputSize
=
[
container
currentOutputSize
];
else
outputSize
=
[
sys
->
container
visibleRect
].
size
;
vout_display_SendEventFullscreen
(
vd
,
false
);
vout_display_SendEventDisplaySize
(
vd
,
(
int
)
outputSize
.
width
,
(
int
)
outputSize
.
height
);
return
VLC_SUCCESS
;
bailout:
Close
(
p_this
);
return
VLC_EGENERIC
;
}
/* setup vout display */
vout_display_info_t
info
=
vd
->
info
;
info
.
subpicture_chromas
=
subpicture_chromas
;
info
.
has_hide_mouse
=
true
;
vd
->
info
=
info
;
vd
->
pool
=
Pool
;
vd
->
prepare
=
PictureRender
;
vd
->
display
=
PictureDisplay
;
vd
->
control
=
Control
;
/* setup initial state */
CGSize
outputSize
;
if
([
container
respondsToSelector
:
@selector
(
currentOutputSize
)])
outputSize
=
[
container
currentOutputSize
];
else
outputSize
=
[
sys
->
container
visibleRect
].
size
;
vout_display_SendEventFullscreen
(
vd
,
false
);
vout_display_SendEventDisplaySize
(
vd
,
(
int
)
outputSize
.
width
,
(
int
)
outputSize
.
height
);
[
pool
release
];
return
VLC_SUCCESS
;
bailout:
[
pool
release
];
Close
(
p_this
);
return
VLC_EGENERIC
;
}
static
void
Close
(
vlc_object_t
*
p_this
)
...
...
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