
static GF_Err jsfio_seek(GF_FileIO *fileio, u64 offset, s32 whence)
{
	JSValue argv[2], res;
	s32 ret;
	JSFileIOCtx *ioctx = gf_fileio_get_udta(fileio);
	if (!ioctx || !ioctx->gfio) return GF_BAD_PARAM;
	JSContext *ctx = ioctx->factory->ctx;

	gf_js_lock(ctx, GF_TRUE);

	argv[0] = JS_NewInt64(ctx, offset);
	argv[1] = JS_NewInt64(ctx, whence);
	res = JS_Call(ctx, ioctx->factory->seek, ioctx->js_obj, 2, argv);
	JS_ToInt32(ctx, &ret, res);
	JS_FreeValue(ctx, res);
	gf_js_lock(ctx, GF_FALSE);
	return ret;

static GF_Err jsfio_seek(GF_FileIO *fileio, u64 offset, s32 whence)
{
	JSValue argv[2], res;
	s32 ret;
	JSFileIOCtx *ioctx = gf_fileio_get_udta(fileio);
	if (!ioctx || !ioctx->gfio) return GF_BAD_PARAM;
	JSContext *ctx = ioctx->factory->ctx;

	gf_js_lock(ctx, GF_TRUE);

	argv[0] = JS_NewInt64(ctx, offset);
	argv[1] = JS_NewInt64(ctx, whence);
	res = JS_Call(ctx, ioctx->factory->seek, ioctx->js_obj, 2, argv);
	JS_ToInt32(ctx, &ret, res);
	JS_FreeValue(ctx, res);
	gf_js_lock(ctx, GF_FALSE);
	return ret;