/*!\brief Control algorithm * * This function is used to exchange algorithm specific data with the codec * instance. This can be used to implement features specific to a particular * algorithm. * * This wrapper function dispatches the request to the helper function * associated with the given ctrl_id. It tries to call this function * transparently, but will return #VPX_CODEC_ERROR if the request could not * be dispatched. * * Note that this function should not be used directly. Call the * #vpx_codec_control wrapper macro instead. * * \param[in] ctx Pointer to this instance's context * \param[in] ctrl_id Algorithm specific control identifier * * \retval #VPX_CODEC_OK * The control request was processed. * \retval #VPX_CODEC_ERROR * The control request was not processed. * \retval #VPX_CODEC_INVALID_PARAM * The data was not valid. */ //vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t* ctx, int ctrl_id, ...) //public static vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t ctx, int ctrl_id, List<Object> valist) //{ // vpx_codec_err_t res; // if (ctx == null || ctrl_id == 0) // { // res = vpx_codec_err_t.VPX_CODEC_INVALID_PARAM; // } // else if (ctx.iface == null || ctx.priv == null || ctx.iface.ctrl_maps == null) // { // res = vpx_codec_err_t.VPX_CODEC_ERROR; // } // else // { // vpx_codec_ctrl_fn_map_t entry; // res = vpx_codec_err_t.VPX_CODEC_INCAPABLE; // for (entry = ctx.iface.ctrl_maps; entry.fn; entry++) // { // if (entry.ctrl_id == 0 || entry.ctrl_id == ctrl_id) // { // va_list ap; // va_start(ap, ctrl_id); // res = entry.fn((vpx_codec_alg_priv_t)ctx->priv, ap); // va_end(ap); // break; // } // } // } // //return SAVE_STATUS(ctx, res); // return ctx != null ? (ctx.err = res) : res; //} /*!\brief vpx_codec_control wrapper macro * * This macro allows for type safe conversions across the variadic parameter * to vpx_codec_control_(). * * \internal * It works by dispatching the call to the control function through a wrapper * function named with the id parameter. */ //#define vpx_codec_control(ctx, id, data) \ // vpx_codec_control_##id(ctx, id, data) /**<\hideinitializer*/ /*!\brief vpx_codec_control type definition macro * * This macro allows for type safe conversions across the variadic parameter * to vpx_codec_control_(). It defines the type of the argument for a given * control identifier. * * \internal * It defines a static function with * the correctly typed arguments as a wrapper to the type-unsafe internal * function. */ //#define VPX_CTRL_USE_TYPE(id, typ) \ // static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int, typ) \ // VPX_UNUSED; \ // \ // static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \ // int ctrl_id, typ data) { \ // return vpx_codec_control_(ctx, ctrl_id, data); \ // } /**<\hideinitializer*/ //public static vpx_codec_err_t vpx_codec_control_hhid(vpx_codec_ctx_t ctx, int ctrl_id, typ data) //{ // return vpx_codec_control_(ctx, ctrl_id, data); //} /*!\brief vpx_codec_control deprecated type definition macro * * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is * deprecated and should not be used. Consult the documentation for your * codec for more information. * * \internal * It defines a static function with the correctly typed arguments as a * wrapper to the type-unsafe internal function. */ //#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \ //VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \ // vpx_codec_ctx_t *, int, typ) VPX_DEPRECATED VPX_UNUSED; \ // \ // VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \ // vpx_codec_ctx_t *ctx, int ctrl_id, typ data) { \ // return vpx_codec_control_(ctx, ctrl_id, data); \ // } /**<\hideinitializer*/ /*!\brief vpx_codec_control void type definition macro * * This macro allows for type safe conversions across the variadic parameter * to vpx_codec_control_(). It indicates that a given control identifier takes * no argument. * * \internal * It defines a static function without a data argument as a wrapper to the * type-unsafe internal function. */ //#define VPX_CTRL_VOID(id) \ //static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int) \ // VPX_UNUSED; \ // \ // static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \ // int ctrl_id) { \ // return vpx_codec_control_(ctx, ctrl_id); \ // } /**<\hideinitializer*/ //#endif //public static vpx_codec_err_t vpx_codec_control<T>(vpx_codec_ctx_t ctx, int ctrl_id) //{ // return vpx_codec_control_(ctx, ctrl_id); //} /// <remarks> /// Original defintion: /// void vpx_internal_error(struct vpx_internal_error_info *info, /// vpx_codec_err_t error, const char* fmt, ...) /// The use of the "va_list" parameter when calling this function was minimal. /// That left the "fmt" parameter being used as a descriptive error message rather than /// a format string. /// </remarks> public static void vpx_internal_error(ref vpx_internal_error_info info, vpx_codec_err_t error, string fmt) { //va_list ap; info.error_code = error; info.has_detail = 0; info.detail = fmt; //if (fmt) //{ // size_t sz = sizeof(info->detail); // info->has_detail = 1; // va_start(ap, fmt); // vsnprintf(info->detail, sz - 1, fmt, ap); // va_end(ap); // info->detail[sz - 1] = '\0'; //} //if (info->setjmp) longjmp(info->jmp, info->error_code); VpxException vpxExcp = new VpxException(error, fmt); throw vpxExcp; }
public static vpx_codec_err_t update_error_state(vpx_codec_alg_priv_t ctx, vpx_internal_error_info error) { vpx_codec_err_t res = error.error_code; if (res != vpx_codec_err_t.VPX_CODEC_OK) { [email protected]_detail = error.has_detail > 0 ? error.detail : null; } return(res); }