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
fc6351d0
Commit
fc6351d0
authored
Nov 16, 2011
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swr: make audio convert code explicitely private.
Only what's declared in libswresample/swresample.h is public.
parent
3a5fc385
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
35 deletions
+35
-35
audioconvert.c
libswresample/audioconvert.c
+9
-9
audioconvert.h
libswresample/audioconvert.h
+8
-8
swresample.c
libswresample/swresample.c
+15
-15
swresample_internal.h
libswresample/swresample_internal.h
+3
-3
No files found.
libswresample/audioconvert.c
View file @
fc6351d0
...
...
@@ -34,7 +34,7 @@
typedef
void
(
conv_func_type
)(
uint8_t
*
po
,
const
uint8_t
*
pi
,
int
is
,
int
os
,
uint8_t
*
end
);
struct
A
VA
udioConvert
{
struct
AudioConvert
{
int
channels
;
conv_func_type
*
conv_f
;
const
int
*
ch_map
;
...
...
@@ -108,17 +108,17 @@ conv_func_type *fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB*AV_SAMPLE_FMT_NB] =
FMT_PAIR_FUNC
(
AV_SAMPLE_FMT_DBL
,
AV_SAMPLE_FMT_DBL
),
};
A
VAudioConvert
*
swr
_audio_convert_alloc
(
enum
AVSampleFormat
out_fmt
,
enum
AVSampleFormat
in_fmt
,
int
channels
,
const
int
*
ch_map
,
int
flags
)
A
udioConvert
*
swri
_audio_convert_alloc
(
enum
AVSampleFormat
out_fmt
,
enum
AVSampleFormat
in_fmt
,
int
channels
,
const
int
*
ch_map
,
int
flags
)
{
A
VA
udioConvert
*
ctx
;
AudioConvert
*
ctx
;
conv_func_type
*
f
=
fmt_pair_to_conv_functions
[
out_fmt
+
AV_SAMPLE_FMT_NB
*
in_fmt
];
if
(
!
f
)
return
NULL
;
ctx
=
av_malloc
(
sizeof
(
AVAudioConvert
));
ctx
=
av_malloc
(
sizeof
(
*
ctx
));
if
(
!
ctx
)
return
NULL
;
ctx
->
channels
=
channels
;
...
...
@@ -127,12 +127,12 @@ AVAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
return
ctx
;
}
void
swr
_audio_convert_free
(
AV
AudioConvert
**
ctx
)
void
swr
i_audio_convert_free
(
AudioConvert
**
ctx
)
{
av_freep
(
ctx
);
}
int
swr
_audio_convert
(
AVAudioConvert
*
ctx
,
AudioData
*
out
,
AudioData
*
in
,
int
len
)
int
swr
i_audio_convert
(
AudioConvert
*
ctx
,
AudioData
*
out
,
AudioData
*
in
,
int
len
)
{
int
ch
;
const
uint8_t
null_input
[
8
]
=
{
0
};
...
...
libswresample/audioconvert.h
View file @
fc6351d0
...
...
@@ -33,8 +33,8 @@
#include "libavutil/cpu.h"
#include "libavutil/audioconvert.h"
struct
A
VA
udioConvert
;
typedef
struct
A
VAudioConvert
AV
AudioConvert
;
struct
AudioConvert
;
typedef
struct
A
udioConvert
AudioConvert
;
/**
* Create an audio sample format converter context
...
...
@@ -46,16 +46,16 @@ typedef struct AVAudioConvert AVAudioConvert;
* if all channels must be selected
* @return NULL on error
*/
A
VAudioConvert
*
swr
_audio_convert_alloc
(
enum
AVSampleFormat
out_fmt
,
enum
AVSampleFormat
in_fmt
,
int
channels
,
const
int
*
ch_map
,
int
flags
);
A
udioConvert
*
swri
_audio_convert_alloc
(
enum
AVSampleFormat
out_fmt
,
enum
AVSampleFormat
in_fmt
,
int
channels
,
const
int
*
ch_map
,
int
flags
);
/**
* Free audio sample format converter context.
* and set the pointer to NULL
*/
void
swr
_audio_convert_free
(
AV
AudioConvert
**
ctx
);
void
swr
i_audio_convert_free
(
AudioConvert
**
ctx
);
/**
* Convert between audio sample formats
...
...
@@ -63,6 +63,6 @@ void swr_audio_convert_free(AVAudioConvert **ctx);
* @param[in] in array of input buffers for each channel
* @param len length of audio frame size (measured in samples)
*/
int
swr
_audio_convert
(
AV
AudioConvert
*
ctx
,
AudioData
*
out
,
AudioData
*
in
,
int
len
);
int
swr
i_audio_convert
(
AudioConvert
*
ctx
,
AudioData
*
out
,
AudioData
*
in
,
int
len
);
#endif
/* AUDIOCONVERT_H */
libswresample/swresample.c
View file @
fc6351d0
...
...
@@ -119,9 +119,9 @@ void swr_free(SwrContext **ss){
free_temp
(
&
s
->
midbuf
);
free_temp
(
&
s
->
preout
);
free_temp
(
&
s
->
in_buffer
);
swr_audio_convert_free
(
&
s
->
in_convert
);
swr_audio_convert_free
(
&
s
->
out_convert
);
swr_audio_convert_free
(
&
s
->
full_convert
);
swr
i
_audio_convert_free
(
&
s
->
in_convert
);
swr
i
_audio_convert_free
(
&
s
->
out_convert
);
swr
i
_audio_convert_free
(
&
s
->
full_convert
);
swr_resample_free
(
&
s
->
resample
);
}
...
...
@@ -136,9 +136,9 @@ int swr_init(SwrContext *s){
free_temp
(
&
s
->
midbuf
);
free_temp
(
&
s
->
preout
);
free_temp
(
&
s
->
in_buffer
);
swr_audio_convert_free
(
&
s
->
in_convert
);
swr_audio_convert_free
(
&
s
->
out_convert
);
swr_audio_convert_free
(
&
s
->
full_convert
);
swr
i
_audio_convert_free
(
&
s
->
in_convert
);
swr
i
_audio_convert_free
(
&
s
->
out_convert
);
swr
i
_audio_convert_free
(
&
s
->
full_convert
);
s
->
in
.
planar
=
s
->
in_sample_fmt
>=
0x100
;
s
->
out
.
planar
=
s
->
out_sample_fmt
>=
0x100
;
...
...
@@ -209,15 +209,15 @@ av_assert0(s->out.ch_count);
s
->
out
.
bps
=
av_get_bytes_per_sample
(
s
->
out_sample_fmt
);
if
(
!
s
->
resample
&&
!
s
->
rematrix
&&
!
s
->
channel_map
){
s
->
full_convert
=
swr_audio_convert_alloc
(
s
->
out_sample_fmt
,
s
->
in_sample_fmt
,
s
->
in
.
ch_count
,
NULL
,
0
);
s
->
full_convert
=
swr
i
_audio_convert_alloc
(
s
->
out_sample_fmt
,
s
->
in_sample_fmt
,
s
->
in
.
ch_count
,
NULL
,
0
);
return
0
;
}
s
->
in_convert
=
swr_audio_convert_alloc
(
s
->
int_sample_fmt
,
s
->
in_sample_fmt
,
s
->
used_ch_count
,
s
->
channel_map
,
0
);
s
->
out_convert
=
swr_audio_convert_alloc
(
s
->
out_sample_fmt
,
s
->
int_sample_fmt
,
s
->
out
.
ch_count
,
NULL
,
0
);
s
->
in_convert
=
swr
i
_audio_convert_alloc
(
s
->
int_sample_fmt
,
s
->
in_sample_fmt
,
s
->
used_ch_count
,
s
->
channel_map
,
0
);
s
->
out_convert
=
swr
i
_audio_convert_alloc
(
s
->
out_sample_fmt
,
s
->
int_sample_fmt
,
s
->
out
.
ch_count
,
NULL
,
0
);
s
->
postin
=
s
->
in
;
...
...
@@ -335,7 +335,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if
(
s
->
full_convert
){
av_assert0
(
!
s
->
resample
);
swr_audio_convert
(
s
->
full_convert
,
out
,
in
,
in_count
);
swr
i
_audio_convert
(
s
->
full_convert
,
out
,
in
,
in_count
);
return
out_count
;
}
...
...
@@ -385,7 +385,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
}
if
(
in
!=
postin
){
swr_audio_convert
(
s
->
in_convert
,
postin
,
in
,
in_count
);
swr
i
_audio_convert
(
s
->
in_convert
,
postin
,
in
,
in_count
);
}
if
(
s
->
resample_first
){
...
...
@@ -402,7 +402,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if
(
preout
!=
out
){
//FIXME packed doesnt need more than 1 chan here!
swr_audio_convert
(
s
->
out_convert
,
out
,
preout
,
out_count
);
swr
i
_audio_convert
(
s
->
out_convert
,
out
,
preout
,
out_count
);
}
if
(
!
in_arg
)
s
->
in_buffer_count
=
0
;
...
...
libswresample/swresample_internal.h
View file @
fc6351d0
...
...
@@ -58,9 +58,9 @@ typedef struct SwrContext { //FIXME find unused fields
int
in_buffer_count
;
int
resample_in_constraint
;
struct
A
VA
udioConvert
*
in_convert
;
struct
A
VA
udioConvert
*
out_convert
;
struct
A
VA
udioConvert
*
full_convert
;
struct
AudioConvert
*
in_convert
;
struct
AudioConvert
*
out_convert
;
struct
AudioConvert
*
full_convert
;
struct
AVResampleContext
*
resample
;
float
matrix
[
SWR_CH_MAX
][
SWR_CH_MAX
];
...
...
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