Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
5d041ddd
Commit
5d041ddd
authored
Jul 20, 2004
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* glx.c: don't scale the image with the chroma (supposed to speed up
the conversion ??)
parent
d6cb888b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
44 deletions
+66
-44
modules/video_output/x11/glx.c
modules/video_output/x11/glx.c
+66
-44
No files found.
modules/video_output/x11/glx.c
View file @
5d041ddd
...
@@ -57,8 +57,6 @@ static void SwitchContext( vout_thread_t *p_vout );
...
@@ -57,8 +57,6 @@ static void SwitchContext( vout_thread_t *p_vout );
static
inline
int
GetAlignedSize
(
int
i_size
);
static
inline
int
GetAlignedSize
(
int
i_size
);
#define MAX_TEXTURE_SIZE 512
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
*****************************************************************************/
*****************************************************************************/
...
@@ -80,6 +78,9 @@ struct vout_sys_t
...
@@ -80,6 +78,9 @@ struct vout_sys_t
uint8_t
*
p_buffer
;
uint8_t
*
p_buffer
;
int
i_index
;
int
i_index
;
int
i_tex_width
;
int
i_tex_height
;
int
i_width
;
int
i_width
;
int
i_height
;
int
i_height
;
int
b_fullscreen
;
int
b_fullscreen
;
...
@@ -124,7 +125,7 @@ static int Create( vlc_object_t *p_this )
...
@@ -124,7 +125,7 @@ static int Create( vlc_object_t *p_this )
msg_Err
(
p_vout
,
"out of memory"
);
msg_Err
(
p_vout
,
"out of memory"
);
return
(
1
);
return
(
1
);
}
}
//XXX set to 0 to disable the cube effect
//XXX set to 0 to disable the cube effect
p_vout
->
p_sys
->
i_effect
=
1
;
p_vout
->
p_sys
->
i_effect
=
1
;
...
@@ -132,16 +133,14 @@ static int Create( vlc_object_t *p_this )
...
@@ -132,16 +133,14 @@ static int Create( vlc_object_t *p_this )
p_vout->p_sys->i_height = p_vout->i_window_height; */
p_vout->p_sys->i_height = p_vout->i_window_height; */
p_vout
->
p_sys
->
i_width
=
700
;
p_vout
->
p_sys
->
i_width
=
700
;
p_vout
->
p_sys
->
i_height
=
700
;
p_vout
->
p_sys
->
i_height
=
700
;
p_vout
->
p_sys
->
b_fullscreen
=
0
;
p_vout
->
p_sys
->
b_fullscreen
=
0
;
/* 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_vout
->
output
.
i_width
=
GetAlignedSize
(
p_vout
->
render
.
i_width
);
p_vout
->
p_sys
->
i_tex_width
=
GetAlignedSize
(
p_vout
->
render
.
i_width
);
p_vout
->
output
.
i_height
=
GetAlignedSize
(
p_vout
->
render
.
i_height
);
p_vout
->
p_sys
->
i_tex_height
=
GetAlignedSize
(
p_vout
->
render
.
i_height
);
p_vout
->
output
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
msg_Dbg
(
p_vout
,
"Texture size: %dx%d"
,
p_vout
->
output
.
i
_width
,
msg_Dbg
(
p_vout
,
"Texture size: %dx%d"
,
p_vout
->
p_sys
->
i_tex
_width
,
p_vout
->
output
.
i
_height
);
p_vout
->
p_sys
->
i_tex
_height
);
/* Open and initialize device */
/* Open and initialize device */
if
(
OpenDisplay
(
p_vout
)
)
if
(
OpenDisplay
(
p_vout
)
)
...
@@ -174,6 +173,10 @@ static int Init( vout_thread_t *p_vout )
...
@@ -174,6 +173,10 @@ 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
;
p_vout
->
output
.
i_width
=
p_vout
->
render
.
i_width
;
p_vout
->
output
.
i_height
=
p_vout
->
render
.
i_height
;
p_vout
->
output
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
I_OUTPUTPICTURES
=
0
;
I_OUTPUTPICTURES
=
0
;
p_pic
=
NULL
;
p_pic
=
NULL
;
...
@@ -197,9 +200,13 @@ static int Init( vout_thread_t *p_vout )
...
@@ -197,9 +200,13 @@ static int Init( vout_thread_t *p_vout )
* directly by the decoder */
* directly by the decoder */
p_pic
->
i_planes
=
1
;
p_pic
->
i_planes
=
1
;
p_pic
->
p
->
p_pixels
=
p_vout
->
p_sys
->
p_buffer
;
p_pic
->
p
->
p_pixels
=
p_vout
->
p_sys
->
p_buffer
+
2
*
p_vout
->
p_sys
->
i_tex_width
*
(
p_vout
->
p_sys
->
i_tex_height
-
p_vout
->
output
.
i_height
)
+
2
*
(
p_vout
->
p_sys
->
i_tex_width
-
p_vout
->
output
.
i_width
);
p_pic
->
p
->
i_lines
=
p_vout
->
output
.
i_height
;
p_pic
->
p
->
i_lines
=
p_vout
->
output
.
i_height
;
p_pic
->
p
->
i_pitch
=
p_vout
->
output
.
i
_width
*
4
;
p_pic
->
p
->
i_pitch
=
p_vout
->
p_sys
->
i_tex
_width
*
4
;
p_pic
->
p
->
i_pixel_pitch
=
4
;
p_pic
->
p
->
i_pixel_pitch
=
4
;
p_pic
->
p
->
i_visible_pitch
=
p_vout
->
output
.
i_width
*
4
;
p_pic
->
p
->
i_visible_pitch
=
p_vout
->
output
.
i_width
*
4
;
...
@@ -311,8 +318,11 @@ static int Manage( vout_thread_t *p_vout )
...
@@ -311,8 +318,11 @@ static int Manage( vout_thread_t *p_vout )
static
void
Render
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
)
static
void
Render
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
)
{
{
glClear
(
GL_COLOR_BUFFER_BIT
);
glClear
(
GL_COLOR_BUFFER_BIT
);
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
3
,
p_vout
->
output
.
i_width
,
/*
glTexImage2D (GL_TEXTURE_2D, 0, 3, p_vout->output.i_width,
p_vout->output.i_height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
p_vout->output.i_height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
p_vout->p_sys->p_buffer);*/
glTexImage2D
(
GL_TEXTURE_2D
,
0
,
3
,
p_vout
->
p_sys
->
i_tex_width
,
p_vout
->
p_sys
->
i_tex_height
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
p_vout
->
p_sys
->
p_buffer
);
p_vout
->
p_sys
->
p_buffer
);
if
(
!
p_vout
->
p_sys
->
i_effect
)
if
(
!
p_vout
->
p_sys
->
i_effect
)
...
@@ -327,74 +337,86 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
...
@@ -327,74 +337,86 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
}
}
else
else
{
{
glRotatef
(
2
.
0
,
3
.
3
,
1
.
5
,
2
.
7
);
glRotatef
(
1
.
0
,
0
.
3
,
0
.
5
,
0
.
7
);
glEnable
(
GL_TEXTURE_2D
);
glEnable
(
GL_TEXTURE_2D
);
glBegin
(
GL_QUADS
);
glBegin
(
GL_QUADS
);
float
f_width
=
p_vout
->
output
.
i_width
;
float
f_height
=
p_vout
->
output
.
i_height
;
/* Correct the aspect ratio */
/* float f_aspect = (float)p_vout->output.i_aspect / VOUT_ASPECT_FACTOR;
if( f_aspect > 1.0 )
{
f_height *= f_aspect;
}
else
{
f_width *= f_aspect;
}*/
float
f_offset_x
=
(
1
.
0
-
f_width
/
p_vout
->
p_sys
->
i_tex_width
)
/
2
.
0
;
float
f_offset_y
=
(
1
.
0
-
f_height
/
p_vout
->
p_sys
->
i_tex_height
)
/
2
.
0
;
/* Front */
/* Front */
glTexCoord2f
(
0
.
0
,
0
.
0
);
glTexCoord2f
(
f_offset_x
,
f_offset_y
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
1
.
0
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
1
.
0
);
glTexCoord2f
(
0
.
0
,
1
.
0
);
glTexCoord2f
(
f_offset_x
,
1
.
0
-
f_offset_y
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
1
.
0
);
glTexCoord2f
(
1
.
0
,
glTexCoord2f
(
1
.
0
-
f_offset_x
,
1
.
0
-
f_offset_y
);
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
1
.
0
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glTexCoord2f
(
1
.
0
-
f_offset_x
,
f_offset_y
);
glVertex3f
(
1
.
0
,
1
.
0
,
1
.
0
);
glVertex3f
(
1
.
0
,
1
.
0
,
1
.
0
);
/* Left */
/* Left */
glTexCoord2f
(
0
.
0
,
0
.
0
);
glTexCoord2f
(
f_offset_x
,
f_offset_y
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
-
1
.
0
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
0
.
0
,
1
.
0
);
glTexCoord2f
(
f_offset_x
,
1
.
0
-
f_offset_y
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
1
.
0
,
glTexCoord2f
(
1
.
0
-
f_offset_x
,
1
.
0
-
f_offset_y
);
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
1
.
0
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glTexCoord2f
(
1
.
0
-
f_offset_x
,
f_offset_y
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
1
.
0
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
1
.
0
);
/* Back */
/* Back */
glTexCoord2f
(
0
.
0
,
0
.
0
);
glTexCoord2f
(
f_offset_x
,
f_offset_y
);
glVertex3f
(
1
.
0
,
1
.
0
,
-
1
.
0
);
glVertex3f
(
1
.
0
,
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
0
.
0
,
1
.
0
);
glTexCoord2f
(
f_offset_x
,
1
.
0
-
f_offset_y
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
1
.
0
,
glTexCoord2f
(
1
.
0
-
f_offset_x
,
1
.
0
-
f_offset_y
);
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glTexCoord2f
(
1
.
0
-
f_offset_x
,
f_offset_y
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
-
1
.
0
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
-
1
.
0
);
/* Right */
/* Right */
glTexCoord2f
(
0
.
0
,
0
.
0
);
glTexCoord2f
(
f_offset_x
,
f_offset_y
);
glVertex3f
(
1
.
0
,
1
.
0
,
1
.
0
);
glVertex3f
(
1
.
0
,
1
.
0
,
1
.
0
);
glTexCoord2f
(
0
.
0
,
1
.
0
);
glTexCoord2f
(
f_offset_x
,
1
.
0
-
f_offset_y
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
1
.
0
);
glTexCoord2f
(
1
.
0
,
glTexCoord2f
(
1
.
0
-
f_offset_x
,
1
.
0
-
f_offset_y
);
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glTexCoord2f
(
1
.
0
-
f_offset_x
,
f_offset_y
);
glVertex3f
(
1
.
0
,
1
.
0
,
-
1
.
0
);
glVertex3f
(
1
.
0
,
1
.
0
,
-
1
.
0
);
/* Top */
/* Top */
glTexCoord2f
(
0
.
0
,
0
.
0
);
glTexCoord2f
(
f_offset_x
,
f_offset_y
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
-
1
.
0
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
0
.
0
,
1
.
0
);
glTexCoord2f
(
f_offset_x
,
1
.
0
-
f_offset_y
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
1
.
0
);
glVertex3f
(
-
1
.
0
,
1
.
0
,
1
.
0
);
glTexCoord2f
(
1
.
0
,
glTexCoord2f
(
1
.
0
-
f_offset_x
,
1
.
0
-
f_offset_y
);
1
.
0
);
glVertex3f
(
1
.
0
,
1
.
0
,
1
.
0
);
glVertex3f
(
1
.
0
,
1
.
0
,
1
.
0
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glTexCoord2f
(
1
.
0
-
f_offset_x
,
f_offset_y
);
glVertex3f
(
1
.
0
,
1
.
0
,
-
1
.
0
);
glVertex3f
(
1
.
0
,
1
.
0
,
-
1
.
0
);
/* Bottom */
/* Bottom */
glTexCoord2f
(
0
.
0
,
0
.
0
);
glTexCoord2f
(
f_offset_x
,
f_offset_y
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
1
.
0
);
glTexCoord2f
(
0
.
0
,
1
.
0
);
glTexCoord2f
(
f_offset_x
,
1
.
0
-
f_offset_y
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glVertex3f
(
-
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
1
.
0
,
glTexCoord2f
(
1
.
0
-
f_offset_x
,
1
.
0
-
f_offset_y
);
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
-
1
.
0
);
glTexCoord2f
(
1
.
0
,
0
.
0
);
glTexCoord2f
(
1
.
0
-
f_offset_x
,
f_offset_y
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
1
.
0
);
glVertex3f
(
1
.
0
,
-
1
.
0
,
1
.
0
);
glEnd
();
glEnd
();
}
}
...
@@ -486,7 +508,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
...
@@ -486,7 +508,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
/* Allocate the texture buffer */
/* Allocate the texture buffer */
p_vout
->
p_sys
->
p_buffer
=
p_vout
->
p_sys
->
p_buffer
=
malloc
(
p_vout
->
output
.
i_width
*
p_vout
->
output
.
i
_height
*
4
);
malloc
(
p_vout
->
p_sys
->
i_tex_width
*
p_vout
->
p_sys
->
i_tex
_height
*
4
);
if
(
!
p_vout
->
p_sys
->
p_buffer
)
if
(
!
p_vout
->
p_sys
->
p_buffer
)
{
{
msg_Err
(
p_vout
,
"Out of memory"
);
msg_Err
(
p_vout
,
"Out of memory"
);
...
...
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