Lines Matching defs:avctx
67 static MppCodingType rkmpp_get_codingtype(AVCodecContext *avctx)
69 switch (avctx->codec_id) {
89 static int rkmpp_write_data(AVCodecContext *avctx, uint8_t *buffer, int size, int64_t pts)
91 RKMPPDecodeContext *rk_context = avctx->priv_data;
99 av_log(avctx, AV_LOG_ERROR, "Failed to init MPP packet (code = %d)\n", ret);
111 av_log(avctx, AV_LOG_DEBUG, "Buffer full writing %d bytes to decoder\n", size);
117 av_log(avctx, AV_LOG_DEBUG, "Wrote %d bytes to decoder\n", size);
124 static int rkmpp_close_decoder(AVCodecContext *avctx)
126 RKMPPDecodeContext *rk_context = avctx->priv_data;
152 static int rkmpp_init_decoder(AVCodecContext *avctx)
154 RKMPPDecodeContext *rk_context = avctx->priv_data;
161 avctx->pix_fmt = AV_PIX_FMT_DRM_PRIME;
178 av_log(avctx, AV_LOG_DEBUG, "Initializing RKMPP decoder.\n");
180 codectype = rkmpp_get_codingtype(avctx);
182 av_log(avctx, AV_LOG_ERROR, "Unknown codec type (%d).\n", avctx->codec_id);
189 av_log(avctx, AV_LOG_ERROR, "Codec type (%d) unsupported by MPP\n", avctx->codec_id);
197 av_log(avctx, AV_LOG_ERROR, "Failed to create MPP context (code = %d).\n", ret);
205 av_log(avctx, AV_LOG_ERROR, "Failed to initialize MPP context (code = %d).\n", ret);
214 av_log(avctx, AV_LOG_ERROR, "Failed to set blocking mode on MPI (code = %d).\n", ret);
222 av_log(avctx, AV_LOG_ERROR, "Failed to set block timeout on MPI (code = %d).\n", ret);
229 av_log(avctx, AV_LOG_ERROR, "Failed to retrieve buffer group (code = %d)\n", ret);
236 av_log(avctx, AV_LOG_ERROR, "Failed to assign buffer group (code = %d)\n", ret);
243 av_log(avctx, AV_LOG_ERROR, "Failed to set buffer group limit (code = %d)\n", ret);
250 av_log(avctx, AV_LOG_DEBUG, "RKMPP decoder initialized successfully.\n");
264 av_log(avctx, AV_LOG_ERROR, "Failed to initialize RKMPP decoder.\n");
265 rkmpp_close_decoder(avctx);
269 static int rkmpp_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
271 RKMPPDecodeContext *rk_context = avctx->priv_data;
277 av_log(avctx, AV_LOG_DEBUG, "End of stream.\n");
279 ret = rkmpp_write_data(avctx, NULL, 0, 0);
281 av_log(avctx, AV_LOG_ERROR, "Failed to send EOS to decoder (code = %d)\n", ret);
287 if (avctx->extradata_size) {
288 ret = rkmpp_write_data(avctx, avctx->extradata,
289 avctx->extradata_size,
292 av_log(avctx, AV_LOG_ERROR, "Failed to write extradata to decoder (code = %d)\n", ret);
300 ret = rkmpp_write_data(avctx, avpkt->data, avpkt->size, avpkt->pts);
302 av_log(avctx, AV_LOG_ERROR, "Failed to write data to decoder (code = %d)\n", ret);
320 static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
322 RKMPPDecodeContext *rk_context = avctx->priv_data;
337 av_log(avctx, AV_LOG_ERROR, "Failed to get a frame from MPP (code = %d)\n", ret);
346 av_log(avctx, AV_LOG_INFO, "Decoder noticed an info change (%dx%d), format=%d\n",
350 avctx->width = mpp_frame_get_width(mppframe);
351 avctx->height = mpp_frame_get_height(mppframe);
369 hwframes->width = avctx->width;
370 hwframes->height = avctx->height;
379 av_log(avctx, AV_LOG_DEBUG, "Received a EOS frame.\n");
384 av_log(avctx, AV_LOG_DEBUG, "Received a discard frame.\n");
388 av_log(avctx, AV_LOG_ERROR, "Received a errinfo frame.\n");
394 av_log(avctx, AV_LOG_DEBUG, "Received a frame.\n");
469 av_log(avctx, AV_LOG_ERROR, "Failed to retrieve the frame buffer, frame is dropped (code = %d)\n", ret);
475 av_log(avctx, AV_LOG_DEBUG, "Timeout when trying to get a frame from MPP\n");
496 static int rkmpp_receive_frame(AVCodecContext *avctx, AVFrame *frame)
498 RKMPPDecodeContext *rk_context = avctx->priv_data;
508 av_log(avctx, AV_LOG_ERROR, "Failed to get decoder used slots (code = %d).\n", ret);
514 ret = ff_decode_get_packet(avctx, &pkt);
519 ret = rkmpp_send_packet(avctx, &pkt);
523 av_log(avctx, AV_LOG_ERROR, "Failed to send packet to decoder (code = %d)\n", ret);
533 return rkmpp_retrieve_frame(avctx, frame);
536 static void rkmpp_flush(AVCodecContext *avctx)
538 RKMPPDecodeContext *rk_context = avctx->priv_data;
542 av_log(avctx, AV_LOG_DEBUG, "Flush.\n");
548 av_log(avctx, AV_LOG_ERROR, "Failed to reset MPI (code = %d)\n", ret);