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
55d2e12a
Commit
55d2e12a
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ac3: decode directly to the user-provided AVFrame
parent
ffd21230
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
ac3dec.c
libavcodec/ac3dec.c
+5
-8
ac3dec.h
libavcodec/ac3dec.h
+0
-1
No files found.
libavcodec/ac3dec.c
View file @
55d2e12a
...
...
@@ -185,9 +185,6 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
}
s
->
downmixed
=
1
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
for
(
i
=
0
;
i
<
AC3_MAX_CHANNELS
;
i
++
)
{
s
->
xcfptr
[
i
]
=
s
->
transform_coeffs
[
i
];
s
->
dlyptr
[
i
]
=
s
->
delay
[
i
];
...
...
@@ -1267,6 +1264,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
static
int
ac3_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
;
AC3DecodeContext
*
s
=
avctx
->
priv_data
;
...
...
@@ -1370,8 +1368,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
/* get output buffer */
avctx
->
channels
=
s
->
out_channels
;
s
->
frame
.
nb_samples
=
s
->
num_blocks
*
256
;
if
((
ret
=
ff_get_buffer
(
avctx
,
&
s
->
frame
))
<
0
)
{
frame
->
nb_samples
=
s
->
num_blocks
*
256
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"get_buffer() failed
\n
"
);
return
ret
;
}
...
...
@@ -1380,7 +1378,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
channel_map
=
ff_ac3_dec_channel_map
[
s
->
output_mode
&
~
AC3_OUTPUT_LFEON
][
s
->
lfe_on
];
for
(
ch
=
0
;
ch
<
s
->
channels
;
ch
++
)
{
if
(
ch
<
s
->
out_channels
)
s
->
outptr
[
channel_map
[
ch
]]
=
(
float
*
)
s
->
frame
.
data
[
ch
];
s
->
outptr
[
channel_map
[
ch
]]
=
(
float
*
)
frame
->
data
[
ch
];
else
s
->
outptr
[
ch
]
=
s
->
output
[
ch
];
output
[
ch
]
=
s
->
output
[
ch
];
...
...
@@ -1403,8 +1401,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
for
(
ch
=
0
;
ch
<
s
->
out_channels
;
ch
++
)
memcpy
(
s
->
output
[
ch
],
output
[
ch
],
1024
);
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
*
got_frame_ptr
=
1
;
return
FFMIN
(
buf_size
,
s
->
frame_size
);
}
...
...
libavcodec/ac3dec.h
View file @
55d2e12a
...
...
@@ -69,7 +69,6 @@
typedef
struct
AC3DecodeContext
{
AVClass
*
class
;
///< class for AVOptions
AVCodecContext
*
avctx
;
///< parent context
AVFrame
frame
;
///< AVFrame for decoded output
GetBitContext
gbc
;
///< bitstream reader
///@name Bit stream information
...
...
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