Ticket #529: ogg_seek.diff
| File ogg_seek.diff, 1.9 KB (added by , 20 years ago) |
|---|
-
utils.c
1097 1097 * @param timestamp new dts expressed in time_base of param ref_st 1098 1098 * @param ref_st reference stream giving time_base of param timestamp 1099 1099 */ 1100 staticvoid av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp){1100 void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp){ 1101 1101 int i; 1102 1102 1103 1103 for(i = 0; i < s->nb_streams; i++) { -
ogg2.c
201 201 return AVERROR_NOMEM; 202 202 203 203 av_set_pts_info(st, 64, 1, 1000000); 204 st->start_time = 0;205 204 206 205 return idx; 207 206 } … … 495 494 496 495 ogg->size = size; 497 496 ogg_restore (s, 0); 497 ogg_save (s); 498 while (ogg_read_page (s, &i)) { 499 if (i == idx && ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0) 500 break; 501 } 502 if (i == idx) { 503 s->streams[idx]->start_time = ogg_gptopts (s, idx, ogg->streams[idx].granule); 504 s->streams[idx]->duration -= s->streams[idx]->start_time; 505 } 506 ogg_restore (s, 0); 498 507 499 508 return 0; 500 509 } … … 572 581 ogg_t *ogg = s->priv_data; 573 582 ByteIOContext *bc = &s->pb; 574 583 uint64_t min = 0, max = ogg->size; 575 uint64_t tmin = 0, tmax =st->duration;584 uint64_t tmin = st->start_time, tmax = st->start_time + st->duration; 576 585 int64_t pts = AV_NOPTS_VALUE; 577 586 578 587 ogg_save (s); 579 588 589 if ((uint64_t)target_ts < tmin || target_ts < 0) 590 target_ts = tmin; 580 591 while (min <= max){ 581 592 uint64_t p = min + (max - min) * (target_ts - tmin) / (tmax - tmin); 582 593 int i = -1; … … 615 626 pts = AV_NOPTS_VALUE; 616 627 } 617 628 618 return pts; 629 av_update_cur_dts(s, st, pts); 630 return 0; 619 631 620 632 #if 0 621 633 //later...
