Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
0e212a7c
Commit
0e212a7c
authored
Mar 16, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* sub.c: added SAMI subtitles support. (Untested and incomplete).
parent
61ec345b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
113 additions
and
24 deletions
+113
-24
modules/demux/util/sub.c
modules/demux/util/sub.c
+113
-24
No files found.
modules/demux/util/sub.c
View file @
0e212a7c
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* sub.c
* sub.c
*****************************************************************************
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* Copyright (C) 1999-2001 VideoLAN
* $Id: sub.c,v 1.
8 2003/03/15 18:44:3
1 fenrir Exp $
* $Id: sub.c,v 1.
9 2003/03/16 16:07:2
1 fenrir Exp $
*
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
*
...
@@ -184,6 +184,13 @@ static char *text_get_line( text_t *txt )
...
@@ -184,6 +184,13 @@ static char *text_get_line( text_t *txt )
return
(
txt
->
line
[
txt
->
i_line
++
]
);
return
(
txt
->
line
[
txt
->
i_line
++
]
);
}
}
static
void
text_previous_line
(
text_t
*
txt
)
{
if
(
txt
->
i_line
>
0
)
{
txt
->
i_line
--
;
}
}
static
void
text_rewind
(
text_t
*
txt
)
static
void
text_rewind
(
text_t
*
txt
)
{
{
txt
->
i_line
=
0
;
txt
->
i_line
=
0
;
...
@@ -873,41 +880,123 @@ static int sub_Vplayer( text_t *txt, subtitle_t *p_subtitle, mtime_t i_microsec
...
@@ -873,41 +880,123 @@ static int sub_Vplayer( text_t *txt, subtitle_t *p_subtitle, mtime_t i_microsec
return
(
0
);
return
(
0
);
}
}
static
int
sub_Sami
(
text_t
*
txt
,
subtitle_t
*
p_subtitle
,
mtime_t
i_microsecperframe
)
static
char
*
sub_SamiSearch
(
text_t
*
txt
,
char
*
psz_start
,
char
*
psz_str
)
{
{
#if 0
if
(
psz_start
)
char buffer[MAX_LINE + 1];
{
char buffer_text[MAX_LINE + 1];
if
(
strstr
(
psz_start
,
psz_str
)
)
char *p;
{
char
*
s
=
strstr
(
psz_start
,
psz_str
);
/* first find "Start=" */
s
+=
strlen
(
psz_str
);
/* the <P ... > */
/* then all text and remove <...> until new "Start="*/
return
(
s
);
}
}
for
(
;;
)
for
(
;;
)
{
{
int i_state
;
char
*
p
;
if( (
s
= text_get_line( txt ) ) == NULL )
if
(
(
p
=
text_get_line
(
txt
)
)
==
NULL
)
{
{
return( VLC_EGENERIC );
return
NULL
;
}
if
(
strstr
(
p
,
psz_str
)
)
{
char
*
s
=
strstr
(
p
,
psz_str
);
s
+=
strlen
(
psz_str
);
return
(
s
);
}
}
}
}
static
int
sub_Sami
(
text_t
*
txt
,
subtitle_t
*
p_subtitle
,
mtime_t
i_microsecperframe
)
{
char
*
p
;
int
i_start
;
if( fgets( buffer, MAX_LINE, p_file ) <= 0)
int
i_text
;
char
buffer_text
[
10
*
MAX_LINE
+
1
];
#define ADDC( c ) \
if( i_text < 10*MAX_LINE ) \
{ \
buffer_text[i_text++] = c; \
buffer_text[i_text] = '\0'; \
}
/* search "Start=" */
if
(
!
(
p
=
sub_SamiSearch
(
txt
,
NULL
,
"Start="
)
)
)
{
{
return( -1 )
;
return
VLC_EGENERIC
;
}
}
i_start = 0;
buffer[MAX_LINE] = '\0';
/* get start value */
memset( buffer_text, '\0', MAX_LINE
);
i_start
=
strtol
(
p
,
&
p
,
0
);
for( ;; )
/* search <P */
if
(
!
(
p
=
sub_SamiSearch
(
txt
,
p
,
"<P"
)
)
)
{
{
if( p = strstr( buffer, "Start=" ) )
return
VLC_EGENERIC
;
}
/* search > */
if
(
!
(
p
=
sub_SamiSearch
(
txt
,
p
,
">"
)
)
)
{
{
return
VLC_EGENERIC
;
}
i_text
=
0
;
buffer_text
[
0
]
=
'\0'
;
/* now get all txt until a "Start=" line */
for
(
;;
)
{
if
(
*
p
)
{
if
(
*
p
==
'<'
)
{
if
(
!
strncmp
(
p
,
"<br"
,
3
)
||
!
strncmp
(
p
,
"<BR"
,
3
)
)
{
ADDC
(
'\n'
);
}
else
if
(
strstr
(
p
,
"Start="
)
)
{
text_previous_line
(
txt
);
break
;
}
p
=
sub_SamiSearch
(
txt
,
p
,
">"
);
}
else
if
(
!
strncmp
(
p
,
" "
,
6
)
)
{
ADDC
(
' '
);
p
+=
6
;
}
else
if
(
*
p
==
'\t'
)
{
ADDC
(
' '
);
p
++
;
}
else
{
ADDC
(
*
p
);
p
++
;
}
}
else
{
p
=
text_get_line
(
txt
);
}
if
(
p
==
NULL
)
{
break
;
}
}
}
}
#endif
return
(
VLC_EGENERIC
);
p_subtitle
->
i_start
=
i_start
*
1000
;
p_subtitle
->
i_stop
=
0
;
p_subtitle
->
psz_text
=
strndup
(
buffer_text
,
10
*
MAX_LINE
);
return
(
VLC_SUCCESS
);
#undef ADDC
}
}
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