[MPlayer-dev-eng] [PATCH] vobsub fix for empty useless streams

Nico Sabbi nicola_sabbi at fastwebnet.it
Sat Sep 15 12:34:20 CEST 2007


Ulion wrote:
> ignored?
> 
> 

the link points to an eastern page that almost no one can read
and understand, much less use to download the file.
Your patch is mostly ok except for the following stylistic reasons:


+int
+vobsub_get_id_by_index(void *vobhandle, unsigned int index)

ugly: it makes harder to find a function definition with grep,
instead the following is much better
+int vobsub_get_id_by_index(void *vobhandle, unsigned int index)

here:
+    for (i = 0; i < vob->spu_streams_size; ++i)
+        if (vob->spu_streams[i].id && j++ == index)
+            return i;

I find that hidden j++ ugly. What's wrong with  this?

+    for (i = 0; i < vob->spu_streams_size; ++i)
+        if (vob->spu_streams[i].id && j == index)
+            return i;
+        else j++;


here:
+vobsub_get_index_by_id(void *vobhandle, int id)
+{
+    vobsub_t *vob = (vobsub_t *) vobhandle;
+    int i, j = 0;
+    if (vob == NULL || id < 0 || id >= vob->spu_streams_size
+            || vob->spu_streams[id].id == NULL)
+        return -1;
+    for (i = 0; i < id; ++i)
+        if (vob->spu_streams[i].id)
+            ++j;
+    return j;

ugly: j should be initialized before the for()

If you provide a direct link with the vobsub stream
I'll commit the fixed patch monday unles someone
objects || the patch doesn't work



More information about the MPlayer-dev-eng mailing list