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
bed957bb
Commit
bed957bb
authored
Dec 24, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libspeex: decode directly to the user-provided AVFrame
parent
19b2cb26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
libspeexdec.c
libavcodec/libspeexdec.c
+5
-9
No files found.
libavcodec/libspeexdec.c
View file @
bed957bb
...
...
@@ -29,7 +29,6 @@
#include "internal.h"
typedef
struct
{
AVFrame
frame
;
SpeexBits
bits
;
SpeexStereoState
stereo
;
void
*
dec_state
;
...
...
@@ -102,9 +101,6 @@ static av_cold int libspeex_decode_init(AVCodecContext *avctx)
speex_decoder_ctl
(
s
->
dec_state
,
SPEEX_SET_HANDLER
,
&
callback
);
}
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
return
0
;
}
...
...
@@ -114,16 +110,17 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
LibSpeexContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
int16_t
*
output
;
int
ret
,
consumed
=
0
;
/* get output buffer */
s
->
frame
.
nb_samples
=
s
->
frame_size
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
frame
->
nb_samples
=
s
->
frame_size
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
output
=
(
int16_t
*
)
s
->
frame
.
data
[
0
];
output
=
(
int16_t
*
)
frame
->
data
[
0
];
/* if there is not enough data left for the smallest possible frame or the
next 5 bits are a terminator code, reset the libspeex buffer using the
...
...
@@ -150,8 +147,7 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data,
if
(
avctx
->
channels
==
2
)
speex_decode_stereo_int
(
output
,
s
->
frame_size
,
&
s
->
stereo
);
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
*
got_frame_ptr
=
1
;
return
consumed
;
}
...
...
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