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
a3bd33af
Commit
a3bd33af
authored
Apr 17, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write sample_aspect_ratio to asf files.
Fixes ticket #3528.
parent
6c18200c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
3 deletions
+39
-3
asfenc.c
libavformat/asfenc.c
+39
-3
No files found.
libavformat/asfenc.c
View file @
a3bd33af
...
...
@@ -352,7 +352,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
AVIOContext
*
pb
=
s
->
pb
;
AVDictionaryEntry
*
tags
[
5
];
int
header_size
,
n
,
extra_size
,
extra_size2
,
wav_extra_size
,
file_time
;
int
has_title
;
int
has_title
,
has_aspect_ratio
=
0
;
int
metadata_count
;
AVCodecContext
*
enc
;
int64_t
header_offset
,
cur_pos
,
hpos
;
...
...
@@ -378,6 +378,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
avpriv_set_pts_info
(
s
->
streams
[
n
],
32
,
1
,
1000
);
/* 32 bit pts in ms */
bit_rate
+=
enc
->
bit_rate
;
if
(
enc
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
enc
->
sample_aspect_ratio
.
num
>
0
&&
enc
->
sample_aspect_ratio
.
den
>
0
)
has_aspect_ratio
++
;
}
if
(
asf
->
is_streamed
)
{
...
...
@@ -410,8 +414,40 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size,
/* unknown headers */
hpos
=
put_header
(
pb
,
&
ff_asf_head1_guid
);
ff_put_guid
(
pb
,
&
ff_asf_head2_guid
);
avio_wl32
(
pb
,
6
);
avio_wl16
(
pb
,
0
);
avio_wl16
(
pb
,
6
);
if
(
has_aspect_ratio
)
{
int64_t
hpos2
;
avio_wl32
(
pb
,
26
+
has_aspect_ratio
*
84
);
hpos2
=
put_header
(
pb
,
&
ff_asf_metadata_header
);
avio_wl16
(
pb
,
2
*
has_aspect_ratio
);
for
(
n
=
0
;
n
<
s
->
nb_streams
;
n
++
)
{
enc
=
s
->
streams
[
n
]
->
codec
;
if
(
enc
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
enc
->
sample_aspect_ratio
.
num
>
0
&&
enc
->
sample_aspect_ratio
.
den
>
0
)
{
AVRational
sar
=
enc
->
sample_aspect_ratio
;
avio_wl16
(
pb
,
0
);
// the stream number is set like this below
avio_wl16
(
pb
,
n
+
1
);
avio_wl16
(
pb
,
26
);
// name_len
avio_wl16
(
pb
,
3
);
// value_type
avio_wl32
(
pb
,
4
);
// value_len
avio_put_str16le
(
pb
,
"AspectRatioX"
);
avio_wl32
(
pb
,
sar
.
num
);
avio_wl16
(
pb
,
0
);
// the stream number is set like this below
avio_wl16
(
pb
,
n
+
1
);
avio_wl16
(
pb
,
26
);
// name_len
avio_wl16
(
pb
,
3
);
// value_type
avio_wl32
(
pb
,
4
);
// value_len
avio_put_str16le
(
pb
,
"AspectRatioY"
);
avio_wl32
(
pb
,
sar
.
den
);
}
}
end_header
(
pb
,
hpos2
);
}
else
{
avio_wl32
(
pb
,
0
);
}
end_header
(
pb
,
hpos
);
/* title and other infos */
...
...
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