|
|
@ -54,7 +54,7 @@ static int hwmap_config_output(AVFilterLink *outlink) |
|
|
|
AVHWFramesContext *hwfc; |
|
|
|
AVHWFramesContext *hwfc; |
|
|
|
AVBufferRef *device; |
|
|
|
AVBufferRef *device; |
|
|
|
const AVPixFmtDescriptor *desc; |
|
|
|
const AVPixFmtDescriptor *desc; |
|
|
|
int err; |
|
|
|
int err, device_is_derived; |
|
|
|
|
|
|
|
|
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Configure hwmap %s -> %s.\n", |
|
|
|
av_log(avctx, AV_LOG_DEBUG, "Configure hwmap %s -> %s.\n", |
|
|
|
av_get_pix_fmt_name(inlink->format), |
|
|
|
av_get_pix_fmt_name(inlink->format), |
|
|
@ -63,6 +63,7 @@ static int hwmap_config_output(AVFilterLink *outlink) |
|
|
|
av_buffer_unref(&ctx->hwframes_ref); |
|
|
|
av_buffer_unref(&ctx->hwframes_ref); |
|
|
|
|
|
|
|
|
|
|
|
device = avctx->hw_device_ctx; |
|
|
|
device = avctx->hw_device_ctx; |
|
|
|
|
|
|
|
device_is_derived = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (inlink->hw_frames_ctx) { |
|
|
|
if (inlink->hw_frames_ctx) { |
|
|
|
hwfc = (AVHWFramesContext*)inlink->hw_frames_ctx->data; |
|
|
|
hwfc = (AVHWFramesContext*)inlink->hw_frames_ctx->data; |
|
|
@ -84,6 +85,7 @@ static int hwmap_config_output(AVFilterLink *outlink) |
|
|
|
"device context: %d.\n", err); |
|
|
|
"device context: %d.\n", err); |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
device_is_derived = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
desc = av_pix_fmt_desc_get(outlink->format); |
|
|
|
desc = av_pix_fmt_desc_get(outlink->format); |
|
|
@ -238,9 +240,13 @@ static int hwmap_config_output(AVFilterLink *outlink) |
|
|
|
outlink->w = inlink->w; |
|
|
|
outlink->w = inlink->w; |
|
|
|
outlink->h = inlink->h; |
|
|
|
outlink->h = inlink->h; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (device_is_derived) |
|
|
|
|
|
|
|
av_buffer_unref(&device); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
fail: |
|
|
|
fail: |
|
|
|
|
|
|
|
if (device_is_derived) |
|
|
|
|
|
|
|
av_buffer_unref(&device); |
|
|
|
av_buffer_unref(&ctx->hwframes_ref); |
|
|
|
av_buffer_unref(&ctx->hwframes_ref); |
|
|
|
return err; |
|
|
|
return err; |
|
|
|
} |
|
|
|
} |
|
|
|