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
182821cf
Commit
182821cf
authored
Dec 23, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dca: decode directly to the user-provided AVFrame
parent
7b783215
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
dcadec.c
libavcodec/dcadec.c
+7
-11
No files found.
libavcodec/dcadec.c
View file @
182821cf
...
@@ -285,7 +285,6 @@ static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
...
@@ -285,7 +285,6 @@ static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba,
typedef
struct
{
typedef
struct
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
AVFrame
frame
;
/* Frame header */
/* Frame header */
int
frame_type
;
///< type of the current frame
int
frame_type
;
///< type of the current frame
int
samples_deficit
;
///< deficit sample count
int
samples_deficit
;
///< deficit sample count
...
@@ -1653,6 +1652,7 @@ static void dca_exss_parse_header(DCAContext *s)
...
@@ -1653,6 +1652,7 @@ static void dca_exss_parse_header(DCAContext *s)
static
int
dca_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
static
int
dca_decode_frame
(
AVCodecContext
*
avctx
,
void
*
data
,
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
int
*
got_frame_ptr
,
AVPacket
*
avpkt
)
{
{
AVFrame
*
frame
=
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
const
uint8_t
*
buf
=
avpkt
->
data
;
int
buf_size
=
avpkt
->
size
;
int
buf_size
=
avpkt
->
size
;
...
@@ -1835,17 +1835,17 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -1835,17 +1835,17 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
avctx
->
channels
=
channels
;
avctx
->
channels
=
channels
;
/* get output buffer */
/* get output buffer */
s
->
frame
.
nb_samples
=
256
*
(
s
->
sample_blocks
/
8
);
frame
->
nb_samples
=
256
*
(
s
->
sample_blocks
/
8
);
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
;
}
}
samples_flt
=
(
float
**
)
s
->
frame
.
extended_data
;
samples_flt
=
(
float
**
)
frame
->
extended_data
;
/* allocate buffer for extra channels if downmixing */
/* allocate buffer for extra channels if downmixing */
if
(
avctx
->
channels
<
full_channels
)
{
if
(
avctx
->
channels
<
full_channels
)
{
ret
=
av_samples_get_buffer_size
(
NULL
,
full_channels
-
channels
,
ret
=
av_samples_get_buffer_size
(
NULL
,
full_channels
-
channels
,
s
->
frame
.
nb_samples
,
frame
->
nb_samples
,
avctx
->
sample_fmt
,
0
);
avctx
->
sample_fmt
,
0
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -1858,7 +1858,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -1858,7 +1858,7 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
ret
=
av_samples_fill_arrays
((
uint8_t
**
)
s
->
extra_channels
,
NULL
,
ret
=
av_samples_fill_arrays
((
uint8_t
**
)
s
->
extra_channels
,
NULL
,
s
->
extra_channels_buffer
,
s
->
extra_channels_buffer
,
full_channels
-
channels
,
full_channels
-
channels
,
s
->
frame
.
nb_samples
,
avctx
->
sample_fmt
,
0
);
frame
->
nb_samples
,
avctx
->
sample_fmt
,
0
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
}
}
...
@@ -1891,7 +1891,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -1891,7 +1891,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
s
->
lfe_data
[
i
]
=
s
->
lfe_data
[
i
+
lfe_samples
];
s
->
lfe_data
[
i
]
=
s
->
lfe_data
[
i
+
lfe_samples
];
*
got_frame_ptr
=
1
;
*
got_frame_ptr
=
1
;
*
(
AVFrame
*
)
data
=
s
->
frame
;
return
buf_size
;
return
buf_size
;
}
}
...
@@ -1925,9 +1924,6 @@ static av_cold int dca_decode_init(AVCodecContext *avctx)
...
@@ -1925,9 +1924,6 @@ static av_cold int dca_decode_init(AVCodecContext *avctx)
avctx
->
channels
=
avctx
->
request_channels
;
avctx
->
channels
=
avctx
->
request_channels
;
}
}
avcodec_get_frame_defaults
(
&
s
->
frame
);
avctx
->
coded_frame
=
&
s
->
frame
;
return
0
;
return
0
;
}
}
...
...
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