static int vobsub_read_header(AVFormatContext *s)

{

    int i, ret = 0, header_parsed = 0, langidx = 0;

    MpegDemuxContext *vobsub = s->priv_data;

    char *sub_name = NULL;

    size_t fname_len;

    char *ext, *header_str;

    AVBPrint header;

    int64_t delay = 0;

    AVStream *st = NULL;



    sub_name = av_strdup(s->filename);

    fname_len = strlen(sub_name);

    ext = sub_name - 3 + fname_len;

    if (fname_len < 4 || *(ext - 1) != '.') {

        av_log(s, AV_LOG_ERROR, "The input index filename is too short "

               "to guess the associated .SUB file\n");

        ret = AVERROR_INVALIDDATA;

        goto end;

    }

    memcpy(ext, !strncmp(ext, "IDX", 3) ? "SUB" : "sub", 3);

    av_log(s, AV_LOG_VERBOSE, "IDX/SUB: %s -> %s\n", s->filename, sub_name);

    ret = avformat_open_input(&vobsub->sub_ctx, sub_name, &ff_mpegps_demuxer, NULL);

    if (ret < 0) {

        av_log(s, AV_LOG_ERROR, "Unable to open %s as MPEG subtitles\n", sub_name);

        goto end;

    }



    av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED);

    while (!url_feof(s->pb)) {

        char line[2048];

        int len = ff_get_line(s->pb, line, sizeof(line));



        if (!len)

            break;



        line[strcspn(line, "\r\n")] = 0;



        if (!strncmp(line, "id:", 3)) {

            int n, stream_id = 0;

            char id[64] = {0};



            n = sscanf(line, "id: %63[^,], index: %u", id, &stream_id);

            if (n != 2) {

                av_log(s, AV_LOG_WARNING, "Unable to parse index line '%s', "

                       "assuming 'id: und, index: 0'\n", line);

                strcpy(id, "und");

                stream_id = 0;

            }



            if (stream_id >= FF_ARRAY_ELEMS(vobsub->q)) {

                av_log(s, AV_LOG_ERROR, "Maximum number of subtitles streams reached\n");

                ret = AVERROR(EINVAL);

                goto end;

            }



            st = avformat_new_stream(s, NULL);

            if (!st) {

                ret = AVERROR(ENOMEM);

                goto end;

            }

            st->id = stream_id;

            st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;

            st->codec->codec_id   = AV_CODEC_ID_DVD_SUBTITLE;

            avpriv_set_pts_info(st, 64, 1, 1000);

            av_dict_set(&st->metadata, "language", id, 0);

            av_log(s, AV_LOG_DEBUG, "IDX stream[%d] id=%s\n", stream_id, id);

            header_parsed = 1;



        } else if (st && !strncmp(line, "timestamp:", 10)) {

            AVPacket *sub;

            int hh, mm, ss, ms;

            int64_t pos, timestamp;

            const char *p = line + 10;



            if (!s->nb_streams) {

                av_log(s, AV_LOG_ERROR, "Timestamp declared before any stream\n");

                ret = AVERROR_INVALIDDATA;

                goto end;

            }



            if (sscanf(p, "%02d:%02d:%02d:%03d, filepos: %"SCNx64,

                       &hh, &mm, &ss, &ms, &pos) != 5) {

                av_log(s, AV_LOG_ERROR, "Unable to parse timestamp line '%s', "

                       "abort parsing\n", line);

                break;

            }

            timestamp = (hh*3600LL + mm*60LL + ss) * 1000LL + ms + delay;

            timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base);



            sub = ff_subtitles_queue_insert(&vobsub->q[s->nb_streams - 1], "", 0, 0);

            if (!sub) {

                ret = AVERROR(ENOMEM);

                goto end;

            }

            sub->pos = pos;

            sub->pts = timestamp;

            sub->stream_index = s->nb_streams - 1;



        } else if (st && !strncmp(line, "alt:", 4)) {

            const char *p = line + 4;



            while (*p == ' ')

                p++;

            av_dict_set(&st->metadata, "title", p, 0);

            av_log(s, AV_LOG_DEBUG, "IDX stream[%d] name=%s\n", st->id, p);

            header_parsed = 1;



        } else if (!strncmp(line, "delay:", 6)) {

            int sign = 1, hh = 0, mm = 0, ss = 0, ms = 0;

            const char *p = line + 6;



            while (*p == ' ')

                p++;

            if (*p == '-' || *p == '+') {

                sign = *p == '-' ? -1 : 1;

                p++;

            }

            sscanf(p, "%d:%d:%d:%d", &hh, &mm, &ss, &ms);

            delay = ((hh*3600LL + mm*60LL + ss) * 1000LL + ms) * sign;



        } else if (!strncmp(line, "langidx:", 8)) {

            const char *p = line + 8;



            if (sscanf(p, "%d", &langidx) != 1)

                av_log(s, AV_LOG_ERROR, "Invalid langidx specified\n");



        } else if (!header_parsed) {

            if (line[0] && line[0] != '#')

                av_bprintf(&header, "%s\n", line);

        }

    }



    if (langidx < s->nb_streams)

        s->streams[langidx]->disposition |= AV_DISPOSITION_DEFAULT;



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

        vobsub->q[i].sort = SUB_SORT_POS_TS;

        ff_subtitles_queue_finalize(&vobsub->q[i]);

    }



    if (!av_bprint_is_complete(&header)) {

        av_bprint_finalize(&header, NULL);

        ret = AVERROR(ENOMEM);

        goto end;

    }

    av_bprint_finalize(&header, &header_str);

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

        AVStream *sub_st = s->streams[i];

        sub_st->codec->extradata      = av_strdup(header_str);

        sub_st->codec->extradata_size = header.len;

    }

    av_free(header_str);



