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
39f52871
Commit
39f52871
authored
Oct 12, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vout: add helpers for OpenGL context without video output
parent
9ad0b173
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
1 deletion
+112
-1
include/vlc_opengl.h
include/vlc_opengl.h
+7
-0
include/vlc_vout_window.h
include/vlc_vout_window.h
+1
-1
src/libvlccore.sym
src/libvlccore.sym
+3
-0
src/video_output/opengl.c
src/video_output/opengl.c
+101
-0
No files found.
include/vlc_opengl.h
View file @
39f52871
...
...
@@ -30,6 +30,7 @@
*/
struct
vout_window_t
;
struct
vout_window_cfg_t
;
/**
* A VLC GL context (and its underlying surface)
...
...
@@ -92,4 +93,10 @@ static inline void *vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)
return
(
gl
->
getProcAddress
!=
NULL
)
?
gl
->
getProcAddress
(
gl
,
name
)
:
NULL
;
}
VLC_API
vlc_gl_t
*
vlc_gl_surface_Create
(
vlc_object_t
*
,
const
struct
vout_window_cfg_t
*
,
struct
vout_window_t
**
)
VLC_USED
;
VLC_API
bool
vlc_gl_surface_CheckSize
(
vlc_gl_t
*
,
unsigned
*
w
,
unsigned
*
h
);
VLC_API
void
vlc_gl_surface_Destroy
(
vlc_gl_t
*
);
#endif
/* VLC_GL_H */
include/vlc_vout_window.h
View file @
39f52871
...
...
@@ -61,7 +61,7 @@ enum {
VOUT_WINDOW_SET_FULLSCREEN
,
/* int b_fullscreen */
};
typedef
struct
{
typedef
struct
vout_window_cfg_t
{
/* If true, a standalone window is requested */
bool
is_standalone
;
...
...
src/libvlccore.sym
View file @
39f52871
...
...
@@ -601,6 +601,9 @@ vlc_epg_SetCurrent
vlc_epg_Merge
vlc_gl_Create
vlc_gl_Destroy
vlc_gl_surface_Create
vlc_gl_surface_CheckSize
vlc_gl_surface_Destroy
vlm_Control
vlm_Delete
vlm_ExecuteCommand
...
...
src/video_output/opengl.c
View file @
39f52871
...
...
@@ -22,6 +22,9 @@
# include <config.h>
#endif
#include <assert.h>
#include <stdlib.h>
#include <vlc_common.h>
#include <vlc_opengl.h>
#include "libvlc.h"
...
...
@@ -80,3 +83,101 @@ void vlc_gl_Destroy(vlc_gl_t *gl)
module_unneed
(
gl
,
gl
->
module
);
vlc_object_release
(
gl
);
}
#include <vlc_vout_window.h>
typedef
struct
vlc_gl_surface
{
int
width
;
int
height
;
vlc_mutex_t
lock
;
}
vlc_gl_surface_t
;
static
void
vlc_gl_surface_ResizeNotify
(
vout_window_t
*
surface
,
unsigned
width
,
unsigned
height
)
{
vlc_gl_surface_t
*
sys
=
surface
->
owner
.
sys
;
msg_Dbg
(
surface
,
"resized to %ux%u"
,
width
,
height
);
vlc_mutex_lock
(
&
sys
->
lock
);
sys
->
width
=
width
;
sys
->
height
=
height
;
vlc_mutex_unlock
(
&
sys
->
lock
);
}
vlc_gl_t
*
vlc_gl_surface_Create
(
vlc_object_t
*
obj
,
const
vout_window_cfg_t
*
cfg
,
struct
vout_window_t
**
restrict
wp
)
{
vlc_gl_surface_t
*
sys
=
malloc
(
sizeof
(
*
sys
));
if
(
unlikely
(
sys
==
NULL
))
return
NULL
;
sys
->
width
=
cfg
->
width
;
sys
->
height
=
cfg
->
height
;
vlc_mutex_init
(
&
sys
->
lock
);
vout_window_owner_t
owner
=
{
.
sys
=
sys
,
.
resized
=
vlc_gl_surface_ResizeNotify
,
};
vout_window_t
*
surface
=
vout_window_New
(
obj
,
"$window"
,
cfg
,
&
owner
);
if
(
surface
==
NULL
)
goto
error
;
if
(
wp
!=
NULL
)
*
wp
=
surface
;
/* TODO: support ES? */
vlc_gl_t
*
gl
=
vlc_gl_Create
(
surface
,
VLC_OPENGL
,
"glx"
);
if
(
gl
==
NULL
)
{
vout_window_Delete
(
surface
);
goto
error
;
}
return
gl
;
error:
vlc_mutex_destroy
(
&
sys
->
lock
);
free
(
sys
);
return
NULL
;
}
/**
* Checks if the dimensions of the surface used by the OpenGL context have
* changed (since the previous call), and the OpenGL viewport should be
* updated.
* \return true if at least one dimension has changed, false otherwise
* \warning This function is intrinsically race-prone.
* The dimensions can change asynchronously.
*/
bool
vlc_gl_surface_CheckSize
(
vlc_gl_t
*
gl
,
unsigned
*
restrict
width
,
unsigned
*
restrict
height
)
{
vout_window_t
*
surface
=
gl
->
surface
;
vlc_gl_surface_t
*
sys
=
surface
->
owner
.
sys
;
bool
ret
=
false
;
vlc_mutex_lock
(
&
sys
->
lock
);
if
(
sys
->
width
>=
0
&&
sys
->
height
>=
0
)
{
*
width
=
sys
->
width
;
*
height
=
sys
->
height
;
sys
->
width
=
-
1
;
sys
->
height
=
-
1
;
ret
=
true
;
}
vlc_mutex_unlock
(
&
sys
->
lock
);
return
ret
;
}
void
vlc_gl_surface_Destroy
(
vlc_gl_t
*
gl
)
{
vout_window_t
*
surface
=
gl
->
surface
;
vlc_gl_surface_t
*
sys
=
surface
->
owner
.
sys
;
vlc_gl_Destroy
(
gl
);
vout_window_Delete
(
surface
);
vlc_mutex_destroy
(
&
sys
->
lock
);
free
(
sys
);
}
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