Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
52960620
Commit
52960620
authored
Mar 11, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Added support of vplayer subtitles files.
parent
9869e03d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
5 deletions
+74
-5
modules/demux/util/sub.c
modules/demux/util/sub.c
+72
-4
modules/demux/util/sub.h
modules/demux/util/sub.h
+2
-1
No files found.
modules/demux/util/sub.c
View file @
52960620
...
...
@@ -2,7 +2,7 @@
* sub.c
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: sub.c,v 1.
6 2003/02/20 01:52:46 sigmunau
Exp $
* $Id: sub.c,v 1.
7 2003/03/11 20:01:23 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -51,10 +51,11 @@ static int sub_MicroDvdRead( FILE *p_file, subtitle_t *p_subtitle, mtime_t i_mi
static
int
sub_SubRipRead
(
FILE
*
p_file
,
subtitle_t
*
p_subtitle
,
mtime_t
i_microsecperframe
);
static
int
sub_SSA1Read
(
FILE
*
p_file
,
subtitle_t
*
p_subtitle
,
mtime_t
i_microsecperframe
);
static
int
sub_SSA2_4Read
(
FILE
*
p_file
,
subtitle_t
*
p_subtitle
,
mtime_t
i_microsecperframe
);
static
int
sub_Vplayer
(
FILE
*
p_file
,
subtitle_t
*
p_subtitle
,
mtime_t
i_microsecperframe
);
static
void
sub_fix
(
subtitle_demux_t
*
p_sub
);
static
char
*
ppsz_sub_type
[]
=
{
"microdvd"
,
"subrip"
,
"ssa1"
,
"ssa2-4"
,
NULL
};
static
char
*
ppsz_sub_type
[]
=
{
"microdvd"
,
"subrip"
,
"ssa1"
,
"ssa2-4"
,
"vplayer"
,
NULL
};
/*****************************************************************************
* Module descriptor
*****************************************************************************/
...
...
@@ -63,7 +64,7 @@ static char *ppsz_sub_type[] = { "microdvd", "subrip", "ssa1", "ssa2-4", NULL };
"Override frames per second. " \
"It will work only with MicroDVD"
#define SUB_TYPE_LONGTEXT \
"One from \"microdvd\", \"subrip\", \"ssa1\", \"ssa2-4\" " \
"One from \"microdvd\", \"subrip\", \"ssa1\", \"ssa2-4\"
, \"vplayer\"
" \
"(nothing for autodetection, it should always work)"
vlc_module_begin
();
...
...
@@ -177,6 +178,10 @@ static int sub_open ( subtitle_demux_t *p_sub,
{
i_sub_type
=
SUB_TYPE_SSA2_4
;
}
else
if
(
!
strcmp
(
psz_file_type
,
"vplayer"
)
)
{
i_sub_type
=
SUB_TYPE_VPLAYER
;
}
else
{
i_sub_type
=
SUB_TYPE_UNKNOWN
;
...
...
@@ -225,11 +230,19 @@ static int sub_open ( subtitle_demux_t *p_sub,
{
i_sub_type
=
SUB_TYPE_SSA2_4
;
// I hop this will work
}
break
;
}
else
if
(
!
strcmp
(
buffer
,
"Dialogue: Marked"
)
)
{
i_sub_type
=
SUB_TYPE_SSA2_4
;
// could be wrong
break
;
}
else
if
(
sscanf
(
buffer
,
"%d:%d:%d:"
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
)
==
3
||
sscanf
(
buffer
,
"%d:%d:%d "
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
)
==
3
)
{
i_sub_type
=
SUB_TYPE_VPLAYER
;
break
;
}
}
}
...
...
@@ -253,6 +266,10 @@ static int sub_open ( subtitle_demux_t *p_sub,
msg_Dbg
(
p_input
,
"detected SSAv2-4 Script format"
);
pf_read_subtitle
=
sub_SSA2_4Read
;
break
;
case
SUB_TYPE_VPLAYER
:
msg_Dbg
(
p_input
,
"detected vplayer format"
);
pf_read_subtitle
=
sub_Vplayer
;
break
;
default:
msg_Err
(
p_sub
,
"unknown subtitile file"
);
fclose
(
p_file
);
...
...
@@ -507,7 +524,7 @@ static int sub_MicroDvdRead( FILE *p_file, subtitle_t *p_subtitle, mtime_t i_mi
char
buffer_text
[
MAX_LINE
+
1
];
uint32_t
i_start
;
uint32_t
i_stop
;
int
i
;
unsigned
int
i
;
for
(
;;
)
{
...
...
@@ -704,3 +721,54 @@ static int sub_SSA2_4Read( FILE *p_file, subtitle_t *p_subtitle, mtime_t i_micr
return
(
sub_SSARead
(
p_file
,
p_subtitle
,
i_microsecperframe
,
9
)
);
}
static
int
sub_Vplayer
(
FILE
*
p_file
,
subtitle_t
*
p_subtitle
,
mtime_t
i_microsecperframe
)
{
/*
* each line:
* h:m:s:Line1|Line2|Line3....
* or
* h:m:s Line1|Line2|Line3....
* where n1 and n2 are the video frame number...
*
*/
char
buffer
[
MAX_LINE
+
1
];
char
buffer_text
[
MAX_LINE
+
1
];
mtime_t
i_start
;
unsigned
int
i
;
for
(
;;
)
{
int
h
,
m
,
s
;
char
c
;
if
(
fgets
(
buffer
,
MAX_LINE
,
p_file
)
<=
0
)
{
return
(
-
1
);
}
i_start
=
0
;
buffer
[
MAX_LINE
]
=
'\0'
;
memset
(
buffer_text
,
'\0'
,
MAX_LINE
);
if
(
sscanf
(
buffer
,
"%d:%d:%d%[ :]%[^
\r\n
]"
,
&
h
,
&
m
,
&
s
,
&
c
,
buffer_text
)
==
5
)
{
i_start
=
(
(
mtime_t
)
h
*
3600
*
1000
+
(
mtime_t
)
m
*
60
*
1000
+
(
mtime_t
)
s
*
1000
)
*
1000
;
break
;
}
}
/* replace | by \n */
for
(
i
=
0
;
i
<
strlen
(
buffer_text
);
i
++
)
{
if
(
buffer_text
[
i
]
==
'|'
)
{
buffer_text
[
i
]
=
'\n'
;
}
}
p_subtitle
->
i_start
=
i_start
;
p_subtitle
->
i_stop
=
0
;
p_subtitle
->
psz_text
=
strndup
(
buffer_text
,
MAX_LINE
);
return
(
0
);
}
modules/demux/util/sub.h
View file @
52960620
...
...
@@ -2,7 +2,7 @@
* sub.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: sub.h,v 1.
2 2003/01/02 23:50:55 massiot
Exp $
* $Id: sub.h,v 1.
3 2003/03/11 20:01:23 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -25,6 +25,7 @@
#define SUB_TYPE_SUBRIP 0x01
#define SUB_TYPE_SSA1 0x02
#define SUB_TYPE_SSA2_4 0x03
#define SUB_TYPE_VPLAYER 0x04
#define SUB_TYPE_UNKNOWN 0xffff
typedef
struct
subtitle_s
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment