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
bb7c5580
Commit
bb7c5580
authored
May 03, 2016
by
foo86
Committed by
James Almer
May 04, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/dtsdec: detect core-less streams
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
fe483ac4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
7 deletions
+40
-7
dtsdec.c
libavformat/dtsdec.c
+40
-7
No files found.
libavformat/dtsdec.c
View file @
bb7c5580
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#include "libavutil/crc.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/dca.h"
#include "libavcodec/dca.h"
#include "libavcodec/dca_syncwords.h"
#include "libavcodec/dca_syncwords.h"
...
@@ -32,23 +34,51 @@ static int dts_probe(AVProbeData *p)
...
@@ -32,23 +34,51 @@ static int dts_probe(AVProbeData *p)
const
uint8_t
*
buf
,
*
bufp
;
const
uint8_t
*
buf
,
*
bufp
;
uint32_t
state
=
-
1
;
uint32_t
state
=
-
1
;
int
markers
[
4
*
16
]
=
{
0
};
int
markers
[
4
*
16
]
=
{
0
};
int
sum
,
max
,
i
;
int
exss_markers
=
0
,
exss_nextpos
=
0
;
int
sum
,
max
,
pos
,
i
;
int64_t
diff
=
0
;
int64_t
diff
=
0
;
uint8_t
hdr
[
12
+
AV_INPUT_BUFFER_PADDING_SIZE
]
=
{
0
};
uint8_t
hdr
[
12
+
AV_INPUT_BUFFER_PADDING_SIZE
]
=
{
0
};
const
AVCRC
*
crctab
=
av_crc_get_table
(
AV_CRC_16_CCITT
);
buf
=
p
->
buf
+
FFMIN
(
4096
,
p
->
buf_size
);
for
(
pos
=
FFMIN
(
4096
,
p
->
buf_size
);
pos
<
p
->
buf_size
-
2
;
pos
+=
2
)
{
for
(;
buf
<
(
p
->
buf
+
p
->
buf_size
)
-
2
;
buf
+=
2
)
{
int
marker
,
sample_blocks
,
sample_rate
,
sr_code
,
framesize
;
int
marker
,
sample_blocks
,
sample_rate
,
sr_code
,
framesize
;
int
lfe
;
int
lfe
,
wide_hdr
,
hdr_size
;
GetBitContext
gb
;
GetBitContext
gb
;
bufp
=
buf
;
bufp
=
buf
=
p
->
buf
+
pos
;
state
=
(
state
<<
16
)
|
bytestream_get_be16
(
&
bufp
);
state
=
(
state
<<
16
)
|
bytestream_get_be16
(
&
bufp
);
if
(
buf
-
p
->
buf
>=
4
)
if
(
pos
>=
4
)
diff
+=
FFABS
(((
int16_t
)
AV_RL16
(
buf
))
-
(
int16_t
)
AV_RL16
(
buf
-
4
));
diff
+=
FFABS
(((
int16_t
)
AV_RL16
(
buf
))
-
(
int16_t
)
AV_RL16
(
buf
-
4
));
/* extension substream (EXSS) */
if
(
state
==
DCA_SYNCWORD_SUBSTREAM
)
{
if
(
pos
<
exss_nextpos
)
continue
;
init_get_bits
(
&
gb
,
buf
-
2
,
96
);
skip_bits_long
(
&
gb
,
42
);
wide_hdr
=
get_bits1
(
&
gb
);
hdr_size
=
get_bits
(
&
gb
,
8
+
4
*
wide_hdr
)
+
1
;
framesize
=
get_bits
(
&
gb
,
16
+
4
*
wide_hdr
)
+
1
;
if
(
hdr_size
&
3
||
framesize
&
3
)
continue
;
if
(
hdr_size
<
16
||
framesize
<
hdr_size
)
continue
;
if
(
pos
-
2
+
hdr_size
>
p
->
buf_size
)
continue
;
if
(
av_crc
(
crctab
,
0xffff
,
buf
+
3
,
hdr_size
-
5
))
continue
;
if
(
pos
==
exss_nextpos
)
exss_markers
++
;
else
exss_markers
=
FFMAX
(
1
,
exss_markers
-
1
);
exss_nextpos
=
pos
+
framesize
;
continue
;
}
/* regular bitstream */
/* regular bitstream */
if
(
state
==
DCA_SYNCWORD_CORE_BE
&&
if
(
state
==
DCA_SYNCWORD_CORE_BE
&&
(
bytestream_get_be16
(
&
bufp
)
&
0xFC00
)
==
0xFC00
)
(
bytestream_get_be16
(
&
bufp
)
&
0xFC00
)
==
0xFC00
)
...
@@ -103,6 +133,9 @@ static int dts_probe(AVProbeData *p)
...
@@ -103,6 +133,9 @@ static int dts_probe(AVProbeData *p)
markers
[
marker
]
++
;
markers
[
marker
]
++
;
}
}
if
(
exss_markers
>
3
)
return
AVPROBE_SCORE_EXTENSION
+
1
;
sum
=
max
=
0
;
sum
=
max
=
0
;
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
markers
);
i
++
)
{
for
(
i
=
0
;
i
<
FF_ARRAY_ELEMS
(
markers
);
i
++
)
{
sum
+=
markers
[
i
];
sum
+=
markers
[
i
];
...
...
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