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
a8ea936a
Commit
a8ea936a
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libilbc: decode directly to the user-provided AVFrame
parent
b8788671
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
8 deletions
+5
-8
libilbc.c
libavcodec/libilbc.c
+5
-8
No files found.
libavcodec/libilbc.c
View file @
a8ea936a
...
@@ -41,7 +41,6 @@ static int get_mode(AVCodecContext *avctx)
...
@@ -41,7 +41,6 @@ static int get_mode(AVCodecContext *avctx)
typedef
struct
ILBCDecContext
{
typedef
struct
ILBCDecContext
{
const
AVClass
*
class
;
const
AVClass
*
class
;
AVFrame
frame
;
iLBC_Dec_Inst_t
decoder
;
iLBC_Dec_Inst_t
decoder
;
int
enhance
;
int
enhance
;
}
ILBCDecContext
;
}
ILBCDecContext
;
...
@@ -66,8 +65,6 @@ static av_cold int ilbc_decode_init(AVCodecContext *avctx)
...
@@ -66,8 +65,6 @@ static av_cold int ilbc_decode_init(AVCodecContext *avctx)
}
}
WebRtcIlbcfix_InitDecode
(
&
s
->
decoder
,
mode
,
s
->
enhance
);
WebRtcIlbcfix_InitDecode
(
&
s
->
decoder
,
mode
,
s
->
enhance
);
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
avctx
->
channels
=
1
;
avctx
->
channels
=
1
;
avctx
->
channel_layout
=
AV_CH_LAYOUT_MONO
;
avctx
->
channel_layout
=
AV_CH_LAYOUT_MONO
;
...
@@ -83,6 +80,7 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -83,6 +80,7 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
ILBCDecContext
*
s
=
avctx
->
priv_data
;
ILBCDecContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
int
ret
;
int
ret
;
if
(
s
->
decoder
.
no_of_bytes
>
buf_size
)
{
if
(
s
->
decoder
.
no_of_bytes
>
buf_size
)
{
...
@@ -91,17 +89,16 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -91,17 +89,16 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data,
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
s
->
frame
.
nb_samples
=
s
->
decoder
.
blockl
;
frame
->
nb_samples
=
s
->
decoder
.
blockl
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
return
ret
;
}
}
WebRtcIlbcfix_DecodeImpl
((
WebRtc_Word16
*
)
s
->
frame
.
data
[
0
],
WebRtcIlbcfix_DecodeImpl
((
WebRtc_Word16
*
)
frame
->
data
[
0
],
(
const
WebRtc_UWord16
*
)
buf
,
&
s
->
decoder
,
1
);
(
const
WebRtc_UWord16
*
)
buf
,
&
s
->
decoder
,
1
);
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
return
s
->
decoder
.
no_of_bytes
;
return
s
->
decoder
.
no_of_bytes
;
}
}
...
...
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