end:

    av_free(sub_name);

    return ret;

}

static int vobsub_read_header(AVFormatContext *s)

{

    int i, ret = 0, header_parsed = 0, langidx = 0;

    MpegDemuxContext *vobsub = s->priv_data;

    char *sub_name = NULL;

    size_t fname_len;

    char *ext, *header_str;

    AVBPrint header;

    int64_t delay = 0;

    AVStream *st = NULL;



    sub_name = av_strdup(s->filename);

    fname_len = strlen(sub_name);

    ext = sub_name - 3 + fname_len;

    if (fname_len < 4 || *(ext - 1) != '.') {

        av_log(s, AV_LOG_ERROR, "The input index filename is too short "

               "to guess the associated .SUB file\n");

        ret = AVERROR_INVALIDDATA;

        goto end;

    }

    memcpy(ext, !strncmp(ext, "IDX", 3) ? "SUB" : "sub", 3);

    av_log(s, AV_LOG_VERBOSE, "IDX/SUB: %s -> %s\n", s->filename, sub_name);

    ret = avformat_open_input(&vobsub->sub_ctx, sub_name, &ff_mpegps_demuxer, NULL);

    if (ret < 0) {

        av_log(s, AV_LOG_ERROR, "Unable to open %s as MPEG subtitles\n", sub_name);

        goto end;

    }



    av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED);

    while (!url_feof(s->pb)) {

        char line[2048];

        int len = ff_get_line(s->pb, line, sizeof(line));



        if (!len)

            break;



        line[strcspn(line, "\r\n")] = 0;



        if (!strncmp(line, "id:", 3)) {

            int n, stream_id = 0;

            char id[64] = {0};



            n = sscanf(line, "id: %63[^,], index: %u", id, &stream_id);

            if (n != 2) {

                av_log(s, AV_LOG_WARNING, "Unable to parse index line '%s', "

                       "assuming 'id: und, index: 0'\n", line);

                strcpy(id, "und");

                stream_id = 0;

            }



            if (stream_id >= FF_ARRAY_ELEMS(vobsub->q)) {

                av_log(s, AV_LOG_ERROR, "Maximum number of subtitles streams reached\n");

                ret = AVERROR(EINVAL);

                goto end;

            }



            st = avformat_new_stream(s, NULL);

            if (!st) {

                ret = AVERROR(ENOMEM);

                goto end;

            }

            st->id = stream_id;

            st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;

            st->codec->codec_id   = AV_CODEC_ID_DVD_SUBTITLE;

            avpriv_set_pts_info(st, 64, 1, 1000);

            av_dict_set(&st->metadata, "language", id, 0);

            av_log(s, AV_LOG_DEBUG, "IDX stream[%d] id=%s\n", stream_id, id);

            header_parsed = 1;



        } else if (st && !strncmp(line, "timestamp:", 10)) {

            AVPacket *sub;

            int hh, mm, ss, ms;

            int64_t pos, timestamp;

            const char *p = line + 10;



            if (!s->nb_streams) {

                av_log(s, AV_LOG_ERROR, "Timestamp declared before any stream\n");

                ret = AVERROR_INVALIDDATA;

                goto end;

            }



            if (sscanf(p, "%02d:%02d:%02d:%03d, filepos: %"SCNx64,

                       &hh, &mm, &ss, &ms, &pos) != 5) {

                av_log(s, AV_LOG_ERROR, "Unable to parse timestamp line '%s', "

                       "abort parsing\n", line);

                break;

            }

            timestamp = (hh*3600LL + mm*60LL + ss) * 1000LL + ms + delay;

            timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base);



            sub = ff_subtitles_queue_insert(&vobsub->q[s->nb_streams - 1], "", 0, 0);

            if (!sub) {

                ret = AVERROR(ENOMEM);

                goto end;

            }

            sub->pos = pos;

            sub->pts = timestamp;

            sub->stream_index = s->nb_streams - 1;



        } else if (st && !strncmp(line, "alt:", 4)) {

            const char *p = line + 4;



            while (*p == ' ')

                p++;

            av_dict_set(&st->metadata, "title", p, 0);

            av_log(s, AV_LOG_DEBUG, "IDX stream[%d] name=%s\n", st->id, p);

            header_parsed = 1;



        } else if (!strncmp(line, "delay:", 6)) {

            int sign = 1, hh = 0, mm = 0, ss = 0, ms = 0;

            const char *p = line + 6;



            while (*p == ' ')

                p++;

            if (*p == '-' || *p == '+') {

                sign = *p == '-' ? -1 : 1;

                p++;

            }

            sscanf(p, "%d:%d:%d:%d", &hh, &mm, &ss, &ms);

            delay = ((hh*3600LL + mm*60LL + ss) * 1000LL + ms) * sign;



        } else if (!strncmp(line, "langidx:", 8)) {

            const char *p = line + 8;



            if (sscanf(p, "%d", &langidx) != 1)

                av_log(s, AV_LOG_ERROR, "Invalid langidx specified\n");



        } else if (!header_parsed) {

            if (line[0] && line[0] != '#')

                av_bprintf(&header, "%s\n", line);

        }

    }



    if (langidx < s->nb_streams)

        s->streams[langidx]->disposition |= AV_DISPOSITION_DEFAULT;



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

        vobsub->q[i].sort = SUB_SORT_POS_TS;

        ff_subtitles_queue_finalize(&vobsub->q[i]);

    }



    if (!av_bprint_is_complete(&header)) {

        av_bprint_finalize(&header, NULL);

        ret = AVERROR(ENOMEM);

        goto end;

    }

    av_bprint_finalize(&header, &header_str);

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

        AVStream *sub_st = s->streams[i];

        sub_st->codec->extradata      = av_strdup(header_str);

        sub_st->codec->extradata_size = header.len;

    }

    av_free(header_str);



