Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
b7f641dc
Commit
b7f641dc
authored
Sep 02, 2014
by
wm4
Committed by
Clément Bœsch
Sep 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/realtextdec: UTF-16 support
Also remove ff_smil_extract_next_chunk - this was the last user of it.
parent
231a514d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
21 deletions
+10
-21
realtextdec.c
libavformat/realtextdec.c
+10
-7
subtitles.c
libavformat/subtitles.c
+0
-9
subtitles.h
libavformat/subtitles.h
+0
-5
No files found.
libavformat/realtextdec.c
View file @
b7f641dc
...
...
@@ -37,11 +37,12 @@ typedef struct {
static
int
realtext_probe
(
AVProbeData
*
p
)
{
const
unsigned
char
*
ptr
=
p
->
buf
;
char
buf
[
7
];
FFTextReader
tr
;
ff_text_init_buf
(
&
tr
,
p
->
buf
,
p
->
buf_size
);
ff_text_read
(
&
tr
,
buf
,
sizeof
(
buf
));
if
(
AV_RB24
(
ptr
)
==
0xEFBBBF
)
ptr
+=
3
;
/* skip UTF-8 BOM */
return
!
av_strncasecmp
(
ptr
,
"<window"
,
7
)
?
AVPROBE_SCORE_EXTENSION
:
0
;
return
!
av_strncasecmp
(
buf
,
"<window"
,
7
)
?
AVPROBE_SCORE_EXTENSION
:
0
;
}
static
int
read_ts
(
const
char
*
s
)
...
...
@@ -63,6 +64,8 @@ static int realtext_read_header(AVFormatContext *s)
AVBPrint
buf
;
char
c
=
0
;
int
res
=
0
,
duration
=
read_ts
(
"60"
);
// default duration is 60 seconds
FFTextReader
tr
;
ff_text_init_avio
(
&
tr
,
s
->
pb
);
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -72,10 +75,10 @@ static int realtext_read_header(AVFormatContext *s)
av_bprint_init
(
&
buf
,
0
,
AV_BPRINT_SIZE_UNLIMITED
);
while
(
!
avio_feof
(
s
->
pb
))
{
while
(
!
ff_text_eof
(
&
tr
))
{
AVPacket
*
sub
;
const
int64_t
pos
=
avio_tell
(
s
->
pb
)
-
(
c
!=
0
);
int
n
=
ff_smil_extract_next_
chunk
(
s
->
pb
,
&
buf
,
&
c
);
const
int64_t
pos
=
ff_text_pos
(
&
tr
)
-
(
c
!=
0
);
int
n
=
ff_smil_extract_next_
text_chunk
(
&
tr
,
&
buf
,
&
c
);
if
(
n
==
0
)
break
;
...
...
libavformat/subtitles.c
View file @
b7f641dc
...
...
@@ -297,15 +297,6 @@ int ff_smil_extract_next_text_chunk(FFTextReader *tr, AVBPrint *buf, char *c)
return
i
;
}
int
ff_smil_extract_next_chunk
(
AVIOContext
*
pb
,
AVBPrint
*
buf
,
char
*
c
)
{
FFTextReader
tr
;
tr
.
buf_pos
=
tr
.
buf_len
=
0
;
tr
.
type
=
0
;
tr
.
pb
=
pb
;
return
ff_smil_extract_next_text_chunk
(
&
tr
,
buf
,
c
);
}
const
char
*
ff_smil_get_attr_ptr
(
const
char
*
s
,
const
char
*
attr
)
{
int
in_quotes
=
0
;
...
...
libavformat/subtitles.h
View file @
b7f641dc
...
...
@@ -144,11 +144,6 @@ void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q);
*
* @param c cached character, to avoid a backward seek
*/
int
ff_smil_extract_next_chunk
(
AVIOContext
*
pb
,
AVBPrint
*
buf
,
char
*
c
);
/**
* As ff_smil_extract_next_chunk(), but with FFTextReader.
*/
int
ff_smil_extract_next_text_chunk
(
FFTextReader
*
tr
,
AVBPrint
*
buf
,
char
*
c
);
/**
...
...
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