Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
a7466071
Commit
a7466071
authored
Jul 02, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed ASF_ReadObject_metadata to work like other functions.
parent
8770fee8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
64 deletions
+67
-64
modules/demux/asf/libasf.c
modules/demux/asf/libasf.c
+67
-64
No files found.
modules/demux/asf/libasf.c
View file @
a7466071
...
...
@@ -312,98 +312,99 @@ static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
asf_object_metadata_t
*
p_meta
=
(
asf_object_metadata_t
*
)
p_obj
;
int
i_peek
,
i_entries
,
i
;
const
uint8_t
*
p_peek
;
int
i_peek
;
unsigned
int
i
;
const
uint8_t
*
p_peek
,
*
p_data
;
#ifdef ASF_DEBUG
unsigned
int
j
;
#endif
if
(
stream_Peek
(
s
,
&
p_peek
,
p_meta
->
i_object_size
)
<
if
(
(
i_peek
=
stream_Peek
(
s
,
&
p_peek
,
p_meta
->
i_object_size
)
)
<
__MAX
(
(
int
)
p_meta
->
i_object_size
,
26
)
)
return
VLC_EGENERIC
;
p_meta
->
i_record_entries_count
=
0
;
p_meta
->
record
=
NULL
;
p_meta
->
i_record_entries_count
=
GetWLE
(
p_peek
+
24
);
i_peek
=
24
;
i_entries
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
for
(
i
=
0
;
i
<
i_entries
&&
i_peek
<
(
int
)
p_meta
->
i_object_size
-
12
;
i
++
)
{
asf_metadata_record_t
record
;
int
i_name
,
i_data
,
j
;
p_data
=
p_peek
+
26
;
p_meta
->
record
=
calloc
(
p_meta
->
i_record_entries_count
,
sizeof
(
asf_metadata_record_t
)
);
if
(
GetWLE
(
p_peek
+
i_peek
)
!=
0
)
for
(
i
=
0
;
i
<
p_meta
->
i_record_entries_count
;
i
++
)
{
ASF_FreeObject_metadata
(
p_obj
);
return
VLC_EGENERIC
;
}
asf_metadata_record_t
*
p_record
=
&
p_meta
->
record
[
i
];
int
i_name
;
int
i_data
;
int
j
;
i_peek
+=
2
;
record
.
i_stream
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
i_name
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
record
.
i_type
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
i_data
=
GetDWLE
(
p_peek
+
i_peek
);
i_peek
+=
4
;
if
(
&
p_data
[
2
+
2
+
2
+
2
+
4
]
>
&
p_peek
[
i_peek
]
)
break
;
if
(
record
.
i_type
>
ASF_METADATA_TYPE_WORD
||
i_peek
+
i_data
+
i_name
>
(
int
)
p_meta
->
i_object_size
)
{
ASF_FreeObject_metadata
(
p_obj
);
return
VLC_EGENERIC
;
}
if
(
GetWLE
(
p_data
)
!=
0
)
break
;
p_data
+=
2
;
p_record
->
i_stream
=
GetWLE
(
p_data
);
p_data
+=
2
;
i_name
=
GetWLE
(
p_data
);
p_data
+=
2
;
p_record
->
i_type
=
GetWLE
(
p_data
);
p_data
+=
2
;
i_data
=
GetDWLE
(
p_data
);
p_data
+=
4
;
record
.
i_val
=
0
;
record
.
i_data
=
0
;
record
.
p_data
=
0
;
if
(
&
p_data
[
i_name
+
i_data
]
>
&
p_peek
[
i_peek
]
)
break
;
/*
get
name */
record
.
psz_name
=
malloc
(
i_name
/
2
+
1
);
/*
Read
name */
p_record
->
psz_name
=
malloc
(
i_name
/
2
+
1
);
for
(
j
=
0
;
j
<
i_name
/
2
;
j
++
)
{
record
.
psz_name
[
j
]
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
p_record
->
psz_name
[
j
]
=
GetWLE
(
p_data
);
p_data
+=
2
;
}
record
.
psz_name
[
j
]
=
0
;
/* just to make sure */
p_record
->
psz_name
[
j
]
=
0
;
/*
get
data */
if
(
record
.
i_type
==
ASF_METADATA_TYPE_STRING
)
/*
Read
data */
if
(
p_record
->
i_type
==
ASF_METADATA_TYPE_STRING
)
{
record
.
p_data
=
malloc
(
i_data
/
2
+
1
);
record
.
i_data
=
i_data
/
2
;
p_record
->
p_data
=
malloc
(
i_data
/
2
+
1
);
p_record
->
i_data
=
i_data
/
2
;
/* FIXME Is that needed ? */
for
(
j
=
0
;
j
<
i_data
/
2
;
j
++
)
{
record
.
p_data
[
j
]
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
p_record
->
p_data
[
j
]
=
GetWLE
(
&
p_data
[
2
*
j
]
)
;
}
record
.
p_data
[
j
]
=
0
;
/* just to make sure */
p_record
->
p_data
[
j
]
=
0
;
/* just to make sure */
p_data
+=
i_data
;
}
else
if
(
record
.
i_type
==
ASF_METADATA_TYPE_BYTE
)
else
if
(
p_record
->
i_type
==
ASF_METADATA_TYPE_BYTE
)
{
record
.
p_data
=
malloc
(
i_data
);
record
.
i_data
=
i_data
;
memcpy
(
record
.
p_data
,
p_peek
+
i_peek
,
i_data
);
p_peek
+=
i_data
;
p_record
->
p_data
=
malloc
(
i_data
);
p_record
->
i_data
=
i_data
;
if
(
i_data
>
0
)
memcpy
(
p_record
->
p_data
,
p_data
,
i_data
);
p_data
+=
i_data
;
}
else
else
if
(
p_record
->
i_type
==
ASF_METADATA_TYPE_QWORD
)
{
if
(
record
.
i_type
==
ASF_METADATA_TYPE_QWORD
)
p_record
->
i_val
=
GetQWLE
(
p_data
);
p_data
+=
8
;
}
else
if
(
p_record
->
i_type
==
ASF_METADATA_TYPE_DWORD
)
{
record
.
i_val
=
GetQWLE
(
p_peek
+
i_peek
);
i_peek
+=
8
;
p_record
->
i_val
=
GetDWLE
(
p_data
);
p_data
+=
4
;
}
else
if
(
record
.
i_type
==
ASF_METADATA_TYPE_D
WORD
)
else
if
(
p_record
->
i_type
==
ASF_METADATA_TYPE_
WORD
)
{
record
.
i_val
=
GetDWLE
(
p_peek
+
i_peek
);
i_peek
+=
4
;
p_record
->
i_val
=
GetWLE
(
p_data
);
p_data
+=
2
;
}
else
else
if
(
p_record
->
i_type
==
ASF_METADATA_TYPE_BOOL
)
{
record
.
i_val
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
p_record
->
i_val
=
GetWLE
(
p_data
);
p_data
+=
2
;
}
else
{
/* Unknown */
p_data
+=
i_data
;
}
p_meta
->
i_record_entries_count
++
;
p_meta
->
record
=
realloc
(
p_meta
->
record
,
p_meta
->
i_record_entries_count
*
sizeof
(
asf_metadata_record_t
)
);
memcpy
(
&
p_meta
->
record
[
p_meta
->
i_record_entries_count
-
1
],
&
record
,
sizeof
(
asf_metadata_record_t
)
);
}
p_meta
->
i_record_entries_count
=
i
;
#ifdef ASF_DEBUG
msg_Dbg
(
s
,
...
...
@@ -597,12 +598,14 @@ static int ASF_ReadObject_codec_list( stream_t *s, asf_object_t *p_obj )
ASF_GetGUID
(
&
p_cl
->
i_reserved
,
p_peek
+
24
);
p_cl
->
i_codec_entries_count
=
GetWLE
(
p_peek
+
40
);
p_data
=
p_peek
+
44
;
if
(
p_cl
->
i_codec_entries_count
>
0
)
{
p_cl
->
codec
=
calloc
(
p_cl
->
i_codec_entries_count
,
sizeof
(
asf_codec_entry_t
)
);
p_data
=
p_peek
+
44
;
for
(
i_codec
=
0
;
i_codec
<
p_cl
->
i_codec_entries_count
;
i_codec
++
)
{
asf_codec_entry_t
*
p_codec
=
&
p_cl
->
codec
[
i_codec
];
...
...
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