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
5cc0bd2c
Commit
5cc0bd2c
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
binkaudio: decode directly to the user-provided AVFrame
parent
9a75ace2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
binkaudio.c
libavcodec/binkaudio.c
+6
-10
No files found.
libavcodec/binkaudio.c
View file @
5cc0bd2c
...
@@ -47,7 +47,6 @@ static float quant_table[96];
...
@@ -47,7 +47,6 @@ static float quant_table[96];
#define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11)
#define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11)
typedef
struct
{
typedef
struct
{
AVFrame
frame
;
GetBitContext
gb
;
GetBitContext
gb
;
int
version_b
;
///< Bink version 'b'
int
version_b
;
///< Bink version 'b'
int
first
;
int
first
;
...
@@ -143,9 +142,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -143,9 +142,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
else
else
return
-
1
;
return
-
1
;
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
return
0
;
return
0
;
}
}
...
@@ -294,6 +290,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
...
@@ -294,6 +290,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
{
BinkAudioContext
*
s
=
avctx
->
priv_data
;
BinkAudioContext
*
s
=
avctx
->
priv_data
;
AVFrame
*
frame
=
data
;
GetBitContext
*
gb
=
&
s
->
gb
;
GetBitContext
*
gb
=
&
s
->
gb
;
int
ret
,
consumed
=
0
;
int
ret
,
consumed
=
0
;
...
@@ -321,22 +318,21 @@ static int decode_frame(AVCodecContext *avctx, void *data,
...
@@ -321,22 +318,21 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
}
/* get output buffer */
/* get output buffer */
s
->
frame
.
nb_samples
=
s
->
frame_len
;
frame
->
nb_samples
=
s
->
frame_len
;
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
;
}
}
if
(
decode_block
(
s
,
(
float
**
)
s
->
frame
.
extended_data
,
if
(
decode_block
(
s
,
(
float
**
)
frame
->
extended_data
,
avctx
->
codec
->
id
==
AV_CODEC_ID_BINKAUDIO_DCT
))
{
avctx
->
codec
->
id
==
AV_CODEC_ID_BINKAUDIO_DCT
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Incomplete packet
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Incomplete packet
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
get_bits_align32
(
gb
);
get_bits_align32
(
gb
);
s
->
frame
.
nb_samples
=
s
->
block_size
/
avctx
->
channels
;
frame
->
nb_samples
=
s
->
block_size
/
avctx
->
channels
;
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
return
consumed
;
return
consumed
;
}
}
...
...
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