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
2acbb5c0
Commit
2acbb5c0
authored
Jul 29, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed internal RGBA->YUVA internal conversion. (If it is really needed
performance wise, it should be done inside spu core).
parent
f9e4aada
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
185 deletions
+23
-185
modules/codec/zvbi.c
modules/codec/zvbi.c
+23
-185
No files found.
modules/codec/zvbi.c
View file @
2acbb5c0
...
@@ -44,37 +44,16 @@
...
@@ -44,37 +44,16 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <assert.h>
#include <assert.h>
#include <stdint.h>
#include <libzvbi.h>
#include <libzvbi.h>
#include "vlc_vout.h"
#include "vlc_vout.h"
#include "vlc_bits.h"
#include "vlc_codec.h"
#include "vlc_codec.h"
#include "vlc_image.h"
typedef
enum
{
DATA_UNIT_EBU_TELETEXT_NON_SUBTITLE
=
0x02
,
DATA_UNIT_EBU_TELETEXT_SUBTITLE
=
0x03
,
DATA_UNIT_EBU_TELETEXT_INVERTED
=
0x0C
,
DATA_UNIT_ZVBI_WSS_CPR1204
=
0xB4
,
DATA_UNIT_ZVBI_CLOSED_CAPTION_525
=
0xB5
,
DATA_UNIT_ZVBI_MONOCHROME_SAMPLES_525
=
0xB6
,
DATA_UNIT_VPS
=
0xC3
,
DATA_UNIT_WSS
=
0xC4
,
DATA_UNIT_CLOSED_CAPTION
=
0xC5
,
DATA_UNIT_MONOCHROME_SAMPLES
=
0xC6
,
DATA_UNIT_STUFFING
=
0xFF
,
}
data_unit_id
;
/*****************************************************************************
/*****************************************************************************
* Module descriptor.
* Module descriptor.
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
subpicture_t
*
Decode
(
decoder_t
*
,
block_t
**
);
#define PAGE_TEXT N_("Teletext page")
#define PAGE_TEXT N_("Teletext page")
#define PAGE_LONGTEXT N_("Open the indicated Teletext page." \
#define PAGE_LONGTEXT N_("Open the indicated Teletext page." \
...
@@ -94,8 +73,6 @@ static subpicture_t *Decode( decoder_t *, block_t ** );
...
@@ -94,8 +73,6 @@ static subpicture_t *Decode( decoder_t *, block_t ** );
#define TELX_LONGTEXT N_( "Output teletext subtitles as text " \
#define TELX_LONGTEXT N_( "Output teletext subtitles as text " \
"instead of as RGBA" )
"instead of as RGBA" )
// #define ZVBI_DEBUG
static
const
int
pi_pos_values
[]
=
{
0
,
1
,
2
,
4
,
8
,
5
,
6
,
9
,
10
};
static
const
int
pi_pos_values
[]
=
{
0
,
1
,
2
,
4
,
8
,
5
,
6
,
9
,
10
};
static
const
char
*
const
ppsz_pos_descriptions
[]
=
static
const
char
*
const
ppsz_pos_descriptions
[]
=
{
N_
(
"Center"
),
N_
(
"Left"
),
N_
(
"Right"
),
N_
(
"Top"
),
N_
(
"Bottom"
),
{
N_
(
"Center"
),
N_
(
"Left"
),
N_
(
"Right"
),
N_
(
"Top"
),
N_
(
"Bottom"
),
...
@@ -123,6 +100,25 @@ vlc_module_end();
...
@@ -123,6 +100,25 @@ vlc_module_end();
* Local structures
* Local structures
****************************************************************************/
****************************************************************************/
// #define ZVBI_DEBUG
typedef
enum
{
DATA_UNIT_EBU_TELETEXT_NON_SUBTITLE
=
0x02
,
DATA_UNIT_EBU_TELETEXT_SUBTITLE
=
0x03
,
DATA_UNIT_EBU_TELETEXT_INVERTED
=
0x0C
,
DATA_UNIT_ZVBI_WSS_CPR1204
=
0xB4
,
DATA_UNIT_ZVBI_CLOSED_CAPTION_525
=
0xB5
,
DATA_UNIT_ZVBI_MONOCHROME_SAMPLES_525
=
0xB6
,
DATA_UNIT_VPS
=
0xC3
,
DATA_UNIT_WSS
=
0xC4
,
DATA_UNIT_CLOSED_CAPTION
=
0xC5
,
DATA_UNIT_MONOCHROME_SAMPLES
=
0xC6
,
DATA_UNIT_STUFFING
=
0xFF
,
}
data_unit_id
;
struct
decoder_sys_t
struct
decoder_sys_t
{
{
vbi_decoder
*
p_vbi_dec
;
vbi_decoder
*
p_vbi_dec
;
...
@@ -137,22 +133,15 @@ struct decoder_sys_t
...
@@ -137,22 +133,15 @@ struct decoder_sys_t
/* Positioning of Teletext images */
/* Positioning of Teletext images */
int
i_align
;
int
i_align
;
/* Misc */
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
image_handler_t
*
p_image
;
#endif
};
};
static
subpicture_t
*
Decode
(
decoder_t
*
,
block_t
**
);
static
void
event_handler
(
vbi_event
*
ev
,
void
*
user_data
);
static
void
event_handler
(
vbi_event
*
ev
,
void
*
user_data
);
static
int
RequestPage
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
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
);
...
@@ -179,15 +168,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -179,15 +168,6 @@ static int Open( vlc_object_t *p_this )
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
memset
(
p_sys
,
0
,
sizeof
(
decoder_sys_t
)
);
memset
(
p_sys
,
0
,
sizeof
(
decoder_sys_t
)
);
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
p_sys
->
p_image
=
image_HandlerCreate
(
VLC_OBJECT
(
p_dec
)
);
if
(
!
p_sys
->
p_image
)
{
free
(
p_sys
);
return
VLC_ENOMEM
;
}
#endif
p_sys
->
b_update
=
false
;
p_sys
->
b_update
=
false
;
p_sys
->
p_vbi_dec
=
vbi_decoder_new
();
p_sys
->
p_vbi_dec
=
vbi_decoder_new
();
p_sys
->
p_dvb_demux
=
vbi_dvb_pes_demux_new
(
NULL
,
NULL
);
p_sys
->
p_dvb_demux
=
vbi_dvb_pes_demux_new
(
NULL
,
NULL
);
...
@@ -222,11 +202,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -222,11 +202,7 @@ static int Open( vlc_object_t *p_this )
if
(
p_sys
->
b_text
)
if
(
p_sys
->
b_text
)
p_dec
->
fmt_out
.
video
.
i_chroma
=
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
);
p_dec
->
fmt_out
.
video
.
i_chroma
=
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
);
else
else
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
p_dec
->
fmt_out
.
video
.
i_chroma
=
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
);
#else
p_dec
->
fmt_out
.
video
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
p_dec
->
fmt_out
.
video
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
#endif
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -243,9 +219,6 @@ static void Close( vlc_object_t *p_this )
...
@@ -243,9 +219,6 @@ static void Close( vlc_object_t *p_this )
var_DelCallback
(
p_dec
,
"vbi-page"
,
RequestPage
,
p_sys
);
var_DelCallback
(
p_dec
,
"vbi-page"
,
RequestPage
,
p_sys
);
var_DelCallback
(
p_dec
,
"vbi-opaque"
,
Opaque
,
p_sys
);
var_DelCallback
(
p_dec
,
"vbi-opaque"
,
Opaque
,
p_sys
);
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
if
(
p_sys
->
p_image
)
image_HandlerDelete
(
p_sys
->
p_image
);
#endif
if
(
p_sys
->
p_vbi_dec
)
vbi_decoder_delete
(
p_sys
->
p_vbi_dec
);
if
(
p_sys
->
p_vbi_dec
)
vbi_decoder_delete
(
p_sys
->
p_vbi_dec
);
if
(
p_sys
->
p_dvb_demux
)
vbi_dvb_demux_delete
(
p_sys
->
p_dvb_demux
);
if
(
p_sys
->
p_dvb_demux
)
vbi_dvb_demux_delete
(
p_sys
->
p_dvb_demux
);
free
(
p_sys
);
free
(
p_sys
);
...
@@ -320,11 +293,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -320,11 +293,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
/* Create a new subpicture region */
/* Create a new subpicture region */
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
fmt
.
i_chroma
=
p_sys
->
b_text
?
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
)
:
fmt
.
i_chroma
=
p_sys
->
b_text
?
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
)
:
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'A'
);
#else
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
#endif
fmt
.
i_aspect
=
p_sys
->
b_text
?
0
:
VOUT_ASPECT_FACTOR
;
fmt
.
i_aspect
=
p_sys
->
b_text
?
0
:
VOUT_ASPECT_FACTOR
;
if
(
!
p_sys
->
b_text
)
if
(
!
p_sys
->
b_text
)
{
{
...
@@ -387,59 +356,6 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -387,59 +356,6 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
}
}
else
else
{
{
#if defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
video_format_t
fmt_in
;
picture_t
*
p_pic
,
*
p_dest
;
p_pic
=
(
picture_t
*
)
malloc
(
sizeof
(
picture_t
)
);
if
(
!
p_pic
)
goto
error
;
memset
(
&
fmt_in
,
0
,
sizeof
(
video_format_t
)
);
memset
(
p_pic
,
0
,
sizeof
(
picture_t
)
);
fmt_in
=
fmt
;
fmt_in
.
i_chroma
=
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
);
vout_AllocatePicture
(
VLC_OBJECT
(
p_dec
),
p_pic
,
fmt_in
.
i_chroma
,
fmt_in
.
i_width
,
fmt_in
.
i_height
,
fmt_in
.
i_aspect
);
if
(
!
p_pic
->
i_planes
)
{
free
(
p_pic
->
p_data_orig
);
free
(
p_pic
);
goto
error
;
}
vbi_draw_vt_page
(
&
p_page
,
ZVBI_PIXFMT_RGBA32
,
p_pic
->
p
->
p_pixels
,
1
,
1
);
p_pic
->
p
->
i_lines
=
p_page
.
rows
*
10
;
p_pic
->
p
->
i_pitch
=
p_page
.
columns
*
12
*
4
;
#ifdef ZVBI_DEBUG
msg_Dbg
(
p_dec
,
"page %x-%x(%d,%d)"
,
p_page
.
pgno
,
p_page
.
subno
,
p_page
.
rows
,
p_page
.
columns
);
#endif
p_dest
=
image_Convert
(
p_sys
->
p_image
,
p_pic
,
&
fmt_in
,
&
p_spu
->
p_region
->
fmt
);
if
(
!
p_dest
)
{
free
(
p_pic
->
p_data_orig
);
free
(
p_pic
);
msg_Err
(
p_dec
,
"chroma conversion failed"
);
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
),
p_dest
);
free
(
p_pic
->
p_data_orig
);
free
(
p_pic
);
free
(
p_dest
->
p_data_orig
);
free
(
p_dest
);
#else
picture_t
*
p_pic
;
picture_t
*
p_pic
;
vbi_draw_vt_page
(
&
p_page
,
ZVBI_PIXFMT_RGBA32
,
vbi_draw_vt_page
(
&
p_page
,
ZVBI_PIXFMT_RGBA32
,
...
@@ -450,7 +366,6 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
...
@@ -450,7 +366,6 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
p_pic
=
&
(
p_spu
->
p_region
->
picture
);
p_pic
=
&
(
p_spu
->
p_region
->
picture
);
OpaquePage
(
p_dec
,
p_page
,
fmt
,
&
p_pic
);
OpaquePage
(
p_dec
,
p_page
,
fmt
,
&
p_pic
);
#endif
}
}
#undef ZVBI_PIXFMT_RGBA32
#undef ZVBI_PIXFMT_RGBA32
...
@@ -505,33 +420,14 @@ static void event_handler( vbi_event *ev, void *user_data )
...
@@ -505,33 +420,14 @@ 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
;
unsigned
int
x
=
0
,
y
=
0
;
unsigned
int
x
=
0
,
y
=
0
;
vbi_opacity
opacity
;
vbi_opacity
opacity
;
assert
(
fmt
.
i_chroma
==
VLC_FOURCC
(
'R'
,
'G'
,
'B'
,
'A'
)
);
/* Kludge since zvbi doesn't provide an option to specify opacity. */
/* Kludge since zvbi doesn't provide an option to specify opacity. */
switch
(
fmt
.
i_chroma
)
switch
(
fmt
.
i_chroma
)
{
{
...
@@ -579,65 +475,7 @@ static int Opaque_32bpp( decoder_t *p_dec, vbi_page p_page,
...
@@ -579,65 +475,7 @@ static int Opaque_32bpp( decoder_t *p_dec, vbi_page p_page,
}
}
/* end of kludge */
/* end of kludge */
return
VLC_SUCCESS
;
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'
):
p_begin
=
(
uint8_t
*
)(
*
p_src
)
->
p
[
A_PLANE
].
p_pixels
;
p_end
=
(
uint8_t
*
)(
*
p_src
)
->
p
[
A_PLANE
].
p_pixels
+
(
fmt
.
i_height
*
(
*
p_src
)
->
p
[
A_PLANE
].
i_pitch
);
i_width
=
(
*
p_src
)
->
p
[
A_PLANE
].
i_pitch
;
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 true to 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
>=
i_width
)
{
x
=
0
;
y
++
;
}
}
/* end of kludge */
return
VLC_SUCCESS
;
}
}
static
int
RequestPage
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
int
RequestPage
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
...
...
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