Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
b8e9c99e
Commit
b8e9c99e
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flac: decode directly to the user-provided AVFrame
parent
97c7bdc6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
flacdec.c
libavcodec/flacdec.c
+5
-9
No files found.
libavcodec/flacdec.c
View file @
b8e9c99e
...
...
@@ -51,7 +51,6 @@ typedef struct FLACContext {
FLACSTREAMINFO
AVCodecContext
*
avctx
;
///< parent AVCodecContext
AVFrame
frame
;
GetBitContext
gb
;
///< GetBitContext initialized to start at the current frame
int
blocksize
;
///< number of samples in the current frame
...
...
@@ -115,9 +114,6 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
ff_flacdsp_init
(
&
s
->
dsp
,
avctx
->
sample_fmt
,
s
->
bps
);
s
->
got_streaminfo
=
1
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
return
0
;
}
...
...
@@ -493,6 +489,7 @@ static int decode_frame(FLACContext *s)
static
int
flac_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
AVFrame
*
frame
=
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
FLACContext
*
s
=
avctx
->
priv_data
;
...
...
@@ -531,13 +528,13 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
bytes_read
=
(
get_bits_count
(
&
s
->
gb
)
+
7
)
/
8
;
/* get output buffer */
s
->
frame
.
nb_samples
=
s
->
blocksize
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
frame
->
nb_samples
=
s
->
blocksize
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
s
->
dsp
.
decorrelate
[
s
->
ch_mode
](
s
->
frame
.
data
,
s
->
decoded
,
s
->
channels
,
s
->
dsp
.
decorrelate
[
s
->
ch_mode
](
frame
->
data
,
s
->
decoded
,
s
->
channels
,
s
->
blocksize
,
s
->
sample_shift
);
if
(
bytes_read
>
buf_size
)
{
...
...
@@ -549,8 +546,7 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
buf_size
-
bytes_read
,
buf_size
);
}
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
*
got_frame_ptr
=
1
;
return
bytes_read
;
}
...
...
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