Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f0366fec
Commit
f0366fec
authored
Feb 12, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xwdenc: switch to encode2().
parent
f2a4559c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
xwdenc.c
libavcodec/xwdenc.c
+12
-9
No files found.
libavcodec/xwdenc.c
View file @
f0366fec
...
...
@@ -24,6 +24,7 @@
#include "libavutil/pixdesc.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
#include "xwd.h"
#define WINDOW_NAME "lavcxwdenc"
...
...
@@ -38,16 +39,15 @@ static av_cold int xwd_encode_init(AVCodecContext *avctx)
return
0
;
}
static
int
xwd_encode_frame
(
AVCodecContext
*
avctx
,
uint8_t
*
buf
,
int
buf_size
,
void
*
data
)
static
int
xwd_encode_frame
(
AVCodecContext
*
avctx
,
AVPacket
*
pkt
,
const
AVFrame
*
p
,
int
*
got_packet
)
{
AVFrame
*
p
=
data
;
enum
PixelFormat
pix_fmt
=
avctx
->
pix_fmt
;
uint32_t
pixdepth
,
bpp
,
bpad
,
ncolors
=
0
,
lsize
,
vclass
,
be
=
0
;
uint32_t
rgb
[
3
]
=
{
0
};
uint32_t
header_size
;
int
i
,
out_size
;
uint8_t
*
ptr
;
int
i
,
out_size
,
ret
;
uint8_t
*
ptr
,
*
buf
;
pixdepth
=
av_get_bits_per_pixel
(
&
av_pix_fmt_descriptors
[
pix_fmt
]);
if
(
av_pix_fmt_descriptors
[
pix_fmt
].
flags
&
PIX_FMT_BE
)
...
...
@@ -146,10 +146,11 @@ static int xwd_encode_frame(AVCodecContext *avctx, uint8_t *buf,
header_size
=
XWD_HEADER_SIZE
+
WINDOW_NAME_SIZE
;
out_size
=
header_size
+
ncolors
*
XWD_CMAP_SIZE
+
avctx
->
height
*
lsize
;
if
(
buf_size
<
out_size
)
{
if
(
(
ret
=
ff_alloc_packet
(
pkt
,
out_size
))
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"output buffer too small
\n
"
);
return
AVERROR
(
ENOMEM
)
;
return
ret
;
}
buf
=
pkt
->
data
;
avctx
->
coded_frame
->
key_frame
=
1
;
avctx
->
coded_frame
->
pict_type
=
AV_PICTURE_TYPE_I
;
...
...
@@ -204,7 +205,9 @@ static int xwd_encode_frame(AVCodecContext *avctx, uint8_t *buf,
ptr
+=
p
->
linesize
[
0
];
}
return
out_size
;
pkt
->
flags
|=
AV_PKT_FLAG_KEY
;
*
got_packet
=
1
;
return
0
;
}
static
av_cold
int
xwd_encode_close
(
AVCodecContext
*
avctx
)
...
...
@@ -219,7 +222,7 @@ AVCodec ff_xwd_encoder = {
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
CODEC_ID_XWD
,
.
init
=
xwd_encode_init
,
.
encode
=
xwd_encode_frame
,
.
encode
2
=
xwd_encode_frame
,
.
close
=
xwd_encode_close
,
.
pix_fmts
=
(
const
enum
PixelFormat
[])
{
PIX_FMT_BGRA
,
PIX_FMT_RGBA
,
...
...
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