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
45782a98
Commit
45782a98
authored
Apr 01, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write aspect ratio when muxing gif.
parent
cecb6d6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
9 deletions
+16
-9
gif.c
libavformat/gif.c
+14
-7
version.h
libavformat/version.h
+1
-1
gif
tests/ref/lavf/gif
+1
-1
No files found.
libavformat/gif.c
View file @
45782a98
...
...
@@ -28,10 +28,18 @@
#include "libavutil/log.h"
#include "libavutil/opt.h"
static
int
gif_image_write_header
(
AV
IOContext
*
pb
,
int
width
,
int
height
,
static
int
gif_image_write_header
(
AV
FormatContext
*
s
,
int
width
,
int
height
,
int
loop_count
,
uint32_t
*
palette
)
{
int
i
;
AVIOContext
*
pb
=
s
->
pb
;
AVRational
sar
=
s
->
streams
[
0
]
->
codec
->
sample_aspect_ratio
;
int
i
,
aspect
=
0
;
if
(
sar
.
num
>
0
&&
sar
.
den
>
0
)
{
aspect
=
sar
.
num
*
64
/
sar
.
den
-
15
;
if
(
aspect
<
0
||
aspect
>
255
)
aspect
=
0
;
}
avio_write
(
pb
,
"GIF"
,
3
);
avio_write
(
pb
,
"89a"
,
3
);
...
...
@@ -41,7 +49,7 @@ static int gif_image_write_header(AVIOContext *pb, int width, int height,
if
(
palette
)
{
avio_w8
(
pb
,
0xf7
);
/* flags: global clut, 256 entries */
avio_w8
(
pb
,
0x1f
);
/* background color index */
avio_w8
(
pb
,
0
);
/* aspect ratio */
avio_w8
(
pb
,
aspect
);
for
(
i
=
0
;
i
<
256
;
i
++
)
{
const
uint32_t
v
=
palette
[
i
]
&
0xffffff
;
avio_wb24
(
pb
,
v
);
...
...
@@ -49,7 +57,7 @@ static int gif_image_write_header(AVIOContext *pb, int width, int height,
}
else
{
avio_w8
(
pb
,
0
);
/* flags */
avio_w8
(
pb
,
0
);
/* background color index */
avio_w8
(
pb
,
0
);
/* aspect ratio */
avio_w8
(
pb
,
aspect
);
}
...
...
@@ -79,7 +87,6 @@ typedef struct {
static
int
gif_write_header
(
AVFormatContext
*
s
)
{
GIFContext
*
gif
=
s
->
priv_data
;
AVIOContext
*
pb
=
s
->
pb
;
AVCodecContext
*
video_enc
;
int
width
,
height
;
uint32_t
palette
[
AVPALETTE_COUNT
];
...
...
@@ -99,9 +106,9 @@ static int gif_write_header(AVFormatContext *s)
avpriv_set_pts_info
(
s
->
streams
[
0
],
64
,
1
,
100
);
if
(
avpriv_set_systematic_pal2
(
palette
,
video_enc
->
pix_fmt
)
<
0
)
{
av_assert0
(
video_enc
->
pix_fmt
==
AV_PIX_FMT_PAL8
);
gif_image_write_header
(
pb
,
width
,
height
,
gif
->
loop
,
NULL
);
gif_image_write_header
(
s
,
width
,
height
,
gif
->
loop
,
NULL
);
}
else
{
gif_image_write_header
(
pb
,
width
,
height
,
gif
->
loop
,
palette
);
gif_image_write_header
(
s
,
width
,
height
,
gif
->
loop
,
palette
);
}
avio_flush
(
s
->
pb
);
...
...
libavformat/version.h
View file @
45782a98
...
...
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 55
#define LIBAVFORMAT_VERSION_MINOR 36
#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, \
...
...
tests/ref/lavf/gif
View file @
45782a98
8aef8081e8afa445f63f320f4a1c5edb
*./tests/data/lavf/lavf.gif
a7365d5015b227f495210e9846d6f3ed
*./tests/data/lavf/lavf.gif
2030198 ./tests/data/lavf/lavf.gif
./tests/data/lavf/lavf.gif CRC=0x0dc5477c
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