Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f80f8dd4
Commit
f80f8dd4
authored
Dec 24, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmdaudio: decode directly to the user-provided AVFrame
parent
3b7d4338
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
vmdav.c
libavcodec/vmdav.c
+7
-10
No files found.
libavcodec/vmdav.c
View file @
f80f8dd4
...
...
@@ -476,7 +476,6 @@ static av_cold int vmdvideo_decode_end(AVCodecContext *avctx)
#define BLOCK_TYPE_SILENCE 3
typedef
struct
VmdAudioContext
{
AVFrame
frame
;
int
out_bps
;
int
chunk_size
;
}
VmdAudioContext
;
...
...
@@ -521,9 +520,6 @@ static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
s
->
chunk_size
=
avctx
->
block_align
+
avctx
->
channels
*
(
s
->
out_bps
==
2
);
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
av_log
(
avctx
,
AV_LOG_DEBUG
,
"%d channels, %d bits/sample, "
"block align = %d, sample rate = %d
\n
"
,
avctx
->
channels
,
avctx
->
bits_per_coded_sample
,
avctx
->
block_align
,
...
...
@@ -564,6 +560,7 @@ static void decode_audio_s16(int16_t *out, const uint8_t *buf, int buf_size,
static
int
vmdaudio_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
AVFrame
*
frame
=
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf_end
;
int
buf_size
=
avpkt
->
size
;
...
...
@@ -608,13 +605,14 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
audio_chunks
=
buf_size
/
s
->
chunk_size
;
/* get output buffer */
s
->
frame
.
nb_samples
=
((
silent_chunks
+
audio_chunks
)
*
avctx
->
block_align
)
/
avctx
->
channels
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
frame
->
nb_samples
=
((
silent_chunks
+
audio_chunks
)
*
avctx
->
block_align
)
/
avctx
->
channels
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
output_samples_u8
=
s
->
frame
.
data
[
0
];
output_samples_s16
=
(
int16_t
*
)
s
->
frame
.
data
[
0
];
output_samples_u8
=
frame
->
data
[
0
];
output_samples_s16
=
(
int16_t
*
)
frame
->
data
[
0
];
/* decode silent chunks */
if
(
silent_chunks
>
0
)
{
...
...
@@ -644,8 +642,7 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
}
}
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
*
got_frame_ptr
=
1
;
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