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
3c5c523f
Commit
3c5c523f
authored
Feb 28, 2004
by
Eric Petit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx/vout* : don't forget to exit fullscreen mode at EOF,
fixed a segfault
parent
c97ac86a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
22 deletions
+71
-22
modules/gui/macosx/vout.h
modules/gui/macosx/vout.h
+4
-2
modules/gui/macosx/vout.m
modules/gui/macosx/vout.m
+67
-20
No files found.
modules/gui/macosx/vout.h
View file @
3c5c523f
...
...
@@ -2,7 +2,7 @@
* vout.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.h,v 1.2
4 2004/02/25 19:27:23
titer Exp $
* $Id: vout.h,v 1.2
5 2004/02/28 13:53:35
titer Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
...
...
@@ -61,10 +61,11 @@
{
vout_thread_t
*
p_vout
;
int
i_effect
;
int
b_init_done
;
unsigned
long
i_texture
;
float
f_x
;
float
f_y
;
int
initDone
;
int
isFullScreen
;
NSOpenGLContext
*
fullScreenContext
;
NSOpenGLContext
*
currentContext
;
}
...
...
@@ -74,6 +75,7 @@
-
(
void
)
reloadTexture
;
-
(
void
)
goFullScreen
;
-
(
void
)
exitFullScreen
;
-
(
void
)
cleanUp
;
@end
...
...
modules/gui/macosx/vout.m
View file @
3c5c523f
...
...
@@ -2,7 +2,7 @@
* vout.m: MacOS X video output module
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.8
4 2004/02/26 13:24:55 hartman
Exp $
* $Id: vout.m,v 1.8
5 2004/02/28 13:53:35 titer
Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
...
...
@@ -328,9 +328,9 @@ static int vout_Init( vout_thread_t *p_vout )
{
/* Nothing special to do, we just need a basic allocated
picture_t */
vout_AllocatePicture
(
p_vout
,
p_pic
,
p_vout
->
output
.
i_chroma
,
p_vout
->
output
.
i_
width
,
p_vout
->
output
.
i_height
,
p_vout
->
output
.
i_aspect
);
vout_AllocatePicture
(
VLC_OBJECT
(
p_vout
),
p_pic
,
p_vout
->
output
.
i_
chroma
,
p_vout
->
output
.
i_width
,
p_vout
->
output
.
i_
height
,
p_vout
->
output
.
i_
aspect
);
}
p_pic
->
i_status
=
DESTROYED_PICTURE
;
...
...
@@ -345,6 +345,7 @@ static int vout_Init( vout_thread_t *p_vout )
{
[
p_vout
->
p_sys
->
o_glview
lockFocus
];
[
p_vout
->
p_sys
->
o_glview
initTextures
];
[
p_vout
->
p_sys
->
o_glview
reshape
];
[
p_vout
->
p_sys
->
o_glview
unlockFocus
];
}
...
...
@@ -362,6 +363,10 @@ static void vout_End( vout_thread_t *p_vout )
{
QTDestroySequence
(
p_vout
);
}
else
{
[
p_vout
->
p_sys
->
o_glview
cleanUp
];
}
/* Free the direct buffers we allocated */
for
(
i_index
=
I_OUTPUTPICTURES
;
i_index
;
)
...
...
@@ -1365,17 +1370,23 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
glTranslatef
(
0
.
0
,
0
.
0
,
-
5
.
0
);
}
b_init_done
=
0
;
i_texture
=
0
;
initDone
=
0
;
isFullScreen
=
0
;
return
self
;
}
-
(
void
)
reshape
{
if
(
!
initDone
)
{
return
;
}
[
currentContext
makeCurrentContext
];
NSRect
bounds
=
[
self
bounds
];
glViewport
(
0
,
0
,
(
GLint
)
bounds
.
size
.
width
,
(
GLint
)
bounds
.
size
.
height
);
...
...
@@ -1385,10 +1396,10 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
f_x
=
1
.
0
;
f_y
=
1
.
0
;
}
else
if
(
bounds
.
size
.
height
*
p_vout
->
render
.
i_aspect
<
else
if
(
bounds
.
size
.
height
*
p_vout
->
output
.
i_aspect
<
bounds
.
size
.
width
*
VOUT_ASPECT_FACTOR
)
{
f_x
=
bounds
.
size
.
height
*
p_vout
->
render
.
i_aspect
/
f_x
=
bounds
.
size
.
height
*
p_vout
->
output
.
i_aspect
/
VOUT_ASPECT_FACTOR
/
bounds
.
size
.
width
;
f_y
=
1
.
0
;
}
...
...
@@ -1396,7 +1407,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
{
f_x
=
1
.
0
;
f_y
=
bounds
.
size
.
width
*
VOUT_ASPECT_FACTOR
/
p_vout
->
render
.
i_aspect
/
bounds
.
size
.
height
;
p_vout
->
output
.
i_aspect
/
bounds
.
size
.
height
;
}
}
...
...
@@ -1404,6 +1415,12 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
{
[
currentContext
makeCurrentContext
];
/* Free previous texture if any */
if
(
i_texture
)
{
glDeleteTextures
(
1
,
&
i_texture
);
}
/* Create textures */
glGenTextures
(
1
,
&
i_texture
);
...
...
@@ -1439,11 +1456,16 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
GL_YCBCR_422_APPLE
,
GL_UNSIGNED_SHORT_8_8_APPLE
,
PP_OUTPUTPICTURE
[
0
]
->
p_data
);
b_init_d
one
=
1
;
initD
one
=
1
;
}
-
(
void
)
reloadTexture
{
if
(
!
initDone
)
{
return
;
}
[
currentContext
makeCurrentContext
];
glBindTexture
(
GL_TEXTURE_RECTANGLE_EXT
,
i_texture
);
...
...
@@ -1459,6 +1481,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
-
(
void
)
goFullScreen
{
/* Create the new pixel format */
NSOpenGLPixelFormatAttribute
attribs
[]
=
{
NSOpenGLPFAAccelerated
,
...
...
@@ -1469,47 +1492,47 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
NSOpenGLPFADepthSize
,
24
,
NSOpenGLPFAFullScreen
,
NSOpenGLPFAScreenMask
,
/* TODO handle macosxx-vdev */
CGDisplayIDToOpenGLDisplayMask
(
kCGDirectMainDisplay
),
0
};
NSOpenGLPixelFormat
*
fmt
=
[[
NSOpenGLPixelFormat
alloc
]
initWithAttributes:
attribs
];
if
(
!
fmt
)
{
msg_Warn
(
p_vout
,
"Cannot create NSOpenGLPixelFormat"
);
return
;
}
/* Create the new OpenGL context */
fullScreenContext
=
[[
NSOpenGLContext
alloc
]
initWithFormat:
fmt
shareContext
:
[
self
openGLContext
]];
initWithFormat:
fmt
shareContext
:
nil
];
if
(
!
fullScreenContext
)
{
msg_Warn
(
p_vout
,
"Failed to create new NSOpenGLContext"
);
return
;
}
currentContext
=
fullScreenContext
;
/* Capture display, switch to fullscreen */
if
(
CGCaptureAllDisplays
()
!=
CGDisplayNoErr
)
{
msg_Warn
(
p_vout
,
"CGCaptureAllDisplays() failed"
);
return
;
}
[
fullScreenContext
setFullScreen
];
[
fullScreenContext
makeCurrentContext
];
/* Fix ratio */
unsigned
width
=
CGDisplayPixelsWide
(
kCGDirectMainDisplay
);
unsigned
height
=
CGDisplayPixelsHigh
(
kCGDirectMainDisplay
);
if
(
config_GetInt
(
p_vout
,
"macosx-stretch"
)
)
{
f_x
=
1
.
0
;
f_y
=
1
.
0
;
}
else
if
(
height
*
p_vout
->
output
.
i_aspect
<
width
*
VOUT_ASPECT_FACTOR
)
else
if
(
height
*
p_vout
->
output
.
i_aspect
<
width
*
VOUT_ASPECT_FACTOR
)
{
f_x
=
(
float
)
height
*
p_vout
->
output
.
i_aspect
/
width
/
VOUT_ASPECT_FACTOR
;
...
...
@@ -1521,18 +1544,42 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
f_y
=
(
float
)
width
*
VOUT_ASPECT_FACTOR
/
p_vout
->
output
.
i_aspect
/
height
;
}
/* Update viewport, re-init textures */
glViewport
(
0
,
0
,
width
,
height
);
[
self
initTextures
];
/* Redraw the last picture */
[
self
setNeedsDisplay
:
YES
];
isFullScreen
=
1
;
}
-
(
void
)
exitFullScreen
{
/* Free current OpenGL context */
[
NSOpenGLContext
clearCurrentContext
];
[
fullScreenContext
clearDrawable
];
[
fullScreenContext
release
];
CGReleaseAllDisplays
();
currentContext
=
[
self
openGLContext
];
[
self
initTextures
];
[
self
reshape
];
/* Redraw the last picture */
[
self
setNeedsDisplay
:
YES
];
isFullScreen
=
0
;
}
-
(
void
)
cleanUp
{
if
(
isFullScreen
)
{
[
self
exitFullScreen
];
}
initDone
=
0
;
}
-
(
void
)
drawQuad
...
...
@@ -1639,7 +1686,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
/* Black background */
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
if
(
!
b_init_d
one
)
if
(
!
initD
one
)
{
[
currentContext
flushBuffer
];
return
;
...
...
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