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
47aae2bc
Commit
47aae2bc
authored
May 15, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: switch to _alt functions
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
f8196759
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
101 deletions
+7
-101
audio.c
libavfilter/audio.c
+2
-76
avcodec.c
libavfilter/avcodec.c
+2
-3
avfilter.h
libavfilter/avfilter.h
+1
-20
src_buffer.c
libavfilter/src_buffer.c
+2
-2
No files found.
libavfilter/audio.c
View file @
47aae2bc
...
...
@@ -33,38 +33,6 @@ AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
}
AVFilterBufferRef
*
ff_default_get_audio_buffer
(
AVFilterLink
*
link
,
int
perms
,
int
nb_samples
)
{
AVFilterBufferRef
*
samplesref
=
NULL
;
int
linesize
[
8
]
=
{
0
};
uint8_t
*
data
[
8
]
=
{
0
};
int
ch
,
nb_channels
=
av_get_channel_layout_nb_channels
(
link
->
channel_layout
);
/* right now we don't support more than 8 channels */
av_assert0
(
nb_channels
<=
8
);
/* Calculate total buffer size, round to multiple of 16 to be SIMD friendly */
if
(
av_samples_alloc
(
data
,
linesize
,
nb_channels
,
nb_samples
,
av_get_alt_sample_fmt
(
link
->
format
,
link
->
planar
),
16
)
<
0
)
return
NULL
;
for
(
ch
=
1
;
link
->
planar
&&
ch
<
nb_channels
;
ch
++
)
linesize
[
ch
]
=
linesize
[
0
];
samplesref
=
avfilter_get_audio_buffer_ref_from_arrays
(
data
,
linesize
,
perms
,
nb_samples
,
link
->
format
,
link
->
channel_layout
,
link
->
planar
);
if
(
!
samplesref
)
{
av_free
(
data
[
0
]);
return
NULL
;
}
return
samplesref
;
}
static
AVFilterBufferRef
*
ff_default_get_audio_buffer_alt
(
AVFilterLink
*
link
,
int
perms
,
int
nb_samples
)
{
AVFilterBufferRef
*
samplesref
=
NULL
;
...
...
@@ -80,7 +48,7 @@ static AVFilterBufferRef *ff_default_get_audio_buffer_alt(AVFilterLink *link, in
if
(
av_samples_alloc
(
data
,
&
linesize
,
nb_channels
,
nb_samples
,
link
->
format
,
0
)
<
0
)
goto
fail
;
samplesref
=
avfilter_get_audio_buffer_ref_from_arrays
_alt
(
data
,
linesize
,
perms
,
samplesref
=
avfilter_get_audio_buffer_ref_from_arrays
(
data
,
linesize
,
perms
,
nb_samples
,
link
->
format
,
link
->
channel_layout
);
if
(
!
samplesref
)
...
...
@@ -112,49 +80,7 @@ AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
return
ret
;
}
AVFilterBufferRef
*
avfilter_get_audio_buffer_ref_from_arrays
(
uint8_t
*
data
[
8
],
int
linesize
[
8
],
int
perms
,
int
nb_samples
,
enum
AVSampleFormat
sample_fmt
,
uint64_t
channel_layout
,
int
planar
)
{
AVFilterBuffer
*
samples
=
av_mallocz
(
sizeof
(
AVFilterBuffer
));
AVFilterBufferRef
*
samplesref
=
av_mallocz
(
sizeof
(
AVFilterBufferRef
));
if
(
!
samples
||
!
samplesref
)
goto
fail
;
samplesref
->
buf
=
samples
;
samplesref
->
buf
->
free
=
ff_avfilter_default_free_buffer
;
if
(
!
(
samplesref
->
audio
=
av_mallocz
(
sizeof
(
AVFilterBufferRefAudioProps
))))
goto
fail
;
samplesref
->
audio
->
nb_samples
=
nb_samples
;
samplesref
->
audio
->
channel_layout
=
channel_layout
;
samplesref
->
audio
->
planar
=
planar
;
/* make sure the buffer gets read permission or it's useless for output */
samplesref
->
perms
=
perms
|
AV_PERM_READ
;
samples
->
refcount
=
1
;
samplesref
->
type
=
AVMEDIA_TYPE_AUDIO
;
samplesref
->
format
=
sample_fmt
;
memcpy
(
samples
->
data
,
data
,
sizeof
(
samples
->
data
));
memcpy
(
samples
->
linesize
,
linesize
,
sizeof
(
samples
->
linesize
));
memcpy
(
samplesref
->
data
,
data
,
sizeof
(
samplesref
->
data
));
memcpy
(
samplesref
->
linesize
,
linesize
,
sizeof
(
samplesref
->
linesize
));
return
samplesref
;
fail:
if
(
samplesref
&&
samplesref
->
audio
)
av_freep
(
&
samplesref
->
audio
);
av_freep
(
&
samplesref
);
av_freep
(
&
samples
);
return
NULL
;
}
AVFilterBufferRef
*
avfilter_get_audio_buffer_ref_from_arrays_alt
(
uint8_t
**
data
,
AVFilterBufferRef
*
avfilter_get_audio_buffer_ref_from_arrays
(
uint8_t
**
data
,
int
linesize
,
int
perms
,
int
nb_samples
,
enum
AVSampleFormat
sample_fmt
,
...
...
libavfilter/avcodec.c
View file @
47aae2bc
...
...
@@ -112,10 +112,9 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame
int
perms
)
{
AVFilterBufferRef
*
picref
=
avfilter_get_audio_buffer_ref_from_arrays
((
uint8_t
**
)
frame
->
data
,
(
int
*
)
frame
->
linesize
,
perms
,
avfilter_get_audio_buffer_ref_from_arrays
((
uint8_t
**
)
frame
->
data
,
frame
->
linesize
[
0
]
,
perms
,
frame
->
nb_samples
,
frame
->
format
,
av_frame_get_channel_layout
(
frame
),
av_sample_fmt_is_planar
(
frame
->
format
));
av_frame_get_channel_layout
(
frame
));
if
(
!
picref
)
return
NULL
;
avfilter_copy_frame_props
(
picref
,
frame
);
...
...
libavfilter/avfilter.h
View file @
47aae2bc
...
...
@@ -790,27 +790,8 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t * const data[4], const int lin
* @param nb_samples number of samples per channel
* @param sample_fmt the format of each sample in the buffer to allocate
* @param channel_layout the channel layout of the buffer
* @param planar audio data layout - planar or packed
*/
AVFilterBufferRef
*
avfilter_get_audio_buffer_ref_from_arrays
(
uint8_t
*
data
[
8
],
int
linesize
[
8
],
int
perms
,
int
nb_samples
,
enum
AVSampleFormat
sample_fmt
,
uint64_t
channel_layout
,
int
planar
);
/**
* Create an audio buffer reference wrapped around an already
* allocated samples buffer.
*
* @param data pointers to the samples plane buffers
* @param linesize linesize for the samples plane buffers
* @param perms the required access permissions
* @param nb_samples number of samples per channel
* @param sample_fmt the format of each sample in the buffer to allocate
* @param channel_layout the channel layout of the buffer
*/
AVFilterBufferRef
*
avfilter_get_audio_buffer_ref_from_arrays_alt
(
uint8_t
**
data
,
AVFilterBufferRef
*
avfilter_get_audio_buffer_ref_from_arrays
(
uint8_t
**
data
,
int
linesize
,
int
perms
,
int
nb_samples
,
...
...
libavfilter/src_buffer.c
View file @
47aae2bc
...
...
@@ -597,9 +597,9 @@ int av_asrc_buffer_add_samples(AVFilterContext *ctx,
AVFilterBufferRef
*
samplesref
;
samplesref
=
avfilter_get_audio_buffer_ref_from_arrays
(
data
,
linesize
,
AV_PERM_WRITE
,
data
,
linesize
[
0
]
,
AV_PERM_WRITE
,
nb_samples
,
sample_fmt
,
channel_layout
,
planar
);
sample_fmt
,
channel_layout
);
if
(
!
samplesref
)
return
AVERROR
(
ENOMEM
);
...
...
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