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
4b59cf6c
Commit
4b59cf6c
authored
Dec 03, 2007
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix non-numeric AVOptions.
Originally committed as revision 11142 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
b81f2b3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
+30
-23
ffmpeg.c
ffmpeg.c
+30
-23
No files found.
ffmpeg.c
View file @
4b59cf6c
...
...
@@ -2677,10 +2677,11 @@ static void opt_input_file(const char *filename)
ap
->
video_codec_id
=
CODEC_ID_PGMYUV
;
for
(
i
=
0
;
i
<
opt_name_count
;
i
++
){
char
buf
[
256
];
const
AVOption
*
opt
;
double
d
=
av_get_double
(
avformat_opts
,
opt_names
[
i
],
&
opt
);
if
(
!
isnan
(
d
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_DECODING_PARAM
))
av_set_
double
(
ic
,
opt_names
[
i
],
d
);
char
*
str
=
av_get_string
(
avformat_opts
,
opt_names
[
i
],
&
opt
,
buf
,
sizeof
(
buf
)
);
if
(
str
&&
(
opt
->
flags
&
AV_OPT_FLAG_DECODING_PARAM
))
av_set_
string
(
ic
,
opt_names
[
i
],
str
);
}
/* open the input file with generic libav function */
err
=
av_open_input_file
(
&
ic
,
filename
,
file_iformat
,
0
,
ap
);
...
...
@@ -2731,10 +2732,11 @@ static void opt_input_file(const char *filename)
switch
(
enc
->
codec_type
)
{
case
CODEC_TYPE_AUDIO
:
for
(
j
=
0
;
j
<
opt_name_count
;
j
++
){
char
buf
[
256
];
const
AVOption
*
opt
;
double
d
=
av_get_double
(
avctx_opts
[
CODEC_TYPE_AUDIO
],
opt_names
[
j
],
&
opt
);
if
(
!
isnan
(
d
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_AUDIO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_DECODING_PARAM
))
av_set_
double
(
enc
,
opt_names
[
j
],
d
);
char
*
str
=
av_get_string
(
avctx_opts
[
CODEC_TYPE_AUDIO
],
opt_names
[
j
],
&
opt
,
buf
,
sizeof
(
buf
)
);
if
(
str
&&
(
opt
->
flags
&
AV_OPT_FLAG_AUDIO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_DECODING_PARAM
))
av_set_
string
(
enc
,
opt_names
[
j
],
str
);
}
//fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
audio_channels
=
enc
->
channels
;
...
...
@@ -2744,10 +2746,11 @@ static void opt_input_file(const char *filename)
break
;
case
CODEC_TYPE_VIDEO
:
for
(
j
=
0
;
j
<
opt_name_count
;
j
++
){
char
buf
[
256
];
const
AVOption
*
opt
;
double
d
=
av_get_double
(
avctx_opts
[
CODEC_TYPE_VIDEO
],
opt_names
[
j
],
&
opt
);
if
(
!
isnan
(
d
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_VIDEO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_DECODING_PARAM
))
av_set_
double
(
enc
,
opt_names
[
j
],
d
);
char
*
str
=
av_get_string
(
avctx_opts
[
CODEC_TYPE_VIDEO
],
opt_names
[
j
],
&
opt
,
buf
,
sizeof
(
buf
)
);
if
(
str
&&
(
opt
->
flags
&
AV_OPT_FLAG_VIDEO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_DECODING_PARAM
))
av_set_
string
(
enc
,
opt_names
[
j
],
str
);
}
frame_height
=
enc
->
height
;
frame_width
=
enc
->
width
;
...
...
@@ -2890,10 +2893,11 @@ static void new_video_stream(AVFormatContext *oc)
codec
=
avcodec_find_encoder
(
codec_id
);
for
(
i
=
0
;
i
<
opt_name_count
;
i
++
){
const
AVOption
*
opt
;
double
d
=
av_get_double
(
avctx_opts
[
CODEC_TYPE_VIDEO
],
opt_names
[
i
],
&
opt
);
if
(
!
isnan
(
d
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_VIDEO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_double
(
video_enc
,
opt_names
[
i
],
d
);
char
buf
[
256
];
const
AVOption
*
opt
;
char
*
str
=
av_get_string
(
avctx_opts
[
CODEC_TYPE_VIDEO
],
opt_names
[
i
],
&
opt
,
buf
,
sizeof
(
buf
));
if
(
str
&&
(
opt
->
flags
&
AV_OPT_FLAG_VIDEO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_string
(
video_enc
,
opt_names
[
i
],
str
);
}
video_enc
->
time_base
.
den
=
frame_rate
.
num
;
...
...
@@ -3033,10 +3037,11 @@ static void new_audio_stream(AVFormatContext *oc)
codec_id
=
av_guess_codec
(
oc
->
oformat
,
NULL
,
oc
->
filename
,
NULL
,
CODEC_TYPE_AUDIO
);
for
(
i
=
0
;
i
<
opt_name_count
;
i
++
){
char
buf
[
256
];
const
AVOption
*
opt
;
double
d
=
av_get_double
(
avctx_opts
[
CODEC_TYPE_AUDIO
],
opt_names
[
i
],
&
opt
);
if
(
!
isnan
(
d
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_AUDIO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_
double
(
audio_enc
,
opt_names
[
i
],
d
);
char
*
str
=
av_get_string
(
avctx_opts
[
CODEC_TYPE_AUDIO
],
opt_names
[
i
],
&
opt
,
buf
,
sizeof
(
buf
)
);
if
(
str
&&
(
opt
->
flags
&
AV_OPT_FLAG_AUDIO_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_
string
(
audio_enc
,
opt_names
[
i
],
str
);
}
if
(
audio_codec_name
)
...
...
@@ -3083,10 +3088,11 @@ static void new_subtitle_stream(AVFormatContext *oc)
st
->
stream_copy
=
1
;
}
else
{
for
(
i
=
0
;
i
<
opt_name_count
;
i
++
){
const
AVOption
*
opt
;
double
d
=
av_get_double
(
avctx_opts
[
CODEC_TYPE_SUBTITLE
],
opt_names
[
i
],
&
opt
);
if
(
!
isnan
(
d
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_SUBTITLE_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_double
(
subtitle_enc
,
opt_names
[
i
],
d
);
char
buf
[
256
];
const
AVOption
*
opt
;
char
*
str
=
av_get_string
(
avctx_opts
[
CODEC_TYPE_SUBTITLE
],
opt_names
[
i
],
&
opt
,
buf
,
sizeof
(
buf
));
if
(
str
&&
(
opt
->
flags
&
AV_OPT_FLAG_SUBTITLE_PARAM
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_string
(
subtitle_enc
,
opt_names
[
i
],
str
);
}
subtitle_enc
->
codec_id
=
find_codec_or_die
(
subtitle_codec_name
,
CODEC_TYPE_SUBTITLE
,
1
);
}
...
...
@@ -3275,10 +3281,11 @@ static void opt_output_file(const char *filename)
oc
->
loop_output
=
loop_output
;
for
(
i
=
0
;
i
<
opt_name_count
;
i
++
){
char
buf
[
256
];
const
AVOption
*
opt
;
double
d
=
av_get_double
(
avformat_opts
,
opt_names
[
i
],
&
opt
);
if
(
!
isnan
(
d
)
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_
double
(
oc
,
opt_names
[
i
],
d
);
char
*
str
=
av_get_string
(
avformat_opts
,
opt_names
[
i
],
&
opt
,
buf
,
sizeof
(
buf
)
);
if
(
str
&&
(
opt
->
flags
&
AV_OPT_FLAG_ENCODING_PARAM
))
av_set_
string
(
oc
,
opt_names
[
i
],
str
);
}
/* reset some options */
...
...
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