Mercurial > mplayer.hg
comparison stream/stream_dvd.c @ 35885:3389262720da
Fix previous commit, off_t must be replaced by int64_t
The commit replacing off_t by uint64_t was by accident,
I meant to commit this variant.
off_t must be replaced by a signed type to avoid breaking
things like seeking backwards and also detecting errors
from e.g. lseek without too complex hacks.
author | reimar |
---|---|
date | Sat, 16 Mar 2013 13:38:34 +0000 |
parents | b5abdfe9bc61 |
children | 389d43c448b3 |
comparison
equal
deleted
inserted
replaced
35884:edd8273dc025 | 35885:3389262720da |
---|---|
414 dvd_set_speed(dvd_device_current, -1); /* -1 => restore default */ | 414 dvd_set_speed(dvd_device_current, -1); /* -1 => restore default */ |
415 } | 415 } |
416 | 416 |
417 static int fill_buffer(stream_t *s, char *buf, int len) | 417 static int fill_buffer(stream_t *s, char *buf, int len) |
418 { | 418 { |
419 uint64_t pos; | 419 int64_t pos; |
420 if (len < 2048) | 420 if (len < 2048) |
421 return -1; | 421 return -1; |
422 pos = dvd_read_sector(s->priv, buf); | 422 pos = dvd_read_sector(s->priv, buf); |
423 if (pos < 0) | 423 if (pos < 0) |
424 return -1; | 424 return -1; |
425 s->pos = 2048*(pos - 1); | 425 s->pos = 2048*(pos - 1); |
426 return 2048; // full sector | 426 return 2048; // full sector |
427 } | 427 } |
428 | 428 |
429 static int seek(stream_t *s, uint64_t newpos) { | 429 static int seek(stream_t *s, int64_t newpos) { |
430 s->pos=newpos; // real seek | 430 s->pos=newpos; // real seek |
431 dvd_seek(s->priv,s->pos/2048); | 431 dvd_seek(s->priv,s->pos/2048); |
432 return 1; | 432 return 1; |
433 } | 433 } |
434 | 434 |
502 static int seek_to_chapter(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no, int chapter) | 502 static int seek_to_chapter(stream_t *stream, ifo_handle_t *vts_file, tt_srpt_t *tt_srpt, int title_no, int chapter) |
503 { | 503 { |
504 dvd_priv_t *d = stream->priv; | 504 dvd_priv_t *d = stream->priv; |
505 ptt_info_t ptt; | 505 ptt_info_t ptt; |
506 pgc_t *pgc; | 506 pgc_t *pgc; |
507 uint64_t pos; | 507 int64_t pos; |
508 | 508 |
509 if(!vts_file || !tt_srpt) | 509 if(!vts_file || !tt_srpt) |
510 return 0; | 510 return 0; |
511 | 511 |
512 if(title_no < 0 || title_no >= tt_srpt->nr_of_srpts) | 512 if(title_no < 0 || title_no >= tt_srpt->nr_of_srpts) |
595 static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec) | 595 static int dvd_seek_to_time(stream_t *stream, ifo_handle_t *vts_file, double sec) |
596 { | 596 { |
597 unsigned int i, j, k, timeunit, ac_time, tmap_sector=0, cell_sector=0, vobu_sector=0; | 597 unsigned int i, j, k, timeunit, ac_time, tmap_sector=0, cell_sector=0, vobu_sector=0; |
598 int t=0; | 598 int t=0; |
599 double tm, duration; | 599 double tm, duration; |
600 uint64_t pos = -1; | 600 int64_t pos = -1; |
601 dvd_priv_t *d = stream->priv; | 601 dvd_priv_t *d = stream->priv; |
602 vts_tmapt_t *vts_tmapt = vts_file->vts_tmapt; | 602 vts_tmapt_t *vts_tmapt = vts_file->vts_tmapt; |
603 | 603 |
604 if(!vts_file->vts_tmapt || sec < 0) | 604 if(!vts_file->vts_tmapt || sec < 0) |
605 return 0; | 605 return 0; |