Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
9f122356
Commit
9f122356
authored
Dec 19, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: connect libavresample options to af_resample via AVFilterGraph
parent
d7c45043
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
2 deletions
+48
-2
APIchanges
doc/APIchanges
+4
-0
af_resample.c
libavfilter/af_resample.c
+35
-0
avfiltergraph.c
libavfilter/avfiltergraph.c
+7
-1
avfiltergraph.h
libavfilter/avfiltergraph.h
+1
-0
version.h
libavfilter/version.h
+1
-1
No files found.
doc/APIchanges
View file @
9f122356
...
@@ -13,6 +13,10 @@ libavutil: 2012-10-22
...
@@ -13,6 +13,10 @@ libavutil: 2012-10-22
API changes, most recent first:
API changes, most recent first:
2013-xx-xx - xxxxxxx - lavfi 3.4.0 - avfiltergraph.h
Add resample_lavr_opts to AVFilterGraph for setting libavresample options
for auto-inserted resample filters.
2013-xx-xx - xxxxxxx - lavu 52.7.0 - dict.h
2013-xx-xx - xxxxxxx - lavu 52.7.0 - dict.h
Add av_dict_parse_string() to set multiple key/value pairs at once from a
Add av_dict_parse_string() to set multiple key/value pairs at once from a
string.
string.
...
...
libavfilter/af_resample.c
View file @
9f122356
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/common.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/opt.h"
...
@@ -37,6 +38,7 @@
...
@@ -37,6 +38,7 @@
typedef
struct
ResampleContext
{
typedef
struct
ResampleContext
{
AVAudioResampleContext
*
avr
;
AVAudioResampleContext
*
avr
;
AVDictionary
*
options
;
int64_t
next_pts
;
int64_t
next_pts
;
...
@@ -44,6 +46,29 @@ typedef struct ResampleContext {
...
@@ -44,6 +46,29 @@ typedef struct ResampleContext {
int
got_output
;
int
got_output
;
}
ResampleContext
;
}
ResampleContext
;
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
ResampleContext
*
s
=
ctx
->
priv
;
if
(
args
)
{
int
ret
=
av_dict_parse_string
(
&
s
->
options
,
args
,
"="
,
":"
,
0
);
if
(
ret
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"error setting option string: %s
\n
"
,
args
);
return
ret
;
}
/* do not allow the user to override basic format options */
av_dict_set
(
&
s
->
options
,
"in_channel_layout"
,
NULL
,
0
);
av_dict_set
(
&
s
->
options
,
"out_channel_layout"
,
NULL
,
0
);
av_dict_set
(
&
s
->
options
,
"in_sample_fmt"
,
NULL
,
0
);
av_dict_set
(
&
s
->
options
,
"out_sample_fmt"
,
NULL
,
0
);
av_dict_set
(
&
s
->
options
,
"in_sample_rate"
,
NULL
,
0
);
av_dict_set
(
&
s
->
options
,
"out_sample_rate"
,
NULL
,
0
);
}
return
0
;
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
{
ResampleContext
*
s
=
ctx
->
priv
;
ResampleContext
*
s
=
ctx
->
priv
;
...
@@ -52,6 +77,7 @@ static av_cold void uninit(AVFilterContext *ctx)
...
@@ -52,6 +77,7 @@ static av_cold void uninit(AVFilterContext *ctx)
avresample_close
(
s
->
avr
);
avresample_close
(
s
->
avr
);
avresample_free
(
&
s
->
avr
);
avresample_free
(
&
s
->
avr
);
}
}
av_dict_free
(
&
s
->
options
);
}
}
static
int
query_formats
(
AVFilterContext
*
ctx
)
static
int
query_formats
(
AVFilterContext
*
ctx
)
...
@@ -103,6 +129,14 @@ static int config_output(AVFilterLink *outlink)
...
@@ -103,6 +129,14 @@ static int config_output(AVFilterLink *outlink)
if
(
!
(
s
->
avr
=
avresample_alloc_context
()))
if
(
!
(
s
->
avr
=
avresample_alloc_context
()))
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
if
(
s
->
options
)
{
AVDictionaryEntry
*
e
=
NULL
;
while
((
e
=
av_dict_get
(
s
->
options
,
""
,
e
,
AV_DICT_IGNORE_SUFFIX
)))
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"lavr option: %s=%s
\n
"
,
e
->
key
,
e
->
value
);
av_opt_set_dict
(
s
->
avr
,
&
s
->
options
);
}
av_opt_set_int
(
s
->
avr
,
"in_channel_layout"
,
inlink
->
channel_layout
,
0
);
av_opt_set_int
(
s
->
avr
,
"in_channel_layout"
,
inlink
->
channel_layout
,
0
);
av_opt_set_int
(
s
->
avr
,
"out_channel_layout"
,
outlink
->
channel_layout
,
0
);
av_opt_set_int
(
s
->
avr
,
"out_channel_layout"
,
outlink
->
channel_layout
,
0
);
av_opt_set_int
(
s
->
avr
,
"in_sample_fmt"
,
inlink
->
format
,
0
);
av_opt_set_int
(
s
->
avr
,
"in_sample_fmt"
,
inlink
->
format
,
0
);
...
@@ -264,6 +298,7 @@ AVFilter avfilter_af_resample = {
...
@@ -264,6 +298,7 @@ AVFilter avfilter_af_resample = {
.
description
=
NULL_IF_CONFIG_SMALL
(
"Audio resampling and conversion."
),
.
description
=
NULL_IF_CONFIG_SMALL
(
"Audio resampling and conversion."
),
.
priv_size
=
sizeof
(
ResampleContext
),
.
priv_size
=
sizeof
(
ResampleContext
),
.
init
=
init
,
.
uninit
=
uninit
,
.
uninit
=
uninit
,
.
query_formats
=
query_formats
,
.
query_formats
=
query_formats
,
...
...
libavfilter/avfiltergraph.c
View file @
9f122356
...
@@ -54,6 +54,7 @@ void avfilter_graph_free(AVFilterGraph **graph)
...
@@ -54,6 +54,7 @@ void avfilter_graph_free(AVFilterGraph **graph)
for
(;
(
*
graph
)
->
filter_count
>
0
;
(
*
graph
)
->
filter_count
--
)
for
(;
(
*
graph
)
->
filter_count
>
0
;
(
*
graph
)
->
filter_count
--
)
avfilter_free
((
*
graph
)
->
filters
[(
*
graph
)
->
filter_count
-
1
]);
avfilter_free
((
*
graph
)
->
filters
[(
*
graph
)
->
filter_count
-
1
]);
av_freep
(
&
(
*
graph
)
->
scale_sws_opts
);
av_freep
(
&
(
*
graph
)
->
scale_sws_opts
);
av_freep
(
&
(
*
graph
)
->
resample_lavr_opts
);
av_freep
(
&
(
*
graph
)
->
filters
);
av_freep
(
&
(
*
graph
)
->
filters
);
av_freep
(
graph
);
av_freep
(
graph
);
}
}
...
@@ -235,8 +236,13 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
...
@@ -235,8 +236,13 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto-inserted resampler %d"
,
snprintf
(
inst_name
,
sizeof
(
inst_name
),
"auto-inserted resampler %d"
,
resampler_count
++
);
resampler_count
++
);
scale_args
[
0
]
=
'\0'
;
if
(
graph
->
resample_lavr_opts
)
snprintf
(
scale_args
,
sizeof
(
scale_args
),
"%s"
,
graph
->
resample_lavr_opts
);
if
((
ret
=
avfilter_graph_create_filter
(
&
convert
,
filter
,
if
((
ret
=
avfilter_graph_create_filter
(
&
convert
,
filter
,
inst_name
,
NULL
,
NULL
,
graph
))
<
0
)
inst_name
,
scale_args
,
NULL
,
graph
))
<
0
)
return
ret
;
return
ret
;
break
;
break
;
default:
default:
...
...
libavfilter/avfiltergraph.h
View file @
9f122356
...
@@ -31,6 +31,7 @@ typedef struct AVFilterGraph {
...
@@ -31,6 +31,7 @@ typedef struct AVFilterGraph {
AVFilterContext
**
filters
;
AVFilterContext
**
filters
;
char
*
scale_sws_opts
;
///< sws options to use for the auto-inserted scale filters
char
*
scale_sws_opts
;
///< sws options to use for the auto-inserted scale filters
char
*
resample_lavr_opts
;
///< libavresample options to use for the auto-inserted resample filters
}
AVFilterGraph
;
}
AVFilterGraph
;
/**
/**
...
...
libavfilter/version.h
View file @
9f122356
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include "libavutil/avutil.h"
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR
3
#define LIBAVFILTER_VERSION_MINOR
4
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
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