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
131698af
Commit
131698af
authored
Feb 24, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flashsv2enc: switch to encode2()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e2cc39b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
flashsv2enc.c
libavcodec/flashsv2enc.c
+15
-12
No files found.
libavcodec/flashsv2enc.c
View file @
131698af
...
...
@@ -823,17 +823,22 @@ static int reconfigure_at_keyframe(FlashSV2Context * s, const uint8_t * image,
return
0
;
}
static
int
flashsv2_encode_frame
(
AVCodecContext
*
avctx
,
uint8_t
*
buf
,
int
buf_size
,
void
*
data
)
static
int
flashsv2_encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
pict
,
int
*
got_packet
)
{
FlashSV2Context
*
const
s
=
avctx
->
priv_data
;
AVFrame
*
pict
=
data
;
AVFrame
*
const
p
=
&
s
->
frame
;
int
res
;
int
keyframe
=
0
;
*
p
=
*
pict
;
if
(
!
pkt
->
data
&&
(
res
=
av_new_packet
(
pkt
,
s
->
frame_size
+
FF_MIN_BUFFER_SIZE
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error getting output packet.
\n
"
);
return
res
;
}
/* First frame needs to be a keyframe */
if
(
avctx
->
frame_number
==
0
)
keyframe
=
1
;
...
...
@@ -844,12 +849,6 @@ static int flashsv2_encode_frame(AVCodecContext * avctx, uint8_t * buf,
keyframe
=
1
;
}
if
(
buf_size
<
s
->
frame_size
)
{
//Conservative upper bound check for compressed data
av_log
(
avctx
,
AV_LOG_ERROR
,
"buf_size %d < %d
\n
"
,
buf_size
,
s
->
frame_size
);
return
-
1
;
}
if
(
!
keyframe
&&
avctx
->
frame_number
>
s
->
last_key_frame
+
avctx
->
keyint_min
)
{
recommend_keyframe
(
s
,
&
keyframe
);
...
...
@@ -866,13 +865,14 @@ static int flashsv2_encode_frame(AVCodecContext * avctx, uint8_t * buf,
if
(
s
->
use15_7
)
s
->
dist
=
optimum_dist
(
s
);
res
=
write_bitstream
(
s
,
p
->
data
[
0
],
p
->
linesize
[
0
],
buf
,
buf_
size
,
keyframe
);
res
=
write_bitstream
(
s
,
p
->
data
[
0
],
p
->
linesize
[
0
],
pkt
->
data
,
pkt
->
size
,
keyframe
);
if
(
keyframe
)
{
new_key_frame
(
s
);
p
->
pict_type
=
AV_PICTURE_TYPE_I
;
p
->
key_frame
=
1
;
s
->
last_key_frame
=
avctx
->
frame_number
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
av_log
(
avctx
,
AV_LOG_DEBUG
,
"Inserting key frame at frame %d
\n
"
,
avctx
->
frame_number
);
}
else
{
p
->
pict_type
=
AV_PICTURE_TYPE_P
;
...
...
@@ -881,7 +881,10 @@ static int flashsv2_encode_frame(AVCodecContext * avctx, uint8_t * buf,
avctx
->
coded_frame
=
p
;
return
res
;
pkt
->
size
=
res
;
*
got_packet
=
1
;
return
0
;
}
static
av_cold
int
flashsv2_encode_end
(
AVCodecContext
*
avctx
)
...
...
@@ -899,7 +902,7 @@ AVCodec ff_flashsv2_encoder = {
.
id
=
CODEC_ID_FLASHSV2
,
.
priv_data_size
=
sizeof
(
FlashSV2Context
),
.
init
=
flashsv2_encode_init
,
.
encode
=
flashsv2_encode_frame
,
.
encode
2
=
flashsv2_encode_frame
,
.
close
=
flashsv2_encode_end
,
.
pix_fmts
=
(
enum
PixelFormat
[])
{
PIX_FMT_BGR24
,
PIX_FMT_NONE
},
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"Flash Screen Video Version 2"
),
...
...
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