mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-09-26 21:03:43 +08:00
fixup! lavc/rkmppdec: refactor RKMPP decoders and extend codecs
refine hw_device_ctx validation. Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
@@ -322,13 +322,16 @@ static av_cold int rkmpp_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
|
||||
if (avctx->hw_device_ctx) {
|
||||
r->hwdevice = av_buffer_ref(avctx->hw_device_ctx);
|
||||
if (!r->hwdevice) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
AVBufferRef *device_ref = avctx->hw_device_ctx;
|
||||
AVHWDeviceContext *device_ctx = (AVHWDeviceContext *)device_ref->data;
|
||||
|
||||
if (device_ctx && device_ctx->type == AV_HWDEVICE_TYPE_RKMPP) {
|
||||
r->hwdevice = av_buffer_ref(avctx->hw_device_ctx);
|
||||
if (r->hwdevice)
|
||||
av_log(avctx, AV_LOG_VERBOSE, "Picked up an existing RKMPP hardware device\n");
|
||||
}
|
||||
av_log(avctx, AV_LOG_VERBOSE, "Picked up an existing RKMPP hardware device\n");
|
||||
} else {
|
||||
}
|
||||
if (!r->hwdevice) {
|
||||
if ((ret = av_hwdevice_ctx_create(&r->hwdevice, AV_HWDEVICE_TYPE_RKMPP, NULL, NULL, 0)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to create a RKMPP hardware device: %d\n", ret);
|
||||
goto fail;
|
||||
|
Reference in New Issue
Block a user