int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)

{

    void *dst, *target_obj;

    const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);

    uint8_t *bin, buf[128];

    int len, i, ret;



    if (!o || !target_obj)

        return AVERROR_OPTION_NOT_FOUND;



    dst = (uint8_t*)target_obj + o->offset;



    buf[0] = 0;

    switch (o->type) {

    case AV_OPT_TYPE_FLAGS:     ret = snprintf(buf, sizeof(buf), "0x%08X",  *(int    *)dst);break;

    case AV_OPT_TYPE_INT:       ret = snprintf(buf, sizeof(buf), "%d" ,     *(int    *)dst);break;

    case AV_OPT_TYPE_INT64:     ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break;

    case AV_OPT_TYPE_FLOAT:     ret = snprintf(buf, sizeof(buf), "%f" ,     *(float  *)dst);break;

    case AV_OPT_TYPE_DOUBLE:    ret = snprintf(buf, sizeof(buf), "%f" ,     *(double *)dst);break;

    case AV_OPT_TYPE_RATIONAL:  ret = snprintf(buf, sizeof(buf), "%d/%d",   ((AVRational*)dst)->num, ((AVRational*)dst)->den);break;

    case AV_OPT_TYPE_STRING:

        if (*(uint8_t**)dst)

            *out_val = av_strdup(*(uint8_t**)dst);

        else

            *out_val = av_strdup("");

        return 0;

    case AV_OPT_TYPE_BINARY:

        len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *));

        if ((uint64_t)len*2 + 1 > INT_MAX)

            return AVERROR(EINVAL);

        if (!(*out_val = av_malloc(len*2 + 1)))

            return AVERROR(ENOMEM);

        bin = *(uint8_t**)dst;

        for (i = 0; i < len; i++)

            snprintf(*out_val + i*2, 3, "%02X", bin[i]);

        return 0;

    default:

        return AVERROR(EINVAL);

    }



    if (ret >= sizeof(buf))

        return AVERROR(EINVAL);

    *out_val = av_strdup(buf);

    return 0;

}

int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)

{

    void *dst, *target_obj;

    const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);

    uint8_t *bin, buf[128];

    int len, i, ret;



    if (!o || !target_obj)

        return AVERROR_OPTION_NOT_FOUND;



    dst = (uint8_t*)target_obj + o->offset;



    buf[0] = 0;

    switch (o->type) {

    case AV_OPT_TYPE_FLAGS:     ret = snprintf(buf, sizeof(buf), "0x%08X",  *(int    *)dst);break;

    case AV_OPT_TYPE_INT:       ret = snprintf(buf, sizeof(buf), "%d" ,     *(int    *)dst);break;

    case AV_OPT_TYPE_INT64:     ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break;

    case AV_OPT_TYPE_FLOAT:     ret = snprintf(buf, sizeof(buf), "%f" ,     *(float  *)dst);break;

    case AV_OPT_TYPE_DOUBLE:    ret = snprintf(buf, sizeof(buf), "%f" ,     *(double *)dst);break;

    case AV_OPT_TYPE_RATIONAL:  ret = snprintf(buf, sizeof(buf), "%d/%d",   ((AVRational*)dst)->num, ((AVRational*)dst)->den);break;

    case AV_OPT_TYPE_STRING:

        if (*(uint8_t**)dst)

            *out_val = av_strdup(*(uint8_t**)dst);

        else

            *out_val = av_strdup("");

        return 0;

    case AV_OPT_TYPE_BINARY:

        len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *));

        if ((uint64_t)len*2 + 1 > INT_MAX)

            return AVERROR(EINVAL);

        if (!(*out_val = av_malloc(len*2 + 1)))

            return AVERROR(ENOMEM);

        bin = *(uint8_t**)dst;

        for (i = 0; i < len; i++)

            snprintf(*out_val + i*2, 3, "%02X", bin[i]);

        return 0;

    default:

        return AVERROR(EINVAL);

    }



    if (ret >= sizeof(buf))

        return AVERROR(EINVAL);

    *out_val = av_strdup(buf);

    return 0;

}

int FUNC_0(void *VAR_0, const char *VAR_1, int VAR_2, uint8_t **VAR_3)

