| 348 | } |
| 349 | |
| 350 | static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, |
| 351 | const AVFrame *frame, int *got_packet) |
| 352 | { |
| 353 | EXRContext *s = avctx->priv_data; |
| 354 | PutByteContext *pb = &s->pb; |
| 355 | int64_t offset; |
| 356 | int ret; |
| 357 | int64_t out_size = 2048LL + avctx->height * 16LL + |
| 358 | av_image_get_buffer_size(avctx->pix_fmt, |
| 359 | avctx->width, |
| 360 | avctx->height, 64) * 3LL / 2; |
| 361 | |
| 362 | if ((ret = ff_get_encode_buffer(avctx, pkt, out_size, 0)) < 0) |
| 363 | return ret; |
| 364 | |
| 365 | bytestream2_init_writer(pb, pkt->data, pkt->size); |
| 366 | |
| 367 | bytestream2_put_le32(pb, 20000630); |
| 368 | bytestream2_put_byte(pb, 2); |
| 369 | bytestream2_put_le24(pb, 0); |
| 370 | bytestream2_put_buffer(pb, "channels\0chlist\0", 16); |
| 371 | bytestream2_put_le32(pb, s->planes * 18 + 1); |
| 372 | |
| 373 | for (int p = 0; p < s->planes; p++) { |
| 374 | bytestream2_put_byte(pb, s->ch_names[p]); |
| 375 | bytestream2_put_byte(pb, 0); |
| 376 | bytestream2_put_le32(pb, s->pixel_type); |
| 377 | bytestream2_put_le32(pb, 0); |
| 378 | bytestream2_put_le32(pb, 1); |
| 379 | bytestream2_put_le32(pb, 1); |
| 380 | } |
| 381 | bytestream2_put_byte(pb, 0); |
| 382 | |
| 383 | bytestream2_put_buffer(pb, "compression\0compression\0", 24); |
| 384 | bytestream2_put_le32(pb, 1); |
| 385 | bytestream2_put_byte(pb, s->compression); |
| 386 | |
| 387 | bytestream2_put_buffer(pb, "dataWindow\0box2i\0", 17); |
| 388 | bytestream2_put_le32(pb, 16); |
| 389 | bytestream2_put_le32(pb, 0); |
| 390 | bytestream2_put_le32(pb, 0); |
| 391 | bytestream2_put_le32(pb, avctx->width - 1); |
| 392 | bytestream2_put_le32(pb, avctx->height - 1); |
| 393 | |
| 394 | bytestream2_put_buffer(pb, "displayWindow\0box2i\0", 20); |
| 395 | bytestream2_put_le32(pb, 16); |
| 396 | bytestream2_put_le32(pb, 0); |
| 397 | bytestream2_put_le32(pb, 0); |
| 398 | bytestream2_put_le32(pb, avctx->width - 1); |
| 399 | bytestream2_put_le32(pb, avctx->height - 1); |
| 400 | |
| 401 | bytestream2_put_buffer(pb, "lineOrder\0lineOrder\0", 20); |
| 402 | bytestream2_put_le32(pb, 1); |
| 403 | bytestream2_put_byte(pb, 0); |
| 404 | |
| 405 | bytestream2_put_buffer(pb, "screenWindowCenter\0v2f\0", 23); |
| 406 | bytestream2_put_le32(pb, 8); |
| 407 | bytestream2_put_le64(pb, 0); |
nothing calls this directly
no test coverage detected