summaryrefslogtreecommitdiffstats
path: root/vobsub.c
diff options
context:
space:
mode:
authoratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-21 15:44:51 +0000
committeratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-21 15:44:51 +0000
commitea1d75800931055c8a04cf76e8b6c914c2ed3e23 (patch)
tree706a97f1da37f85a262bf10db23d8799eba37140 /vobsub.c
parent49a76c3a0d9d9797f59959703a325e10b102bd98 (diff)
downloadmpv-ea1d75800931055c8a04cf76e8b6c914c2ed3e23.tar.bz2
mpv-ea1d75800931055c8a04cf76e8b6c914c2ed3e23.tar.xz
Fix automatic vobsub detection and make it silent.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4788 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'vobsub.c')
-rw-r--r--vobsub.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/vobsub.c b/vobsub.c
index fbdcd2344a..8919ca94d2 100644
--- a/vobsub.c
+++ b/vobsub.c
@@ -589,7 +589,7 @@ vobsub_parse_one_line(vobsub_t *vob, FILE *fd)
}
void *
-vobsub_open(const char *const name)
+vobsub_open(const char *const name, const int force)
{
vobsub_t *vob = malloc(sizeof(vobsub_t));
if (vob) {
@@ -605,9 +605,10 @@ vobsub_open(const char *const name)
strcpy(buf, name);
strcat(buf, ".ifo");
fd = fopen(buf, "rb");
- if (fd == NULL)
- perror("VobSub: Can't open IFO file");
- else {
+ if (fd == NULL) {
+ if(force)
+ perror("VobSub: Can't open IFO file");
+ } else {
// parse IFO header
unsigned char block[0x800];
const char *const ifo_magic = "DVDVIDEO-VTS";
@@ -660,9 +661,12 @@ vobsub_open(const char *const name)
strcpy(buf, name);
strcat(buf, ".idx");
fd = fopen(buf, "rb");
- if (fd == NULL)
- perror("VobSub: Can't open IDX file");
- else {
+ if (fd == NULL) {
+ if(force)
+ perror("VobSub: Can't open IDX file");
+ else
+ return NULL;
+ } else {
while (vobsub_parse_one_line(vob, fd) >= 0)
/* NOOP */ ;
fclose(fd);
@@ -672,9 +676,10 @@ vobsub_open(const char *const name)
strcpy(buf, name);
strcat(buf, ".sub");
mpg = mpeg_open(buf);
- if (mpg == NULL)
- perror("VobSub: Can't open SUB file");
- else {
+ if (mpg == NULL) {
+ if(force)
+ perror("VobSub: Can't open SUB file");
+ } else {
long last_pts_diff = 0;
while (!mpeg_eof(mpg)) {
off_t pos = mpeg_tell(mpg);