Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
76a77ff2
Commit
76a77ff2
authored
Jun 28, 2006
by
Luca Abeni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly set the image depth
Originally committed as revision 5538 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
b582d7ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
grab.c
libavformat/grab.c
+12
-4
No files found.
libavformat/grab.c
View file @
76a77ff2
...
...
@@ -62,7 +62,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
int
width
,
height
;
int
video_fd
,
frame_size
;
int
ret
,
frame_rate
,
frame_rate_base
;
int
desired_palette
;
int
desired_palette
,
desired_depth
;
struct
video_tuner
tuner
;
struct
video_audio
audio
;
struct
video_picture
pict
;
...
...
@@ -118,12 +118,16 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
desired_palette
=
-
1
;
if
(
st
->
codec
->
pix_fmt
==
PIX_FMT_YUV420P
)
{
desired_depth
=
-
1
;
if
(
ap
->
pix_fmt
==
PIX_FMT_YUV420P
)
{
desired_palette
=
VIDEO_PALETTE_YUV420P
;
}
else
if
(
st
->
codec
->
pix_fmt
==
PIX_FMT_YUV422
)
{
desired_depth
=
12
;
}
else
if
(
ap
->
pix_fmt
==
PIX_FMT_YUV422
)
{
desired_palette
=
VIDEO_PALETTE_YUV422
;
}
else
if
(
st
->
codec
->
pix_fmt
==
PIX_FMT_BGR24
)
{
desired_depth
=
16
;
}
else
if
(
ap
->
pix_fmt
==
PIX_FMT_BGR24
)
{
desired_palette
=
VIDEO_PALETTE_RGB24
;
desired_depth
=
24
;
}
/* set tv standard */
...
...
@@ -155,14 +159,18 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
#endif
/* try to choose a suitable video format */
pict
.
palette
=
desired_palette
;
pict
.
depth
=
desired_depth
;
if
(
desired_palette
==
-
1
||
(
ret
=
ioctl
(
video_fd
,
VIDIOCSPICT
,
&
pict
))
<
0
)
{
pict
.
palette
=
VIDEO_PALETTE_YUV420P
;
pict
.
depth
=
12
;
ret
=
ioctl
(
video_fd
,
VIDIOCSPICT
,
&
pict
);
if
(
ret
<
0
)
{
pict
.
palette
=
VIDEO_PALETTE_YUV422
;
pict
.
depth
=
16
;
ret
=
ioctl
(
video_fd
,
VIDIOCSPICT
,
&
pict
);
if
(
ret
<
0
)
{
pict
.
palette
=
VIDEO_PALETTE_RGB24
;
pict
.
depth
=
24
;
ret
=
ioctl
(
video_fd
,
VIDIOCSPICT
,
&
pict
);
if
(
ret
<
0
)
goto
fail1
;
...
...
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