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;