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
bb0984cc
Commit
bb0984cc
authored
Dec 12, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/gif: enable encoding single gif image per frame
Unbreaks gif image2 muxer.
parent
80f0f866
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
gif.c
libavcodec/gif.c
+14
-6
No files found.
libavcodec/gif.c
View file @
bb0984cc
...
...
@@ -51,6 +51,7 @@ typedef struct GIFContext {
int
is_first_frame
;
AVFrame
*
last_frame
;
int
flags
;
int
image
;
uint32_t
palette
[
AVPALETTE_COUNT
];
///< local reference palette for !pal8
int
palette_loaded
;
int
transparent_index
;
...
...
@@ -422,6 +423,9 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
outbuf_ptr
=
pkt
->
data
;
end
=
pkt
->
data
+
pkt
->
size
;
if
(
s
->
image
)
s
->
is_first_frame
=
1
;
if
(
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
)
{
palette
=
(
uint32_t
*
)
pict
->
data
[
1
];
...
...
@@ -436,19 +440,22 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
gif_image_write_image
(
avctx
,
&
outbuf_ptr
,
end
,
palette
,
pict
->
data
[
0
],
pict
->
linesize
[
0
],
pkt
);
if
(
!
s
->
last_frame
)
{
if
(
!
s
->
last_frame
&&
!
s
->
image
)
{
s
->
last_frame
=
av_frame_alloc
();
if
(
!
s
->
last_frame
)
return
AVERROR
(
ENOMEM
);
}
av_frame_unref
(
s
->
last_frame
);
ret
=
av_frame_ref
(
s
->
last_frame
,
(
AVFrame
*
)
pict
);
if
(
ret
<
0
)
return
ret
;
if
(
!
s
->
image
)
{
av_frame_unref
(
s
->
last_frame
);
ret
=
av_frame_ref
(
s
->
last_frame
,
(
AVFrame
*
)
pict
);
if
(
ret
<
0
)
return
ret
;
}
pkt
->
size
=
outbuf_ptr
-
pkt
->
data
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
if
(
s
->
is_first_frame
)
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
return
0
;
...
...
@@ -472,6 +479,7 @@ static const AVOption gif_options[] = {
{
"gifflags"
,
"set GIF flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
GF_OFFSETTING
|
GF_TRANSDIFF
},
0
,
INT_MAX
,
FLAGS
,
"flags"
},
{
"offsetting"
,
"enable picture offsetting"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
GF_OFFSETTING
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"flags"
},
{
"transdiff"
,
"enable transparency detection between frames"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
GF_TRANSDIFF
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"flags"
},
{
"gifimage"
,
"enable encoding only images per frame"
,
OFFSET
(
image
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"flags"
},
{
NULL
}
};
...
...
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