static int parse_times(void *log_ctx, int64_t **times, int *nb_times,

                       const char *times_str)

{

    char *p;

    int i, ret = 0;

    char *times_str1 = av_strdup(times_str);

    char *saveptr = NULL;



    if (!times_str1)

        return AVERROR(ENOMEM);



#define FAIL(err) ret = err; goto end



    *nb_times = 1;

    for (p = times_str1; *p; p++)

        if (*p == ',')

            (*nb_times)++;



    *times = av_malloc(sizeof(**times) * *nb_times);

    if (!*times) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not allocate forced times array\n");

        FAIL(AVERROR(ENOMEM));

    }



    p = times_str1;

    for (i = 0; i < *nb_times; i++) {

        int64_t t;

        char *tstr = av_strtok(p, ",", &saveptr);

        av_assert0(tstr);

        p = NULL;



        ret = av_parse_time(&t, tstr, 1);

        if (ret < 0) {

            av_log(log_ctx, AV_LOG_ERROR,

                   "Invalid time duration specification in %s\n", p);

            FAIL(AVERROR(EINVAL));

        }

        (*times)[i] = t;



        /* check on monotonicity */

        if (i && (*times)[i-1] > (*times)[i]) {

            av_log(log_ctx, AV_LOG_ERROR,

                   "Specified time %f is greater than the following time %f\n",

                   (float)((*times)[i])/1000000, (float)((*times)[i-1])/1000000);

            FAIL(AVERROR(EINVAL));

        }

    }



end:

    av_free(times_str1);

    return ret;

}

static int parse_times(void *log_ctx, int64_t **times, int *nb_times,

                       const char *times_str)

{

    char *p;

    int i, ret = 0;

    char *times_str1 = av_strdup(times_str);

    char *saveptr = NULL;



    if (!times_str1)

        return AVERROR(ENOMEM);



#define FAIL(err) ret = err; goto end



    *nb_times = 1;

    for (p = times_str1; *p; p++)

        if (*p == ',')

            (*nb_times)++;



    *times = av_malloc(sizeof(**times) * *nb_times);

    if (!*times) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not allocate forced times array\n");

        FAIL(AVERROR(ENOMEM));

    }



    p = times_str1;

    for (i = 0; i < *nb_times; i++) {

        int64_t t;

        char *tstr = av_strtok(p, ",", &saveptr);

        av_assert0(tstr);

        p = NULL;



        ret = av_parse_time(&t, tstr, 1);

        if (ret < 0) {

            av_log(log_ctx, AV_LOG_ERROR,

                   "Invalid time duration specification in %s\n", p);

            FAIL(AVERROR(EINVAL));

        }

        (*times)[i] = t;



        

        if (i && (*times)[i-1] > (*times)[i]) {

            av_log(log_ctx, AV_LOG_ERROR,

                   "Specified time %f is greater than the following time %f\n",

                   (float)((*times)[i])/1000000, (float)((*times)[i-1])/1000000);

            FAIL(AVERROR(EINVAL));

        }

    }



end:

    av_free(times_str1);

    return ret;

}

        av_assert0(tstr);                    "Invalid time duration specification in %s\n", p);
static int FUNC_0(void *VAR_0, int64_t **VAR_1, int *VAR_2,

                       const char *VAR_3)

{

    char *VAR_4;

    int VAR_5, VAR_6 = 0;

    char *VAR_7 = av_strdup(VAR_3);

    char *VAR_8 = NULL;



    if (!VAR_7)

        return AVERROR(ENOMEM);



#define FAIL(err) VAR_6 = err; goto end



    *VAR_2 = 1;

    for (VAR_4 = VAR_7; *VAR_4; VAR_4++)

        if (*VAR_4 == ',')

            (*VAR_2)++;



    *VAR_1 = av_malloc(sizeof(**VAR_1) * *VAR_2);

    if (!*VAR_1) {

        av_log(VAR_0, AV_LOG_ERROR, "Could not allocate forced VAR_1 array\n");

        FAIL(AVERROR(ENOMEM));

    }



    VAR_4 = VAR_7;

    for (VAR_5 = 0; VAR_5 < *VAR_2; VAR_5++) {

        int64_t t;

        char *VAR_9 = av_strtok(VAR_4, ",", &VAR_8);

        av_assert0(VAR_9);

        VAR_4 = NULL;



        VAR_6 = av_parse_time(&t, VAR_9, 1);

        if (VAR_6 < 0) {

            av_log(VAR_0, AV_LOG_ERROR,

                   "Invalid time duration specification in %s\n", VAR_4);

            FAIL(AVERROR(EINVAL));

        }

        (*VAR_1)[VAR_5] = t;



        

        if (VAR_5 && (*VAR_1)[VAR_5-1] > (*VAR_1)[VAR_5]) {

            av_log(VAR_0, AV_LOG_ERROR,

                   "Specified time %f is greater than the following time %f\n",

                   (float)((*VAR_1)[VAR_5])/1000000, (float)((*VAR_1)[VAR_5-1])/1000000);

            FAIL(AVERROR(EINVAL));

        }

    }



end:

    av_free(VAR_7);

    return VAR_6;

}

static int FUNC_0(void *VAR_0, int64_t **VAR_1, int *VAR_2,
const char *VAR_3)
{ char *VAR_4; int VAR_5, VAR_6 = 0; char *VAR_7 = av_strdup(VAR_3); char *VAR_8 = NULL; if (!VAR_7)
return AVERROR(ENOMEM); #define FAIL(err) VAR_6 = err; goto end *VAR_2 = 1; for (VAR_4 = VAR_7; *VAR_4; VAR_4++) if (*VAR_4 == ',')
(*VAR_2)++; *VAR_1 = av_malloc(sizeof(**VAR_1) * *VAR_2); if (!*VAR_1) { av_log(VAR_0, AV_LOG_ERROR, "Could not allocate forced VAR_1 array\n"); FAIL(AVERROR(ENOMEM)); } VAR_4 = VAR_7; for (VAR_5 = 0; VAR_5 < *VAR_2; VAR_5++) { int64_t t; char *VAR_9 = av_strtok(VAR_4, ",", &VAR_8); av_assert0(VAR_9); VAR_4 = NULL; VAR_6 = av_parse_time(&t, VAR_9, 1); if (VAR_6 < 0) { av_log(VAR_0, AV_LOG_ERROR,
"Invalid time duration specification in %s\n", VAR_4); FAIL(AVERROR(EINVAL)); } (*VAR_1)[VAR_5] = t; if (VAR_5 && (*VAR_1)[VAR_5-1] > (*VAR_1)[VAR_5]) { av_log(VAR_0, AV_LOG_ERROR,
"Specified time %f is greater than the following time %f\n",
(float)((*VAR_1)[VAR_5])/1000000, (float)((*VAR_1)[VAR_5-1])/1000000); FAIL(AVERROR(EINVAL)); } } end:
av_free(VAR_7); return VAR_6; }