27 const AVFrame *p,
int *got_packet)
29 uint8_t *bytestream, *bytestream_start, *bytestream_end;
30 int i,
h, h1,
c,
n, linesize,
ret;
35 avctx->
height) + 200)) < 0)
39 bytestream = pkt->
data;
40 bytestream_end = pkt->
data + pkt->
size;
47 n = (avctx->
width + 7) >> 3;
82 snprintf(bytestream, bytestream_end - bytestream,
83 "P%c\n%d %d\n", c, avctx->
width, h1);
84 bytestream += strlen(bytestream);
87 snprintf(bytestream, bytestream_end - bytestream,
89 bytestream += strlen(bytestream);
94 for (i = 0; i <
h; i++) {
95 memcpy(bytestream, ptr, n);
105 for (i = 0; i <
h; i++) {
106 memcpy(bytestream, ptr1, n);
108 memcpy(bytestream, ptr2, n);
114 pkt->
size = bytestream - bytestream_start;
139 #if CONFIG_PGM_ENCODER
154 #if CONFIG_PGMYUV_ENCODER
169 #if CONFIG_PPM_ENCODER
184 #if CONFIG_PBM_ENCODER
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
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
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint16_t depth_minus1
Number of bits in the component minus 1.
#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. ...
static av_cold int pnm_encode_init(AVCodecContext *avctx)
static av_cold int pnm_encode_close(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
Libavcodec external API header.
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
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 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
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
AVPixelFormat
Pixel format.
This structure stores compressed data.