Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
return 0;
}
+
+void ff_decklink_cleanup(AVFormatContext *avctx)
+{
+ struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data;
+ struct decklink_ctx *ctx = (struct decklink_ctx *) cctx->ctx;
+
+ if (ctx->dli)
+ ctx->dli->Release();
+ if (ctx->dlo)
+ ctx->dlo->Release();
+ if (ctx->dl)
+ ctx->dl->Release();
+}
int ff_decklink_set_format(AVFormatContext *avctx, decklink_direction_t direction, int num);
int ff_decklink_list_devices(AVFormatContext *avctx);
int ff_decklink_list_formats(AVFormatContext *avctx, decklink_direction_t direction = DIRECTION_OUT);
+void ff_decklink_cleanup(AVFormatContext *avctx);
#endif /* AVDEVICE_DECKLINK_COMMON_H */
ctx->dli->DisableAudioInput();
}
- if (ctx->dli)
- ctx->dli->Release();
- if (ctx->dl)
- ctx->dl->Release();
-
+ ff_decklink_cleanup(avctx);
avpacket_queue_end(&ctx->queue);
av_freep(&cctx->ctx);
return 0;
error:
-
- ctx->dli->Release();
- ctx->dl->Release();
-
+ ff_decklink_cleanup(avctx);
return AVERROR(EIO);
}
ctx->dlo->DisableAudioOutput();
}
- if (ctx->dlo)
- ctx->dlo->Release();
- if (ctx->dl)
- ctx->dl->Release();
+ ff_decklink_cleanup(avctx);
if (ctx->output_callback)
delete ctx->output_callback;
return 0;
error:
-
- ctx->dlo->Release();
- ctx->dl->Release();
-
+ ff_decklink_cleanup(avctx);
return AVERROR(EIO);
}