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
b16960a8
Commit
b16960a8
authored
Sep 22, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tta: fix reading of format in TTA header.
TTA does not support float at all, and format 2 is encrypted TTA.
parent
4d3e7a75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
tta.c
libavcodec/tta.c
+14
-18
No files found.
libavcodec/tta.c
View file @
b16960a8
...
...
@@ -33,8 +33,8 @@
#include "avcodec.h"
#include "get_bits.h"
#define FORMAT_
INT
1
#define FORMAT_
FLOAT 3
#define FORMAT_
SIMPLE
1
#define FORMAT_
ENCRYPTED 2
#define MAX_ORDER 16
typedef
struct
TTAFilter
{
...
...
@@ -58,7 +58,7 @@ typedef struct TTAContext {
AVCodecContext
*
avctx
;
GetBitContext
gb
;
int
f
lags
,
channels
,
bps
,
is_float
,
data_length
;
int
f
ormat
,
channels
,
bps
,
data_length
;
int
frame_length
,
last_frame_length
,
total_frames
;
int32_t
*
decode_buffer
;
...
...
@@ -204,13 +204,15 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
/* signature */
skip_bits
(
&
s
->
gb
,
32
);
s
->
flags
=
get_bits
(
&
s
->
gb
,
16
);
if
(
s
->
flags
!=
1
&&
s
->
flags
!=
3
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid flags
\n
"
);
s
->
format
=
get_bits
(
&
s
->
gb
,
16
);
if
(
s
->
format
>
2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Invalid format
\n
"
);
return
-
1
;
}
s
->
is_float
=
(
s
->
flags
==
FORMAT_FLOAT
);
if
(
s
->
format
==
FORMAT_ENCRYPTED
)
{
av_log_missing_feature
(
s
->
avctx
,
"Encrypted TTA"
,
0
);
return
AVERROR
(
EINVAL
);
}
avctx
->
channels
=
s
->
channels
=
get_bits
(
&
s
->
gb
,
16
);
avctx
->
bits_per_coded_sample
=
get_bits
(
&
s
->
gb
,
16
);
s
->
bps
=
(
avctx
->
bits_per_coded_sample
+
7
)
/
8
;
...
...
@@ -222,13 +224,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s
->
data_length
=
get_bits_long
(
&
s
->
gb
,
32
);
skip_bits
(
&
s
->
gb
,
32
);
// CRC32 of header
if
(
s
->
is_float
)
{
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_FLT
;
av_log_ask_for_sample
(
s
->
avctx
,
"Unsupported sample format.
\n
"
);
return
-
1
;
}
else
switch
(
s
->
bps
)
{
switch
(
s
->
bps
)
{
// case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break;
case
2
:
avctx
->
sample_fmt
=
AV_SAMPLE_FMT_S16
;
break
;
// case 3: avctx->sample_fmt = AV_SAMPLE_FMT_S24; break;
...
...
@@ -247,8 +243,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
s
->
total_frames
=
s
->
data_length
/
s
->
frame_length
+
(
s
->
last_frame_length
?
1
:
0
);
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"f
lags: %x
chans: %d bps: %d rate: %d block: %d
\n
"
,
s
->
f
lags
,
avctx
->
channels
,
avctx
->
bits_per_coded_sample
,
avctx
->
sample_rate
,
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"f
ormat: %d
chans: %d bps: %d rate: %d block: %d
\n
"
,
s
->
f
ormat
,
avctx
->
channels
,
avctx
->
bits_per_coded_sample
,
avctx
->
sample_rate
,
avctx
->
block_align
);
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"data_length: %d frame_length: %d last: %d total: %d
\n
"
,
s
->
data_length
,
s
->
frame_length
,
s
->
last_frame_length
,
s
->
total_frames
);
...
...
@@ -372,7 +368,7 @@ static int tta_decode_frame(AVCodecContext *avctx,
cur_chan
++
;
else
{
// decorrelate in case of stereo integer
if
(
!
s
->
is_float
&&
(
s
->
channels
>
1
)
)
{
if
(
s
->
channels
>
1
)
{
int32_t
*
r
=
p
-
1
;
for
(
*
p
+=
*
r
/
2
;
r
>
p
-
s
->
channels
;
r
--
)
*
r
=
*
(
r
+
1
)
-
*
r
;
...
...
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