27 const AVFrame *pict,
int *got_packet)
29 uint8_t *bytestream_start, *bytestream, *bytestream_end;
31 int i, h, w, n, linesize, depth, maxval, ret;
32 const char *tuple_type;
37 avctx->
height) + 200)) < 0) {
43 bytestream = pkt->
data;
44 bytestream_end = pkt->
data + pkt->
size;
53 tuple_type =
"BLACKANDWHITE";
59 tuple_type =
"GRAYSCALE";
71 tuple_type =
"RGB_ALPHA";
76 snprintf(bytestream, bytestream_end - bytestream,
77 "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLTYPE %s\nENDHDR\n",
78 w, h, depth, maxval, tuple_type);
79 bytestream += strlen(bytestream);
88 for (i = 0; i < h; i++) {
89 for (j = 0; j < w; j++) {
90 v = ((uint32_t *)ptr)[j];
91 bytestream_put_be24(&bytestream, v);
92 *bytestream++ = v >> 24;
97 for (i = 0; i < h; i++) {
98 memcpy(bytestream, ptr, n);
104 pkt->
size = bytestream - bytestream_start;
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
const char * name
Name of the codec implementation.
static av_cold int pam_encode_init(AVCodecContext *avctx)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Libavcodec external API header.
AVPixelFormat
Pixel format.
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
static av_cold int pam_encode_close(AVCodecContext *avctx)
main external API structure.
AVFrame * coded_frame
the picture in the bitstream
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
common internal api header.
int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
Calculate the size in bytes that a picture of the given width and height would occupy if stored in th...
int key_frame
1 -> keyframe, 0-> not
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.