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
6d39132f
Commit
6d39132f
authored
Apr 15, 2016
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/bink: Support Monkey Island 4 (SMUSH) files.
Fixes ticket #5410.
parent
139cbeb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
bink.c
libavformat/bink.c
+19
-2
version.h
libavformat/version.h
+1
-1
No files found.
libavformat/bink.c
View file @
6d39132f
...
...
@@ -45,6 +45,7 @@ enum BinkAudFlags {
#define BINK_MAX_AUDIO_TRACKS 256
#define BINK_MAX_WIDTH 7680
#define BINK_MAX_HEIGHT 4800
#define SMUSH_BLOCK_SIZE 512
typedef
struct
BinkDemuxContext
{
uint32_t
file_size
;
...
...
@@ -55,12 +56,15 @@ typedef struct BinkDemuxContext {
int64_t
audio_pts
[
BINK_MAX_AUDIO_TRACKS
];
uint32_t
remain_packet_size
;
int
smush_size
;
}
BinkDemuxContext
;
static
int
probe
(
AVProbeData
*
p
)
{
const
uint8_t
*
b
=
p
->
buf
;
int
smush
=
AV_RN32
(
p
->
buf
)
==
AV_RN32
(
"SMUS"
);
do
{
if
(((
b
[
0
]
==
'B'
&&
b
[
1
]
==
'I'
&&
b
[
2
]
==
'K'
&&
(
b
[
3
]
==
'b'
||
b
[
3
]
==
'f'
||
b
[
3
]
==
'g'
||
b
[
3
]
==
'h'
||
b
[
3
]
==
'i'
))
||
(
b
[
0
]
==
'K'
&&
b
[
1
]
==
'B'
&&
b
[
2
]
==
'2'
&&
/* Bink 2 */
...
...
@@ -70,6 +74,8 @@ static int probe(AVProbeData *p)
AV_RL32
(
b
+
24
)
>
0
&&
AV_RL32
(
b
+
24
)
<=
BINK_MAX_HEIGHT
&&
AV_RL32
(
b
+
28
)
>
0
&&
AV_RL32
(
b
+
32
)
>
0
)
// fps num,den
return
AVPROBE_SCORE_MAX
;
b
+=
SMUSH_BLOCK_SIZE
;
}
while
(
smush
&&
b
<
p
->
buf
+
p
->
buf_size
-
32
);
return
0
;
}
...
...
@@ -90,6 +96,17 @@ static int read_header(AVFormatContext *s)
return
AVERROR
(
ENOMEM
);
vst
->
codecpar
->
codec_tag
=
avio_rl32
(
pb
);
if
(
vst
->
codecpar
->
codec_tag
==
AV_RL32
(
"SMUS"
))
{
do
{
bink
->
smush_size
+=
SMUSH_BLOCK_SIZE
;
avio_skip
(
pb
,
SMUSH_BLOCK_SIZE
-
4
);
vst
->
codecpar
->
codec_tag
=
avio_rl32
(
pb
);
}
while
(
!
avio_feof
(
pb
)
&&
(
vst
->
codecpar
->
codec_tag
&
0xFFFFFF
)
!=
AV_RL32
(
"BIK"
));
if
(
avio_feof
(
pb
))
{
av_log
(
s
,
AV_LOG_ERROR
,
"invalid SMUSH header: BIK not found
\n
"
);
return
AVERROR_INVALIDDATA
;
}
}
bink
->
file_size
=
avio_rl32
(
pb
)
+
8
;
vst
->
duration
=
avio_rl32
(
pb
);
...
...
@@ -195,7 +212,7 @@ static int read_header(AVFormatContext *s)
}
if
(
vst
->
index_entries
)
avio_seek
(
pb
,
vst
->
index_entries
[
0
].
pos
,
SEEK_SET
);
avio_seek
(
pb
,
vst
->
index_entries
[
0
].
pos
+
bink
->
smush_size
,
SEEK_SET
);
else
avio_skip
(
pb
,
4
);
...
...
@@ -279,7 +296,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
return
-
1
;
/* seek to the first frame */
if
(
avio_seek
(
s
->
pb
,
vst
->
index_entries
[
0
].
pos
,
SEEK_SET
)
<
0
)
if
(
avio_seek
(
s
->
pb
,
vst
->
index_entries
[
0
].
pos
+
bink
->
smush_size
,
SEEK_SET
)
<
0
)
return
-
1
;
bink
->
video_pts
=
0
;
...
...
libavformat/version.h
View file @
6d39132f
...
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 34
#define LIBAVFORMAT_VERSION_MICRO 10
0
#define LIBAVFORMAT_VERSION_MICRO 10
1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
...
...
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