int av_opt_set_from_string(void *ctx, const char *opts,

                           const char *const *shorthand,

                           const char *key_val_sep, const char *pairs_sep)

{

    int ret, count = 0;

    const char *dummy_shorthand = NULL;

    char key_buf[68], *value;

    const char *key;



    if (!opts)

        return 0;

    if (!shorthand)

        shorthand = &dummy_shorthand;



    while (*opts) {

        if ((ret = get_key(&opts, key_val_sep, key_buf, sizeof(key_buf))) < 0) {

            if (*shorthand) {

                key = *(shorthand++);

            } else {

                av_log(ctx, AV_LOG_ERROR, "No option name near '%s'\n", opts);

                return AVERROR(EINVAL);

            }

        } else {

            key = key_buf;

            while (*shorthand) /* discard all remaining shorthand */

                shorthand++;

        }



        if (!(value = av_get_token(&opts, pairs_sep)))

            return AVERROR(ENOMEM);

        if (*opts && strchr(pairs_sep, *opts))

            opts++;



        av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value);

        if ((ret = av_opt_set(ctx, key, value, 0)) < 0) {

            if (ret == AVERROR_OPTION_NOT_FOUND)

                av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key);

            av_free(value);

            return ret;

        }



        av_free(value);

        count++;

    }

    return count;

}

int av_opt_set_from_string(void *ctx, const char *opts,

                           const char *const *shorthand,

                           const char *key_val_sep, const char *pairs_sep)

{

    int ret, count = 0;

    const char *dummy_shorthand = NULL;

    char key_buf[68], *value;

    const char *key;



    if (!opts)

        return 0;

    if (!shorthand)

        shorthand = &dummy_shorthand;



    while (*opts) {

        if ((ret = get_key(&opts, key_val_sep, key_buf, sizeof(key_buf))) < 0) {

            if (*shorthand) {

                key = *(shorthand++);

            } else {

                av_log(ctx, AV_LOG_ERROR, "No option name near '%s'\n", opts);

                return AVERROR(EINVAL);

            }

        } else {

            key = key_buf;

            while (*shorthand) 

                shorthand++;

        }



        if (!(value = av_get_token(&opts, pairs_sep)))

            return AVERROR(ENOMEM);

        if (*opts && strchr(pairs_sep, *opts))

            opts++;



        av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value);

        if ((ret = av_opt_set(ctx, key, value, 0)) < 0) {

            if (ret == AVERROR_OPTION_NOT_FOUND)

                av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key);

            av_free(value);

            return ret;

        }



        av_free(value);

        count++;

    }

    return count;

}

int FUNC_0(void *VAR_0, const char *VAR_1,

                           const char *const *VAR_2,

                           const char *VAR_3, const char *VAR_4)

{

    int VAR_5, VAR_6 = 0;

    const char *VAR_7 = NULL;

    char VAR_8[68], *VAR_9;

    const char *VAR_10;



    if (!VAR_1)

        return 0;

    if (!VAR_2)

        VAR_2 = &VAR_7;



    while (*VAR_1) {

        if ((VAR_5 = get_key(&VAR_1, VAR_3, VAR_8, sizeof(VAR_8))) < 0) {

            if (*VAR_2) {

                VAR_10 = *(VAR_2++);

            } else {

                av_log(VAR_0, AV_LOG_ERROR, "No option name near '%s'\n", VAR_1);

                return AVERROR(EINVAL);

            }

        } else {

            VAR_10 = VAR_8;

            while (*VAR_2) 

                VAR_2++;

        }



        if (!(VAR_9 = av_get_token(&VAR_1, VAR_4)))

            return AVERROR(ENOMEM);

        if (*VAR_1 && strchr(VAR_4, *VAR_1))

            VAR_1++;



        av_log(VAR_0, AV_LOG_DEBUG, "Setting '%s' to VAR_9 '%s'\n", VAR_10, VAR_9);

        if ((VAR_5 = av_opt_set(VAR_0, VAR_10, VAR_9, 0)) < 0) {

            if (VAR_5 == AVERROR_OPTION_NOT_FOUND)

                av_log(VAR_0, AV_LOG_ERROR, "Option '%s' not found\n", VAR_10);

            av_free(VAR_9);

            return VAR_5;

        }



        av_free(VAR_9);

        VAR_6++;

    }

    return VAR_6;

}

int FUNC_0(void *VAR_0, const char *VAR_1,
const char *const *VAR_2,
const char *VAR_3, const char *VAR_4)
{ int VAR_5, VAR_6 = 0; const char *VAR_7 = NULL; char VAR_8[68], *VAR_9; const char *VAR_10; if (!VAR_1)
return 0; if (!VAR_2)
VAR_2 = &VAR_7; while (*VAR_1) { if ((VAR_5 = get_key(&VAR_1, VAR_3, VAR_8, sizeof(VAR_8))) < 0) { if (*VAR_2) { VAR_10 = *(VAR_2++); } else { av_log(VAR_0, AV_LOG_ERROR, "No option name near '%s'\n", VAR_1); return AVERROR(EINVAL); } } else { VAR_10 = VAR_8; while (*VAR_2)
VAR_2++; } if (!(VAR_9 = av_get_token(&VAR_1, VAR_4)))
return AVERROR(ENOMEM); if (*VAR_1 && strchr(VAR_4, *VAR_1))
VAR_1++; av_log(VAR_0, AV_LOG_DEBUG, "Setting '%s' to VAR_9 '%s'\n", VAR_10, VAR_9); if ((VAR_5 = av_opt_set(VAR_0, VAR_10, VAR_9, 0)) < 0) { if (VAR_5 == AVERROR_OPTION_NOT_FOUND)
av_log(VAR_0, AV_LOG_ERROR, "Option '%s' not found\n", VAR_10); av_free(VAR_9); return VAR_5; } av_free(VAR_9); VAR_6++; } return VAR_6; }