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
2fe18640
Commit
2fe18640
authored
Jul 04, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: skip initial silence when requested
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
0f03563d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
internal.h
libavcodec/internal.h
+5
-0
utils.c
libavcodec/utils.c
+18
-0
No files found.
libavcodec/internal.h
View file @
2fe18640
...
...
@@ -84,6 +84,11 @@ typedef struct AVCodecInternal {
unsigned
int
byte_buffer_size
;
void
*
frame_thread_encoder
;
/**
* Number of audio samples to skip at the start of the next decoded frame
*/
int
skip_samples
;
}
AVCodecInternal
;
struct
AVCodecDefault
{
...
...
libavcodec/utils.c
View file @
2fe18640
...
...
@@ -1627,6 +1627,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
}
if
((
avctx
->
codec
->
capabilities
&
CODEC_CAP_DELAY
)
||
avpkt
->
size
)
{
uint8_t
*
side
;
int
side_size
;
// copy to ensure we do not change avpkt
AVPacket
tmp
=
*
avpkt
;
int
did_split
=
av_packet_split_side_data
(
&
tmp
);
...
...
@@ -1645,6 +1647,22 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
frame
->
sample_rate
=
avctx
->
sample_rate
;
}
side
=
av_packet_get_side_data
(
avctx
->
pkt
,
AV_PKT_DATA_SKIP_SAMPLES
,
&
side_size
);
if
(
side
&&
side_size
>=
10
)
{
avctx
->
internal
->
skip_samples
=
AV_RL32
(
side
);
}
if
(
avctx
->
internal
->
skip_samples
)
{
if
(
frame
->
nb_samples
<=
avctx
->
internal
->
skip_samples
){
*
got_frame_ptr
=
0
;
avctx
->
internal
->
skip_samples
-=
frame
->
nb_samples
;
}
else
{
av_samples_copy
(
frame
->
extended_data
,
frame
->
extended_data
,
0
,
avctx
->
internal
->
skip_samples
,
frame
->
nb_samples
-
avctx
->
internal
->
skip_samples
,
avctx
->
channels
,
frame
->
format
);
frame
->
nb_samples
-=
avctx
->
internal
->
skip_samples
;
avctx
->
internal
->
skip_samples
=
0
;
}
}
avctx
->
pkt
=
NULL
;
if
(
did_split
)
{
ff_packet_free_side_data
(
&
tmp
);
...
...
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