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
00cae867
Commit
00cae867
authored
Jan 20, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swr: support first_pts
Trolled-by: Daemon404 Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
eb553096
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
swresample.c
libswresample/swresample.c
+10
-1
swresample_internal.h
libswresample/swresample_internal.h
+2
-0
No files found.
libswresample/swresample.c
View file @
00cae867
...
@@ -108,6 +108,8 @@ static const AVOption options[]={
...
@@ -108,6 +108,8 @@ static const AVOption options[]={
,
OFFSET
(
max_soft_compensation
),
AV_OPT_TYPE_FLOAT
,{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
PARAM
},
,
OFFSET
(
max_soft_compensation
),
AV_OPT_TYPE_FLOAT
,{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
PARAM
},
{
"async"
,
"simplified 1 parameter audio timestamp matching, 0(disabled), 1(filling and trimming), >1(maximum stretch/squeeze in samples per second)"
{
"async"
,
"simplified 1 parameter audio timestamp matching, 0(disabled), 1(filling and trimming), >1(maximum stretch/squeeze in samples per second)"
,
OFFSET
(
async
)
,
AV_OPT_TYPE_FLOAT
,{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
PARAM
},
,
OFFSET
(
async
)
,
AV_OPT_TYPE_FLOAT
,{.
dbl
=
0
},
INT_MIN
,
INT_MAX
,
PARAM
},
{
"first_pts"
,
"Assume the first pts should be this value (in samples)."
,
OFFSET
(
firstpts_in_samples
),
AV_OPT_TYPE_INT64
,{.
i64
=
AV_NOPTS_VALUE
},
INT64_MIN
,
INT64_MAX
,
PARAM
},
{
"matrix_encoding"
,
"set matrixed stereo encoding"
,
OFFSET
(
matrix_encoding
),
AV_OPT_TYPE_INT
,{.
i64
=
AV_MATRIX_ENCODING_NONE
},
AV_MATRIX_ENCODING_NONE
,
AV_MATRIX_ENCODING_NB
-
1
,
PARAM
,
"matrix_encoding"
},
{
"matrix_encoding"
,
"set matrixed stereo encoding"
,
OFFSET
(
matrix_encoding
),
AV_OPT_TYPE_INT
,{.
i64
=
AV_MATRIX_ENCODING_NONE
},
AV_MATRIX_ENCODING_NONE
,
AV_MATRIX_ENCODING_NB
-
1
,
PARAM
,
"matrix_encoding"
},
{
"none"
,
"select none"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
AV_MATRIX_ENCODING_NONE
},
INT_MIN
,
INT_MAX
,
PARAM
,
"matrix_encoding"
},
{
"none"
,
"select none"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
AV_MATRIX_ENCODING_NONE
},
INT_MIN
,
INT_MAX
,
PARAM
,
"matrix_encoding"
},
...
@@ -296,6 +298,13 @@ av_cold int swr_init(struct SwrContext *s){
...
@@ -296,6 +298,13 @@ av_cold int swr_init(struct SwrContext *s){
set_audiodata_fmt
(
&
s
->
in
,
s
->
in_sample_fmt
);
set_audiodata_fmt
(
&
s
->
in
,
s
->
in_sample_fmt
);
set_audiodata_fmt
(
&
s
->
out
,
s
->
out_sample_fmt
);
set_audiodata_fmt
(
&
s
->
out
,
s
->
out_sample_fmt
);
if
(
s
->
firstpts_in_samples
!=
AV_NOPTS_VALUE
)
{
if
(
!
s
->
async
&&
s
->
min_compensation
>=
FLT_MAX
/
2
)
s
->
async
=
1
;
s
->
firstpts
=
s
->
outpts
=
s
->
firstpts_in_samples
*
s
->
out_sample_rate
;
}
if
(
s
->
async
)
{
if
(
s
->
async
)
{
if
(
s
->
min_compensation
>=
FLT_MAX
/
2
)
if
(
s
->
min_compensation
>=
FLT_MAX
/
2
)
s
->
min_compensation
=
0
.
001
;
s
->
min_compensation
=
0
.
001
;
...
@@ -877,7 +886,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts){
...
@@ -877,7 +886,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts){
double
fdelta
=
delta
/
(
double
)(
s
->
in_sample_rate
*
(
int64_t
)
s
->
out_sample_rate
);
double
fdelta
=
delta
/
(
double
)(
s
->
in_sample_rate
*
(
int64_t
)
s
->
out_sample_rate
);
if
(
fabs
(
fdelta
)
>
s
->
min_compensation
)
{
if
(
fabs
(
fdelta
)
>
s
->
min_compensation
)
{
if
(
!
s
->
ou
tpts
||
fabs
(
fdelta
)
>
s
->
min_hard_compensation
){
if
(
s
->
outpts
==
s
->
firs
tpts
||
fabs
(
fdelta
)
>
s
->
min_hard_compensation
){
int
ret
;
int
ret
;
if
(
delta
>
0
)
ret
=
swr_inject_silence
(
s
,
delta
/
s
->
out_sample_rate
);
if
(
delta
>
0
)
ret
=
swr_inject_silence
(
s
,
delta
/
s
->
out_sample_rate
);
else
ret
=
swr_drop_output
(
s
,
-
delta
/
s
->
in_sample_rate
);
else
ret
=
swr_drop_output
(
s
,
-
delta
/
s
->
in_sample_rate
);
...
...
libswresample/swresample_internal.h
View file @
00cae867
...
@@ -102,6 +102,7 @@ struct SwrContext {
...
@@ -102,6 +102,7 @@ struct SwrContext {
float
soft_compensation_duration
;
///< swr duration over which soft compensation is applied
float
soft_compensation_duration
;
///< swr duration over which soft compensation is applied
float
max_soft_compensation
;
///< swr maximum soft compensation in seconds over soft_compensation_duration
float
max_soft_compensation
;
///< swr maximum soft compensation in seconds over soft_compensation_duration
float
async
;
///< swr simple 1 parameter async, similar to ffmpegs -async
float
async
;
///< swr simple 1 parameter async, similar to ffmpegs -async
int64_t
firstpts_in_samples
;
///< swr first pts in samples
int
resample_first
;
///< 1 if resampling must come first, 0 if rematrixing
int
resample_first
;
///< 1 if resampling must come first, 0 if rematrixing
int
rematrix
;
///< flag to indicate if rematrixing is needed (basically if input and output layouts mismatch)
int
rematrix
;
///< flag to indicate if rematrixing is needed (basically if input and output layouts mismatch)
...
@@ -120,6 +121,7 @@ struct SwrContext {
...
@@ -120,6 +121,7 @@ struct SwrContext {
int
resample_in_constraint
;
///< 1 if the input end was reach before the output end, 0 otherwise
int
resample_in_constraint
;
///< 1 if the input end was reach before the output end, 0 otherwise
int
flushed
;
///< 1 if data is to be flushed and no further input is expected
int
flushed
;
///< 1 if data is to be flushed and no further input is expected
int64_t
outpts
;
///< output PTS
int64_t
outpts
;
///< output PTS
int64_t
firstpts
;
///< first PTS
int
drop_output
;
///< number of output samples to drop
int
drop_output
;
///< number of output samples to drop
struct
AudioConvert
*
in_convert
;
///< input conversion context
struct
AudioConvert
*
in_convert
;
///< input conversion context
...
...
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