end:

    av_free(sub_name);

    return ret;

}

        char line[2048];             int n, stream_id = 0;             char id[64] = {0};             n = sscanf(line, "id: %63[^,], index: %u", id, &stream_id);             if (n != 2) {             st = avformat_new_stream(s, NULL);             if (!st) {                 ret = AVERROR(ENOMEM);                 goto end;             st->id = stream_id;             st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;             st->codec->codec_id   = AV_CODEC_ID_DVD_SUBTITLE;             avpriv_set_pts_info(st, 64, 1, 1000);             av_dict_set(&st->metadata, "language", id, 0);             av_log(s, AV_LOG_DEBUG, "IDX stream[%d] id=%s\n", stream_id, id);         } else if (st && !strncmp(line, "timestamp:", 10)) {             if (!s->nb_streams) {                 break;         } else if (st && !strncmp(line, "alt:", 4)) {             av_dict_set(&st->metadata, "title", p, 0);
static int FUNC_0(AVFormatContext *VAR_0)

{

    int VAR_1, VAR_2 = 0, VAR_3 = 0, VAR_4 = 0;

    MpegDemuxContext *vobsub = VAR_0->priv_data;

    char *VAR_5 = NULL;

    size_t fname_len;

    char *VAR_6, *VAR_7;

    AVBPrint header;

    int64_t delay = 0;

    AVStream *st = NULL;



    VAR_5 = av_strdup(VAR_0->filename);

    fname_len = strlen(VAR_5);

    VAR_6 = VAR_5 - 3 + fname_len;

    if (fname_len < 4 || *(VAR_6 - 1) != '.') {

        av_log(VAR_0, AV_LOG_ERROR, "The input index filename is too short "

               "to guess the associated .SUB file\VAR_10");

        VAR_2 = AVERROR_INVALIDDATA;

        goto end;

    }

    memcpy(VAR_6, !strncmp(VAR_6, "IDX", 3) ? "SUB" : "sub", 3);

    av_log(VAR_0, AV_LOG_VERBOSE, "IDX/SUB: %VAR_0 -> %VAR_0\VAR_10", VAR_0->filename, VAR_5);

    VAR_2 = avformat_open_input(&vobsub->sub_ctx, VAR_5, &ff_mpegps_demuxer, NULL);

    if (VAR_2 < 0) {

        av_log(VAR_0, AV_LOG_ERROR, "Unable to open %VAR_0 as MPEG subtitles\VAR_10", VAR_5);

        goto end;

    }



    av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED);

    while (!url_feof(VAR_0->pb)) {

        char VAR_8[2048];

        int VAR_9 = ff_get_line(VAR_0->pb, VAR_8, sizeof(VAR_8));



        if (!VAR_9)

            break;



        VAR_8[strcspn(VAR_8, "\r\VAR_10")] = 0;



        if (!strncmp(VAR_8, "VAR_12:", 3)) {

            int VAR_10, VAR_11 = 0;

            char VAR_12[64] = {0};



            VAR_10 = sscanf(VAR_8, "VAR_12: %63[^,], index: %u", VAR_12, &VAR_11);

            if (VAR_10 != 2) {

                av_log(VAR_0, AV_LOG_WARNING, "Unable to parse index VAR_8 '%VAR_0', "

                       "assuming 'VAR_12: und, index: 0'\VAR_10", VAR_8);

                strcpy(VAR_12, "und");

                VAR_11 = 0;

            }



            if (VAR_11 >= FF_ARRAY_ELEMS(vobsub->q)) {

                av_log(VAR_0, AV_LOG_ERROR, "Maximum number of subtitles streams reached\VAR_10");

                VAR_2 = AVERROR(EINVAL);

                goto end;

            }



            st = avformat_new_stream(VAR_0, NULL);

            if (!st) {

                VAR_2 = AVERROR(ENOMEM);

                goto end;

            }

            st->VAR_12 = VAR_11;

            st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;

            st->codec->codec_id   = AV_CODEC_ID_DVD_SUBTITLE;

            avpriv_set_pts_info(st, 64, 1, 1000);

            av_dict_set(&st->metadata, "language", VAR_12, 0);

            av_log(VAR_0, AV_LOG_DEBUG, "IDX stream[%d] VAR_12=%VAR_0\VAR_10", VAR_11, VAR_12);

            VAR_3 = 1;



        } else if (st && !strncmp(VAR_8, "timestamp:", 10)) {

            AVPacket *sub;

            int VAR_19, VAR_19, VAR_19, VAR_19;

            int64_t pos, timestamp;

            const char *VAR_19 = VAR_8 + 10;



            if (!VAR_0->nb_streams) {

                av_log(VAR_0, AV_LOG_ERROR, "Timestamp declared before any stream\VAR_10");

                VAR_2 = AVERROR_INVALIDDATA;

                goto end;

            }



            if (sscanf(VAR_19, "%02d:%02d:%02d:%03d, filepos: %"SCNx64,

                       &VAR_19, &VAR_19, &VAR_19, &VAR_19, &pos) != 5) {

                av_log(VAR_0, AV_LOG_ERROR, "Unable to parse timestamp VAR_8 '%VAR_0', "

                       "abort parsing\VAR_10", VAR_8);

                break;

            }

            timestamp = (VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19 + delay;

            timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base);



            sub = ff_subtitles_queue_insert(&vobsub->q[VAR_0->nb_streams - 1], "", 0, 0);

            if (!sub) {

                VAR_2 = AVERROR(ENOMEM);

                goto end;

            }

            sub->pos = pos;

            sub->pts = timestamp;

            sub->stream_index = VAR_0->nb_streams - 1;



        } else if (st && !strncmp(VAR_8, "alt:", 4)) {

            const char *VAR_19 = VAR_8 + 4;



            while (*VAR_19 == ' ')

                VAR_19++;

            av_dict_set(&st->metadata, "title", VAR_19, 0);

            av_log(VAR_0, AV_LOG_DEBUG, "IDX stream[%d] name=%VAR_0\VAR_10", st->VAR_12, VAR_19);

            VAR_3 = 1;



        } else if (!strncmp(VAR_8, "delay:", 6)) {

            int VAR_18 = 1, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0;

            const char *VAR_19 = VAR_8 + 6;



            while (*VAR_19 == ' ')

                VAR_19++;

            if (*VAR_19 == '-' || *VAR_19 == '+') {

                VAR_18 = *VAR_19 == '-' ? -1 : 1;

                VAR_19++;

            }

            sscanf(VAR_19, "%d:%d:%d:%d", &VAR_19, &VAR_19, &VAR_19, &VAR_19);

            delay = ((VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19) * VAR_18;



        } else if (!strncmp(VAR_8, "VAR_4:", 8)) {

            const char *VAR_19 = VAR_8 + 8;



            if (sscanf(VAR_19, "%d", &VAR_4) != 1)

                av_log(VAR_0, AV_LOG_ERROR, "Invalid VAR_4 specified\VAR_10");



        } else if (!VAR_3) {

            if (VAR_8[0] && VAR_8[0] != '#')

                av_bprintf(&header, "%VAR_0\VAR_10", VAR_8);

        }

    }



    if (VAR_4 < VAR_0->nb_streams)

        VAR_0->streams[VAR_4]->disposition |= AV_DISPOSITION_DEFAULT;



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

        vobsub->q[VAR_1].sort = SUB_SORT_POS_TS;

        ff_subtitles_queue_finalize(&vobsub->q[VAR_1]);

    }



    if (!av_bprint_is_complete(&header)) {

        av_bprint_finalize(&header, NULL);

        VAR_2 = AVERROR(ENOMEM);

        goto end;

    }

    av_bprint_finalize(&header, &VAR_7);

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

        AVStream *sub_st = VAR_0->streams[VAR_1];

        sub_st->codec->extradata      = av_strdup(VAR_7);

        sub_st->codec->extradata_size = header.VAR_9;

    }

    av_free(VAR_7);



end:

    av_free(VAR_5);

    return VAR_2;

}

static int FUNC_0(AVFormatContext *VAR_0)
{ int VAR_1, VAR_2 = 0, VAR_3 = 0, VAR_4 = 0; MpegDemuxContext *vobsub = VAR_0->priv_data; char *VAR_5 = NULL; size_t fname_len; char *VAR_6, *VAR_7; AVBPrint header; int64_t delay = 0; AVStream *st = NULL; VAR_5 = av_strdup(VAR_0->filename); fname_len = strlen(VAR_5); VAR_6 = VAR_5 - 3 + fname_len; if (fname_len < 4 || *(VAR_6 - 1) != '.') { av_log(VAR_0, AV_LOG_ERROR, "The input index filename is too short "
"to guess the associated .SUB file\VAR_10"); VAR_2 = AVERROR_INVALIDDATA; goto end; } memcpy(VAR_6, !strncmp(VAR_6, "IDX", 3) ? "SUB" : "sub", 3); av_log(VAR_0, AV_LOG_VERBOSE, "IDX/SUB: %VAR_0 -> %VAR_0\VAR_10", VAR_0->filename, VAR_5); VAR_2 = avformat_open_input(&vobsub->sub_ctx, VAR_5, &ff_mpegps_demuxer, NULL); if (VAR_2 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to open %VAR_0 as MPEG subtitles\VAR_10", VAR_5); goto end; } av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); while (!url_feof(VAR_0->pb)) { char VAR_8[2048]; int VAR_9 = ff_get_line(VAR_0->pb, VAR_8, sizeof(VAR_8)); if (!VAR_9)
break; VAR_8[strcspn(VAR_8, "\r\VAR_10")] = 0; if (!strncmp(VAR_8, "VAR_12:", 3)) { int VAR_10, VAR_11 = 0; char VAR_12[64] = {0}; VAR_10 = sscanf(VAR_8, "VAR_12: %63[^,], index: %u", VAR_12, &VAR_11); if (VAR_10 != 2) { av_log(VAR_0, AV_LOG_WARNING, "Unable to parse index VAR_8 '%VAR_0', "
"assuming 'VAR_12: und, index: 0'\VAR_10", VAR_8); strcpy(VAR_12, "und"); VAR_11 = 0; } if (VAR_11 >= FF_ARRAY_ELEMS(vobsub->q)) { av_log(VAR_0, AV_LOG_ERROR, "Maximum number of subtitles streams reached\VAR_10"); VAR_2 = AVERROR(EINVAL); goto end; } st = avformat_new_stream(VAR_0, NULL); if (!st) { VAR_2 = AVERROR(ENOMEM); goto end; } st->VAR_12 = VAR_11; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id   = AV_CODEC_ID_DVD_SUBTITLE; avpriv_set_pts_info(st, 64, 1, 1000); av_dict_set(&st->metadata, "language", VAR_12, 0); av_log(VAR_0, AV_LOG_DEBUG, "IDX stream[%d] VAR_12=%VAR_0\VAR_10", VAR_11, VAR_12); VAR_3 = 1; } else if (st && !strncmp(VAR_8, "timestamp:", 10)) { AVPacket *sub; int VAR_19, VAR_19, VAR_19, VAR_19; int64_t pos, timestamp; const char *VAR_19 = VAR_8 + 10; if (!VAR_0->nb_streams) { av_log(VAR_0, AV_LOG_ERROR, "Timestamp declared before any stream\VAR_10"); VAR_2 = AVERROR_INVALIDDATA; goto end; } if (sscanf(VAR_19, "%02d:%02d:%02d:%03d, filepos: %"SCNx64,
&VAR_19, &VAR_19, &VAR_19, &VAR_19, &pos) != 5) { av_log(VAR_0, AV_LOG_ERROR, "Unable to parse timestamp VAR_8 '%VAR_0', "
"abort parsing\VAR_10", VAR_8); break; } timestamp = (VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19 + delay; timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base); sub = ff_subtitles_queue_insert(&vobsub->q[VAR_0->nb_streams - 1], "", 0, 0); if (!sub) { VAR_2 = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = timestamp; sub->stream_index = VAR_0->nb_streams - 1; } else if (st && !strncmp(VAR_8, "alt:", 4)) { const char *VAR_19 = VAR_8 + 4; while (*VAR_19 == ' ')
VAR_19++; av_dict_set(&st->metadata, "title", VAR_19, 0); av_log(VAR_0, AV_LOG_DEBUG, "IDX stream[%d] name=%VAR_0\VAR_10", st->VAR_12, VAR_19); VAR_3 = 1; } else if (!strncmp(VAR_8, "delay:", 6)) { int VAR_18 = 1, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0; const char *VAR_19 = VAR_8 + 6; while (*VAR_19 == ' ')
VAR_19++; if (*VAR_19 == '-' || *VAR_19 == '+') { VAR_18 = *VAR_19 == '-' ? -1 : 1; VAR_19++; } sscanf(VAR_19, "%d:%d:%d:%d", &VAR_19, &VAR_19, &VAR_19, &VAR_19); delay = ((VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19) * VAR_18; } else if (!strncmp(VAR_8, "VAR_4:", 8)) { const char *VAR_19 = VAR_8 + 8; if (sscanf(VAR_19, "%d", &VAR_4) != 1)
av_log(VAR_0, AV_LOG_ERROR, "Invalid VAR_4 specified\VAR_10"); } else if (!VAR_3) { if (VAR_8[0] && VAR_8[0] != '#')
av_bprintf(&header, "%VAR_0\VAR_10", VAR_8); } } if (VAR_4 < VAR_0->nb_streams)
VAR_0->streams[VAR_4]->disposition |= AV_DISPOSITION_DEFAULT; for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { vobsub->q[VAR_1].sort = SUB_SORT_POS_TS; ff_subtitles_queue_finalize(&vobsub->q[VAR_1]); } if (!av_bprint_is_complete(&header)) { av_bprint_finalize(&header, NULL); VAR_2 = AVERROR(ENOMEM); goto end; } av_bprint_finalize(&header, &VAR_7); for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *sub_st = VAR_0->streams[VAR_1]; sub_st->codec->extradata      = av_strdup(VAR_7); sub_st->codec->extradata_size = header.VAR_9; } av_free(VAR_7); end:
av_free(VAR_5); return VAR_2; }