Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
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
Steve Lhomme
VLC
Commits
2769e85f
Commit
2769e85f
authored
Apr 17, 2016
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2 demux: add colorimetry infos
parent
8748a077
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
0 deletions
+134
-0
modules/access/v4l2/demux.c
modules/access/v4l2/demux.c
+134
-0
No files found.
modules/access/v4l2/demux.c
View file @
2769e85f
...
...
@@ -404,6 +404,140 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
es_fmt
.
video
.
i_frame_rate_base
=
parm
.
parm
.
capture
.
timeperframe
.
numerator
;
GetAR
(
fd
,
&
es_fmt
.
video
.
i_sar_num
,
&
es_fmt
.
video
.
i_sar_den
);
msg_Dbg
(
demux
,
"color primaries: %u"
,
fmt
.
fmt
.
pix
.
colorspace
);
switch
(
fmt
.
fmt
.
pix
.
colorspace
)
{
case
V4L2_COLORSPACE_DEFAULT
:
break
;
case
V4L2_COLORSPACE_SMPTE170M
:
es_fmt
.
video
.
primaries
=
COLOR_PRIMARIES_BT601_525
;
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_BT709
;
es_fmt
.
video
.
space
=
COLOR_SPACE_BT601
;
break
;
case
V4L2_COLORSPACE_SMPTE240M
:
/* not supported */
break
;
case
V4L2_COLORSPACE_REC709
:
es_fmt
.
video
.
primaries
=
COLOR_PRIMARIES_BT709
;
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_BT709
;
es_fmt
.
video
.
space
=
COLOR_SPACE_BT709
;
break
;
case
V4L2_COLORSPACE_470_SYSTEM_M
:
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_BT709
;
es_fmt
.
video
.
space
=
COLOR_SPACE_BT601
;
break
;
case
V4L2_COLORSPACE_470_SYSTEM_BG
:
es_fmt
.
video
.
primaries
=
COLOR_PRIMARIES_BT601_625
;
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_BT709
;
es_fmt
.
video
.
space
=
COLOR_SPACE_BT601
;
break
;
case
V4L2_COLORSPACE_JPEG
:
es_fmt
.
video
.
primaries
=
COLOR_PRIMARIES_SRGB
;
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_SRGB
;
es_fmt
.
video
.
space
=
COLOR_SPACE_BT601
;
es_fmt
.
video
.
b_color_range_full
=
true
;
break
;
case
V4L2_COLORSPACE_SRGB
:
es_fmt
.
video
.
primaries
=
COLOR_PRIMARIES_SRGB
;
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_SRGB
;
es_fmt
.
video
.
space
=
COLOR_SPACE_UNDEF
;
/* sYCC unsupported */
break
;
case
V4L2_COLORSPACE_ADOBERGB
:
/* not supported */
es_fmt
.
video
.
space
=
COLOR_SPACE_BT601
;
break
;
case
V4L2_COLORSPACE_BT2020
:
es_fmt
.
video
.
primaries
=
COLOR_PRIMARIES_BT2020
;
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_BT2020
;
es_fmt
.
video
.
space
=
COLOR_SPACE_BT2020
;
break
;
case
V4L2_COLORSPACE_RAW
:
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_LINEAR
;
break
;
case
V4L2_COLORSPACE_DCI_P3
:
es_fmt
.
video
.
primaries
=
COLOR_PRIMARIES_DCI_P3
;
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_UNDEF
;
es_fmt
.
video
.
space
=
COLOR_SPACE_BT2020
;
break
;
default:
msg_Warn
(
demux
,
"unknown color space %u"
,
fmt
.
fmt
.
pix
.
colorspace
);
break
;
}
msg_Dbg
(
demux
,
"transfer function: %u"
,
fmt
.
fmt
.
pix
.
xfer_func
);
switch
(
fmt
.
fmt
.
pix
.
xfer_func
)
{
case
V4L2_XFER_FUNC_DEFAULT
:
/* If transfer function is default, the transfer function is
* inferred from the colorspace value for backward compatibility.
* See V4L2 documentation for details. */
break
;
case
V4L2_XFER_FUNC_709
:
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_BT709
;
break
;
case
V4L2_XFER_FUNC_SRGB
:
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_SRGB
;
break
;
case
V4L2_XFER_FUNC_ADOBERGB
:
case
V4L2_XFER_FUNC_SMPTE240M
:
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_UNDEF
;
break
;
case
V4L2_XFER_FUNC_NONE
:
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_LINEAR
;
break
;
case
V4L2_XFER_FUNC_DCI_P3
:
case
V4L2_XFER_FUNC_SMPTE2084
:
es_fmt
.
video
.
transfer
=
TRANSFER_FUNC_UNDEF
;
break
;
default:
msg_Warn
(
demux
,
"unknown transfer function %u"
,
fmt
.
fmt
.
pix
.
xfer_func
);
break
;
}
msg_Dbg
(
demux
,
"YCbCr encoding: %u"
,
fmt
.
fmt
.
pix
.
ycbcr_enc
);
switch
(
fmt
.
fmt
.
pix
.
ycbcr_enc
)
{
case
V4L2_YCBCR_ENC_DEFAULT
:
/* Same as transfer function - use color space value */
break
;
case
V4L2_YCBCR_ENC_601
:
es_fmt
.
video
.
space
=
COLOR_SPACE_BT601
;
break
;
case
V4L2_YCBCR_ENC_709
:
es_fmt
.
video
.
space
=
COLOR_SPACE_BT709
;
break
;
case
V4L2_YCBCR_ENC_XV601
:
case
V4L2_YCBCR_ENC_XV709
:
case
V4L2_YCBCR_ENC_SYCC
:
break
;
case
V4L2_YCBCR_ENC_BT2020
:
es_fmt
.
video
.
space
=
COLOR_SPACE_BT2020
;
break
;
case
V4L2_YCBCR_ENC_BT2020_CONST_LUM
:
case
V4L2_YCBCR_ENC_SMPTE240M
:
break
;
default:
msg_Err
(
demux
,
"unknown YCbCr encoding: %u"
,
fmt
.
fmt
.
pix
.
ycbcr_enc
);
break
;
}
msg_Dbg
(
demux
,
"quantization: %u"
,
fmt
.
fmt
.
pix
.
quantization
);
switch
(
fmt
.
fmt
.
pix
.
quantization
)
{
case
V4L2_QUANTIZATION_DEFAULT
:
break
;
case
V4L2_QUANTIZATION_FULL_RANGE
:
es_fmt
.
video
.
b_color_range_full
=
true
;
break
;
case
V4L2_QUANTIZATION_LIM_RANGE
:
es_fmt
.
video
.
b_color_range_full
=
false
;
break
;
default:
msg_Err
(
demux
,
"unknown quantization: %u"
,
fmt
.
fmt
.
pix
.
quantization
);
break
;
}
msg_Dbg
(
demux
,
"added new video ES %4.4s %ux%u (%ux%u)"
,
(
char
*
)
&
es_fmt
.
i_codec
,
es_fmt
.
video
.
i_visible_width
,
es_fmt
.
video
.
i_visible_height
,
...
...
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