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
66c92a15
Commit
66c92a15
authored
Mar 21, 2013
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/resampling_audio: make use of av_samples_alloc_array_and_samples()
Simplify.
parent
5c73645d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
16 deletions
+4
-16
resampling_audio.c
doc/examples/resampling_audio.c
+4
-16
No files found.
doc/examples/resampling_audio.c
View file @
66c92a15
...
...
@@ -78,18 +78,6 @@ void fill_samples(double *dst, int nb_samples, int nb_channels, int sample_rate,
}
}
int
alloc_samples_array_and_data
(
uint8_t
***
data
,
int
*
linesize
,
int
nb_channels
,
int
nb_samples
,
enum
AVSampleFormat
sample_fmt
,
int
align
)
{
int
nb_planes
=
av_sample_fmt_is_planar
(
sample_fmt
)
?
nb_channels
:
1
;
*
data
=
av_malloc
(
sizeof
(
*
data
)
*
nb_planes
);
if
(
!*
data
)
return
AVERROR
(
ENOMEM
);
return
av_samples_alloc
(
*
data
,
linesize
,
nb_channels
,
nb_samples
,
sample_fmt
,
align
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int64_t
src_ch_layout
=
AV_CH_LAYOUT_STEREO
,
dst_ch_layout
=
AV_CH_LAYOUT_SURROUND
;
...
...
@@ -149,8 +137,8 @@ int main(int argc, char **argv)
/* allocate source and destination samples buffers */
src_nb_channels
=
av_get_channel_layout_nb_channels
(
src_ch_layout
);
ret
=
a
lloc_samples_array_and_data
(
&
src_data
,
&
src_linesize
,
src_nb_channels
,
src_nb_samples
,
src_sample_fmt
,
0
);
ret
=
a
v_samples_alloc_array_and_samples
(
&
src_data
,
&
src_linesize
,
src_nb_channels
,
src_nb_samples
,
src_sample_fmt
,
0
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Could not allocate source samples
\n
"
);
goto
end
;
...
...
@@ -164,8 +152,8 @@ int main(int argc, char **argv)
/* buffer is going to be directly written to a rawaudio file, no alignment */
dst_nb_channels
=
av_get_channel_layout_nb_channels
(
dst_ch_layout
);
ret
=
a
lloc_samples_array_and_data
(
&
dst_data
,
&
dst_linesize
,
dst_nb_channels
,
dst_nb_samples
,
dst_sample_fmt
,
0
);
ret
=
a
v_samples_alloc_array_and_samples
(
&
dst_data
,
&
dst_linesize
,
dst_nb_channels
,
dst_nb_samples
,
dst_sample_fmt
,
0
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Could not allocate destination samples
\n
"
);
goto
end
;
...
...
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