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
65fb59ab
Commit
65fb59ab
authored
Oct 23, 2013
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libzvbi-teletextdec: use AVBPrint for whitespace cleanup
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
b689b1f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
libzvbi-teletextdec.c
libavcodec/libzvbi-teletextdec.c
+19
-18
No files found.
libavcodec/libzvbi-teletextdec.c
View file @
65fb59ab
...
...
@@ -20,6 +20,7 @@
#include "avcodec.h"
#include "libavutil/opt.h"
#include "libavutil/bprint.h"
#include "libavutil/intreadwrite.h"
#include <libzvbi.h>
...
...
@@ -95,9 +96,8 @@ subtitle_rect_free(AVSubtitleRect **sub_rect)
static
int
gen_sub_text
(
TeletextContext
*
ctx
,
AVSubtitleRect
*
sub_rect
,
vbi_page
*
page
,
int
chop_top
)
{
char
*
text
;
const
char
*
in
;
char
*
out
;
AVBPrint
buf
;
char
*
vbi_text
=
av_malloc
(
TEXT_MAXSZ
);
int
sz
;
...
...
@@ -115,11 +115,8 @@ gen_sub_text(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int
}
vbi_text
[
sz
]
=
'\0'
;
in
=
vbi_text
;
out
=
text
=
av_malloc
(
TEXT_MAXSZ
);
if
(
!
text
)
{
av_free
(
vbi_text
);
return
AVERROR
(
ENOMEM
);
}
av_bprint_init
(
&
buf
,
0
,
TEXT_MAXSZ
);
if
(
ctx
->
chop_spaces
)
{
for
(;;)
{
int
nl
,
sz
;
...
...
@@ -134,25 +131,29 @@ gen_sub_text(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int
break
;
// skip trailing spaces
sz
=
chop_spaces_utf8
(
in
,
nl
);
memcpy
(
out
,
in
,
sz
);
out
+=
sz
;
*
out
++
=
'\n'
;
av_bprint_append_data
(
&
buf
,
in
,
sz
);
av_bprintf
(
&
buf
,
"
\n
"
);
in
+=
nl
;
}
}
else
{
strcpy
(
text
,
vbi_text
);
out
+=
sz
;
*
out
++
=
'\n'
;
av_bprintf
(
&
buf
,
"%s
\n
"
,
vbi_text
);
}
av_free
(
vbi_text
);
*
out
=
'\0'
;
if
(
out
>
text
)
{
if
(
!
av_bprint_is_complete
(
&
buf
))
{
av_bprint_finalize
(
&
buf
,
NULL
);
return
AVERROR
(
ENOMEM
);
}
if
(
buf
.
len
)
{
int
ret
;
sub_rect
->
type
=
SUBTITLE_TEXT
;
sub_rect
->
text
=
text
;
av_log
(
ctx
,
AV_LOG_DEBUG
,
"subtext:%s:txetbus
\n
"
,
text
);
if
((
ret
=
av_bprint_finalize
(
&
buf
,
&
sub_rect
->
text
))
<
0
)
return
ret
;
av_log
(
ctx
,
AV_LOG_DEBUG
,
"subtext:%s:txetbus
\n
"
,
sub_rect
->
text
);
}
else
{
sub_rect
->
type
=
SUBTITLE_NONE
;
av_
free
(
text
);
av_
bprint_finalize
(
&
buf
,
NULL
);
}
return
0
;
}
...
...
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