30 #define WINDOW_NAME "lavcxwdenc" 31 #define WINDOW_NAME_SIZE 11 43 const AVFrame *p,
int *got_packet)
47 uint32_t pixdepth, bpp, bpad, ncolors = 0, lsize, vclass, be = 0;
48 uint32_t rgb[3] = { 0 }, bitorder = 0;
161 bytestream_put_be32(&buf, header_size);
164 bytestream_put_be32(&buf, pixdepth);
165 bytestream_put_be32(&buf, avctx->
width);
166 bytestream_put_be32(&buf, avctx->
height);
167 bytestream_put_be32(&buf, 0);
168 bytestream_put_be32(&buf, be);
169 bytestream_put_be32(&buf, 32);
170 bytestream_put_be32(&buf, bitorder);
171 bytestream_put_be32(&buf, bpad);
172 bytestream_put_be32(&buf, bpp);
173 bytestream_put_be32(&buf, lsize);
174 bytestream_put_be32(&buf, vclass);
175 bytestream_put_be32(&buf, rgb[0]);
176 bytestream_put_be32(&buf, rgb[1]);
177 bytestream_put_be32(&buf, rgb[2]);
178 bytestream_put_be32(&buf, 8);
179 bytestream_put_be32(&buf, ncolors);
180 bytestream_put_be32(&buf, ncolors);
181 bytestream_put_be32(&buf, avctx->
width);
182 bytestream_put_be32(&buf, avctx->
height);
183 bytestream_put_be32(&buf, 0);
184 bytestream_put_be32(&buf, 0);
185 bytestream_put_be32(&buf, 0);
188 for (i = 0; i < ncolors; i++) {
193 red = (val >> 16) & 0xFF;
194 green = (val >> 8) & 0xFF;
197 bytestream_put_be32(&buf, i);
198 bytestream_put_be16(&buf, red << 8);
199 bytestream_put_be16(&buf, green << 8);
200 bytestream_put_be16(&buf, blue << 8);
201 bytestream_put_byte(&buf, 0x7);
202 bytestream_put_byte(&buf, 0);
206 for (i = 0; i < avctx->
height; i++) {
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
AVFrame * coded_frame
the picture in the bitstream
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 ...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
static int xwd_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
8 bit with PIX_FMT_RGB32 palette
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static av_cold int xwd_encode_init(AVCodecContext *avctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
int width
picture width / height.
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
packed RGB 8:8:8, 24bpp, BGRBGR...
enum AVPixelFormat pix_fmt
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
#define AV_LOG_INFO
Standard information.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure.
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 ...
static av_cold int xwd_encode_close(AVCodecContext *avctx)
packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 ...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
#define AV_PIX_FMT_FLAG_BE
Pixel format is big-endian.
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
int key_frame
1 -> keyframe, 0-> not
packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 ...
AVPixelFormat
Pixel format.
This structure stores compressed data.