diff options
author | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-05-15 15:38:57 +0000 |
---|---|---|
committer | nicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-05-15 15:38:57 +0000 |
commit | f781d5bc30586161c243a4ae71b50292c4b9facf (patch) | |
tree | 2eb1911db13b41ec4b52fbaed6be193e3d8cf474 /libmpdemux/cue_read.c | |
parent | 03be3966c2944767fc9d47afa66b817135732738 (diff) | |
download | mpv-f781d5bc30586161c243a4ae71b50292c4b9facf.tar.bz2 mpv-f781d5bc30586161c243a4ae71b50292c4b9facf.tar.xz |
better implementation of read()
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15483 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/cue_read.c')
-rw-r--r-- | libmpdemux/cue_read.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/libmpdemux/cue_read.c b/libmpdemux/cue_read.c index f5dad7507e..1786693a63 100644 --- a/libmpdemux/cue_read.c +++ b/libmpdemux/cue_read.c @@ -168,6 +168,7 @@ static int cue_find_bin (char *firstline) { /* get the filename out of that */ /* 12345 6 */ + mp_msg (MSGT_OPEN,MSGL_INFO, "[bincue] cue_find_bin(%s)\n", firstline); if (strncmp(firstline, "FILE \"",6)==0) { i = 0; @@ -324,9 +325,9 @@ static int cue_read_cue (char *in_cue_filename) if (*t == '\0') strcpy(t, "/"); } - mp_msg(MSGT_OPEN,MSGL_V,"dirname: %s\n", t); + strlcpy(bincue_path,t,sizeof( bincue_path )); - + mp_msg(MSGT_OPEN,MSGL_V,"dirname: %s, cuepath: %s\n", t, bincue_path); /* no path at all? */ if (strcmp(bincue_path, ".") == 0) { @@ -497,7 +498,6 @@ static void cue_vcd_read_toc(){ static int cue_vcd_read(stream_t *stream, char *mem, int size) { unsigned long position; int track = cue_current_pos.track - 1; - unsigned char tmp[VCD_SECTOR_OFFS]; position = tracks[track].start_offset + (cue_msf_2_sector(cue_current_pos.minute, @@ -510,16 +510,11 @@ static int cue_vcd_read(stream_t *stream, char *mem, int size) { if(position >= tracks[track+1].start_offset) return 0; - if(lseek(fd_bin, position, SEEK_SET) == -1) { + if(lseek(fd_bin, position+VCD_SECTOR_OFFS, SEEK_SET) == -1) { mp_msg(MSGT_OPEN,MSGL_ERR, "[bincue] unexpected end of bin file\n"); return 0; } - if(read(fd_bin, tmp, VCD_SECTOR_OFFS) != VCD_SECTOR_OFFS) { - mp_msg(MSGT_OPEN,MSGL_ERR, "[bincue] couldn't skip %d bytes before payload\n", VCD_SECTOR_OFFS); - return 0; - } - if(read(fd_bin, mem, VCD_SECTOR_DATA) != VCD_SECTOR_DATA) { mp_msg(MSGT_OPEN,MSGL_ERR, "[bincue] couldn't read %d bytes of payload\n", VCD_SECTOR_DATA); return 0; |