Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
c3c6e9b8
Commit
c3c6e9b8
authored
Apr 03, 2014
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: mp4: handle in sample text encoding (fix #11137)
parent
edb0f284
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
modules/codec/substx3g.c
modules/codec/substx3g.c
+16
-8
modules/demux/mp4/mp4.c
modules/demux/mp4/mp4.c
+0
-1
No files found.
modules/codec/substx3g.c
View file @
c3c6e9b8
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_codec.h>
#include <vlc_sout.h>
#include <vlc_sout.h>
#include <vlc_charset.h>
#include "substext.h"
#include "substext.h"
...
@@ -255,14 +256,21 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -255,14 +256,21 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
uint8_t
*
p_buf
=
p_block
->
p_buffer
;
uint8_t
*
p_buf
=
p_block
->
p_buffer
;
/* Read our raw string and create the styled segment for HTML */
/* Read our raw string and create the styled segment for HTML */
uint16_t
i_psz_length
=
GetWBE
(
p_buf
);
uint16_t
i_psz_bytelength
=
GetWBE
(
p_buf
);
char
*
psz_subtitle
=
malloc
(
i_psz_length
+
1
);
const
uint8_t
*
p_pszstart
=
p_block
->
p_buffer
+
sizeof
(
uint16_t
);
char
*
psz_subtitle
;
if
(
i_psz_bytelength
>
2
&&
(
!
memcmp
(
p_pszstart
,
"
\xFE\xFF
"
,
2
)
||
!
memcmp
(
p_pszstart
,
"
\xFF\xFE
"
,
2
)
)
)
psz_subtitle
=
FromCharset
(
"UTF-16"
,
p_pszstart
,
i_psz_bytelength
);
else
psz_subtitle
=
malloc
(
i_psz_bytelength
+
1
);
if
(
!
psz_subtitle
)
return
NULL
;
if
(
!
psz_subtitle
)
return
NULL
;
memcpy
(
psz_subtitle
,
p_
block
->
p_buffer
+
sizeof
(
uint16_t
),
i_psz_
length
);
memcpy
(
psz_subtitle
,
p_
pszstart
,
i_psz_byte
length
);
psz_subtitle
[
i_psz_length
]
=
'\0'
;
psz_subtitle
[
i_psz_
byte
length
]
=
'\0'
;
p_buf
+=
i_psz_length
+
sizeof
(
uint16_t
);
p_buf
+=
i_psz_
byte
length
+
sizeof
(
uint16_t
);
for
(
uint16_t
i
=
0
;
i
<
i_psz_length
;
i
++
)
for
(
uint16_t
i
=
0
;
i
<
i_psz_
byte
length
;
i
++
)
if
(
psz_subtitle
[
i
]
==
'\r'
)
psz_subtitle
[
i
]
=
'\n'
;
if
(
psz_subtitle
[
i
]
==
'\r'
)
psz_subtitle
[
i
]
=
'\n'
;
segment_t
*
p_segment
=
calloc
(
1
,
sizeof
(
segment_t
)
);
segment_t
*
p_segment
=
calloc
(
1
,
sizeof
(
segment_t
)
);
...
@@ -317,8 +325,8 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -317,8 +325,8 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
while
(
i_cur_record
++
<
i_nbrecords
)
while
(
i_cur_record
++
<
i_nbrecords
)
{
{
if
(
(
size_t
)(
p_buf
-
p_block
->
p_buffer
)
<
12
)
break
;
if
(
(
size_t
)(
p_buf
-
p_block
->
p_buffer
)
<
12
)
break
;
uint16_t
i_start
=
__MIN
(
GetWBE
(
p_buf
),
i_psz_length
-
1
);
uint16_t
i_start
=
__MIN
(
GetWBE
(
p_buf
),
i_psz_
byte
length
-
1
);
uint16_t
i_end
=
__MIN
(
GetWBE
(
p_buf
+
2
),
i_psz_length
-
1
);
uint16_t
i_end
=
__MIN
(
GetWBE
(
p_buf
+
2
),
i_psz_
byte
length
-
1
);
segment_style_t
style
;
segment_style_t
style
;
style
.
i_flags
=
ConvertFlags
(
p_buf
[
6
]
);
style
.
i_flags
=
ConvertFlags
(
p_buf
[
6
]
);
...
...
modules/demux/mp4/mp4.c
View file @
c3c6e9b8
...
@@ -2001,7 +2001,6 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
...
@@ -2001,7 +2001,6 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
}
}
p_track
->
fmt
.
subs
.
p_style
=
p_style
;
p_track
->
fmt
.
subs
.
p_style
=
p_style
;
}
}
/* FIXME: Not true, could be UTF-16 with a Byte Order Mark (0xfeff) */
/* FIXME UTF-8 doesn't work here ? */
/* FIXME UTF-8 doesn't work here ? */
if
(
p_track
->
b_mac_encoding
)
if
(
p_track
->
b_mac_encoding
)
p_track
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"MAC"
);
p_track
->
fmt
.
subs
.
psz_encoding
=
strdup
(
"MAC"
);
...
...
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