Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
d882b56e
Commit
d882b56e
authored
May 18, 2011
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
screen: added error handling to prevent this module from failing silently
parent
921123fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
46 deletions
+78
-46
modules/access/screen/mac.c
modules/access/screen/mac.c
+78
-46
No files found.
modules/access/screen/mac.c
View file @
d882b56e
...
@@ -87,6 +87,8 @@ int screen_InitCapture( demux_t *p_demux )
...
@@ -87,6 +87,8 @@ int screen_InitCapture( demux_t *p_demux )
CGLPixelFormatObj
pix
;
CGLPixelFormatObj
pix
;
GLint
npix
;
GLint
npix
;
GLint
viewport
[
4
];
GLint
viewport
[
4
];
GLuint
displayMask
;
CGLError
returnedError
;
p_sys
->
p_data
=
p_data
=
p_sys
->
p_data
=
p_data
=
(
screen_data_t
*
)
malloc
(
sizeof
(
screen_data_t
)
);
(
screen_data_t
*
)
malloc
(
sizeof
(
screen_data_t
)
);
...
@@ -96,12 +98,25 @@ int screen_InitCapture( demux_t *p_demux )
...
@@ -96,12 +98,25 @@ int screen_InitCapture( demux_t *p_demux )
attribs
[
2
]
=
CGDisplayIDToOpenGLDisplayMask
(
CGMainDisplayID
()
);
attribs
[
2
]
=
CGDisplayIDToOpenGLDisplayMask
(
CGMainDisplayID
()
);
attribs
[
3
]
=
0
;
attribs
[
3
]
=
0
;
CGLChoosePixelFormat
(
attribs
,
&
pix
,
&
npix
);
returnedError
=
CGLChoosePixelFormat
(
attribs
,
&
pix
,
&
npix
);
CGLCreateContext
(
pix
,
NULL
,
&
(
p_data
->
screen
)
);
if
(
returnedError
)
CGLDestroyPixelFormat
(
pix
)
;
goto
errorHandling
;
CGLSetCurrentContext
(
p_data
->
screen
);
returnedError
=
CGLCreateContext
(
pix
,
NULL
,
&
(
p_data
->
screen
)
);
CGLSetFullScreen
(
p_data
->
screen
);
if
(
returnedError
)
goto
errorHandling
;
returnedError
=
CGLDestroyPixelFormat
(
pix
);
if
(
returnedError
)
goto
errorHandling
;
returnedError
=
CGLSetCurrentContext
(
p_data
->
screen
);
if
(
returnedError
)
goto
errorHandling
;
returnedError
=
CGLSetFullScreen
(
p_data
->
screen
);
if
(
returnedError
)
goto
errorHandling
;
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
...
@@ -124,15 +139,28 @@ int screen_InitCapture( demux_t *p_demux )
...
@@ -124,15 +139,28 @@ int screen_InitCapture( demux_t *p_demux )
attribs
[
2
]
=
32
;
attribs
[
2
]
=
32
;
attribs
[
3
]
=
0
;
attribs
[
3
]
=
0
;
CGLChoosePixelFormat
(
attribs
,
&
pix
,
&
npix
);
returnedError
=
CGLChoosePixelFormat
(
attribs
,
&
pix
,
&
npix
);
CGLCreateContext
(
pix
,
NULL
,
&
(
p_data
->
scaled
)
);
if
(
returnedError
)
CGLDestroyPixelFormat
(
pix
);
goto
errorHandling
;
returnedError
=
CGLCreateContext
(
pix
,
NULL
,
&
(
p_data
->
scaled
)
);
if
(
returnedError
)
goto
errorHandling
;
returnedError
=
CGLDestroyPixelFormat
(
pix
);
if
(
returnedError
)
goto
errorHandling
;
returnedError
=
CGLSetCurrentContext
(
p_data
->
scaled
);
if
(
returnedError
)
goto
errorHandling
;
CGLSetCurrentContext
(
p_data
->
scaled
);
p_data
->
scaled_image
=
(
char
*
)
malloc
(
p_data
->
dest_width
p_data
->
scaled_image
=
(
char
*
)
malloc
(
p_data
->
dest_width
*
p_data
->
dest_height
*
4
);
*
p_data
->
dest_height
*
4
);
CGLSetOffScreen
(
p_data
->
scaled
,
p_data
->
dest_width
,
p_data
->
dest_height
,
#warning FIXME: CGLSetOffScreen is no longer supported in the future!
p_data
->
dest_width
*
4
,
p_data
->
scaled_image
);
returnedError
=
CGLSetOffScreen
(
p_data
->
scaled
,
p_data
->
dest_width
,
p_data
->
dest_height
,
p_data
->
dest_width
*
4
,
p_data
->
scaled_image
);
if
(
returnedError
)
goto
errorHandling
;
es_format_Init
(
&
p_sys
->
fmt
,
VIDEO_ES
,
VLC_CODEC_RGB32
);
es_format_Init
(
&
p_sys
->
fmt
,
VIDEO_ES
,
VLC_CODEC_RGB32
);
...
@@ -164,6 +192,10 @@ int screen_InitCapture( demux_t *p_demux )
...
@@ -164,6 +192,10 @@ int screen_InitCapture( demux_t *p_demux )
CGSNewConnection
(
NULL
,
&
(
p_data
->
connection
)
);
CGSNewConnection
(
NULL
,
&
(
p_data
->
connection
)
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
errorHandling:
msg_Err
(
p_demux
,
"Core OpenGL failure: %s"
,
CGLErrorString
(
returnedError
)
);
return
VLC_EGENERIC
;
}
}
int
screen_CloseCapture
(
demux_t
*
p_demux
)
int
screen_CloseCapture
(
demux_t
*
p_demux
)
...
...
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