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
6ab18a50
Commit
6ab18a50
authored
Oct 23, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/video_output/opengl.c: implemented cropping.
parent
d8ac16fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
25 deletions
+37
-25
modules/video_output/opengl.c
modules/video_output/opengl.c
+37
-25
No files found.
modules/video_output/opengl.c
View file @
6ab18a50
...
@@ -64,9 +64,21 @@
...
@@ -64,9 +64,21 @@
#define VLCGL_RGB_FORMAT GL_RGBA
#define VLCGL_RGB_FORMAT GL_RGBA
#define VLCGL_RGB_TYPE GL_UNSIGNED_BYTE
#define VLCGL_RGB_TYPE GL_UNSIGNED_BYTE
/* YUY2 */
#ifndef YCBCR_MESA
#define YCBCR_MESA 0x8757
#endif
#ifndef UNSIGNED_SHORT_8_8_MESA
#define UNSIGNED_SHORT_8_8_MESA 0x85BA
#endif
#define VLCGL_YUV_FORMAT YCBCR_MESA
#define VLCGL_YUV_TYPE UNSIGNED_SHORT_8_8_MESA
/* Use RGB on Win32/GLX */
/* Use RGB on Win32/GLX */
#define VLCGL_FORMAT VLCGL_RGB_FORMAT
#define VLCGL_FORMAT VLCGL_RGB_FORMAT
#define VLCGL_TYPE VLCGL_RGB_TYPE
#define VLCGL_TYPE VLCGL_RGB_TYPE
//#define VLCGL_FORMAT VLCGL_YUV_FORMAT
//#define VLCGL_TYPE VLCGL_YUV_TYPE
#endif
#endif
#ifndef GL_CLAMP_TO_EDGE
#ifndef GL_CLAMP_TO_EDGE
...
@@ -176,12 +188,12 @@ static int CreateVout( vlc_object_t *p_this )
...
@@ -176,12 +188,12 @@ static int CreateVout( vlc_object_t *p_this )
p_sys
->
i_index
=
0
;
p_sys
->
i_index
=
0
;
#ifdef SYS_DARWIN
#ifdef SYS_DARWIN
p_sys
->
i_tex_width
=
p_vout
->
render
.
i
_width
;
p_sys
->
i_tex_width
=
p_vout
->
fmt_in
.
i_visible
_width
;
p_sys
->
i_tex_height
=
p_vout
->
render
.
i
_height
;
p_sys
->
i_tex_height
=
p_vout
->
fmt_in
.
i_visible
_height
;
#else
#else
/* A texture must have a size aligned on a power of 2 */
/* A texture must have a size aligned on a power of 2 */
p_sys
->
i_tex_width
=
GetAlignedSize
(
p_vout
->
render
.
i
_width
);
p_sys
->
i_tex_width
=
GetAlignedSize
(
p_vout
->
fmt_in
.
i_visible
_width
);
p_sys
->
i_tex_height
=
GetAlignedSize
(
p_vout
->
render
.
i
_height
);
p_sys
->
i_tex_height
=
GetAlignedSize
(
p_vout
->
fmt_in
.
i_visible
_height
);
#endif
#endif
msg_Dbg
(
p_vout
,
"Texture size: %dx%d"
,
p_sys
->
i_tex_width
,
msg_Dbg
(
p_vout
,
"Texture size: %dx%d"
,
p_sys
->
i_tex_width
,
...
@@ -203,6 +215,8 @@ static int CreateVout( vlc_object_t *p_this )
...
@@ -203,6 +215,8 @@ static int CreateVout( vlc_object_t *p_this )
p_sys
->
p_vout
->
render
.
i_width
=
p_vout
->
render
.
i_width
;
p_sys
->
p_vout
->
render
.
i_width
=
p_vout
->
render
.
i_width
;
p_sys
->
p_vout
->
render
.
i_height
=
p_vout
->
render
.
i_height
;
p_sys
->
p_vout
->
render
.
i_height
=
p_vout
->
render
.
i_height
;
p_sys
->
p_vout
->
render
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
p_sys
->
p_vout
->
render
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
p_sys
->
p_vout
->
fmt_render
=
p_vout
->
fmt_render
;
p_sys
->
p_vout
->
fmt_in
=
p_vout
->
fmt_in
;
p_sys
->
p_vout
->
b_scale
=
p_vout
->
b_scale
;
p_sys
->
p_vout
->
b_scale
=
p_vout
->
b_scale
;
p_sys
->
p_vout
->
i_alignment
=
p_vout
->
i_alignment
;
p_sys
->
p_vout
->
i_alignment
=
p_vout
->
i_alignment
;
...
@@ -254,15 +268,12 @@ static int Init( vout_thread_t *p_vout )
...
@@ -254,15 +268,12 @@ static int Init( vout_thread_t *p_vout )
p_sys
->
p_vout
->
pf_init
(
p_sys
->
p_vout
);
p_sys
->
p_vout
->
pf_init
(
p_sys
->
p_vout
);
#if
def SYS_DARWIN
#if
defined( SYS_DARWIN ) || (VLCGL_FORMAT == YCBCR_MESA)
p_vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
);
p_vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'Y'
,
'U'
,
'Y'
,
'2'
);
p_vout
->
output
.
i_rmask
=
0x00ff0000
;
p_vout
->
output
.
i_gmask
=
0x0000ff00
;
p_vout
->
output
.
i_bmask
=
0x000000ff
;
i_pixel_pitch
=
2
;
i_pixel_pitch
=
2
;
#else
#
if VLCGL_RGB
_FORMAT == GL_RGB
#
elif VLCGL
_FORMAT == GL_RGB
# if VLCGL_
RGB_
TYPE == GL_UNSIGNED_BYTE
# if VLCGL_TYPE == GL_UNSIGNED_BYTE
p_vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
);
p_vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
);
p_vout
->
output
.
i_rmask
=
0x000000ff
;
p_vout
->
output
.
i_rmask
=
0x000000ff
;
p_vout
->
output
.
i_gmask
=
0x0000ff00
;
p_vout
->
output
.
i_gmask
=
0x0000ff00
;
...
@@ -281,7 +292,6 @@ static int Init( vout_thread_t *p_vout )
...
@@ -281,7 +292,6 @@ static int Init( vout_thread_t *p_vout )
p_vout
->
output
.
i_gmask
=
0x0000ff00
;
p_vout
->
output
.
i_gmask
=
0x0000ff00
;
p_vout
->
output
.
i_bmask
=
0x00ff0000
;
p_vout
->
output
.
i_bmask
=
0x00ff0000
;
i_pixel_pitch
=
4
;
i_pixel_pitch
=
4
;
#endif
#endif
#endif
/* Since OpenGL can do rescaling for us, stick to the default
/* Since OpenGL can do rescaling for us, stick to the default
...
@@ -290,6 +300,9 @@ static int Init( vout_thread_t *p_vout )
...
@@ -290,6 +300,9 @@ static int Init( vout_thread_t *p_vout )
p_vout
->
output
.
i_height
=
p_vout
->
render
.
i_height
;
p_vout
->
output
.
i_height
=
p_vout
->
render
.
i_height
;
p_vout
->
output
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
p_vout
->
output
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
p_vout
->
fmt_out
=
p_vout
->
fmt_in
;
p_vout
->
fmt_out
.
i_chroma
=
p_vout
->
output
.
i_chroma
;
/* We know the chroma, allocate one buffer which will be used
/* We know the chroma, allocate one buffer which will be used
* directly by the decoder */
* directly by the decoder */
p_sys
->
pp_buffer
[
0
]
=
p_sys
->
pp_buffer
[
0
]
=
...
@@ -536,9 +549,11 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -536,9 +549,11 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
/* Update the texture */
/* Update the texture */
glBindTexture
(
VLCGL_TARGET
,
p_sys
->
p_textures
[
i_new_index
]
);
glBindTexture
(
VLCGL_TARGET
,
p_sys
->
p_textures
[
i_new_index
]
);
glTexSubImage2D
(
VLCGL_TARGET
,
0
,
0
,
0
,
p_sys
->
i_tex_width
,
glTexSubImage2D
(
VLCGL_TARGET
,
0
,
p_sys
->
i_tex_height
,
VLCGL_FORMAT
,
VLCGL_TYPE
,
p_vout
->
fmt_out
.
i_x_offset
,
p_vout
->
fmt_out
.
i_y_offset
,
p_sys
->
pp_buffer
[
i_new_index
]
);
p_vout
->
fmt_out
.
i_visible_width
,
p_vout
->
fmt_out
.
i_visible_height
,
VLCGL_FORMAT
,
VLCGL_TYPE
,
p_sys
->
pp_buffer
[
i_new_index
]
);
/* Bind to the previous texture for drawing */
/* Bind to the previous texture for drawing */
glBindTexture
(
VLCGL_TARGET
,
p_sys
->
p_textures
[
p_sys
->
i_index
]
);
glBindTexture
(
VLCGL_TARGET
,
p_sys
->
p_textures
[
p_sys
->
i_index
]
);
...
@@ -549,9 +564,11 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -549,9 +564,11 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
#else
#else
/* Update the texture */
/* Update the texture */
glTexSubImage2D
(
GL_TEXTURE_2D
,
0
,
0
,
0
,
glTexSubImage2D
(
GL_TEXTURE_2D
,
0
,
p_vout
->
render
.
i_width
,
p_vout
->
render
.
i_height
,
p_vout
->
fmt_out
.
i_x_offset
,
p_vout
->
fmt_out
.
i_y_offset
,
VLCGL_RGB_FORMAT
,
VLCGL_RGB_TYPE
,
p_sys
->
pp_buffer
[
0
]
);
p_vout
->
fmt_out
.
i_visible_width
,
p_vout
->
fmt_out
.
i_visible_height
,
VLCGL_FORMAT
,
VLCGL_TYPE
,
p_sys
->
pp_buffer
[
0
]
);
#endif
#endif
if
(
p_sys
->
p_vout
->
pf_unlock
)
if
(
p_sys
->
p_vout
->
pf_unlock
)
...
@@ -577,13 +594,8 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -577,13 +594,8 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
/* glTexCoord works differently with GL_TEXTURE_2D and
/* glTexCoord works differently with GL_TEXTURE_2D and
GL_TEXTURE_RECTANGLE_EXT */
GL_TEXTURE_RECTANGLE_EXT */
#ifdef SYS_DARWIN
f_width
=
(
float
)
p_vout
->
fmt_out
.
i_visible_width
/
p_sys
->
i_tex_width
;
f_width
=
(
float
)
p_vout
->
output
.
i_width
;
f_height
=
(
float
)
p_vout
->
fmt_out
.
i_visible_height
/
p_sys
->
i_tex_height
;
f_height
=
(
float
)
p_vout
->
output
.
i_height
;
#else
f_width
=
(
float
)
p_vout
->
output
.
i_width
/
p_sys
->
i_tex_width
;
f_height
=
(
float
)
p_vout
->
output
.
i_height
/
p_sys
->
i_tex_height
;
#endif
/* Why drawing here and not in Render()? Because this way, the
/* Why drawing here and not in Render()? Because this way, the
OpenGL providers can call pf_display to force redraw. Currently,
OpenGL providers can call pf_display to force redraw. Currently,
...
...
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