int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)

{

    if (*spec <= '9' && *spec >= '0') /* opt:index */

        return strtol(spec, NULL, 0) == st->index;

    else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||

             *spec == 't') { /* opt:[vasdt] */

        enum AVMediaType type;



        switch (*spec++) {

        case 'v': type = AVMEDIA_TYPE_VIDEO;      break;

        case 'a': type = AVMEDIA_TYPE_AUDIO;      break;

        case 's': type = AVMEDIA_TYPE_SUBTITLE;   break;

        case 'd': type = AVMEDIA_TYPE_DATA;       break;

        case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;


        }

        if (type != st->codec->codec_type)

            return 0;

        if (*spec++ == ':') { /* possibly followed by :index */

            int i, index = strtol(spec, NULL, 0);

            for (i = 0; i < s->nb_streams; i++)

                if (s->streams[i]->codec->codec_type == type && index-- == 0)

                   return i == st->index;

            return 0;

        }

        return 1;

    } else if (*spec == 'p' && *(spec + 1) == ':') {

        int prog_id, i, j;

        char *endptr;

        spec += 2;

        prog_id = strtol(spec, &endptr, 0);

        for (i = 0; i < s->nb_programs; i++) {

            if (s->programs[i]->id != prog_id)

                continue;



            if (*endptr++ == ':') {

                int stream_idx = strtol(endptr, NULL, 0);

                return stream_idx >= 0 &&

                    stream_idx < s->programs[i]->nb_stream_indexes &&

                    st->index == s->programs[i]->stream_index[stream_idx];

            }



            for (j = 0; j < s->programs[i]->nb_stream_indexes; j++)

                if (st->index == s->programs[i]->stream_index[j])

                    return 1;

        }

        return 0;

    } else if (!*spec) /* empty specifier, matches everything */

        return 1;



    av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);

    return AVERROR(EINVAL);

}
int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)

{

    if (*spec <= '9' && *spec >= '0') 

        return strtol(spec, NULL, 0) == st->index;

    else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' ||

             *spec == 't') { 

        enum AVMediaType type;



        switch (*spec++) {

        case 'v': type = AVMEDIA_TYPE_VIDEO;      break;

        case 'a': type = AVMEDIA_TYPE_AUDIO;      break;

        case 's': type = AVMEDIA_TYPE_SUBTITLE;   break;

        case 'd': type = AVMEDIA_TYPE_DATA;       break;

        case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;


        }

        if (type != st->codec->codec_type)

            return 0;

        if (*spec++ == ':') { 

            int i, index = strtol(spec, NULL, 0);

            for (i = 0; i < s->nb_streams; i++)

                if (s->streams[i]->codec->codec_type == type && index-- == 0)

                   return i == st->index;

            return 0;

        }

        return 1;

    } else if (*spec == 'p' && *(spec + 1) == ':') {

        int prog_id, i, j;

        char *endptr;

        spec += 2;

        prog_id = strtol(spec, &endptr, 0);

        for (i = 0; i < s->nb_programs; i++) {

            if (s->programs[i]->id != prog_id)

                continue;



            if (*endptr++ == ':') {

                int stream_idx = strtol(endptr, NULL, 0);

                return stream_idx >= 0 &&

                    stream_idx < s->programs[i]->nb_stream_indexes &&

                    st->index == s->programs[i]->stream_index[stream_idx];

            }



            for (j = 0; j < s->programs[i]->nb_stream_indexes; j++)

                if (st->index == s->programs[i]->stream_index[j])

                    return 1;

        }

        return 0;

    } else if (!*spec) 

        return 1;



    av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec);

    return AVERROR(EINVAL);

}
int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, const char *VAR_2)

