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
77788598
Commit
77788598
authored
Sep 15, 2015
by
Alexandra Hájková
Committed by
Luca Barbato
Sep 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dcadec: set channel layout in a separate function
Signed-off-by:
Luca Barbato
<
lu_zero@gentoo.org
>
parent
971177f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
57 deletions
+69
-57
dcadec.c
libavcodec/dcadec.c
+69
-57
No files found.
libavcodec/dcadec.c
View file @
77788598
...
@@ -1244,65 +1244,10 @@ static int scan_for_extensions(AVCodecContext *avctx)
...
@@ -1244,65 +1244,10 @@ static int scan_for_extensions(AVCodecContext *avctx)
return
ret
;
return
ret
;
}
}
/**
static
int
set_channel_layout
(
AVCodecContext
*
avctx
,
int
channels
,
int
num_core_channels
)
* Main frame decoding function
* FIXME add arguments
*/
static
int
dca_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
;
int
lfe_samples
;
int
num_core_channels
=
0
;
int
i
,
ret
;
float
**
samples_flt
;
DCAContext
*
s
=
avctx
->
priv_data
;
DCAContext
*
s
=
avctx
->
priv_data
;
int
channels
,
full_channels
;
int
i
;
int
upsample
=
0
;
s
->
exss_ext_mask
=
0
;
s
->
xch_present
=
0
;
s
->
dca_buffer_size
=
ff_dca_convert_bitstream
(
buf
,
buf_size
,
s
->
dca_buffer
,
DCA_MAX_FRAME_SIZE
+
DCA_MAX_EXSS_HEADER_SIZE
);
if
(
s
->
dca_buffer_size
==
AVERROR_INVALIDDATA
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Not a valid DCA frame
\n
"
);
return
AVERROR_INVALIDDATA
;
}
if
((
ret
=
dca_parse_frame_header
(
s
))
<
0
)
{
// seems like the frame is corrupt, try with the next one
return
ret
;
}
// set AVCodec values with parsed data
avctx
->
sample_rate
=
s
->
sample_rate
;
avctx
->
bit_rate
=
s
->
bit_rate
;
s
->
profile
=
FF_PROFILE_DTS
;
for
(
i
=
0
;
i
<
(
s
->
sample_blocks
/
8
);
i
++
)
{
if
((
ret
=
dca_decode_block
(
s
,
0
,
i
)))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"error decoding block
\n
"
);
return
ret
;
}
}
/* record number of core channels incase less than max channels are requested */
num_core_channels
=
s
->
prim_channels
;
if
(
s
->
ext_coding
)
s
->
core_ext_mask
=
dca_ext_audio_descr_mask
[
s
->
ext_descr
];
else
s
->
core_ext_mask
=
0
;
ret
=
scan_for_extensions
(
avctx
);
avctx
->
profile
=
s
->
profile
;
full_channels
=
channels
=
s
->
prim_channels
+
!!
s
->
lfe
;
if
(
s
->
amode
<
16
)
{
if
(
s
->
amode
<
16
)
{
avctx
->
channel_layout
=
dca_core_channel_layout
[
s
->
amode
];
avctx
->
channel_layout
=
dca_core_channel_layout
[
s
->
amode
];
...
@@ -1389,6 +1334,73 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
...
@@ -1389,6 +1334,73 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data,
av_log
(
avctx
,
AV_LOG_ERROR
,
"Non standard configuration %d !
\n
"
,
s
->
amode
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Non standard configuration %d !
\n
"
,
s
->
amode
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
return
0
;
}
/**
* Main frame decoding function
* FIXME add arguments
*/
static
int
dca_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
;
int
lfe_samples
;
int
num_core_channels
=
0
;
int
i
,
ret
;
float
**
samples_flt
;
DCAContext
*
s
=
avctx
->
priv_data
;
int
channels
,
full_channels
;
int
upsample
=
0
;
s
->
exss_ext_mask
=
0
;
s
->
xch_present
=
0
;
s
->
dca_buffer_size
=
ff_dca_convert_bitstream
(
buf
,
buf_size
,
s
->
dca_buffer
,
DCA_MAX_FRAME_SIZE
+
DCA_MAX_EXSS_HEADER_SIZE
);
if
(
s
->
dca_buffer_size
==
AVERROR_INVALIDDATA
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Not a valid DCA frame
\n
"
);
return
AVERROR_INVALIDDATA
;
}
if
((
ret
=
dca_parse_frame_header
(
s
))
<
0
)
{
// seems like the frame is corrupt, try with the next one
return
ret
;
}
// set AVCodec values with parsed data
avctx
->
sample_rate
=
s
->
sample_rate
;
avctx
->
bit_rate
=
s
->
bit_rate
;
s
->
profile
=
FF_PROFILE_DTS
;
for
(
i
=
0
;
i
<
(
s
->
sample_blocks
/
8
);
i
++
)
{
if
((
ret
=
dca_decode_block
(
s
,
0
,
i
)))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"error decoding block
\n
"
);
return
ret
;
}
}
/* record number of core channels incase less than max channels are requested */
num_core_channels
=
s
->
prim_channels
;
if
(
s
->
ext_coding
)
s
->
core_ext_mask
=
dca_ext_audio_descr_mask
[
s
->
ext_descr
];
else
s
->
core_ext_mask
=
0
;
ret
=
scan_for_extensions
(
avctx
);
avctx
->
profile
=
s
->
profile
;
full_channels
=
channels
=
s
->
prim_channels
+
!!
s
->
lfe
;
ret
=
set_channel_layout
(
avctx
,
channels
,
num_core_channels
);
if
(
ret
<
0
)
return
ret
;
avctx
->
channels
=
channels
;
avctx
->
channels
=
channels
;
/* get output buffer */
/* get output buffer */
...
...
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