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
142e740d
Commit
142e740d
authored
May 06, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
samplefmt: add a function for copying audio samples.
parent
96843413
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
samplefmt.c
libavutil/samplefmt.c
+19
-0
samplefmt.h
libavutil/samplefmt.h
+15
-0
No files found.
libavutil/samplefmt.c
View file @
142e740d
...
@@ -185,3 +185,22 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
...
@@ -185,3 +185,22 @@ int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
}
}
return
0
;
return
0
;
}
}
int
av_samples_copy
(
uint8_t
**
dst
,
uint8_t
*
const
*
src
,
int
dst_offset
,
int
src_offset
,
int
nb_samples
,
int
nb_channels
,
enum
AVSampleFormat
sample_fmt
)
{
int
planar
=
av_sample_fmt_is_planar
(
sample_fmt
);
int
planes
=
planar
?
nb_channels
:
1
;
int
block_align
=
av_get_bytes_per_sample
(
sample_fmt
)
*
(
planar
?
1
:
nb_channels
);
int
data_size
=
nb_samples
*
block_align
;
int
i
;
dst_offset
*=
block_align
;
src_offset
*=
block_align
;
for
(
i
=
0
;
i
<
planes
;
i
++
)
memcpy
(
dst
[
i
]
+
dst_offset
,
src
[
i
]
+
src_offset
,
data_size
);
return
0
;
}
libavutil/samplefmt.h
View file @
142e740d
...
@@ -194,4 +194,19 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
...
@@ -194,4 +194,19 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
int
av_samples_alloc
(
uint8_t
**
audio_data
,
int
*
linesize
,
int
nb_channels
,
int
av_samples_alloc
(
uint8_t
**
audio_data
,
int
*
linesize
,
int
nb_channels
,
int
nb_samples
,
enum
AVSampleFormat
sample_fmt
,
int
align
);
int
nb_samples
,
enum
AVSampleFormat
sample_fmt
,
int
align
);
/**
* Copy samples from src to dst.
*
* @param dst destination array of pointers to data planes
* @param src source array of pointers to data planes
* @param dst_offset offset in samples at which the data will be written to dst
* @param src_offset offset in samples at which the data will be read from src
* @param nb_samples number of samples to be copied
* @param nb_channels number of audio channels
* @param sample_fmt audio sample format
*/
int
av_samples_copy
(
uint8_t
**
dst
,
uint8_t
*
const
*
src
,
int
dst_offset
,
int
src_offset
,
int
nb_samples
,
int
nb_channels
,
enum
AVSampleFormat
sample_fmt
);
#endif
/* AVUTIL_SAMPLEFMT_H */
#endif
/* AVUTIL_SAMPLEFMT_H */
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