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
762b386e
Commit
762b386e
authored
Feb 23, 2011
by
Justin Ruggles
Committed by
Ronald S. Bultje
Feb 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmdaudio: move all silence chunk handling to vmdaudio_loadsound().
Signed-off-by:
Ronald S. Bultje
<
rsbultje@gmail.com
>
parent
8e9027d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
14 deletions
+9
-14
vmdav.c
libavcodec/vmdav.c
+9
-14
No files found.
libavcodec/vmdav.c
View file @
762b386e
...
@@ -477,13 +477,15 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data,
...
@@ -477,13 +477,15 @@ static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data,
}
}
static
int
vmdaudio_loadsound
(
VmdAudioContext
*
s
,
unsigned
char
*
data
,
static
int
vmdaudio_loadsound
(
VmdAudioContext
*
s
,
unsigned
char
*
data
,
const
uint8_t
*
buf
,
int
silen
ce
,
int
data_size
)
const
uint8_t
*
buf
,
int
silen
t_chunks
,
int
data_size
)
{
{
int
i
;
int
i
;
int
silent_size
=
s
->
block_align
*
silent_chunks
*
2
;
if
(
silence
)
{
if
(
silent_chunks
)
{
memset
(
data
,
0
,
data_size
*
2
);
memset
(
data
,
0
,
silent_size
);
}
else
{
data
+=
silent_size
;
}
if
(
s
->
bits
==
16
)
if
(
s
->
bits
==
16
)
vmdaudio_decode_audio
(
s
,
data
,
buf
,
data_size
,
s
->
channels
==
2
);
vmdaudio_decode_audio
(
s
,
data
,
buf
,
data_size
,
s
->
channels
==
2
);
else
{
else
{
...
@@ -493,9 +495,8 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
...
@@ -493,9 +495,8 @@ static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
*
data
++
=
buf
[
i
]
+
0x80
;
*
data
++
=
buf
[
i
]
+
0x80
;
}
}
}
}
}
return
data_size
*
2
;
return
silent_size
+
data_size
*
2
;
}
}
static
int
vmdaudio_decode_frame
(
AVCodecContext
*
avctx
,
static
int
vmdaudio_decode_frame
(
AVCodecContext
*
avctx
,
...
@@ -528,21 +529,15 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
...
@@ -528,21 +529,15 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
}
else
if
(
block_type
==
BLOCK_TYPE_INITIAL
)
{
}
else
if
(
block_type
==
BLOCK_TYPE_INITIAL
)
{
/* initial chunk, may contain audio and silence */
/* initial chunk, may contain audio and silence */
uint32_t
flags
=
AV_RB32
(
buf
);
uint32_t
flags
=
AV_RB32
(
buf
);
int
raw_block_size
=
s
->
block_align
*
(
av_get_bits_per_sample_fmt
(
avctx
->
sample_fmt
)
/
8
);
int
silent_chunks
=
av_popcount
(
flags
);
int
silent_chunks
=
av_popcount
(
flags
);
buf
+=
4
;
buf
+=
4
;
buf_size
-=
4
;
buf_size
-=
4
;
if
(
*
data_size
<
(
s
->
block_align
*
silent_chunks
+
buf_size
)
*
2
)
if
(
*
data_size
<
(
s
->
block_align
*
silent_chunks
+
buf_size
)
*
2
)
return
-
1
;
return
-
1
;
*
data_size
=
0
;
*
data_size
=
vmdaudio_loadsound
(
s
,
output_samples
,
buf
,
silent_chunks
,
buf_size
);
memset
(
output_samples
,
0
,
raw_block_size
*
silent_chunks
);
output_samples
+=
raw_block_size
*
silent_chunks
;
*
data_size
=
raw_block_size
*
silent_chunks
;
*
data_size
+=
vmdaudio_loadsound
(
s
,
output_samples
,
buf
,
0
,
buf_size
);
}
else
if
(
block_type
==
BLOCK_TYPE_SILENCE
)
{
}
else
if
(
block_type
==
BLOCK_TYPE_SILENCE
)
{
/* silent chunk */
/* silent chunk */
*
data_size
=
vmdaudio_loadsound
(
s
,
output_samples
,
buf
,
1
,
s
->
block_align
);
*
data_size
=
vmdaudio_loadsound
(
s
,
output_samples
,
buf
,
1
,
0
);
}
}
return
avpkt
->
size
;
return
avpkt
->
size
;
...
...
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