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
117ebd7e
Commit
117ebd7e
authored
Jan 04, 2008
by
Faustino Osuna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
video_output/opengllayer.m: Revert backbuffer resizing & code cleanup.
parent
3772bb95
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
45 deletions
+38
-45
modules/video_output/opengllayer.m
modules/video_output/opengllayer.m
+38
-45
No files found.
modules/video_output/opengllayer.m
View file @
117ebd7e
...
@@ -238,7 +238,7 @@ static void End( vout_thread_t *p_vout )
...
@@ -238,7 +238,7 @@ static void End( vout_thread_t *p_vout )
{
{
vout_sys_t
*
p_sys
=
p_vout
->
p_sys
;
vout_sys_t
*
p_sys
=
p_vout
->
p_sys
;
p_vout
->
p_sys
->
b_frame_available
=
0
;
p_vout
->
p_sys
->
b_frame_available
=
VLC_FALSE
;
[
CATransaction
performSelectorOnMainThread
:
@selector
(
begin
)
[
CATransaction
performSelectorOnMainThread
:
@selector
(
begin
)
withObject:
nil
waitUntilDone
:
YES
];
withObject:
nil
waitUntilDone
:
YES
];
...
@@ -253,8 +253,8 @@ static void End( vout_thread_t *p_vout )
...
@@ -253,8 +253,8 @@ static void End( vout_thread_t *p_vout )
[
p_sys
->
autorealease_pool
release
];
[
p_sys
->
autorealease_pool
release
];
/* Free the texture buffer*/
/* Free the texture buffer*/
if
(
p_sys
->
pp_buffer
[
0
]
)
free
(
p_sys
->
pp_buffer
[
0
]
);
free
(
p_sys
->
pp_buffer
[
0
]
);
if
(
p_sys
->
pp_buffer
[
1
]
)
free
(
p_sys
->
pp_buffer
[
1
]
);
free
(
p_sys
->
pp_buffer
[
1
]
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -296,7 +296,6 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -296,7 +296,6 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
/* Give a buffer where the image will be rendered */
/* Give a buffer where the image will be rendered */
p_pic
->
p
->
p_pixels
=
p_sys
->
pp_buffer
[
p_new_index
];
p_pic
->
p
->
p_pixels
=
p_sys
->
pp_buffer
[
p_new_index
];
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -312,7 +311,7 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -312,7 +311,7 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
p_sys
->
i_index
=
(
p_sys
->
i_index
+
1
)
&
1
;
/* Indicate the layer should use that index */
p_sys
->
i_index
=
(
p_sys
->
i_index
+
1
)
&
1
;
/* Indicate the layer should use that index */
}
}
p_sys
->
b_frame_available
=
1
;
p_sys
->
b_frame_available
=
VLC_TRUE
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -394,7 +393,7 @@ static int InitTextures( vout_thread_t *p_vout )
...
@@ -394,7 +393,7 @@ static int InitTextures( vout_thread_t *p_vout )
+
(
void
)
autoinitInVout
:(
NSValue
*
)
arg
+
(
void
)
autoinitInVout
:(
NSValue
*
)
arg
{
{
vout_thread_t
*
p_vout
=
[
arg
pointerValue
];
vout_thread_t
*
p_vout
=
[
arg
pointerValue
];
p_vout
->
p_sys
->
o_layer
=
[[
VLCVoutLayer
layerWithVout
:
p_vout
]
retain
];
p_vout
->
p_sys
->
o_layer
=
[[
VLCVoutLayer
layerWithVout
:
p_vout
]
retain
];
[
p_vout
->
p_sys
->
o_cocoa_container
addVoutLayer
:
p_vout
->
p_sys
->
o_layer
];
[
p_vout
->
p_sys
->
o_cocoa_container
addVoutLayer
:
p_vout
->
p_sys
->
o_layer
];
}
}
...
@@ -419,10 +418,8 @@ static int InitTextures( vout_thread_t *p_vout )
...
@@ -419,10 +418,8 @@ static int InitTextures( vout_thread_t *p_vout )
-
(
BOOL
)
canDrawInCGLContext
:(
CGLContextObj
)
glContext
pixelFormat
:(
CGLPixelFormatObj
)
pixelFormat
forLayerTime
:(
CFTimeInterval
)
timeInterval
displayTime
:(
const
CVTimeStamp
*
)
timeStamp
-
(
BOOL
)
canDrawInCGLContext
:(
CGLContextObj
)
glContext
pixelFormat
:(
CGLPixelFormatObj
)
pixelFormat
forLayerTime
:(
CFTimeInterval
)
timeInterval
displayTime
:(
const
CVTimeStamp
*
)
timeStamp
{
{
/* Only draw the frame when if have a frame that was previously rendered */
/* Only draw the frame if we have a frame that was previously rendered */
BOOL
ret
=
p_vout
->
p_sys
->
b_frame_available
;
return
p_vout
->
p_sys
->
b_frame_available
;
// Flag is cleared by drawInCGLContext:pixelFormat:forLayerTime:displayTime:
p_vout
->
p_sys
->
b_frame_available
=
VLC_FALSE
;
return
ret
;
}
}
-
(
void
)
drawInCGLContext
:(
CGLContextObj
)
glContext
pixelFormat
:(
CGLPixelFormatObj
)
pixelFormat
forLayerTime
:(
CFTimeInterval
)
timeInterval
displayTime
:(
const
CVTimeStamp
*
)
timeStamp
-
(
void
)
drawInCGLContext
:(
CGLContextObj
)
glContext
pixelFormat
:(
CGLPixelFormatObj
)
pixelFormat
forLayerTime
:(
CFTimeInterval
)
timeInterval
displayTime
:(
const
CVTimeStamp
*
)
timeStamp
...
@@ -449,7 +446,6 @@ static int InitTextures( vout_thread_t *p_vout )
...
@@ -449,7 +446,6 @@ static int InitTextures( vout_thread_t *p_vout )
p_vout
->
fmt_out
.
i_height
,
p_vout
->
fmt_out
.
i_height
,
VLCGL_FORMAT
,
VLCGL_TYPE
,
p_vout
->
p_sys
->
pp_buffer
[
p_vout
->
p_sys
->
i_index
]
);
VLCGL_FORMAT
,
VLCGL_TYPE
,
p_vout
->
p_sys
->
pp_buffer
[
p_vout
->
p_sys
->
i_index
]
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glEnable
(
VLCGL_TARGET
);
glEnable
(
VLCGL_TARGET
);
...
@@ -466,34 +462,38 @@ static int InitTextures( vout_thread_t *p_vout )
...
@@ -466,34 +462,38 @@ static int InitTextures( vout_thread_t *p_vout )
}
}
CGLUnlockContext
(
glContext
);
CGLUnlockContext
(
glContext
);
p_vout
->
p_sys
->
b_frame_available
=
VLC_FALSE
;
p_vout
->
p_sys
->
b_frame_available
=
VLC_FALSE
;
}
}
-
(
CGLPixelFormatObj
)
copyCGLPixelFormatForDisplayMask
:(
uint32_t
)
mask
//
- (CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask
{
//
{
GLuint
attribs
[]
=
//
GLuint attribs[] =
{
//
{
NSOpenGLPFANoRecovery
,
//
NSOpenGLPFANoRecovery,
NSOpenGLPFAWindow
,
//
NSOpenGLPFAWindow,
NSOpenGLPFAAccelerated
,
//
NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer
,
//
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorSize
,
24
,
//
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAAlphaSize
,
8
,
//
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADepthSize
,
24
,
//
NSOpenGLPFADepthSize, 24,
NSOpenGLPFAStencilSize
,
8
,
//
NSOpenGLPFAStencilSize, 8,
NSOpenGLPFAAccumSize
,
0
,
//
NSOpenGLPFAAccumSize, 0,
0
//
0
};
//
};
//
NSOpenGLPixelFormat
*
fmt
=
[[
NSOpenGLPixelFormat
alloc
]
initWithAttributes
:
(
NSOpenGLPixelFormatAttribute
*
)
attribs
];
//
NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs];
//
return
[
super
copyCGLPixelFormatForDisplayMask
:
mask
];
//
[fmt CGLPixelFormatObj];
// return
[fmt CGLPixelFormatObj];
}
//
}
-
(
CGLContextObj
)
copyCGLContextForPixelFormat
:(
CGLPixelFormatObj
)
pixelFormat
-
(
CGLContextObj
)
copyCGLContextForPixelFormat
:(
CGLPixelFormatObj
)
pixelFormat
{
{
CGLContextObj
context
=
[
super
copyCGLContextForPixelFormat
:
pixelFormat
];
CGLContextObj
context
=
[
super
copyCGLContextForPixelFormat
:
pixelFormat
];
CGLLockContext
(
context
);
CGLSetCurrentContext
(
context
);
/* Swap buffers only during the vertical retrace of the monitor.
/* Swap buffers only during the vertical retrace of the monitor.
http://developer.apple.com/documentation/GraphicsImaging/
http://developer.apple.com/documentation/GraphicsImaging/
...
@@ -503,22 +503,16 @@ static int InitTextures( vout_thread_t *p_vout )
...
@@ -503,22 +503,16 @@ static int InitTextures( vout_thread_t *p_vout )
CGLSetParameter
(
CGLGetCurrentContext
(),
kCGLCPSwapInterval
,
CGLSetParameter
(
CGLGetCurrentContext
(),
kCGLCPSwapInterval
,
&
params
);
&
params
);
/* Make sure our texture will gets drawn at the right resolution */
GLint
dim
[
2
]
=
{
p_vout
->
p_sys
->
i_tex_width
,
p_vout
->
p_sys
->
i_tex_height
};
NSLog
(
@"asking for %dx%d"
,
p_vout
->
p_sys
->
i_tex_width
,
p_vout
->
p_sys
->
i_tex_height
);
CGLSetParameter
(
context
,
kCGLCPSurfaceBackingSize
,
dim
);
CGLEnable
(
context
,
kCGLCESurfaceBackingSize
);
CGLSetCurrentContext
(
context
);
InitTextures
(
p_vout
);
InitTextures
(
p_vout
);
glDisable
(
GL_BLEND
);
glDisable
(
GL_BLEND
);
glDisable
(
GL_DEPTH_TEST
);
glDisable
(
GL_DEPTH_TEST
);
glDepthMask
(
GL_FALSE
);
glDepthMask
(
GL_FALSE
);
glDisable
(
GL_CULL_FACE
)
;
glDisable
(
GL_CULL_FACE
)
;
glClearColor
(
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
glClearColor
(
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
);
CGLUnlockContext
(
context
);
return
context
;
return
context
;
}
}
...
@@ -531,5 +525,4 @@ static int InitTextures( vout_thread_t *p_vout )
...
@@ -531,5 +525,4 @@ static int InitTextures( vout_thread_t *p_vout )
CGLUnlockContext
(
glContext
);
CGLUnlockContext
(
glContext
);
}
}
@end
@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