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
ee6ca11b
Commit
ee6ca11b
authored
Dec 24, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vorbis: decode directly to the user-provided AVFrame
parent
f80f8dd4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
vorbisdec.c
libavcodec/vorbisdec.c
+7
-11
No files found.
libavcodec/vorbisdec.c
View file @
ee6ca11b
...
...
@@ -123,7 +123,6 @@ typedef struct {
typedef
struct
vorbis_context_s
{
AVCodecContext
*
avccontext
;
AVFrame
frame
;
GetBitContext
gb
;
VorbisDSPContext
dsp
;
AVFloatDSPContext
fdsp
;
...
...
@@ -1030,9 +1029,6 @@ static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
avccontext
->
channels
=
vc
->
audio_channels
;
avccontext
->
sample_rate
=
vc
->
audio_samplerate
;
avcodec_get_frame_defaults
(
&
vc
->
frame
);
avccontext
->
coded_frame
=
&
vc
->
frame
;
return
0
;
}
...
...
@@ -1643,6 +1639,7 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
vorbis_context
*
vc
=
avccontext
->
priv_data
;
AVFrame
*
frame
=
data
;
GetBitContext
*
gb
=
&
vc
->
gb
;
float
*
channel_ptrs
[
255
];
int
i
,
len
,
ret
;
...
...
@@ -1650,19 +1647,19 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
av_dlog
(
NULL
,
"packet length %d
\n
"
,
buf_size
);
/* get output buffer */
vc
->
frame
.
nb_samples
=
vc
->
blocksize
[
1
]
/
2
;
if
((
ret
=
ff_get_buffer
(
avccontext
,
&
vc
->
frame
))
<
0
)
{
frame
->
nb_samples
=
vc
->
blocksize
[
1
]
/
2
;
if
((
ret
=
ff_get_buffer
(
avccontext
,
frame
))
<
0
)
{
av_log
(
avccontext
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
if
(
vc
->
audio_channels
>
8
)
{
for
(
i
=
0
;
i
<
vc
->
audio_channels
;
i
++
)
channel_ptrs
[
i
]
=
(
float
*
)
vc
->
frame
.
extended_data
[
i
];
channel_ptrs
[
i
]
=
(
float
*
)
frame
->
extended_data
[
i
];
}
else
{
for
(
i
=
0
;
i
<
vc
->
audio_channels
;
i
++
)
{
int
ch
=
ff_vorbis_channel_layout_offsets
[
vc
->
audio_channels
-
1
][
i
];
channel_ptrs
[
ch
]
=
(
float
*
)
vc
->
frame
.
extended_data
[
i
];
channel_ptrs
[
ch
]
=
(
float
*
)
frame
->
extended_data
[
i
];
}
}
...
...
@@ -1680,9 +1677,8 @@ static int vorbis_decode_frame(AVCodecContext *avccontext, void *data,
av_dlog
(
NULL
,
"parsed %d bytes %d bits, returned %d samples (*ch*bits)
\n
"
,
get_bits_count
(
gb
)
/
8
,
get_bits_count
(
gb
)
%
8
,
len
);
vc
->
frame
.
nb_samples
=
len
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
vc
->
frame
;
frame
->
nb_samples
=
len
;
*
got_frame_ptr
=
1
;
return
buf_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