Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
fee9386c
Commit
fee9386c
authored
Oct 30, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added targa support to image demuxer.
parent
b7505eeb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
modules/demux/image.c
modules/demux/image.c
+48
-0
No files found.
modules/demux/image.c
View file @
fee9386c
...
...
@@ -404,6 +404,51 @@ static bool IsSpiff(stream_t *s)
return
true
;
}
static
bool
IsTarga
(
stream_t
*
s
)
{
/* The header is not enough to ensure proper detection, we need
* to have a look at the footer. But doing so can be slow. So
* try to avoid it when possible */
const
uint8_t
*
header
;
if
(
stream_Peek
(
s
,
&
header
,
18
)
<
18
)
/* Targa fixed header */
return
false
;
if
(
header
[
1
]
>
1
)
/* Color Map Type */
return
false
;
if
((
header
[
1
]
!=
0
||
header
[
3
+
4
]
!=
0
)
&&
header
[
3
+
4
]
!=
8
&&
header
[
3
+
4
]
!=
15
&&
header
[
3
+
4
]
!=
16
&&
header
[
3
+
4
]
!=
24
&&
header
[
3
+
4
]
!=
32
)
return
false
;
if
((
header
[
2
]
>
3
&&
header
[
2
]
<
9
)
||
header
[
2
]
>
11
)
/* Image Type */
return
false
;
if
(
GetWLE
(
&
header
[
8
+
4
])
<=
0
||
/* Width */
GetWLE
(
&
header
[
8
+
6
])
<=
0
)
/* Height */
return
false
;
if
(
header
[
8
+
8
]
!=
8
&&
header
[
8
+
8
]
!=
15
&&
header
[
8
+
8
]
!=
16
&&
header
[
8
+
8
]
!=
24
&&
header
[
8
+
8
]
!=
32
)
return
false
;
if
(
header
[
8
+
9
]
&
0xc0
)
/* Reserved bits */
return
false
;
const
int64_t
size
=
stream_Size
(
s
);
if
(
size
<=
18
+
26
)
return
false
;
bool
can_seek
;
if
(
stream_Control
(
s
,
STREAM_CAN_SEEK
,
&
can_seek
)
||
!
can_seek
)
return
false
;
const
int64_t
position
=
stream_Tell
(
s
);
if
(
stream_Seek
(
s
,
size
-
26
))
return
false
;
const
uint8_t
*
footer
;
bool
is_targa
=
stream_Peek
(
s
,
&
footer
,
26
)
>=
26
&&
!
memcmp
(
&
footer
[
8
],
"TRUEVISION-XFILE.
\x00
"
,
18
);
stream_Seek
(
s
,
position
);
return
is_targa
;
}
typedef
struct
{
vlc_fourcc_t
codec
;
int
marker_size
;
...
...
@@ -468,6 +513,9 @@ static const image_format_t formats[] = {
{
.
codec
=
VLC_CODEC_JPEG
,
.
detect
=
IsSpiff
,
},
{
.
codec
=
VLC_CODEC_TARGA
,
.
detect
=
IsTarga
,
},
{
.
codec
=
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