| 345 | } |
| 346 | |
| 347 | static int encode_receive_packet_internal(AVCodecContext *avctx, AVPacket *avpkt) |
| 348 | { |
| 349 | AVCodecInternal *avci = avctx->internal; |
| 350 | int ret; |
| 351 | |
| 352 | if (avci->draining_done) |
| 353 | return AVERROR_EOF; |
| 354 | |
| 355 | av_assert0(!avpkt->data && !avpkt->side_data); |
| 356 | |
| 357 | if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) { |
| 358 | if ((avctx->flags & AV_CODEC_FLAG_PASS1) && avctx->stats_out) |
| 359 | avctx->stats_out[0] = '\0'; |
| 360 | } |
| 361 | |
| 362 | if (ffcodec(avctx->codec)->cb_type == FF_CODEC_CB_TYPE_RECEIVE_PACKET) { |
| 363 | ret = ffcodec(avctx->codec)->cb.receive_packet(avctx, avpkt); |
| 364 | if (ret < 0) |
| 365 | av_packet_unref(avpkt); |
| 366 | else |
| 367 | // Encoders must always return ref-counted buffers. |
| 368 | // Side-data only packets have no data and can be not ref-counted. |
| 369 | av_assert0(!avpkt->data || avpkt->buf); |
| 370 | } else |
| 371 | ret = encode_simple_receive_packet(avctx, avpkt); |
| 372 | if (ret >= 0) |
| 373 | avpkt->flags |= encode_ctx(avci)->intra_only_flag; |
| 374 | |
| 375 | if (ret == AVERROR_EOF) |
| 376 | avci->draining_done = 1; |
| 377 | |
| 378 | return ret; |
| 379 | } |
| 380 | |
| 381 | #if CONFIG_LCMS2 |
| 382 | static int encode_generate_icc_profile(AVCodecContext *avctx, AVFrame *frame) |
no test coverage detected