- }
- }
- if (!len)
- len = ff_get_line(s->pb, buffer, sizeof(buffer));
-
- if (microdvd->last_pkt.duration == -1 && !buffer[0]) {
- // if the previous subtitle line had no duration, last until the end of
- // the presentation
- microdvd->last_pkt.duration = 0;
- *pkt = microdvd->last_pkt;
- pkt->duration = -1;
- res = 0;
- } else if (buffer[0] && !(res = av_new_packet(pkt, len))) {
- memcpy(pkt->data, buffer, len);
- pkt->flags |= AV_PKT_FLAG_KEY;
- pkt->pos = pos;
- pkt->pts = pkt->dts = get_pts(buffer);
-
- if (pkt->pts != AV_NOPTS_VALUE) {
- pkt->duration = get_duration(buffer);
- if (microdvd->last_pkt.duration == -1) {
- // previous packet wasn't raised because it was lacking the
- // duration info, so set its duration with the new packet pts
- // and raise it
- AVPacket tmp_pkt;
-
- tmp_pkt = microdvd->last_pkt;
- tmp_pkt.duration = pkt->pts - tmp_pkt.pts;
- microdvd->last_pkt = *pkt;
- microdvd->last_pkt_ready = pkt->duration != -1;
- *pkt = tmp_pkt;
- } else if (pkt->duration == -1) {
- // no packet without duration queued, and current one is
- // lacking the duration info, we need to parse another subtitle
- // event.
- microdvd->last_pkt = *pkt;
- res = AVERROR(EAGAIN);
+ if (i < 3) {
+ int frame;
+ double fps;
+ char c;
+
+ i++;
+ if ((sscanf(line, "{%d}{}%6lf", &frame, &fps) == 2 ||
+ sscanf(line, "{%d}{%*d}%6lf", &frame, &fps) == 2)
+ && frame <= 1 && fps > 3 && fps < 100)
+ pts_info = av_d2q(fps, 100000);
+ if (!st->codec->extradata && sscanf(line, "{DEFAULT}{}%c", &c) == 1) {
+ st->codec->extradata = av_strdup(line + 11);
+ if (!st->codec->extradata)
+ return AVERROR(ENOMEM);
+ st->codec->extradata_size = strlen(st->codec->extradata) + 1;
+ continue;