28 const AVFrame *p,
int *got_packet)
30 uint8_t *bytestream, *bytestream_start, *bytestream_end;
31 int i,
h, h1,
c,
n, linesize, ret;
40 bytestream = pkt->
data;
41 bytestream_end = pkt->
data + pkt->
size;
48 n = (avctx->
width + 7) >> 3;
83 snprintf(bytestream, bytestream_end - bytestream,
84 "P%c\n%d %d\n", c, avctx->
width, h1);
85 bytestream += strlen(bytestream);
88 snprintf(bytestream, bytestream_end - bytestream,
90 bytestream += strlen(bytestream);
95 for (i = 0; i <
h; i++) {
96 memcpy(bytestream, ptr, n);
106 for (i = 0; i <
h; i++) {
107 memcpy(bytestream, ptr1, n);
109 memcpy(bytestream, ptr2, n);
115 pkt->
size = bytestream - bytestream_start;
124 #if FF_API_CODED_FRAME
134 #if CONFIG_PGM_ENCODER
148 #if CONFIG_PGMYUV_ENCODER
162 #if CONFIG_PPM_ENCODER
176 #if CONFIG_PBM_ENCODER
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...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters...
#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. ...
static av_cold int pnm_encode_init(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
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
Libavcodec external API header.
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)
#define FF_DISABLE_DEPRECATION_WARNINGS
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...
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
#define FF_ENABLE_DEPRECATION_WARNINGS
int key_frame
1 -> keyframe, 0-> not
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
This structure stores compressed data.