[MPlayer-users] No subtitle displayed when "langidx:" in .idx is invalid . Code included for "VobSub.c"

Nap nap at xs4all.nl
Tue Jun 22 00:22:59 CEST 2004


This is a bugreport for MPlayer cvs 2004-06-21
Problem:
No subtitle displayed when "langidx:" in .idx is invalid . Code included for "VobSub.c"
 

I have made sugestion for a change in
VobSub.c

I am not a developer, but like to contribute to your wonderfull project.


By today 2004-06-21 the problem was not solved in the latest cvs
The problem is when an idx contains an invalid value for "langidx:" there will be no subtitle choosen as default.
This will occure often in v7 idx files.

The code is:

/*================================================================*/
     int i;
(...)
     /* If langidx: in .idx is not a valid id then take the first one available */
     if ((vobsub_id >= vob->spu_streams_size) || !(vob->spu_streams[vobsub_id].id)) {
      /* vobsub_id is the default language, if it is not present in stream we
         need to select another one. Just take the first available */
      vobsub_id = -1;
      for (i = 0; i < vob->spu_streams_size; i++) 
               if (vob->spu_streams[i].id) {
                    vobsub_id = i;
                    break;}
     }
/*================================================================*/


and can be added to "vobsub_open" just below the "if no palette in .idx" check as shown below:


(file: "VobSub.c")

void *
vobsub_open(const char *const name,const char *const ifo,const int force,void** spu)
{
    int i;
    vobsub_t *vob = malloc(sizeof(vobsub_t));
              (...................................)
              (...................................)
     /* if no palette in .idx then use custom colors */
     if ((vob->custom == 0)&&(vob->have_palette!=1))
  vob->custom = 1;
     if (spu && vob->orig_frame_width && vob->orig_frame_height)
       *spu = spudec_new_scaled_vobsub(vob->palette, vob->cuspal, vob->custom, vob->orig_frame_width, vob->orig_frame_height);

-----> This is the place to put it :-)
     /* If langidx: in .idx is not a valid id then take the first one available */
     if ((vobsub_id < 0) || (vobsub_id >= vob->spu_streams_size) || !(vob->spu_streams[vobsub_id].id)) {
      /* vobsub_id is the default language, if it is not present in stream we
         need to select another one. Just take the first available */
      vobsub_id = -1;
      for (i = 0; i < vob->spu_streams_size; i++) 
               if (vob->spu_streams[i].id) {
                    vobsub_id = i;
                    break;}
     }

     /* read the indexed mpeg_stream */
(.....)


A test .idx contains something like this:
#==================================================================
# VobSub index file, v7
# Eample of a failing subtitle, langidx <> index. This will offten occure in idx generated files.
langidx: 0
      #Value 6 (same as index below) would solve the problem.
      #Beware of caching of subtitles. 
      #Running next test from another directory will avoid caching problems.
id: nl, index: 6
timestamp: 00:00:02:720, filepos: 000000000
timestamp: 00:00:06:400, filepos: 000001000
timestamp: 00:00:10:720, filepos: 000002800
#==================================================================


Could someone make this change and test it ?
Thanx alot and keep up the good work...


Branko, alias Nappie :-)
Holland.




More information about the MPlayer-users mailing list