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
75e0324e
Commit
75e0324e
authored
May 06, 2012
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src_buffer: move code to avoid forward declarations.
parent
f7f6aaf9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
73 deletions
+67
-73
src_buffer.c
libavfilter/src_buffer.c
+67
-73
No files found.
libavfilter/src_buffer.c
View file @
75e0324e
...
@@ -69,11 +69,75 @@ typedef struct {
...
@@ -69,11 +69,75 @@ typedef struct {
return AVERROR(EINVAL);\
return AVERROR(EINVAL);\
}
}
static
void
buf_free
(
AVFilterBuffer
*
ptr
)
{
av_free
(
ptr
);
return
;
}
static
void
set_link_source
(
AVFilterContext
*
src
,
AVFilterLink
*
link
)
{
link
->
src
=
src
;
link
->
srcpad
=
&
(
src
->
output_pads
[
0
]);
src
->
outputs
[
0
]
=
link
;
}
static
int
reconfigure_filter
(
BufferSourceContext
*
abuffer
,
AVFilterContext
*
filt_ctx
)
{
int
ret
;
AVFilterLink
*
const
inlink
=
filt_ctx
->
inputs
[
0
];
AVFilterLink
*
const
outlink
=
filt_ctx
->
outputs
[
0
];
inlink
->
format
=
abuffer
->
sample_format
;
inlink
->
channel_layout
=
abuffer
->
channel_layout
;
inlink
->
planar
=
abuffer
->
packing_format
;
inlink
->
sample_rate
=
abuffer
->
sample_rate
;
filt_ctx
->
filter
->
uninit
(
filt_ctx
);
memset
(
filt_ctx
->
priv
,
0
,
filt_ctx
->
filter
->
priv_size
);
if
((
ret
=
filt_ctx
->
filter
->
init
(
filt_ctx
,
NULL
,
NULL
))
<
0
)
return
ret
;
if
((
ret
=
inlink
->
srcpad
->
config_props
(
inlink
))
<
0
)
return
ret
;
return
outlink
->
srcpad
->
config_props
(
outlink
);
}
static
int
insert_filter
(
BufferSourceContext
*
abuffer
,
static
int
insert_filter
(
BufferSourceContext
*
abuffer
,
AVFilterLink
*
link
,
AVFilterContext
**
filt_ctx
,
AVFilterLink
*
link
,
AVFilterContext
**
filt_ctx
,
const
char
*
filt_name
);
const
char
*
filt_name
)
static
void
remove_filter
(
AVFilterContext
**
filt_ctx
);
{
static
int
reconfigure_filter
(
BufferSourceContext
*
abuffer
,
AVFilterContext
*
filt_ctx
);
int
ret
;
if
((
ret
=
avfilter_open
(
filt_ctx
,
avfilter_get_by_name
(
filt_name
),
NULL
))
<
0
)
return
ret
;
link
->
src
->
outputs
[
0
]
=
NULL
;
if
((
ret
=
avfilter_link
(
link
->
src
,
0
,
*
filt_ctx
,
0
))
<
0
)
{
link
->
src
->
outputs
[
0
]
=
link
;
return
ret
;
}
set_link_source
(
*
filt_ctx
,
link
);
if
((
ret
=
reconfigure_filter
(
abuffer
,
*
filt_ctx
))
<
0
)
{
avfilter_free
(
*
filt_ctx
);
return
ret
;
}
return
0
;
}
static
void
remove_filter
(
AVFilterContext
**
filt_ctx
)
{
AVFilterLink
*
outlink
=
(
*
filt_ctx
)
->
outputs
[
0
];
AVFilterContext
*
src
=
(
*
filt_ctx
)
->
inputs
[
0
]
->
src
;
(
*
filt_ctx
)
->
outputs
[
0
]
=
NULL
;
avfilter_free
(
*
filt_ctx
);
*
filt_ctx
=
NULL
;
set_link_source
(
src
,
outlink
);
}
static
inline
void
log_input_change
(
void
*
ctx
,
AVFilterLink
*
link
,
AVFilterBufferRef
*
ref
)
static
inline
void
log_input_change
(
void
*
ctx
,
AVFilterLink
*
link
,
AVFilterBufferRef
*
ref
)
{
{
...
@@ -516,76 +580,6 @@ static int poll_frame(AVFilterLink *link)
...
@@ -516,76 +580,6 @@ static int poll_frame(AVFilterLink *link)
return
size
/
sizeof
(
AVFilterBufferRef
*
);
return
size
/
sizeof
(
AVFilterBufferRef
*
);
}
}
static
void
buf_free
(
AVFilterBuffer
*
ptr
)
{
av_free
(
ptr
);
return
;
}
static
void
set_link_source
(
AVFilterContext
*
src
,
AVFilterLink
*
link
)
{
link
->
src
=
src
;
link
->
srcpad
=
&
(
src
->
output_pads
[
0
]);
src
->
outputs
[
0
]
=
link
;
}
static
int
reconfigure_filter
(
BufferSourceContext
*
abuffer
,
AVFilterContext
*
filt_ctx
)
{
int
ret
;
AVFilterLink
*
const
inlink
=
filt_ctx
->
inputs
[
0
];
AVFilterLink
*
const
outlink
=
filt_ctx
->
outputs
[
0
];
inlink
->
format
=
abuffer
->
sample_format
;
inlink
->
channel_layout
=
abuffer
->
channel_layout
;
inlink
->
planar
=
abuffer
->
packing_format
;
inlink
->
sample_rate
=
abuffer
->
sample_rate
;
filt_ctx
->
filter
->
uninit
(
filt_ctx
);
memset
(
filt_ctx
->
priv
,
0
,
filt_ctx
->
filter
->
priv_size
);
if
((
ret
=
filt_ctx
->
filter
->
init
(
filt_ctx
,
NULL
,
NULL
))
<
0
)
return
ret
;
if
((
ret
=
inlink
->
srcpad
->
config_props
(
inlink
))
<
0
)
return
ret
;
return
outlink
->
srcpad
->
config_props
(
outlink
);
}
static
int
insert_filter
(
BufferSourceContext
*
abuffer
,
AVFilterLink
*
link
,
AVFilterContext
**
filt_ctx
,
const
char
*
filt_name
)
{
int
ret
;
if
((
ret
=
avfilter_open
(
filt_ctx
,
avfilter_get_by_name
(
filt_name
),
NULL
))
<
0
)
return
ret
;
link
->
src
->
outputs
[
0
]
=
NULL
;
if
((
ret
=
avfilter_link
(
link
->
src
,
0
,
*
filt_ctx
,
0
))
<
0
)
{
link
->
src
->
outputs
[
0
]
=
link
;
return
ret
;
}
set_link_source
(
*
filt_ctx
,
link
);
if
((
ret
=
reconfigure_filter
(
abuffer
,
*
filt_ctx
))
<
0
)
{
avfilter_free
(
*
filt_ctx
);
return
ret
;
}
return
0
;
}
static
void
remove_filter
(
AVFilterContext
**
filt_ctx
)
{
AVFilterLink
*
outlink
=
(
*
filt_ctx
)
->
outputs
[
0
];
AVFilterContext
*
src
=
(
*
filt_ctx
)
->
inputs
[
0
]
->
src
;
(
*
filt_ctx
)
->
outputs
[
0
]
=
NULL
;
avfilter_free
(
*
filt_ctx
);
*
filt_ctx
=
NULL
;
set_link_source
(
src
,
outlink
);
}
int
av_asrc_buffer_add_audio_buffer_ref
(
AVFilterContext
*
ctx
,
int
av_asrc_buffer_add_audio_buffer_ref
(
AVFilterContext
*
ctx
,
AVFilterBufferRef
*
samplesref
,
AVFilterBufferRef
*
samplesref
,
int
av_unused
flags
)
int
av_unused
flags
)
...
...
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