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
2d213695
Commit
2d213695
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: simplify buffer pointer and header size handling.
Signed-off-by:
Ronald S. Bultje
<
rsbultje@gmail.com
>
parent
7a4fb3fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
vmdav.c
libavcodec/vmdav.c
+10
-9
No files found.
libavcodec/vmdav.c
View file @
2d213695
...
@@ -511,9 +511,6 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
...
@@ -511,9 +511,6 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
int
block_type
;
int
block_type
;
unsigned
char
*
output_samples
=
(
unsigned
char
*
)
data
;
unsigned
char
*
output_samples
=
(
unsigned
char
*
)
data
;
/* point to the start of the encoded data */
const
unsigned
char
*
p
=
buf
+
16
;
if
(
buf_size
<
16
)
{
if
(
buf_size
<
16
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"skipping small junk packet
\n
"
);
av_log
(
avctx
,
AV_LOG_WARNING
,
"skipping small junk packet
\n
"
);
*
data_size
=
0
;
*
data_size
=
0
;
...
@@ -525,29 +522,33 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
...
@@ -525,29 +522,33 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx,
av_log
(
avctx
,
AV_LOG_ERROR
,
"unknown block type: %d
\n
"
,
block_type
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"unknown block type: %d
\n
"
,
block_type
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
buf
+=
16
;
buf_size
-=
16
;
if
(
block_type
==
BLOCK_TYPE_AUDIO
)
{
if
(
block_type
==
BLOCK_TYPE_AUDIO
)
{
/* the chunk contains audio */
/* the chunk contains audio */
*
data_size
=
vmdaudio_loadsound
(
s
,
output_samples
,
p
,
0
,
buf_size
-
16
);
*
data_size
=
vmdaudio_loadsound
(
s
,
output_samples
,
buf
,
0
,
buf_size
);
}
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
(
p
);
uint32_t
flags
=
AV_RB32
(
buf
);
int
raw_block_size
=
s
->
block_align
*
int
raw_block_size
=
s
->
block_align
*
(
av_get_bits_per_sample_fmt
(
avctx
->
sample_fmt
)
/
8
);
(
av_get_bits_per_sample_fmt
(
avctx
->
sample_fmt
)
/
8
);
int
silent_chunks
=
av_popcount
(
flags
);
int
silent_chunks
=
av_popcount
(
flags
);
if
(
*
data_size
<
(
s
->
block_align
*
silent_chunks
+
buf_size
-
20
)
*
2
)
buf
+=
4
;
buf_size
-=
4
;
if
(
*
data_size
<
(
s
->
block_align
*
silent_chunks
+
buf_size
)
*
2
)
return
-
1
;
return
-
1
;
*
data_size
=
0
;
*
data_size
=
0
;
memset
(
output_samples
,
0
,
raw_block_size
*
silent_chunks
);
memset
(
output_samples
,
0
,
raw_block_size
*
silent_chunks
);
output_samples
+=
raw_block_size
*
silent_chunks
;
output_samples
+=
raw_block_size
*
silent_chunks
;
*
data_size
=
raw_block_size
*
silent_chunks
;
*
data_size
=
raw_block_size
*
silent_chunks
;
*
data_size
+=
vmdaudio_loadsound
(
s
,
output_samples
,
p
+
4
,
0
,
buf_size
-
20
);
*
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
,
p
,
1
,
s
->
block_align
);
*
data_size
=
vmdaudio_loadsound
(
s
,
output_samples
,
buf
,
1
,
s
->
block_align
);
}
}
return
buf_
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