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
b6a30543
Commit
b6a30543
authored
Oct 31, 2007
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed transparency when using FFMPEG_SWSCALE in zvbi.
parent
23e37d85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
21 deletions
+92
-21
modules/codec/zvbi.c
modules/codec/zvbi.c
+92
-21
No files found.
modules/codec/zvbi.c
View file @
b6a30543
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* zvbi.c : VBI and Teletext PES demux and decoder using libzvbi
* zvbi.c : VBI and Teletext PES demux and decoder using libzvbi
*****************************************************************************
*****************************************************************************
* Copyright (C) 2007, M2X
* Copyright (C) 2007, M2X
* $Id$
* $Id
:
$
*
*
* Authors: Derk-Jan Hartman <djhartman at m2x dot nl>
* Authors: Derk-Jan Hartman <djhartman at m2x dot nl>
* Jean-Paul Saman <jpsaman at m2x dot nl>
* Jean-Paul Saman <jpsaman at m2x dot nl>
...
@@ -142,6 +142,10 @@ static int RequestPage( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -142,6 +142,10 @@ static int RequestPage( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
);
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
);
static
int
OpaquePage
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
video_format_t
fmt
,
static
int
OpaquePage
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
video_format_t
fmt
,
picture_t
**
p_src
);
picture_t
**
p_src
);
static
int
Opaque_32bpp
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
video_format_t
fmt
,
picture_t
**
p_src
);
static
int
Opaque_8bpp
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
video_format_t
fmt
,
picture_t
**
p_src
);
static
int
Opaque
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
Opaque
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
);
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
);
...
@@ -331,10 +335,10 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -331,10 +335,10 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
p_spu
->
p_region
->
i_x
=
0
;
p_spu
->
p_region
->
i_x
=
0
;
p_spu
->
p_region
->
i_y
=
0
;
p_spu
->
p_region
->
i_y
=
0
;
p_spu
->
p_region
->
i_align
=
SUBPICTURE_ALIGN_
TOP
;
p_spu
->
p_region
->
i_align
=
SUBPICTURE_ALIGN_
BOTTOM
;
/* Normal text subs, easy markup */
/* Normal text subs, easy markup */
p_spu
->
i_flags
=
SUBPICTURE_ALIGN_
TOP
;
p_spu
->
i_flags
=
SUBPICTURE_ALIGN_
BOTTOM
;
p_spu
->
i_start
=
(
mtime_t
)
p_block
->
i_dts
;
p_spu
->
i_start
=
(
mtime_t
)
p_block
->
i_dts
;
p_spu
->
i_stop
=
(
mtime_t
)
0
;
p_spu
->
i_stop
=
(
mtime_t
)
0
;
...
@@ -384,7 +388,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -384,7 +388,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
memset
(
&
fmt_in
,
0
,
sizeof
(
video_format_t
)
);
memset
(
&
fmt_in
,
0
,
sizeof
(
video_format_t
)
);
memset
(
p_pic
,
0
,
sizeof
(
picture_t
)
);
memset
(
p_pic
,
0
,
sizeof
(
picture_t
)
);
fmt_in
=
p_spu
->
p_region
->
fmt
;
fmt_in
=
fmt
;
fmt_in
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
fmt_in
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
vout_AllocatePicture
(
VLC_OBJECT
(
p_dec
),
p_pic
,
fmt_in
.
i_chroma
,
vout_AllocatePicture
(
VLC_OBJECT
(
p_dec
),
p_pic
,
fmt_in
.
i_chroma
,
...
@@ -402,8 +406,6 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -402,8 +406,6 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
p_pic
->
p
->
i_lines
=
p_page
.
rows
*
10
;
p_pic
->
p
->
i_lines
=
p_page
.
rows
*
10
;
p_pic
->
p
->
i_pitch
=
p_page
.
columns
*
12
*
4
;
p_pic
->
p
->
i_pitch
=
p_page
.
columns
*
12
*
4
;
OpaquePage
(
p_dec
,
p_page
,
fmt_in
,
&
p_pic
);
#if 0
#if 0
msg_Dbg( p_dec, "page %x-%x(%d,%d)",
msg_Dbg( p_dec, "page %x-%x(%d,%d)",
p_page.pgno, p_page.subno,
p_page.pgno, p_page.subno,
...
@@ -418,8 +420,8 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -418,8 +420,8 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
msg_Err
(
p_dec
,
"chroma conversion failed"
);
msg_Err
(
p_dec
,
"chroma conversion failed"
);
goto
error
;
goto
error
;
}
}
OpaquePage
(
p_dec
,
p_page
,
p_spu
->
p_region
->
fmt
,
&
p_dest
);
vout_CopyPicture
(
VLC_OBJECT
(
p_dec
),
&
p_spu
->
p_region
->
picture
,
vout_CopyPicture
(
VLC_OBJECT
(
p_dec
),
&
(
p_spu
->
p_region
->
picture
)
,
p_dest
);
p_dest
);
free
(
p_pic
->
p_data_orig
);
free
(
p_pic
->
p_data_orig
);
...
@@ -475,8 +477,9 @@ static void event_handler( vbi_event *ev, void *user_data )
...
@@ -475,8 +477,9 @@ static void event_handler( vbi_event *ev, void *user_data )
if
(
ev
->
ev
.
ttx_page
.
clock_update
)
if
(
ev
->
ev
.
ttx_page
.
clock_update
)
msg_Dbg
(
p_dec
,
"clock"
);
msg_Dbg
(
p_dec
,
"clock"
);
if
(
ev
->
ev
.
ttx_page
.
header_update
)
/*
if( ev->ev.ttx_page.header_update )
msg_Dbg( p_dec, "header" );
msg_Dbg( p_dec, "header" );
*/
}
}
else
if
(
ev
->
type
==
VBI_EVENT_CAPTION
)
else
if
(
ev
->
type
==
VBI_EVENT_CAPTION
)
msg_Dbg
(
p_dec
,
"Caption line: %x"
,
ev
->
ev
.
caption
.
pgno
);
msg_Dbg
(
p_dec
,
"Caption line: %x"
,
ev
->
ev
.
caption
.
pgno
);
...
@@ -490,6 +493,27 @@ static void event_handler( vbi_event *ev, void *user_data )
...
@@ -490,6 +493,27 @@ static void event_handler( vbi_event *ev, void *user_data )
static
int
OpaquePage
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
static
int
OpaquePage
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
video_format_t
fmt
,
picture_t
**
p_src
)
video_format_t
fmt
,
picture_t
**
p_src
)
{
int
result
=
VLC_EGENERIC
;
/* Kludge since zvbi doesn't provide an option to specify opacity. */
switch
(
fmt
.
i_chroma
)
{
case
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
):
result
=
Opaque_32bpp
(
p_dec
,
p_page
,
fmt
,
p_src
);
break
;
case
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
):
result
=
Opaque_8bpp
(
p_dec
,
p_page
,
fmt
,
p_src
);
break
;
default:
msg_Err
(
p_dec
,
"chroma not supported %4.4s"
,
(
char
*
)
&
fmt
.
i_chroma
);
return
VLC_EGENERIC
;
}
return
result
;
}
static
int
Opaque_32bpp
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
video_format_t
fmt
,
picture_t
**
p_src
)
{
{
decoder_sys_t
*
p_sys
=
(
decoder_sys_t
*
)
p_dec
->
p_sys
;
decoder_sys_t
*
p_sys
=
(
decoder_sys_t
*
)
p_dec
->
p_sys
;
uint32_t
*
p_begin
,
*
p_end
;
uint32_t
*
p_begin
,
*
p_end
;
...
@@ -497,24 +521,71 @@ static int OpaquePage( decoder_t *p_dec, vbi_page p_page,
...
@@ -497,24 +521,71 @@ static int OpaquePage( decoder_t *p_dec, vbi_page p_page,
vbi_opacity
opacity
;
vbi_opacity
opacity
;
/* Kludge since zvbi doesn't provide an option to specify opacity. */
/* Kludge since zvbi doesn't provide an option to specify opacity. */
if
(
(
fmt
.
i_chroma
!=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
)
&&
(
fmt
.
i_chroma
!=
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
)
)
)
{
msg_Err
(
p_dec
,
"chroma not supported %4.4s"
,
(
char
*
)
&
fmt
.
i_chroma
);
return
VLC_EGENERIC
;
}
switch
(
fmt
.
i_chroma
)
switch
(
fmt
.
i_chroma
)
{
{
case
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
):
case
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
):
p_begin
=
(
uint32_t
*
)(
*
p_src
)
->
p
->
p_pixels
;
p_begin
=
(
uint32_t
*
)(
*
p_src
)
->
p
->
p_pixels
;
p_end
=
(
uint32_t
*
)(
*
p_src
)
->
p
->
p_pixels
+
p_end
=
(
uint32_t
*
)(
*
p_src
)
->
p
->
p_pixels
+
(
fmt
.
i_width
*
fmt
.
i_height
);
(
fmt
.
i_width
*
fmt
.
i_height
);
break
;
break
;
default:
msg_Err
(
p_dec
,
"chroma not supported %4.4s"
,
(
char
*
)
&
fmt
.
i_chroma
);
return
VLC_EGENERIC
;
}
for
(
;
p_begin
<
p_end
;
p_begin
++
)
{
opacity
=
p_page
.
text
[
y
/
10
*
p_page
.
columns
+
x
/
12
].
opacity
;
switch
(
opacity
)
{
/* Show video instead of this character */
case
VBI_TRANSPARENT_SPACE
:
*
p_begin
=
0
;
break
;
/* To make the boxed text "closed captioning" transparent
* change VLC_TRUE to VLC_FALSE.
*/
case
VBI_OPAQUE
:
if
(
p_sys
->
b_opaque
)
break
;
/* Full text transparency. only foreground color is show */
case
VBI_TRANSPARENT_FULL
:
*
p_begin
=
0
;
break
;
/* Transparency for boxed text */
case
VBI_SEMI_TRANSPARENT
:
if
(
(
*
p_begin
&
0xffffff00
)
==
0xff
)
*
p_begin
=
0
;
break
;
}
x
++
;
if
(
x
>=
fmt
.
i_width
)
{
x
=
0
;
y
++
;
}
}
/* end of kludge */
return
VLC_SUCCESS
;
}
static
int
Opaque_8bpp
(
decoder_t
*
p_dec
,
vbi_page
p_page
,
video_format_t
fmt
,
picture_t
**
p_src
)
{
decoder_sys_t
*
p_sys
=
(
decoder_sys_t
*
)
p_dec
->
p_sys
;
uint8_t
*
p_begin
,
*
p_end
;
uint32_t
i_width
=
0
;
unsigned
int
x
=
0
,
y
=
0
;
vbi_opacity
opacity
;
/* Kludge since zvbi doesn't provide an option to specify opacity. */
switch
(
fmt
.
i_chroma
)
{
case
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
):
case
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
):
p_begin
=
(
uint32_t
*
)(
*
p_src
)
->
p
[
A_PLANE
].
p_pixels
;
p_begin
=
(
uint8_t
*
)(
*
p_src
)
->
p
[
A_PLANE
].
p_pixels
;
p_end
=
(
uint32_t
*
)(
*
p_src
)
->
p
[
A_PLANE
].
p_pixels
+
p_end
=
(
uint8_t
*
)(
*
p_src
)
->
p
[
A_PLANE
].
p_pixels
+
(
(
*
p_src
)
->
p
[
A_PLANE
].
i_lines
*
(
*
p_src
)
->
p
[
A_PLANE
].
i_pitch
);
(
fmt
.
i_height
*
(
*
p_src
)
->
p
[
A_PLANE
].
i_pitch
);
i_width
=
(
*
p_src
)
->
p
[
A_PLANE
].
i_pitch
;
break
;
break
;
default:
default:
msg_Err
(
p_dec
,
"chroma not supported %4.4s"
,
(
char
*
)
&
fmt
.
i_chroma
);
msg_Err
(
p_dec
,
"chroma not supported %4.4s"
,
(
char
*
)
&
fmt
.
i_chroma
);
...
@@ -547,7 +618,7 @@ static int OpaquePage( decoder_t *p_dec, vbi_page p_page,
...
@@ -547,7 +618,7 @@ static int OpaquePage( decoder_t *p_dec, vbi_page p_page,
break
;
break
;
}
}
x
++
;
x
++
;
if
(
x
>=
fmt
.
i_width
)
if
(
x
>=
i_width
)
{
{
x
=
0
;
x
=
0
;
y
++
;
y
++
;
...
...
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