[Mplayer-cvslog] CVS: main vobsub.c,1.33,1.34
Moritz Bunkus CVS
mosu at mplayerhq.hu
Tue Oct 28 23:37:22 CET 2003
Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv27423
Modified Files:
vobsub.c
Log Message:
Improved searching for VobSubs inside RAR archives even if the names do not match the movie name. Do not display VobSubs whose timecodes are < 0 which would make all VobSubs appear from the start on upon seeking. Patches by "Reder, Uwe" <Uwe.Reder at 3SOFT.de>.
Index: vobsub.c
===================================================================
RCS file: /cvsroot/mplayer/main/vobsub.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- vobsub.c 21 Sep 2003 14:21:11 -0000 1.33
+++ vobsub.c 28 Oct 2003 22:36:56 -0000 1.34
@@ -88,11 +88,38 @@
p++;
}
rc = urarlib_get(&stream->data, &stream->size, (char*) p, rar_filename, "");
- free(rar_filename);
if (!rc) {
- free(stream);
- return NULL;
+ /* There is no matching filename in the archive. However, sometimes
+ * the files we are looking for have been given arbitrary names in the archive.
+ * Let's look for a file with an exact match in the extension only. */
+ int i, num_files, name_len;
+ ArchiveList_struct *list, *lp;
+ /* the cast in the next line is a hack to overcome a design flaw (IMHO) in unrarlib */
+ num_files = urarlib_list (rar_filename, (ArchiveList_struct *)&list);
+ if (num_files > 0) {
+ char *demanded_ext;
+ demanded_ext = strrchr (p, '.');
+ if (demanded_ext) {
+ int demanded_ext_len = strlen (demanded_ext);
+ for (i=0, lp=list; i<num_files; i++, lp=lp->next) {
+ name_len = strlen (lp->item.Name);
+ if (name_len >= demanded_ext_len && !strcasecmp (lp->item.Name + name_len - demanded_ext_len, demanded_ext)) {
+ if ((rc = urarlib_get(&stream->data, &stream->size, lp->item.Name, rar_filename, ""))) {
+ break;
+ }
+ }
+ }
+ }
+ urarlib_freelist (list);
+ }
+ if (!rc) {
+ free(rar_filename);
+ free(stream);
+ return NULL;
+ }
}
+
+ free(rar_filename);
stream->pos = 0;
}
return stream;
More information about the MPlayer-cvslog
mailing list