vlc | branch: master | Tristan Matthews <[email protected]> | Thu Feb 4 13:40:16 2016 +0100| [fa0629f9c3e0c25fd3b37f79c57c25ca19e40ce5] | committer: Tristan Matthews
vpx: refactor error handling > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fa0629f9c3e0c25fd3b37f79c57c25ca19e40ce5 --- modules/codec/vpx.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c index 5cc3df6..aee6b5f 100644 --- a/modules/codec/vpx.c +++ b/modules/codec/vpx.c @@ -53,6 +53,18 @@ vlc_module_begin () set_subcategory(SUBCAT_INPUT_VCODEC) vlc_module_end () +static void vpx_err_msg(vlc_object_t *this, struct vpx_codec_ctx *ctx, + const char *msg) +{ + const char *error = vpx_codec_error(ctx); + const char *detail = vpx_codec_error_detail(ctx); + if (!detail) + detail = "no specific information"; + msg_Err(this, msg, error, detail); +} + +#define VPX_ERR(this, ctx, msg) vpx_err_msg(VLC_OBJECT(this), ctx, msg) + /***************************************************************************** * decoder_sys_t: libvpx decoder descriptor *****************************************************************************/ @@ -95,11 +107,7 @@ static picture_t *Decode(decoder_t *dec, block_t **pp_block) if (err != VPX_CODEC_OK) { free(pkt_pts); - const char *error = vpx_codec_error(ctx); - const char *detail = vpx_codec_error_detail(ctx); - if (!detail) - detail = "no specific information"; - msg_Err(dec, "Failed to decode frame: %s (%s)", error, detail); + VPX_ERR(dec, ctx, "Failed to decode frame: %s (%s)"); return NULL; } @@ -191,8 +199,7 @@ static int OpenDecoder(vlc_object_t *p_this) vp_version, vpx_codec_version_str(), vpx_codec_build_config()); if (vpx_codec_dec_init(&sys->ctx, iface, &deccfg, 0) != VPX_CODEC_OK) { - const char *error = vpx_codec_error(&sys->ctx); - msg_Err(p_this, "Failed to initialize decoder: %s\n", error); + VPX_ERR(p_this, &sys->ctx, "Failed to initialize decoder: %s (%s)"); free(sys); return VLC_EGENERIC;; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