{

    if (*VAR_2 <= '9' && *VAR_2 >= '0') 

        return strtol(VAR_2, NULL, 0) == VAR_1->VAR_5;

    else if (*VAR_2 == 'v' || *VAR_2 == 'a' || *VAR_2 == 'VAR_0' || *VAR_2 == 'd' ||

             *VAR_2 == 't') { 

        enum AVMediaType VAR_3;



        switch (*VAR_2++) {

        case 'v': VAR_3 = AVMEDIA_TYPE_VIDEO;      break;

        case 'a': VAR_3 = AVMEDIA_TYPE_AUDIO;      break;

        case 'VAR_0': VAR_3 = AVMEDIA_TYPE_SUBTITLE;   break;

        case 'd': VAR_3 = AVMEDIA_TYPE_DATA;       break;

        case 't': VAR_3 = AVMEDIA_TYPE_ATTACHMENT; break;


        }

        if (VAR_3 != VAR_1->codec->codec_type)

            return 0;

        if (*VAR_2++ == ':') { 

            int VAR_7, VAR_5 = strtol(VAR_2, NULL, 0);

            for (VAR_7 = 0; VAR_7 < VAR_0->nb_streams; VAR_7++)

                if (VAR_0->streams[VAR_7]->codec->codec_type == VAR_3 && VAR_5-- == 0)

                   return VAR_7 == VAR_1->VAR_5;

            return 0;

        }

        return 1;

    } else if (*VAR_2 == 'p' && *(VAR_2 + 1) == ':') {

        int VAR_6, VAR_7, VAR_7;

        char *VAR_8;

        VAR_2 += 2;

        VAR_6 = strtol(VAR_2, &VAR_8, 0);

        for (VAR_7 = 0; VAR_7 < VAR_0->nb_programs; VAR_7++) {

            if (VAR_0->programs[VAR_7]->id != VAR_6)

                continue;



            if (*VAR_8++ == ':') {

                int stream_idx = strtol(VAR_8, NULL, 0);

                return stream_idx >= 0 &&

                    stream_idx < VAR_0->programs[VAR_7]->nb_stream_indexes &&

                    VAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[stream_idx];

            }



            for (VAR_7 = 0; VAR_7 < VAR_0->programs[VAR_7]->nb_stream_indexes; VAR_7++)

                if (VAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[VAR_7])

                    return 1;

        }

        return 0;

    } else if (!*VAR_2) 

        return 1;



    av_log(VAR_0, AV_LOG_ERROR, "Invalid stream specifier: %VAR_0.\n", VAR_2);

    return AVERROR(EINVAL);

}
int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, const char *VAR_2)
{ if (*VAR_2 <= '9' && *VAR_2 >= '0')
return strtol(VAR_2, NULL, 0) == VAR_1->VAR_5; else if (*VAR_2 == 'v' || *VAR_2 == 'a' || *VAR_2 == 'VAR_0' || *VAR_2 == 'd' ||
*VAR_2 == 't') { enum AVMediaType VAR_3; switch (*VAR_2++) { case 'v': VAR_3 = AVMEDIA_TYPE_VIDEO;      break; case 'a': VAR_3 = AVMEDIA_TYPE_AUDIO;      break; case 'VAR_0': VAR_3 = AVMEDIA_TYPE_SUBTITLE;   break; case 'd': VAR_3 = AVMEDIA_TYPE_DATA;       break; case 't': VAR_3 = AVMEDIA_TYPE_ATTACHMENT; break; } if (VAR_3 != VAR_1->codec->codec_type)
return 0; if (*VAR_2++ == ':') { int VAR_7, VAR_5 = strtol(VAR_2, NULL, 0); for (VAR_7 = 0; VAR_7 < VAR_0->nb_streams; VAR_7++) if (VAR_0->streams[VAR_7]->codec->codec_type == VAR_3 && VAR_5-- == 0)
return VAR_7 == VAR_1->VAR_5; return 0; } return 1; } else if (*VAR_2 == 'p' && *(VAR_2 + 1) == ':') { int VAR_6, VAR_7, VAR_7; char *VAR_8; VAR_2 += 2; VAR_6 = strtol(VAR_2, &VAR_8, 0); for (VAR_7 = 0; VAR_7 < VAR_0->nb_programs; VAR_7++) { if (VAR_0->programs[VAR_7]->id != VAR_6)
continue; if (*VAR_8++ == ':') { int stream_idx = strtol(VAR_8, NULL, 0); return stream_idx >= 0 &&
stream_idx < VAR_0->programs[VAR_7]->nb_stream_indexes &&
VAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[stream_idx]; } for (VAR_7 = 0; VAR_7 < VAR_0->programs[VAR_7]->nb_stream_indexes; VAR_7++) if (VAR_1->VAR_5 == VAR_0->programs[VAR_7]->stream_index[VAR_7])
return 1; } return 0; } else if (!*VAR_2) return 1; av_log(VAR_0, AV_LOG_ERROR, "Invalid stream specifier: %VAR_0.\n", VAR_2); return AVERROR(EINVAL); }