Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
7f7eeb17
Commit
7f7eeb17
authored
Nov 22, 2005
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* subtitle.c: added support of "DVDSubtitle" format
parent
7f4fbf72
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
17 deletions
+102
-17
modules/demux/subtitle.c
modules/demux/subtitle.c
+102
-17
No files found.
modules/demux/subtitle.c
View file @
7f7eeb17
...
@@ -50,11 +50,11 @@ static void Close( vlc_object_t *p_this );
...
@@ -50,11 +50,11 @@ static void Close( vlc_object_t *p_this );
"It will only work with MicroDVD subtitles."
"It will only work with MicroDVD subtitles."
#define SUB_TYPE_LONGTEXT \
#define SUB_TYPE_LONGTEXT \
"One from \"microdvd\", \"subrip\", \"ssa1\", \"ssa2-4\", \"ass\", \"vplayer\" " \
"One from \"microdvd\", \"subrip\", \"ssa1\", \"ssa2-4\", \"ass\", \"vplayer\" " \
"\"sami\" (auto for autodetection, it should always work)."
"\"sami\"
, \"dvdsubtitle\"
(auto for autodetection, it should always work)."
static
char
*
ppsz_sub_type
[]
=
static
char
*
ppsz_sub_type
[]
=
{
{
"auto"
,
"microdvd"
,
"subrip"
,
"subviewer"
,
"ssa1"
,
"auto"
,
"microdvd"
,
"subrip"
,
"subviewer"
,
"ssa1"
,
"ssa2-4"
,
"ass"
,
"vplayer"
,
"sami"
"ssa2-4"
,
"ass"
,
"vplayer"
,
"sami"
,
"dvdsubtitle"
};
};
vlc_module_begin
();
vlc_module_begin
();
...
@@ -91,6 +91,7 @@ enum
...
@@ -91,6 +91,7 @@ enum
SUB_TYPE_VPLAYER
,
SUB_TYPE_VPLAYER
,
SUB_TYPE_SAMI
,
SUB_TYPE_SAMI
,
SUB_TYPE_SUBVIEWER
,
SUB_TYPE_SUBVIEWER
,
SUB_TYPE_DVDSUBTITLE
};
};
typedef
struct
typedef
struct
...
@@ -132,10 +133,11 @@ struct demux_sys_t
...
@@ -132,10 +133,11 @@ struct demux_sys_t
static
int
ParseMicroDvd
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseMicroDvd
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSubRip
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSubRip
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSubViewer
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSubViewer
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSSA
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSSA
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseVplayer
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseVplayer
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSami
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseSami
(
demux_t
*
,
subtitle_t
*
);
static
int
ParseDVDSubtitle
(
demux_t
*
,
subtitle_t
*
);
static
struct
static
struct
{
{
...
@@ -147,12 +149,13 @@ static struct
...
@@ -147,12 +149,13 @@ static struct
{
{
{
"microdvd"
,
SUB_TYPE_MICRODVD
,
"MicroDVD"
,
ParseMicroDvd
},
{
"microdvd"
,
SUB_TYPE_MICRODVD
,
"MicroDVD"
,
ParseMicroDvd
},
{
"subrip"
,
SUB_TYPE_SUBRIP
,
"SubRIP"
,
ParseSubRip
},
{
"subrip"
,
SUB_TYPE_SUBRIP
,
"SubRIP"
,
ParseSubRip
},
{
"subviewer"
,
SUB_TYPE_SUBVIEWER
,
"SubViewer"
,
ParseSubViewer
},
{
"subviewer"
,
SUB_TYPE_SUBVIEWER
,
"SubViewer"
,
ParseSubViewer
},
{
"ssa1"
,
SUB_TYPE_SSA1
,
"SSA-1"
,
ParseSSA
},
{
"ssa1"
,
SUB_TYPE_SSA1
,
"SSA-1"
,
ParseSSA
},
{
"ssa2-4"
,
SUB_TYPE_SSA2_4
,
"SSA-2/3/4"
,
ParseSSA
},
{
"ssa2-4"
,
SUB_TYPE_SSA2_4
,
"SSA-2/3/4"
,
ParseSSA
},
{
"ass"
,
SUB_TYPE_ASS
,
"SSA/ASS"
,
ParseSSA
},
{
"ass"
,
SUB_TYPE_ASS
,
"SSA/ASS"
,
ParseSSA
},
{
"vplayer"
,
SUB_TYPE_VPLAYER
,
"VPlayer"
,
ParseVplayer
},
{
"vplayer"
,
SUB_TYPE_VPLAYER
,
"VPlayer"
,
ParseVplayer
},
{
"sami"
,
SUB_TYPE_SAMI
,
"SAMI"
,
ParseSami
},
{
"sami"
,
SUB_TYPE_SAMI
,
"SAMI"
,
ParseSami
},
{
"dvdsubtitle"
,
SUB_TYPE_DVDSUBTITLE
,
"DVDSubtitle"
,
ParseDVDSubtitle
},
{
NULL
,
SUB_TYPE_UNKNOWN
,
"Unknown"
,
NULL
}
{
NULL
,
SUB_TYPE_UNKNOWN
,
"Unknown"
,
NULL
}
};
};
...
@@ -301,6 +304,12 @@ static int Open ( vlc_object_t *p_this )
...
@@ -301,6 +304,12 @@ static int Open ( vlc_object_t *p_this )
p_sys
->
i_type
=
SUB_TYPE_VPLAYER
;
p_sys
->
i_type
=
SUB_TYPE_VPLAYER
;
break
;
break
;
}
}
else
if
(
sscanf
(
s
,
"{T %d:%d:%d:%d"
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
,
&
i_dummy
)
==
4
)
{
p_sys
->
i_type
=
SUB_TYPE_DVDSUBTITLE
;
break
;
}
free
(
s
);
free
(
s
);
s
=
NULL
;
s
=
NULL
;
...
@@ -1203,3 +1212,79 @@ static int ParseSami( demux_t *p_demux, subtitle_t *p_subtitle )
...
@@ -1203,3 +1212,79 @@ static int ParseSami( demux_t *p_demux, subtitle_t *p_subtitle )
return
(
VLC_SUCCESS
);
return
(
VLC_SUCCESS
);
#undef ADDC
#undef ADDC
}
}
static
int
ParseDVDSubtitle
(
demux_t
*
p_demux
,
subtitle_t
*
p_subtitle
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
text_t
*
txt
=
&
p_sys
->
txt
;
/*
* {T h1:m1:s1:c1
* Line1
* Line2
* ...
* }
*
*/
char
*
s
;
char
buffer_text
[
10
*
MAX_LINE
];
int
i_buffer_text
;
int64_t
i_start
;
p_subtitle
->
i_start
=
0
;
p_subtitle
->
i_stop
=
0
;
p_subtitle
->
psz_text
=
NULL
;
for
(
;;
)
{
int
h1
,
m1
,
s1
,
c1
;
if
(
(
s
=
TextGetLine
(
txt
)
)
==
NULL
)
{
return
(
VLC_EGENERIC
);
}
if
(
sscanf
(
s
,
"{T %d:%d:%d:%d"
,
&
h1
,
&
m1
,
&
s1
,
&
c1
)
==
4
)
{
i_start
=
(
(
int64_t
)
h1
*
3600
*
1000
+
(
int64_t
)
m1
*
60
*
1000
+
(
int64_t
)
s1
*
1000
+
(
int64_t
)
c1
*
10
)
*
1000
;
/* Now read text until a line containing "}" */
for
(
i_buffer_text
=
0
;;
)
{
int
i_len
;
if
(
(
s
=
TextGetLine
(
txt
)
)
==
NULL
)
{
return
(
VLC_EGENERIC
);
}
i_len
=
strlen
(
s
);
if
(
i_len
==
1
&&
s
[
0
]
==
'}'
)
{
/* "}" -> end of this subtitle */
buffer_text
[
__MAX
(
i_buffer_text
-
1
,
0
)]
=
'\0'
;
p_subtitle
->
i_start
=
i_start
;
p_subtitle
->
i_stop
=
0
;
p_subtitle
->
psz_text
=
strdup
(
buffer_text
);
return
0
;
}
else
{
if
(
i_buffer_text
+
i_len
+
1
<
10
*
MAX_LINE
)
{
memcpy
(
buffer_text
+
i_buffer_text
,
s
,
i_len
);
i_buffer_text
+=
i_len
;
buffer_text
[
i_buffer_text
]
=
'\n'
;
i_buffer_text
++
;
}
}
}
}
}
}
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