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
4f69612d
Commit
4f69612d
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libgsm: decode directly to the user-provided AVFrame
parent
a8ea936a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
libgsm.c
libavcodec/libgsm.c
+5
-9
No files found.
libavcodec/libgsm.c
View file @
4f69612d
...
...
@@ -148,7 +148,6 @@ AVCodec ff_libgsm_ms_encoder = {
};
typedef
struct
LibGSMDecodeContext
{
AVFrame
frame
;
struct
gsm_state
*
state
;
}
LibGSMDecodeContext
;
...
...
@@ -175,9 +174,6 @@ static av_cold int libgsm_decode_init(AVCodecContext *avctx) {
}
}
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
return
0
;
}
...
...
@@ -194,6 +190,7 @@ static int libgsm_decode_frame(AVCodecContext *avctx, void *data,
{
int
i
,
ret
;
LibGSMDecodeContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int16_t
*
samples
;
...
...
@@ -204,12 +201,12 @@ static int libgsm_decode_frame(AVCodecContext *avctx, void *data,
}
/* get output buffer */
s
->
frame
.
nb_samples
=
avctx
->
frame_size
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
frame
->
nb_samples
=
avctx
->
frame_size
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
samples
=
(
int16_t
*
)
s
->
frame
.
data
[
0
];
samples
=
(
int16_t
*
)
frame
->
data
[
0
];
for
(
i
=
0
;
i
<
avctx
->
frame_size
/
GSM_FRAME_SIZE
;
i
++
)
{
if
((
ret
=
gsm_decode
(
s
->
state
,
buf
,
samples
))
<
0
)
...
...
@@ -219,7 +216,6 @@ static int libgsm_decode_frame(AVCodecContext *avctx, void *data,
}
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
return
avctx
->
block_align
;
}
...
...
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