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
7cf2ad43
Commit
7cf2ad43
authored
Sep 10, 2004
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/demux/asf/*: get video aspect ratio from metadata object.
parent
6c84da28
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
17 deletions
+60
-17
modules/demux/asf/asf.c
modules/demux/asf/asf.c
+44
-6
modules/demux/asf/libasf.c
modules/demux/asf/libasf.c
+16
-10
modules/demux/asf/libasf.h
modules/demux/asf/libasf.h
+0
-1
No files found.
modules/demux/asf/asf.c
View file @
7cf2ad43
...
...
@@ -679,25 +679,63 @@ static int DemuxInit( demux_t *p_demux )
msg_Dbg
(
p_demux
,
"added new audio stream(codec:0x%x,ID:%d)"
,
GetWLE
(
p_data
),
p_sp
->
i_stream_number
);
}
else
if
(
ASF_CmpGUID
(
&
p_sp
->
i_stream_type
,
&
asf_object_stream_type_video
)
&&
p_sp
->
i_type_specific_data_length
>=
11
+
sizeof
(
BITMAPINFOHEADER
)
)
else
if
(
ASF_CmpGUID
(
&
p_sp
->
i_stream_type
,
&
asf_object_stream_type_video
)
&&
p_sp
->
i_type_specific_data_length
>=
11
+
sizeof
(
BITMAPINFOHEADER
)
)
{
es_format_t
fmt
;
uint8_t
*
p_data
=
&
p_sp
->
p_type_specific_data
[
11
];
es_format_Init
(
&
fmt
,
VIDEO_ES
,
VLC_FOURCC
(
p_data
[
16
],
p_data
[
17
],
p_data
[
18
],
p_data
[
19
]
)
);
VLC_FOURCC
(
p_data
[
16
],
p_data
[
17
],
p_data
[
18
],
p_data
[
19
]
)
);
fmt
.
video
.
i_width
=
GetDWLE
(
p_data
+
4
);
fmt
.
video
.
i_height
=
GetDWLE
(
p_data
+
8
);
if
(
p_sp
->
i_type_specific_data_length
>
11
+
sizeof
(
BITMAPINFOHEADER
)
)
if
(
p_sp
->
i_type_specific_data_length
>
11
+
sizeof
(
BITMAPINFOHEADER
)
)
{
fmt
.
i_extra
=
__MIN
(
GetDWLE
(
p_data
),
p_sp
->
i_type_specific_data_length
-
11
-
sizeof
(
BITMAPINFOHEADER
)
);
p_sp
->
i_type_specific_data_length
-
11
-
sizeof
(
BITMAPINFOHEADER
)
);
fmt
.
p_extra
=
malloc
(
fmt
.
i_extra
);
memcpy
(
fmt
.
p_extra
,
&
p_data
[
sizeof
(
BITMAPINFOHEADER
)],
fmt
.
i_extra
);
memcpy
(
fmt
.
p_extra
,
&
p_data
[
sizeof
(
BITMAPINFOHEADER
)],
fmt
.
i_extra
);
}
/* Look for an aspect ratio */
if
(
p_sys
->
p_root
->
p_metadata
)
{
asf_object_metadata_t
*
p_meta
=
p_sys
->
p_root
->
p_metadata
;
int
i
,
i_aspect_x
=
0
,
i_aspect_y
=
0
;
for
(
i
=
0
;
i
<
p_meta
->
i_record_entries_count
;
i
++
)
{
if
(
!
strcmp
(
p_meta
->
record
[
i
].
psz_name
,
"AspectRatioX"
)
)
{
if
(
(
!
i_aspect_x
&&
!
p_meta
->
record
[
i
].
i_stream
)
||
p_meta
->
record
[
i
].
i_stream
==
p_sp
->
i_stream_number
)
i_aspect_x
=
p_meta
->
record
[
i
].
i_val
;
}
if
(
!
strcmp
(
p_meta
->
record
[
i
].
psz_name
,
"AspectRatioY"
)
)
{
if
(
(
!
i_aspect_y
&&
!
p_meta
->
record
[
i
].
i_stream
)
||
p_meta
->
record
[
i
].
i_stream
==
p_sp
->
i_stream_number
)
i_aspect_y
=
p_meta
->
record
[
i
].
i_val
;
}
}
if
(
i_aspect_x
&&
i_aspect_y
)
{
fmt
.
video
.
i_aspect
=
i_aspect_x
*
fmt
.
video
.
i_width
*
VOUT_ASPECT_FACTOR
/
(
int64_t
)
fmt
.
video
.
i_height
/
i_aspect_y
;
}
}
tk
->
i_cat
=
VIDEO_ES
;
tk
->
p_es
=
es_out_Add
(
p_demux
->
out
,
&
fmt
);
es_format_Clean
(
&
fmt
);
...
...
modules/demux/asf/libasf.c
View file @
7cf2ad43
...
...
@@ -348,23 +348,27 @@ static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
record
.
p_data
=
0
;
/* get name */
record
.
psz_name
=
malloc
(
i_name
/
2
);
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
;
}
record
.
psz_name
[
j
]
=
0
;
/* just to make sure */
/* get data */
if
(
record
.
i_type
==
ASF_METADATA_TYPE_STRING
)
{
record
.
p_data
=
malloc
(
i_data
/
2
);
record
.
p_data
=
malloc
(
i_data
/
2
+
1
);
record
.
i_data
=
i_data
/
2
;
for
(
j
=
0
;
j
<
i_data
/
2
;
j
++
)
{
record
.
p_data
[
j
]
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
}
record
.
p_data
[
j
]
=
0
;
/* just to make sure */
#ifdef ASF_DEBUG
msg_Dbg
(
s
,
"metadata: %s=%s"
,
record
.
psz_name
,
record
.
p_data
);
#endif
}
else
if
(
record
.
i_type
==
ASF_METADATA_TYPE_BYTE
)
{
...
...
@@ -373,8 +377,10 @@ static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
memcpy
(
record
.
p_data
,
p_peek
+
i_peek
,
i_data
);
p_peek
+=
i_data
;
#ifdef ASF_DEBUG
msg_Dbg
(
s
,
"metadata: %s (%i bytes)"
,
record
.
psz_name
,
record
.
i_data
);
#endif
}
else
{
...
...
@@ -391,7 +397,9 @@ static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj )
record
.
i_val
=
GetWLE
(
p_peek
+
i_peek
);
i_peek
+=
2
;
}
#ifdef ASF_DEBUG
msg_Dbg
(
s
,
"metadata: %s=%i"
,
record
.
psz_name
,
record
.
i_val
);
#endif
}
p_meta
->
i_record_entries_count
++
;
...
...
@@ -880,7 +888,6 @@ asf_object_root_t *ASF_ReadObjectRoot( stream_t *s, int b_seekable )
p_root
->
p_data
=
NULL
;
p_root
->
p_fp
=
NULL
;
p_root
->
p_index
=
NULL
;
p_root
->
p_hdr_ext
=
NULL
;
p_root
->
p_metadata
=
NULL
;
for
(
;
;
)
...
...
@@ -903,9 +910,6 @@ asf_object_root_t *ASF_ReadObjectRoot( stream_t *s, int b_seekable )
case
(
ASF_OBJECT_TYPE_INDEX
):
p_root
->
p_index
=
(
asf_object_index_t
*
)
p_obj
;
break
;
case
(
ASF_OBJECT_TYPE_HEADER_EXTENSION
):
p_root
->
p_hdr_ext
=
(
asf_object_header_extension_t
*
)
p_obj
;
break
;
default:
msg_Warn
(
(
vlc_object_t
*
)
s
,
"unknow object found"
);
break
;
...
...
@@ -935,17 +939,19 @@ asf_object_root_t *ASF_ReadObjectRoot( stream_t *s, int b_seekable )
if
(
p_root
->
p_fp
)
{
if
(
p_root
->
p_hdr_ext
!=
NULL
)
asf_object_t
*
p_hdr_ext
=
ASF_FindObject
(
p_root
->
p_hdr
,
&
asf_object_header_extension_guid
,
0
);
if
(
p_hdr_ext
)
{
p_root
->
p_metadata
=
ASF_FindObject
(
p_
root
->
p_
hdr_ext
,
ASF_FindObject
(
p_hdr_ext
,
&
asf_object_metadata_guid
,
0
);
}
return
p_root
;
}
msg_Warn
(
(
vlc_object_t
*
)
s
,
"cannot find file properties object"
);
msg_Warn
(
s
,
"cannot find file properties object"
);
}
/* Invalid file */
...
...
modules/demux/asf/libasf.h
View file @
7cf2ad43
...
...
@@ -308,7 +308,6 @@ typedef struct asf_object_root_s
asf_object_data_t
*
p_data
;
/* could be NULL if !b_seekable or not-present */
asf_object_index_t
*
p_index
;
asf_object_header_extension_t
*
p_hdr_ext
;
/* from asf_object_header_t */
asf_object_file_properties_t
*
p_fp
;
...
...
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