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
7fdebb11
Commit
7fdebb11
authored
Apr 11, 2013
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/astreamsync: switch to an AVOptions-based system.
parent
2fb8ca7d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
filters.texi
doc/filters.texi
+9
-2
af_astreamsync.c
libavfilter/af_astreamsync.c
+15
-4
avfilter.c
libavfilter/avfilter.c
+0
-1
No files found.
doc/filters.texi
View file @
7fdebb11
...
...
@@ -999,7 +999,11 @@ will create 5 copies of the input audio.
Forward two audio streams and control the order the buffers are forwarded.
The argument to the filter is an expression deciding which stream should be
The filter accepts the following options:
@table @option
@item expr, e
Set the expression deciding which stream should be
forwarded next: if the result is negative, the first stream is forwarded; if
the result is positive or zero, the second stream is forwarded. It can use
the following variables:
...
...
@@ -1015,8 +1019,11 @@ current timestamp of each stream
The default value is @code{t1-t2}, which means to always forward the stream
that has a smaller timestamp.
@end table
@subsection Examples
Example: s
tress-test @code{amerge} by randomly sending buffers on the wrong
S
tress-test @code{amerge} by randomly sending buffers on the wrong
input, while avoiding too much of a desynchronization:
@example
amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
...
...
libavfilter/af_astreamsync.c
View file @
7fdebb11
...
...
@@ -24,6 +24,7 @@
*/
#include "libavutil/eval.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "internal.h"
...
...
@@ -45,7 +46,9 @@ enum var_name {
};
typedef
struct
{
const
AVClass
*
class
;
AVExpr
*
expr
;
char
*
expr_str
;
double
var_values
[
VAR_NB
];
struct
buf_queue
{
AVFrame
*
buf
[
QUEUE_SIZE
];
...
...
@@ -58,18 +61,25 @@ typedef struct {
int
eof
;
/* bitmask, one bit for each stream */
}
AStreamSyncContext
;
static
const
char
*
default_expr
=
"t1-t2"
;
#define OFFSET(x) offsetof(AStreamSyncContext, x)
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
static
const
AVOption
astreamsync_options
[]
=
{
{
"expr"
,
"set stream selection expression"
,
OFFSET
(
expr_str
),
AV_OPT_TYPE_STRING
,
{
.
str
=
"t1-t2"
},
.
flags
=
FLAGS
},
{
"e"
,
"set stream selection expression"
,
OFFSET
(
expr_str
),
AV_OPT_TYPE_STRING
,
{
.
str
=
"t1-t2"
},
.
flags
=
FLAGS
},
{
NULL
}
};
AVFILTER_DEFINE_CLASS
(
astreamsync
);
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args0
)
{
AStreamSyncContext
*
as
=
ctx
->
priv
;
const
char
*
expr
=
args0
?
args0
:
default_expr
;
int
r
,
i
;
r
=
av_expr_parse
(
&
as
->
expr
,
exp
r
,
var_names
,
r
=
av_expr_parse
(
&
as
->
expr
,
as
->
expr_st
r
,
var_names
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
ctx
);
if
(
r
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error in expression
\"
%s
\"\n
"
,
exp
r
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error in expression
\"
%s
\"\n
"
,
as
->
expr_st
r
);
return
r
;
}
for
(
i
=
0
;
i
<
42
;
i
++
)
...
...
@@ -226,4 +236,5 @@ AVFilter avfilter_af_astreamsync = {
.
query_formats
=
query_formats
,
.
inputs
=
astreamsync_inputs
,
.
outputs
=
astreamsync_outputs
,
.
priv_class
=
&
astreamsync_class
,
};
libavfilter/avfilter.c
View file @
7fdebb11
...
...
@@ -679,7 +679,6 @@ static const char *const filters_left_to_update[] = {
"anullsrc"
,
"aresample"
,
"asetnsamples"
,
"astreamsync"
,
"atempo"
,
"bbox"
,
"buffer"
,
...
...
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