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
503bdd97
Commit
503bdd97
authored
Aug 26, 2003
by
Derk-Jan Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/demux/util/sub.c: fixed the subtitle autodetection.
* modules/demux/mkv.cpp: set
UTF-8
for matroska subtitles.
parent
25763b6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
18 deletions
+30
-18
modules/demux/mkv.cpp
modules/demux/mkv.cpp
+10
-1
modules/demux/util/sub.c
modules/demux/util/sub.c
+20
-17
No files found.
modules/demux/mkv.cpp
View file @
503bdd97
...
...
@@ -2,7 +2,7 @@
* mkv.cpp : matroska demuxer
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: mkv.cpp,v 1.2
4 2003/08/26 18:11:02 fenrir
Exp $
* $Id: mkv.cpp,v 1.2
5 2003/08/26 19:43:51 hartman
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -1048,6 +1048,15 @@ static int Open( vlc_object_t * p_this )
i_track
+
1
,
tk
.
i_cat
,
tk
.
psz_language
,
0
);
if
(
tk
.
i_cat
==
SPU_ES
)
{
vlc_value_t
val
;
val
.
psz_string
=
"UTF-8"
;
#if defined(HAVE_ICONV)
var_Create
(
p_input
,
"subsdec-encoding"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
#endif
var_Set
(
p_input
,
"subsdec-encoding"
,
val
);
}
if
(
!
strcmp
(
tk
.
psz_codec
,
"V_MS/VFW/FOURCC"
)
)
{
if
(
tk
.
i_extra_data
<
(
int
)
sizeof
(
BITMAPINFOHEADER
)
)
...
...
modules/demux/util/sub.c
View file @
503bdd97
...
...
@@ -2,7 +2,7 @@
* sub.c
*****************************************************************************
* Copyright (C) 1999-2003 VideoLAN
* $Id: sub.c,v 1.2
4 2003/08/24 14:43:07 titer
Exp $
* $Id: sub.c,v 1.2
5 2003/08/26 19:43:51 hartman
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -25,7 +25,6 @@
* Preamble
*****************************************************************************/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
...
...
@@ -246,7 +245,7 @@ char* sub_detect( subtitle_demux_t *p_sub, char *psz_filename)
char
*
psz_result
,
*
psz_basename
,
*
psz_dir
=
NULL
;
char
*
psz_file_noext
,
*
psz_extension
;
int
i
;
size_t
i_dirlen
=
0
;
size_t
i_dirlen
,
i_baselen
=
0
;
if
(
psz_filename
&&
*
psz_filename
)
{
...
...
@@ -277,7 +276,7 @@ char* sub_detect( subtitle_demux_t *p_sub, char *psz_filename)
if
(
psz_extension
)
{
size_t
i_baselen
=
(
1
+
psz_extension
)
-
psz_basename
;
i_baselen
=
(
1
+
psz_extension
)
-
psz_basename
;
psz_file_noext
=
(
char
*
)
malloc
(
i_baselen
+
1
);
if
(
!
psz_file_noext
)
...
...
@@ -292,13 +291,13 @@ char* sub_detect( subtitle_demux_t *p_sub, char *psz_filename)
p_dir_handle
=
opendir
(
psz_dir
?
psz_dir
:
""
);
if
(
p_dir_handle
)
{
int
i_found
=
0
;
while
((
p_dir_afile
=
readdir
(
p_dir_handle
)))
{
char
*
psz_afile_ext
=
strrchr
(
p_dir_afile
->
d_name
,
'.'
);
if
(
psz_afile_ext
)
{
int
i_found
=
0
;
++
psz_afile_ext
;
for
(
i
=
0
;
ppsz_sub_exts
[
i
];
i
++
)
{
if
(
strcmp
(
ppsz_sub_exts
[
i
],
psz_afile_ext
)
==
0
)
{
...
...
@@ -306,20 +305,24 @@ char* sub_detect( subtitle_demux_t *p_sub, char *psz_filename)
break
;
}
}
if
(
i_found
)
if
(
i_found
)
/* found a file with a subtitle extension */
{
msg_Dbg
(
p_sub
,
"autodetected subtitlefile: %s"
,
strdup
(
p_dir_afile
->
d_name
)
);
if
(
psz_dir
)
if
(
strncmp
(
p_dir_afile
->
d_name
,
psz_file_noext
,
(
strlen
(
p_dir_afile
->
d_name
)
-
strlen
(
psz_afile_ext
)
)
)
==
0
)
{
char
*
psz_append
;
psz_result
=
(
char
*
)
malloc
(
i_dirlen
+
strlen
(
p_dir_afile
->
d_name
)
+
1
);
strncpy
(
psz_result
,
psz_dir
,
i_dirlen
);
psz_append
=
psz_result
+
i_dirlen
;
strncpy
(
psz_append
,
p_dir_afile
->
d_name
,
strlen
(
p_dir_afile
->
d_name
)
);
psz_result
[
i_dirlen
+
strlen
(
p_dir_afile
->
d_name
)]
=
'\0'
;
return
psz_result
;
/* perfect match */
msg_Dbg
(
p_sub
,
"autodetected subtitlefile: %s"
,
strdup
(
p_dir_afile
->
d_name
)
);
if
(
psz_dir
)
{
char
*
psz_append
;
psz_result
=
(
char
*
)
malloc
(
i_dirlen
+
strlen
(
p_dir_afile
->
d_name
)
+
1
);
strncpy
(
psz_result
,
psz_dir
,
i_dirlen
);
psz_append
=
psz_result
+
i_dirlen
;
strncpy
(
psz_append
,
p_dir_afile
->
d_name
,
strlen
(
p_dir_afile
->
d_name
)
);
psz_result
[
i_dirlen
+
strlen
(
p_dir_afile
->
d_name
)]
=
'\0'
;
return
psz_result
;
}
else
return
strdup
(
p_dir_afile
->
d_name
);
}
else
return
strdup
(
p_dir_afile
->
d_name
);
}
}
}
...
...
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