[vlc] Re: VobSub format changes

Derk-Jan Hartman hartman at videolan.org
Sun Jan 29 17:50:53 CET 2006


On 28-jan-2006, at 18:05, Vorfeed Canal wrote:
> Finally managed to compile the beast. It works. Almost. The problem is
> that "Delay:" is written in file EXACTLY like this. With Capital "D".
> I've fixed problem with "negative offset biger then 1hour" and
> replaced "delay" with "Delay" in couple of places and now my files are
> fully playable. Hurray ? Nope. I've checked VSFilter sources and found
> that "Delay:", "delay:" or even "dElAy:" are accepted. AFAIK nothing
> will produce last version but both "Delay:" and "delay:" are Ok.
>
> Solution is simple: lowercase the line before parsing it (that's what
> VSFilter is doing; actually it does lowercase in dozen of places:
> every time where it needs string). But... I'm not sure if VLC have
> such function readily available


I do a strcasecmp on the Delay now. However the sscanf that actually  
reads the line will only accept Delay or delay now. I think it will  
do the trick.
The SSA format is case sensitive btw. it should ALWAYS be "delay",  
regardless of what VSFilter accepts.

The issue with the hour needing h = -h is also fixed now. (had been  
for a couple of days already btw.)

DJ

> Here is what I did to make all my files playable:
>
> --- vobsub.c
> +++ vobsub.c
> @@ -577,12 +577,16 @@
>
>              vobsub_track_t *current_tk = &p_sys->track[p_sys- 
> >i_tracks - 1];
>
> -            if( sscanf( line, "timestamp: %d%n:%d:%d:%d, filepos: % 
> x",
> -                        &h, &count, &m, &s, &ms, &loc ) >= 5  )
> +            if( sscanf( line, "timestamp: %n%d:%d:%d:%d, filepos: % 
> x",
> +                        &count, &h, &m, &s, &ms, &loc ) >= 5  )
>              {
>                  subtitle_t *current_sub;
>
> -                if( line[count-3] == '-' ) i_sign = -1;
> +                if( line[count] == '-' )
> +               {
> +                   i_sign = -1;
> +                   h = -h;
> +               }
>                  i_start = (int64_t) ( h * 3600*1000 +
>                              m * 60*1000 +
>                              s * 1000 +
> @@ -598,7 +602,7 @@
>                  current_sub->i_vobsub_location = i_location;
>              }
>          }
> -        else if( !strncmp( line, "delay:", 6 ) )
> +        else if( !strncmp( line, "Delay:", 6 ) )
>          {
>              /*
>               * delay: [sign]hh:mm:ss:mss
> @@ -609,10 +613,14 @@
>
>              vobsub_track_t *current_tk = &p_sys->track[p_sys- 
> >i_tracks - 1];
>
> -            if( sscanf( line, "delay: %d%n:%d:%d:%d",
> -                        &h, &count, &m, &s, &ms ) >= 4 )
> +            if( sscanf( line, "Delay: %n%d:%d:%d:%d",
> +                        &count, &h, &m, &s, &ms ) >= 4 )
>              {
> -                if( line[count-3] == '-' ) i_sign = -1;
> +                if( line[count] == '-' )
> +               {
> +                   i_sign = -1;
> +                   h = -h;
> +               }
>                  i_gap = (int64_t) ( h * 3600*1000 +
>                              m * 60*1000 +
>                              s * 1000 +
>
> Does VLC have handy function to lowercase (or upcase) string ? It'll
> be better to do this then to replace "delay" with "Delay" IMO...
>
> On 1/20/06, Vorfeed Canal <vorfeed.canal at gmail.com> wrote:
>> Sorry for delay.
>>
>> Here are subtitles. You can grab .AVI files for them from
>> http://lj.karlson.ru/UY/UY-Ep58Avi.7z
>>
>> I can not compile last version from SVN (I think it's something with
>> my setup - I upgraded glibc recently) so I've just looked on code. It
>> does not look exactly right. What'll happen if timestamp will include
>> timestamp like -01:23:45:678 ?
>>
>> I think it'll be more correct to grab position of "-" directly  
>> (sscanf
>> will skip spaces if there are any), but more important is to negate h
>> when it's not zero !
>>
>> Or may be it's better to use abs ?
>>
>> On 1/16/06, Derk-Jan Hartman <hartman at videolan.org> wrote:
>>> I think I just fixed your problem.
>>> You can try a nightly build tomorrow (it was committed after  
>>> tonights
>>> nightly)
>>> I would welcome it if you could test it with your files, since i  
>>> only
>>> tested:
>>>
>>>> Delay:  -00:25:39:200
>>>> Delay:  00:25:39:200
>>>> timestamp: 00:25:38:138, filepos: 000000000
>>>
>>> but not
>>>
>>>> timestamp: -00:25:38:138, filepos: 000000000
>>>
>>> Since that was a bit too complicated.
>>>
>>>
>>>
>>> I also added support for dvd palette information.
>>>
>>> DJ
>>>
>>>
>>> On 15-jan-2006, at 17:39, Derk-Jan Hartman wrote:
>>>
>>>> If you could send me these .idx and .sub, i will take a look at it.
>>>>
>>>> DJ
>>>>
>>>> On 15-jan-2006, at 8:44, Vorfeed Canal wrote:
>>>>
>>>>> Recently I've got few files with VobSub subtiles unplayable by  
>>>>> VLC.
>>>>> Here is sample of VLC-friendly VobSub .idx:
>>>>>
>>>>> # English
>>>>> id: en, index: 0
>>>>> # Decomment next line to activate alternative name in  
>>>>> DirectVobSub /
>>>>> Windows Media Player 6.x
>>>>> # alt: English
>>>>> # Vob/Cell ID: 21, 1 (PTS: 0)
>>>>> timestamp: 00:00:01:062, filepos: 000000000
>>>>> timestamp: 00:00:08:302, filepos: 000001800
>>>>> timestamp: 00:00:15:510, filepos: 000002800
>>>>> timestamp: 00:00:22:683, filepos: 000003800
>>>>> timestamp: 00:00:29:624, filepos: 000004800
>>>>>
>>>>> Here is what latest version of VSFilter produced:
>>>>>
>>>>> # English
>>>>> id: en, index: 0
>>>>> # Decomment next line to activate alternative name in  
>>>>> DirectVobSub /
>>>>> Windows Media Player 6.x
>>>>> # alt: English
>>>>> # Vob/Cell ID: 21, 1 (PTS: 0)
>>>>> Delay:  00:25:39:200
>>>>> timestamp: -00:25:38:138, filepos: 000000000
>>>>> timestamp: -00:25:30:898, filepos: 000001800
>>>>> timestamp: -00:25:23:690, filepos: 000002800
>>>>> timestamp: -00:25:16:517, filepos: 000003800
>>>>> timestamp: -00:25:09:376, filepos: 000004800
>>>>>
>>>>> I can send you full sample (.avi+.idx+.sub) if you need it - or  
>>>>> you
>>>>> can grab it from http://www.boxtorrents.com/details.php? 
>>>>> id=128748...
>>>>>
>>>>> Now the question: are there plans to add support for this  
>>>>> "extended"
>>>>> VobSub subtitles ?
>>>>>
>>>>> VSFilter is Windows-only but GPLed so it should not be too hard to
>>>>> see
>>>>> how it handles this format. I checked CVS for VSFilter and it does
>>>>> not
>>>>> even unclude ancient versions without "Delay:" support ! And  
>>>>> CVS goes
>>>>> back as far as to may 2003 so it's little sad to see this  
>>>>> format not
>>>>> fully-supported in VLC today...
>>>>>
>>>>> --
>>>>> This is the vlc mailing-list, see http://www.videolan.org/vlc/
>>>>> To unsubscribe, please read http://www.videolan.org/support/
>>>>> lists.html
>>>>>
>>>>>
>>>>
>>>> --
>>>> This is the vlc mailing-list, see http://www.videolan.org/vlc/
>>>> To unsubscribe, please read http://www.videolan.org/support/ 
>>>> lists.html
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
> --
> This is the vlc mailing-list, see http://www.videolan.org/vlc/
> To unsubscribe, please read http://www.videolan.org/support/lists.html
>
>

-- 
This is the vlc mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/support/lists.html



More information about the vlc mailing list