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
8a28fa01
Commit
8a28fa01
authored
Apr 17, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: choose_pix_fmt: pass target fmt in
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
47787831
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
ffmpeg.c
ffmpeg.c
+9
-8
No files found.
ffmpeg.c
View file @
8a28fa01
...
@@ -667,11 +667,11 @@ static void filter_release_buffer(AVFilterBuffer *fb)
...
@@ -667,11 +667,11 @@ static void filter_release_buffer(AVFilterBuffer *fb)
unref_buffer
(
buf
->
ist
,
buf
);
unref_buffer
(
buf
->
ist
,
buf
);
}
}
static
void
choose_pixel_fmt
(
AVStream
*
st
,
AVCodec
*
codec
)
static
enum
PixelFormat
choose_pixel_fmt
(
AVStream
*
st
,
AVCodec
*
codec
,
enum
PixelFormat
target
)
{
{
if
(
codec
&&
codec
->
pix_fmts
)
{
if
(
codec
&&
codec
->
pix_fmts
)
{
const
enum
PixelFormat
*
p
=
codec
->
pix_fmts
;
const
enum
PixelFormat
*
p
=
codec
->
pix_fmts
;
int
has_alpha
=
av_pix_fmt_descriptors
[
st
->
codec
->
pix_fm
t
].
nb_components
%
2
==
0
;
int
has_alpha
=
av_pix_fmt_descriptors
[
targe
t
].
nb_components
%
2
==
0
;
enum
PixelFormat
best
=
PIX_FMT_NONE
;
enum
PixelFormat
best
=
PIX_FMT_NONE
;
if
(
st
->
codec
->
strict_std_compliance
<=
FF_COMPLIANCE_UNOFFICIAL
)
{
if
(
st
->
codec
->
strict_std_compliance
<=
FF_COMPLIANCE_UNOFFICIAL
)
{
if
(
st
->
codec
->
codec_id
==
CODEC_ID_MJPEG
)
{
if
(
st
->
codec
->
codec_id
==
CODEC_ID_MJPEG
)
{
...
@@ -682,20 +682,21 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
...
@@ -682,20 +682,21 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
}
}
}
}
for
(;
*
p
!=
PIX_FMT_NONE
;
p
++
)
{
for
(;
*
p
!=
PIX_FMT_NONE
;
p
++
)
{
best
=
avcodec_find_best_pix_fmt2
(
best
,
*
p
,
st
->
codec
->
pix_fm
t
,
has_alpha
,
NULL
);
best
=
avcodec_find_best_pix_fmt2
(
best
,
*
p
,
targe
t
,
has_alpha
,
NULL
);
if
(
*
p
==
st
->
codec
->
pix_fm
t
)
if
(
*
p
==
targe
t
)
break
;
break
;
}
}
if
(
*
p
==
PIX_FMT_NONE
)
{
if
(
*
p
==
PIX_FMT_NONE
)
{
if
(
st
->
codec
->
pix_fm
t
!=
PIX_FMT_NONE
)
if
(
targe
t
!=
PIX_FMT_NONE
)
av_log
(
NULL
,
AV_LOG_WARNING
,
av_log
(
NULL
,
AV_LOG_WARNING
,
"Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'
\n
"
,
"Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'
\n
"
,
av_pix_fmt_descriptors
[
st
->
codec
->
pix_fm
t
].
name
,
av_pix_fmt_descriptors
[
targe
t
].
name
,
codec
->
name
,
codec
->
name
,
av_pix_fmt_descriptors
[
best
].
name
);
av_pix_fmt_descriptors
[
best
].
name
);
st
->
codec
->
pix_fmt
=
best
;
return
best
;
}
}
}
}
return
target
;
}
}
static
const
enum
PixelFormat
*
choose_pixel_fmts
(
OutputStream
*
ost
)
static
const
enum
PixelFormat
*
choose_pixel_fmts
(
OutputStream
*
ost
)
...
@@ -4789,7 +4790,7 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
...
@@ -4789,7 +4790,7 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
&&
!
ost
->
stream_copy
)
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_AUDIO
&&
!
ost
->
stream_copy
)
choose_sample_fmt
(
st
,
codec
);
choose_sample_fmt
(
st
,
codec
);
else
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
!
ost
->
stream_copy
)
else
if
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
!
ost
->
stream_copy
)
choose_pixel_fmt
(
st
,
codec
);
choose_pixel_fmt
(
st
,
codec
,
st
->
codec
->
pix_fmt
);
}
}
avformat_close_input
(
&
ic
);
avformat_close_input
(
&
ic
);
...
...
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