Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
7a59964b
Commit
7a59964b
authored
12 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
swr: add swr_inject_silence()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
72872d02
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libswresample/swresample.c
+24
-0
24 additions, 0 deletions
libswresample/swresample.c
libswresample/swresample.h
+6
-1
6 additions, 1 deletion
libswresample/swresample.h
with
30 additions
and
1 deletion
libswresample/swresample.c
+
24
−
0
View file @
7a59964b
...
...
@@ -676,3 +676,27 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
}
}
int
swr_inject_silence
(
struct
SwrContext
*
s
,
int
count
){
int
ret
,
i
;
AudioData
silence
=
s
->
out
;
uint8_t
*
tmp_arg
[
SWR_CH_MAX
];
if
(
count
<=
0
)
return
0
;
silence
.
count
=
0
;
silence
.
data
=
NULL
;
if
((
ret
=
realloc_audio
(
&
silence
,
count
))
<
0
)
return
ret
;
if
(
silence
.
planar
)
for
(
i
=
0
;
i
<
silence
.
ch_count
;
i
++
)
{
memset
(
silence
.
ch
[
i
],
silence
.
bps
==
1
?
0x80
:
0
,
count
*
silence
.
bps
);
}
else
memset
(
silence
.
ch
[
0
],
silence
.
bps
==
1
?
0x80
:
0
,
count
*
silence
.
bps
*
silence
.
ch_count
);
reversefill_audiodata
(
&
silence
,
tmp_arg
);
av_log
(
s
,
AV_LOG_VERBOSE
,
"adding %d audio samples of silence
\n
"
,
count
);
ret
=
swr_convert
(
s
,
NULL
,
0
,
(
const
uint8_t
**
)
tmp_arg
,
count
);
av_freep
(
&
silence
.
data
);
return
ret
;
}
This diff is collapsed.
Click to expand it.
libswresample/swresample.h
+
6
−
1
View file @
7a59964b
...
...
@@ -30,7 +30,7 @@
#include
"libavutil/samplefmt.h"
#define LIBSWRESAMPLE_VERSION_MAJOR 0
#define LIBSWRESAMPLE_VERSION_MINOR 1
2
#define LIBSWRESAMPLE_VERSION_MINOR 1
3
#define LIBSWRESAMPLE_VERSION_MICRO 100
#define LIBSWRESAMPLE_VERSION_INT AV_VERSION_INT(LIBSWRESAMPLE_VERSION_MAJOR, \
...
...
@@ -158,6 +158,11 @@ int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map);
*/
int
swr_set_matrix
(
struct
SwrContext
*
s
,
const
double
*
matrix
,
int
stride
);
/**
* Injects the specified number of silence samples.
*/
int
swr_inject_silence
(
struct
SwrContext
*
s
,
int
count
);
/**
* Gets the delay the next input sample will experience relative to the next output sample.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment