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
09d6831f
Commit
09d6831f
authored
Dec 24, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sipr: decode directly to the user-provided AVFrame
parent
fed74c0a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
sipr.c
libavcodec/sipr.c
+6
-9
sipr.h
libavcodec/sipr.h
+0
-1
No files found.
libavcodec/sipr.c
View file @
09d6831f
...
@@ -516,9 +516,6 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
...
@@ -516,9 +516,6 @@ static av_cold int sipr_decoder_init(AVCodecContext * avctx)
avctx
->
channel_layout
=
AV_CH_LAYOUT_MONO
;
avctx
->
channel_layout
=
AV_CH_LAYOUT_MONO
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLT
;
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLT
;
avcodec_get_frame_defaults
(
&
ctx
->
frame
);
avctx
->
coded_frame
=
&
ctx
->
frame
;
return
0
;
return
0
;
}
}
...
@@ -526,6 +523,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -526,6 +523,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
{
SiprContext
*
ctx
=
avctx
->
priv_data
;
SiprContext
*
ctx
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
SiprParameters
parm
;
SiprParameters
parm
;
const
SiprModeParam
*
mode_par
=
&
modes
[
ctx
->
mode
];
const
SiprModeParam
*
mode_par
=
&
modes
[
ctx
->
mode
];
...
@@ -543,13 +541,13 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -543,13 +541,13 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
}
}
/* get output buffer */
/* get output buffer */
ctx
->
frame
.
nb_samples
=
mode_par
->
frames_per_packet
*
subframe_size
*
frame
->
nb_samples
=
mode_par
->
frames_per_packet
*
subframe_size
*
mode_par
->
subframe_count
;
mode_par
->
subframe_count
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
ctx
->
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
;
}
}
samples
=
(
float
*
)
ctx
->
frame
.
data
[
0
];
samples
=
(
float
*
)
frame
->
data
[
0
];
init_get_bits
(
&
gb
,
buf
,
mode_par
->
bits_per_frame
);
init_get_bits
(
&
gb
,
buf
,
mode_par
->
bits_per_frame
);
...
@@ -561,8 +559,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -561,8 +559,7 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data,
samples
+=
subframe_size
*
mode_par
->
subframe_count
;
samples
+=
subframe_size
*
mode_par
->
subframe_count
;
}
}
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
ctx
->
frame
;
return
mode_par
->
bits_per_frame
>>
3
;
return
mode_par
->
bits_per_frame
>>
3
;
}
}
...
...
libavcodec/sipr.h
View file @
09d6831f
...
@@ -65,7 +65,6 @@ typedef struct SiprParameters {
...
@@ -65,7 +65,6 @@ typedef struct SiprParameters {
typedef
struct
SiprContext
{
typedef
struct
SiprContext
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
frame
;
SiprMode
mode
;
SiprMode
mode
;
...
...
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