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
ce973636
Commit
ce973636
authored
Oct 22, 2015
by
Hendrik Leppkes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/libzvbi: Update for AVSubtitleRect changes
parent
ee573b4d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
libzvbi-teletextdec.c
libavcodec/libzvbi-teletextdec.c
+23
-14
No files found.
libavcodec/libzvbi-teletextdec.c
View file @
ce973636
...
...
@@ -86,8 +86,8 @@ static int chop_spaces_utf8(const unsigned char* t, int len)
static
void
subtitle_rect_free
(
AVSubtitleRect
**
sub_rect
)
{
av_freep
(
&
(
*
sub_rect
)
->
pict
.
data
[
0
]);
av_freep
(
&
(
*
sub_rect
)
->
pict
.
data
[
1
]);
av_freep
(
&
(
*
sub_rect
)
->
data
[
0
]);
av_freep
(
&
(
*
sub_rect
)
->
data
[
1
]);
av_freep
(
&
(
*
sub_rect
)
->
ass
);
av_freep
(
sub_rect
);
}
...
...
@@ -199,7 +199,7 @@ static void fix_transparency(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi
// Hack for transparency, inspired by VLC code...
for
(
iy
=
0
;
iy
<
resy
;
iy
++
)
{
uint8_t
*
pixel
=
sub_rect
->
pict
.
data
[
0
]
+
iy
*
sub_rect
->
pict
.
linesize
[
0
];
uint8_t
*
pixel
=
sub_rect
->
data
[
0
]
+
iy
*
sub_rect
->
linesize
[
0
];
vbi_char
*
vc
=
page
->
text
+
(
iy
/
BITMAP_CHAR_HEIGHT
+
chop_top
)
*
page
->
columns
;
vbi_char
*
vcnext
=
vc
+
page
->
columns
;
for
(;
vc
<
vcnext
;
vc
++
)
{
...
...
@@ -246,13 +246,13 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa
return
0
;
}
if
((
ret
=
avpicture_alloc
(
&
sub_rect
->
pict
,
AV_PIX_FMT_PAL8
,
resx
,
resy
))
<
0
)
return
ret
;
// Yes, we want to allocate the palette on our own because AVSubtitle works this way
sub_rect
->
pict
.
data
[
1
]
=
NULL
;
sub_rect
->
data
[
0
]
=
av_mallocz
(
resx
*
resy
);
sub_rect
->
linesize
[
0
]
=
resx
;
if
(
!
sub_rect
->
data
[
0
])
return
AVERROR
(
ENOMEM
)
;
vbi_draw_vt_page_region
(
page
,
VBI_PIXFMT_PAL8
,
sub_rect
->
pict
.
data
[
0
],
sub_rect
->
pict
.
linesize
[
0
],
sub_rect
->
data
[
0
],
sub_rect
->
linesize
[
0
],
0
,
chop_top
,
page
->
columns
,
page
->
rows
-
chop_top
,
/*reveal*/
1
,
/*flash*/
1
);
...
...
@@ -262,9 +262,9 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa
sub_rect
->
w
=
resx
;
sub_rect
->
h
=
resy
;
sub_rect
->
nb_colors
=
(
int
)
cmax
+
1
;
sub_rect
->
pict
.
data
[
1
]
=
av_mallocz
(
AVPALETTE_SIZE
);
if
(
!
sub_rect
->
pict
.
data
[
1
])
{
av_freep
(
&
sub_rect
->
pict
.
data
[
0
]);
sub_rect
->
data
[
1
]
=
av_mallocz
(
AVPALETTE_SIZE
);
if
(
!
sub_rect
->
data
[
1
])
{
av_freep
(
&
sub_rect
->
data
[
0
]);
return
AVERROR
(
ENOMEM
);
}
for
(
ci
=
0
;
ci
<
cmax
;
ci
++
)
{
...
...
@@ -274,10 +274,10 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa
g
=
VBI_G
(
page
->
color_map
[
ci
]);
b
=
VBI_B
(
page
->
color_map
[
ci
]);
a
=
VBI_A
(
page
->
color_map
[
ci
]);
((
uint32_t
*
)
sub_rect
->
pict
.
data
[
1
])[
ci
]
=
RGBA
(
r
,
g
,
b
,
a
);
ff_dlog
(
ctx
,
"palette %0x
\n
"
,
((
uint32_t
*
)
sub_rect
->
pict
.
data
[
1
])[
ci
]);
((
uint32_t
*
)
sub_rect
->
data
[
1
])[
ci
]
=
RGBA
(
r
,
g
,
b
,
a
);
ff_dlog
(
ctx
,
"palette %0x
\n
"
,
((
uint32_t
*
)
sub_rect
->
data
[
1
])[
ci
]);
}
((
uint32_t
*
)
sub_rect
->
pict
.
data
[
1
])[
cmax
]
=
RGBA
(
0
,
0
,
0
,
0
);
((
uint32_t
*
)
sub_rect
->
data
[
1
])[
cmax
]
=
RGBA
(
0
,
0
,
0
,
0
);
sub_rect
->
type
=
SUBTITLE_BITMAP
;
return
0
;
}
...
...
@@ -466,6 +466,15 @@ static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_si
}
else
{
ret
=
AVERROR
(
ENOMEM
);
}
#if FF_API_AVPICTURE
FF_DISABLE_DEPRECATION_WARNINGS
for
(
j
=
0
;
j
<
4
;
j
++
)
{
sub
->
rects
[
0
]
->
pict
.
data
[
j
]
=
sub
->
rects
[
0
]
->
data
[
j
];
sub
->
rects
[
0
]
->
pict
.
linesize
[
j
]
=
sub
->
rects
[
0
]
->
linesize
[
j
];
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
else
{
av_log
(
avctx
,
AV_LOG_DEBUG
,
"sending empty sub
\n
"
);
sub
->
rects
=
NULL
;
...
...
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