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
ad9613a7
Commit
ad9613a7
authored
Apr 16, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XCB: check/select pixmap format
parent
8e9bd644
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
22 deletions
+44
-22
modules/video_output/xcb/xcb.c
modules/video_output/xcb/xcb.c
+44
-22
No files found.
modules/video_output/xcb/xcb.c
View file @
ad9613a7
...
@@ -84,6 +84,7 @@ struct vout_sys_t
...
@@ -84,6 +84,7 @@ struct vout_sys_t
xcb_gcontext_t
gc
;
/* context to put images */
xcb_gcontext_t
gc
;
/* context to put images */
bool
shm
;
/* whether to use MIT-SHM */
bool
shm
;
/* whether to use MIT-SHM */
uint8_t
bpp
;
/* bits per pixel */
uint8_t
bpp
;
/* bits per pixel */
uint8_t
pad
;
/* scanline pad */
};
};
static
int
Init
(
vout_thread_t
*
);
static
int
Init
(
vout_thread_t
*
);
...
@@ -136,6 +137,8 @@ static int Open (vlc_object_t *obj)
...
@@ -136,6 +137,8 @@ static int Open (vlc_object_t *obj)
}
}
free
(
display
);
free
(
display
);
const
xcb_setup_t
*
setup
=
xcb_get_setup
(
p_sys
->
conn
);
/* Get the preferred screen */
/* Get the preferred screen */
xcb_screen_t
*
scr
=
xcb_aux_get_screen
(
p_sys
->
conn
,
snum
);
xcb_screen_t
*
scr
=
xcb_aux_get_screen
(
p_sys
->
conn
,
snum
);
p_sys
->
screen
=
scr
;
p_sys
->
screen
=
scr
;
...
@@ -165,43 +168,63 @@ static int Open (vlc_object_t *obj)
...
@@ -165,43 +168,63 @@ static int Open (vlc_object_t *obj)
}
}
else
else
{
{
vt
=
xcb_aux_find_visual_by_id
(
scr
,
scr
->
root_visual
);
msg_Err
(
vout
,
"no supported visual class"
);
assert
(
vt
);
msg_Err
(
vout
,
"unsupported visual class %"
PRIu8
,
vt
->
_class
);
goto
error
;
goto
error
;
}
}
p_sys
->
vid
=
vt
->
visual_id
;
p_sys
->
vid
=
vt
->
visual_id
;
/* Determine our input format (normally, done in Init() but X11
/* Determine our input format (normally, done in Init() but X11
* never changes its format) */
* never changes its format) */
p_sys
->
bpp
=
scr
->
root_depth
;
vout
->
output
.
i_chroma
=
0
;
switch
(
scr
->
root_depth
)
for
(
const
xcb_format_t
*
fmt
=
xcb_setup_pixmap_formats
(
setup
),
*
end
=
fmt
+
xcb_setup_pixmap_formats_length
(
setup
);
fmt
<
end
;
fmt
++
)
{
if
(
fmt
->
depth
!=
scr
->
root_depth
)
continue
;
switch
(
fmt
->
depth
)
{
{
case
24
:
case
24
:
p_sys
->
bpp
=
32
;
if
(
fmt
->
bits_per_pixel
==
32
)
case
32
:
/* FIXME: untested */
vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
);
vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'3'
,
'2'
);
else
if
(
fmt
->
bits_per_pixel
==
24
)
vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'2'
,
'4'
);
else
continue
;
break
;
break
;
case
16
:
case
16
:
if
(
fmt
->
bits_per_pixel
!=
16
)
continue
;
vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'6'
);
vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'6'
);
break
;
break
;
case
15
:
case
15
:
p_sys
->
bpp
=
16
;
if
(
fmt
->
bits_per_pixel
!=
16
)
continue
;
vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'5'
);
vout
->
output
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'V'
,
'1'
,
'5'
);
break
;
break
;
case
8
:
case
8
:
/* FIXME: VLC cannot convert */
if
(
fmt
->
bits_per_pixel
!=
8
)
continue
;
vout
->
output
.
i_chroma
=
gray
?
VLC_FOURCC
(
'G'
,
'R'
,
'E'
,
'Y'
)
vout
->
output
.
i_chroma
=
gray
?
VLC_FOURCC
(
'G'
,
'R'
,
'E'
,
'Y'
)
:
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'2'
);
:
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'2'
);
break
;
break
;
}
if
((
fmt
->
bits_per_pixel
<<
4
)
%
fmt
->
scanline_pad
)
continue
;
/* VLC pads lines to 16 pixels internally */
p_sys
->
bpp
=
fmt
->
bits_per_pixel
;
p_sys
->
pad
=
fmt
->
scanline_pad
;
msg_Dbg
(
vout
,
"using %"
PRIu8
" bits per pixels (line pad: %"
PRIu8
")"
,
p_sys
->
bpp
,
p_sys
->
pad
);
break
;
}
default:
if
(
!
vout
->
output
.
i_chroma
)
msg_Err
(
vout
,
"unsupported %"
PRIu8
"-bits screen depth"
,
{
scr
->
root_depth
);
msg_Err
(
vout
,
"no supported pixmap formats"
);
goto
error
;
goto
error
;
}
}
vout
->
fmt_out
.
i_chroma
=
vout
->
output
.
i_chroma
;
vout
->
fmt_out
.
i_chroma
=
vout
->
output
.
i_chroma
;
if
(
!
gray
)
if
(
!
gray
)
{
{
...
@@ -337,10 +360,9 @@ static int PictureInit (vout_thread_t *vout, picture_t *pic)
...
@@ -337,10 +360,9 @@ static int PictureInit (vout_thread_t *vout, picture_t *pic)
const
unsigned
real_width
=
pic
->
p
->
i_pitch
/
(
p_sys
->
bpp
>>
3
);
const
unsigned
real_width
=
pic
->
p
->
i_pitch
/
(
p_sys
->
bpp
>>
3
);
/* FIXME: anyway to getthing more intuitive than that?? */
/* FIXME: anyway to getthing more intuitive than that?? */
/* NOTE: 32-bits scanline_pad assumed, FIXME? (see xdpyinfo) */
xcb_image_t
*
img
;
xcb_image_t
*
img
;
img
=
xcb_image_create
(
real_width
,
pic
->
p
->
i_lines
,
img
=
xcb_image_create
(
real_width
,
pic
->
p
->
i_lines
,
XCB_IMAGE_FORMAT_Z_PIXMAP
,
32
,
XCB_IMAGE_FORMAT_Z_PIXMAP
,
p_sys
->
pad
,
p_sys
->
screen
->
root_depth
,
p_sys
->
bpp
,
p_sys
->
bpp
,
p_sys
->
screen
->
root_depth
,
p_sys
->
bpp
,
p_sys
->
bpp
,
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
XCB_IMAGE_ORDER_MSB_FIRST
,
XCB_IMAGE_ORDER_MSB_FIRST
,
...
...
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