{

    void *VAR_4, *VAR_5;

    const AVOption *VAR_6 = av_opt_find2(VAR_0, VAR_1, NULL, 0, VAR_2, &VAR_5);

    uint8_t *bin, buf[128];

    int VAR_7, VAR_8, VAR_9;



    if (!VAR_6 || !VAR_5)

        return AVERROR_OPTION_NOT_FOUND;



    VAR_4 = (uint8_t*)VAR_5 + VAR_6->offset;



    buf[0] = 0;

    switch (VAR_6->type) {

    case AV_OPT_TYPE_FLAGS:     VAR_9 = snprintf(buf, sizeof(buf), "0x%08X",  *(int    *)VAR_4);break;

    case AV_OPT_TYPE_INT:       VAR_9 = snprintf(buf, sizeof(buf), "%d" ,     *(int    *)VAR_4);break;

    case AV_OPT_TYPE_INT64:     VAR_9 = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)VAR_4);break;

    case AV_OPT_TYPE_FLOAT:     VAR_9 = snprintf(buf, sizeof(buf), "%f" ,     *(float  *)VAR_4);break;

    case AV_OPT_TYPE_DOUBLE:    VAR_9 = snprintf(buf, sizeof(buf), "%f" ,     *(double *)VAR_4);break;

    case AV_OPT_TYPE_RATIONAL:  VAR_9 = snprintf(buf, sizeof(buf), "%d/%d",   ((AVRational*)VAR_4)->num, ((AVRational*)VAR_4)->den);break;

    case AV_OPT_TYPE_STRING:

        if (*(uint8_t**)VAR_4)

            *VAR_3 = av_strdup(*(uint8_t**)VAR_4);

        else

            *VAR_3 = av_strdup("");

        return 0;

    case AV_OPT_TYPE_BINARY:

        VAR_7 = *(int*)(((uint8_t *)VAR_4) + sizeof(uint8_t *));

        if ((uint64_t)VAR_7*2 + 1 > INT_MAX)

            return AVERROR(EINVAL);

        if (!(*VAR_3 = av_malloc(VAR_7*2 + 1)))

            return AVERROR(ENOMEM);

        bin = *(uint8_t**)VAR_4;

        for (VAR_8 = 0; VAR_8 < VAR_7; VAR_8++)

            snprintf(*VAR_3 + VAR_8*2, 3, "%02X", bin[VAR_8]);

        return 0;

    default:

        return AVERROR(EINVAL);

    }



    if (VAR_9 >= sizeof(buf))

        return AVERROR(EINVAL);

    *VAR_3 = av_strdup(buf);

    return 0;

}

int FUNC_0(void *VAR_0, const char *VAR_1, int VAR_2, uint8_t **VAR_3)
{ void *VAR_4, *VAR_5; const AVOption *VAR_6 = av_opt_find2(VAR_0, VAR_1, NULL, 0, VAR_2, &VAR_5); uint8_t *bin, buf[128]; int VAR_7, VAR_8, VAR_9; if (!VAR_6 || !VAR_5)
return AVERROR_OPTION_NOT_FOUND; VAR_4 = (uint8_t*)VAR_5 + VAR_6->offset; buf[0] = 0; switch (VAR_6->type) { case AV_OPT_TYPE_FLAGS:     VAR_9 = snprintf(buf, sizeof(buf), "0x%08X",  *(int    *)VAR_4);break; case AV_OPT_TYPE_INT:       VAR_9 = snprintf(buf, sizeof(buf), "%d" ,     *(int    *)VAR_4);break; case AV_OPT_TYPE_INT64:     VAR_9 = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)VAR_4);break; case AV_OPT_TYPE_FLOAT:     VAR_9 = snprintf(buf, sizeof(buf), "%f" ,     *(float  *)VAR_4);break; case AV_OPT_TYPE_DOUBLE:    VAR_9 = snprintf(buf, sizeof(buf), "%f" ,     *(double *)VAR_4);break; case AV_OPT_TYPE_RATIONAL:  VAR_9 = snprintf(buf, sizeof(buf), "%d/%d",   ((AVRational*)VAR_4)->num, ((AVRational*)VAR_4)->den);break; case AV_OPT_TYPE_STRING:
if (*(uint8_t**)VAR_4)
*VAR_3 = av_strdup(*(uint8_t**)VAR_4); else
*VAR_3 = av_strdup(""); return 0; case AV_OPT_TYPE_BINARY:
VAR_7 = *(int*)(((uint8_t *)VAR_4) + sizeof(uint8_t *)); if ((uint64_t)VAR_7*2 + 1 > INT_MAX)
return AVERROR(EINVAL); if (!(*VAR_3 = av_malloc(VAR_7*2 + 1)))
return AVERROR(ENOMEM); bin = *(uint8_t**)VAR_4; for (VAR_8 = 0; VAR_8 < VAR_7; VAR_8++) snprintf(*VAR_3 + VAR_8*2, 3, "%02X", bin[VAR_8]); return 0; default:
return AVERROR(EINVAL); } if (VAR_9 >= sizeof(buf))
return AVERROR(EINVAL); *VAR_3 = av_strdup(buf); return 0; }