Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
f0c76d50
Commit
f0c76d50
authored
Sep 20, 2008
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up a bit subpicture region API.
parent
7c4a6119
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
153 additions
and
163 deletions
+153
-163
include/vlc_osd.h
include/vlc_osd.h
+0
-4
include/vlc_vout.h
include/vlc_vout.h
+23
-5
modules/codec/cc.c
modules/codec/cc.c
+1
-1
modules/codec/csri.c
modules/codec/csri.c
+2
-7
modules/codec/cvdsub.c
modules/codec/cvdsub.c
+14
-12
modules/codec/dvbsub.c
modules/codec/dvbsub.c
+15
-14
modules/codec/kate.c
modules/codec/kate.c
+6
-5
modules/codec/libass.c
modules/codec/libass.c
+2
-7
modules/codec/spudec/parse.c
modules/codec/spudec/parse.c
+14
-13
modules/codec/subtitles/subsdec.c
modules/codec/subtitles/subsdec.c
+1
-1
modules/codec/subtitles/subsusf.c
modules/codec/subtitles/subsusf.c
+3
-3
modules/codec/svcdsub.c
modules/codec/svcdsub.c
+14
-14
modules/codec/telx.c
modules/codec/telx.c
+1
-1
modules/codec/zvbi.c
modules/codec/zvbi.c
+1
-1
modules/video_filter/dynamicoverlay/dynamicoverlay.c
modules/video_filter/dynamicoverlay/dynamicoverlay.c
+1
-2
modules/video_filter/logo.c
modules/video_filter/logo.c
+1
-1
modules/video_filter/marq.c
modules/video_filter/marq.c
+1
-1
modules/video_filter/mosaic.c
modules/video_filter/mosaic.c
+2
-2
modules/video_filter/osdmenu.c
modules/video_filter/osdmenu.c
+13
-15
modules/video_filter/remoteosd.c
modules/video_filter/remoteosd.c
+1
-1
modules/video_filter/rss.c
modules/video_filter/rss.c
+2
-2
src/libvlccore.sym
src/libvlccore.sym
+2
-2
src/osd/osd_text.c
src/osd/osd_text.c
+1
-1
src/osd/osd_widgets.c
src/osd/osd_widgets.c
+1
-1
src/video_output/video_text.c
src/video_output/video_text.c
+1
-1
src/video_output/vout_intf.c
src/video_output/vout_intf.c
+1
-1
src/video_output/vout_subpictures.c
src/video_output/vout_subpictures.c
+29
-45
No files found.
include/vlc_osd.h
View file @
f0c76d50
...
...
@@ -118,10 +118,6 @@ VLC_EXPORT( subpicture_t *, spu_CreateSubpicture, ( spu_t * ) );
VLC_EXPORT
(
void
,
spu_DestroySubpicture
,
(
spu_t
*
,
subpicture_t
*
)
);
VLC_EXPORT
(
void
,
spu_DisplaySubpicture
,
(
spu_t
*
,
subpicture_t
*
)
);
#define spu_CreateRegion(a,b) __spu_CreateRegion(VLC_OBJECT(a),b)
VLC_EXPORT
(
subpicture_region_t
*
,
__spu_CreateRegion
,
(
vlc_object_t
*
,
video_format_t
*
)
);
#define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
VLC_EXPORT
(
void
,
__spu_DestroyRegion
,
(
vlc_object_t
*
,
subpicture_region_t
*
)
);
VLC_EXPORT
(
subpicture_t
*
,
spu_SortSubpictures
,
(
spu_t
*
,
mtime_t
display_date
,
bool
b_paused
,
bool
b_subtitle_only
)
);
/**
...
...
include/vlc_vout.h
View file @
f0c76d50
...
...
@@ -319,9 +319,31 @@ struct subpicture_region_t
text_style_t
*
p_style
;
/**< a description of the text style formatting */
subpicture_region_t
*
p_next
;
/**< next region in the list */
subpicture_region_private_t
*
p_private
;
/**<
modified version of this region
*/
subpicture_region_private_t
*
p_private
;
/**<
Private data for spu_t *only*
*/
};
/**
* This function will create a new subpicture.
* You can must use subpicture_region_Delete to destroy it.
*/
VLC_EXPORT
(
subpicture_region_t
*
,
subpicture_region_New
,
(
const
video_format_t
*
p_fmt
)
);
/**
* This function will destroy a subpicture allocated by
* subpicture_region_New.
*
* You may give it NULL.
*/
VLC_EXPORT
(
void
,
subpicture_region_Delete
,
(
subpicture_region_t
*
p_region
)
);
/**
* This function will destroy a list of subpicture allocated by
* subpicture_region_New.
*
* Provided for convenience.
*/
VLC_EXPORT
(
void
,
subpicture_region_ChainDelete
,
(
subpicture_region_t
*
p_head
)
);
/**
* Video subtitle
*
...
...
@@ -375,10 +397,6 @@ struct subpicture_t
void
(
*
pf_destroy
)
(
subpicture_t
*
);
/** Pointer to functions for region management */
subpicture_region_t
*
(
*
pf_create_region
)
(
vlc_object_t
*
,
video_format_t
*
);
void
(
*
pf_destroy_region
)
(
vlc_object_t
*
,
subpicture_region_t
*
);
void
(
*
pf_pre_render
)
(
spu_t
*
,
subpicture_t
*
,
const
video_format_t
*
);
void
(
*
pf_update_regions
)(
spu_t
*
,
subpicture_t
*
,
const
video_format_t
*
,
mtime_t
);
...
...
modules/codec/cc.c
View file @
f0c76d50
...
...
@@ -344,7 +344,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
fmt
.
i_aspect
=
0
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
modules/codec/csri.c
View file @
f0c76d50
...
...
@@ -250,12 +250,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
video_format_t
fmt
;
/* TODO maybe checking if we really need redrawing */
while
(
p_subpic
->
p_region
)
{
subpicture_region_t
*
p_region
=
p_subpic
->
p_region
;
p_subpic
->
p_region
=
p_region
->
p_next
;
spu_DestroyRegion
(
p_spu
,
p_region
);
}
subpicture_region_ChainDelete
(
p_subpic
->
p_region
);
p_subpic
->
p_region
=
NULL
;
/* FIXME check why this is needed */
...
...
@@ -297,7 +292,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
p_subpic
->
i_original_picture_height
=
fmt
.
i_height
;
p_subpic
->
i_original_picture_width
=
fmt
.
i_width
;
p_spu_region
=
p_subpic
->
p_region
=
p_subpic
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_spu_region
=
p_subpic
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
p_spu_region
)
{
...
...
modules/codec/cvdsub.c
View file @
f0c76d50
...
...
@@ -498,6 +498,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
subpicture_t
*
p_spu
;
subpicture_region_t
*
p_region
;
video_format_t
fmt
;
video_palette_t
palette
;
int
i
;
/* Allocate the subpicture internal data. */
...
...
@@ -515,11 +516,22 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
fmt
.
i_width
=
fmt
.
i_visible_width
=
p_sys
->
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_sys
->
i_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
fmt
.
p_palette
=
&
palette
;
fmt
.
p_palette
->
i_entries
=
4
;
for
(
i
=
0
;
i
<
fmt
.
p_palette
->
i_entries
;
i
++
)
{
fmt
.
p_palette
->
palette
[
i
][
0
]
=
p_sys
->
p_palette
[
i
][
0
];
fmt
.
p_palette
->
palette
[
i
][
1
]
=
p_sys
->
p_palette
[
i
][
1
];
fmt
.
p_palette
->
palette
[
i
][
2
]
=
p_sys
->
p_palette
[
i
][
2
];
fmt
.
p_palette
->
palette
[
i
][
3
]
=
p_sys
->
p_palette
[
i
][
3
];
}
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
//goto error;
p_dec
->
pf_spu_buffer_del
(
p_dec
,
p_spu
);
return
NULL
;
}
p_spu
->
p_region
=
p_region
;
...
...
@@ -527,16 +539,6 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
p_region
->
i_x
=
p_region
->
i_x
*
3
/
4
;
/* FIXME: use aspect ratio for x? */
p_region
->
i_y
=
p_sys
->
i_y_start
;
/* Build palette */
fmt
.
p_palette
->
i_entries
=
4
;
for
(
i
=
0
;
i
<
fmt
.
p_palette
->
i_entries
;
i
++
)
{
fmt
.
p_palette
->
palette
[
i
][
0
]
=
p_sys
->
p_palette
[
i
][
0
];
fmt
.
p_palette
->
palette
[
i
][
1
]
=
p_sys
->
p_palette
[
i
][
1
];
fmt
.
p_palette
->
palette
[
i
][
2
]
=
p_sys
->
p_palette
[
i
][
2
];
fmt
.
p_palette
->
palette
[
i
][
3
]
=
p_sys
->
p_palette
[
i
][
3
];
}
RenderImage
(
p_dec
,
p_data
,
p_region
);
return
p_spu
;
...
...
modules/codec/dvbsub.c
View file @
f0c76d50
...
...
@@ -1500,6 +1500,7 @@ static subpicture_t *render( decoder_t *p_dec )
subpicture_region_t
*
p_spu_region
;
uint8_t
*
p_src
,
*
p_dst
;
video_format_t
fmt
;
video_palette_t
palette
;
int
i_pitch
;
i_timeout
=
p_sys
->
p_page
->
i_timeout
;
...
...
@@ -1545,19 +1546,7 @@ static subpicture_t *render( decoder_t *p_dec )
fmt
.
i_width
=
fmt
.
i_visible_width
=
p_region
->
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_region
->
i_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
if
(
!
p_spu_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
continue
;
}
p_spu_region
->
i_x
=
i_base_x
+
p_regiondef
->
i_x
;
p_spu_region
->
i_y
=
i_base_y
+
p_regiondef
->
i_y
;
p_spu_region
->
i_align
=
p_sys
->
i_spu_position
;
*
pp_spu_region
=
p_spu_region
;
pp_spu_region
=
&
p_spu_region
->
p_next
;
/* Build palette */
fmt
.
p_palette
=
&
palette
;
fmt
.
p_palette
->
i_entries
=
(
p_region
->
i_depth
==
1
)
?
4
:
(
(
p_region
->
i_depth
==
2
)
?
16
:
256
);
p_color
=
(
p_region
->
i_depth
==
1
)
?
p_clut
->
c_2b
:
...
...
@@ -1570,6 +1559,18 @@ static subpicture_t *render( decoder_t *p_dec )
fmt
.
p_palette
->
palette
[
j
][
3
]
=
0xff
-
p_color
[
j
].
T
;
}
p_spu_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
continue
;
}
p_spu_region
->
i_x
=
i_base_x
+
p_regiondef
->
i_x
;
p_spu_region
->
i_y
=
i_base_y
+
p_regiondef
->
i_y
;
p_spu_region
->
i_align
=
p_sys
->
i_spu_position
;
*
pp_spu_region
=
p_spu_region
;
pp_spu_region
=
&
p_spu_region
->
p_next
;
p_src
=
p_region
->
p_pixbuf
;
p_dst
=
p_spu_region
->
p_picture
->
Y_PIXELS
;
i_pitch
=
p_spu_region
->
p_picture
->
Y_PITCH
;
...
...
@@ -1598,7 +1599,7 @@ static subpicture_t *render( decoder_t *p_dec )
fmt
.
i_width
=
fmt
.
i_visible_width
=
p_region
->
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_region
->
i_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_spu_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
modules/codec/kate.c
View file @
f0c76d50
...
...
@@ -552,6 +552,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
subpicture_region_t
*
p_bitmap_region
=
NULL
;
int
ret
;
video_format_t
fmt
;
video_format_t
palette
;
kate_tracker
kin
;
bool
tracker_valid
=
false
;
...
...
@@ -620,6 +621,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
#ifdef ENABLE_BITMAPS
if
(
ev
->
bitmap
&&
ev
->
bitmap
->
type
==
kate_bitmap_type_paletted
&&
ev
->
palette
)
{
/* create a separate region for the bitmap */
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
fmt
.
i_chroma
=
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'P'
);
...
...
@@ -627,8 +629,10 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
fmt
.
i_width
=
fmt
.
i_visible_width
=
ev
->
bitmap
->
width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
ev
->
bitmap
->
height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
fmt
.
p_palette
=
&
palette
;
CreateKatePalette
(
fmt
.
p_palette
,
ev
->
palette
);
p_bitmap_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_bitmap_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_bitmap_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
@@ -636,9 +640,6 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
return
NULL
;
}
/* create the palette */
CreateKatePalette
(
fmt
.
p_palette
,
ev
->
palette
);
/* create the bitmap */
CreateKateBitmap
(
p_bitmap_region
->
p_picture
,
ev
->
bitmap
);
...
...
@@ -651,7 +652,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, kate_packet *p_kp, block_t
fmt
.
i_aspect
=
0
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
modules/codec/libass.c
View file @
f0c76d50
...
...
@@ -399,7 +399,7 @@ static void UpdateRegions( spu_t *p_spu, subpicture_t *p_subpic,
fmt_region
.
i_height
=
fmt_region
.
i_visible_height
=
region
[
i
].
y1
-
region
[
i
].
y0
;
pp_region
[
i
]
=
r
=
p_subpic
->
pf_create_region
(
VLC_OBJECT
(
p_spu
),
&
fmt_region
);
pp_region
[
i
]
=
r
=
subpicture_region_New
(
&
fmt_region
);
if
(
!
r
)
break
;
r
->
i_x
=
region
[
i
].
x0
;
...
...
@@ -620,12 +620,7 @@ static void RegionDraw( subpicture_region_t *p_region, ass_image_t *p_img )
static
void
SubpictureReleaseRegions
(
spu_t
*
p_spu
,
subpicture_t
*
p_subpic
)
{
while
(
p_subpic
->
p_region
)
{
subpicture_region_t
*
p_region
=
p_subpic
->
p_region
;
p_subpic
->
p_region
=
p_region
->
p_next
;
spu_DestroyRegion
(
p_spu
,
p_region
);
}
subpicture_region_ChainDelete
(
p_subpic
->
p_region
);
p_subpic
->
p_region
=
NULL
;
}
...
...
modules/codec/spudec/parse.c
View file @
f0c76d50
...
...
@@ -658,6 +658,7 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
int
i_x
,
i_y
,
i_len
,
i_color
,
i_pitch
;
uint16_t
*
p_source
=
(
uint16_t
*
)
p_spu_data
->
p_data
;
video_format_t
fmt
;
video_palette_t
palette
;
/* Create a new subpicture region */
memset
(
&
fmt
,
0
,
sizeof
(
video_format_t
)
);
...
...
@@ -667,19 +668,7 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_spu_properties
->
i_height
-
p_spu_data
->
i_y_top_offset
-
p_spu_data
->
i_y_bottom_offset
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
return
;
}
p_spu
->
p_region
->
i_x
=
p_spu_properties
->
i_x
;
p_spu
->
p_region
->
i_y
=
p_spu_properties
->
i_y
+
p_spu_data
->
i_y_top_offset
;
p_p
=
p_spu
->
p_region
->
p_picture
->
p
->
p_pixels
;
i_pitch
=
p_spu
->
p_region
->
p_picture
->
p
->
i_pitch
;
/* Build palette */
fmt
.
p_palette
=
&
palette
;
fmt
.
p_palette
->
i_entries
=
4
;
for
(
i_x
=
0
;
i_x
<
fmt
.
p_palette
->
i_entries
;
i_x
++
)
{
...
...
@@ -691,6 +680,18 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
p_spu_data
->
pi_alpha
[
i_x
]
<<
4
;
}
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
return
;
}
p_spu
->
p_region
->
i_x
=
p_spu_properties
->
i_x
;
p_spu
->
p_region
->
i_y
=
p_spu_properties
->
i_y
+
p_spu_data
->
i_y_top_offset
;
p_p
=
p_spu
->
p_region
->
p_picture
->
p
->
p_pixels
;
i_pitch
=
p_spu
->
p_region
->
p_picture
->
p
->
i_pitch
;
/* Draw until we reach the bottom of the subtitle */
for
(
i_y
=
0
;
i_y
<
(
int
)
fmt
.
i_height
*
i_pitch
;
i_y
+=
i_pitch
)
{
...
...
modules/codec/subtitles/subsdec.c
View file @
f0c76d50
...
...
@@ -418,7 +418,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
fmt
.
i_aspect
=
0
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
modules/codec/subtitles/subsusf.c
View file @
f0c76d50
...
...
@@ -386,7 +386,7 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
fmt
.
i_aspect
=
0
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_text_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_text_region
=
subpicture_region_New
(
&
fmt
);
if
(
p_text_region
!=
NULL
)
{
...
...
@@ -396,7 +396,7 @@ static subpicture_region_t *CreateTextRegion( decoder_t *p_dec,
p_text_region
->
psz_html
=
strndup
(
psz_subtitle
,
i_len
);
if
(
!
p_text_region
->
psz_html
)
{
p_spu
->
pf_destroy_region
(
VLC_OBJECT
(
p_dec
),
p_text_region
);
subpicture_region_Delete
(
p_text_region
);
return
NULL
;
}
...
...
@@ -1201,7 +1201,7 @@ static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec,
fmt_out
.
i_height
=
fmt_out
.
i_visible_height
=
p_pic
->
format
.
i_visible_height
;
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt_out
);
p_region
=
subpicture_region_New
(
&
fmt_out
);
if
(
!
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
modules/codec/svcdsub.c
View file @
f0c76d50
...
...
@@ -467,6 +467,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
subpicture_t
*
p_spu
;
subpicture_region_t
*
p_region
;
video_format_t
fmt
;
video_palette_t
palette
;
int
i
;
/* Allocate the subpicture internal data. */
...
...
@@ -494,20 +495,7 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
fmt
.
i_width
=
fmt
.
i_visible_width
=
p_sys
->
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_sys
->
i_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
if
(
!
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SVCD subtitle region"
);
//goto error;
}
p_region
->
fmt
.
i_aspect
=
VOUT_ASPECT_FACTOR
;
p_spu
->
p_region
=
p_region
;
p_region
->
i_x
=
p_sys
->
i_x_start
;
p_region
->
i_y
=
p_sys
->
i_y_start
;
/* Build palette */
fmt
.
p_palette
=
&
palette
;
fmt
.
p_palette
->
i_entries
=
4
;
for
(
i
=
0
;
i
<
fmt
.
p_palette
->
i_entries
;
i
++
)
{
...
...
@@ -517,6 +505,18 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
fmt
.
p_palette
->
palette
[
i
][
3
]
=
p_sys
->
p_palette
[
i
][
3
];
}
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_region
)
{
msg_Err
(
p_dec
,
"cannot allocate SVCD subtitle region"
);
p_dec
->
pf_spu_buffer_del
(
p_dec
,
p_spu
);
return
NULL
;
}
p_spu
->
p_region
=
p_region
;
p_region
->
i_x
=
p_sys
->
i_x_start
;
p_region
->
i_y
=
p_sys
->
i_y_start
;
SVCDSubRenderImage
(
p_dec
,
p_data
,
p_region
);
return
p_spu
;
...
...
modules/codec/telx.c
View file @
f0c76d50
...
...
@@ -708,7 +708,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
fmt
.
i_aspect
=
0
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
p_spu
->
p_region
==
NULL
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
modules/codec/zvbi.c
View file @
f0c76d50
...
...
@@ -483,7 +483,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
}
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_dec
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
p_spu
->
p_region
==
NULL
)
{
msg_Err
(
p_dec
,
"cannot allocate SPU region"
);
...
...
modules/video_filter/dynamicoverlay/dynamicoverlay.c
View file @
f0c76d50
...
...
@@ -347,8 +347,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
subpicture_region_t
*
p_region
;
*
pp_region
=
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
p_overlay
->
format
);
*
pp_region
=
p_region
=
subpicture_region_New
(
&
p_overlay
->
format
);
if
(
!
p_region
)
break
;
...
...
modules/video_filter/logo.c
View file @
f0c76d50
...
...
@@ -864,7 +864,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
fmt
.
i_width
=
fmt
.
i_visible_width
=
p_pic
->
p
[
Y_PLANE
].
i_visible_pitch
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_pic
->
p
[
Y_PLANE
].
i_visible_lines
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt
);
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_region
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
...
...
modules/video_filter/marq.c
View file @
f0c76d50
...
...
@@ -286,7 +286,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
0
;
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
p_filter
->
pf_sub_buffer_del
(
p_filter
,
p_spu
);
...
...
modules/video_filter/mosaic.c
View file @
f0c76d50
...
...
@@ -641,10 +641,10 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
fmt_out
.
i_visible_height
=
fmt_out
.
i_height
;
}
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt_out
);
p_region
=
subpicture_region_New
(
&
fmt_out
);
/* FIXME the copy is probably not needed anymore */
if
(
p_region
)
picture_Copy
(
&
p_region
->
p_picture
,
p_converted
);
picture_Copy
(
p_region
->
p_picture
,
p_converted
);
if
(
!
p_sys
->
b_keep
)
picture_Release
(
p_converted
);
...
...
modules/video_filter/osdmenu.c
View file @
f0c76d50
...
...
@@ -375,7 +375,7 @@ static subpicture_region_t *create_text_region( filter_t *p_filter, subpicture_t
fmt.i_width = fmt.i_visible_width = i_width;
fmt.i_height = fmt.i_visible_height = i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_region =
p_spu->pf_create_region( VLC_OBJECT(p_filter),
&fmt );
p_region =
subpicture_region_New(
&fmt );
if( !p_region )
{
msg_Err( p_filter, "cannot allocate another SPU region" );
...
...
@@ -401,6 +401,7 @@ static subpicture_region_t *create_picture_region( filter_t *p_filter, subpictur
{
subpicture_region_t
*
p_region
=
NULL
;
video_format_t
fmt
;
video_palette_t
palette
;
if
(
!
p_spu
)
return
NULL
;
...
...
@@ -412,20 +413,21 @@ static subpicture_region_t *create_picture_region( filter_t *p_filter, subpictur
fmt
.
i_width
=
fmt
.
i_visible_width
=
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
i_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
if
(
fmt
.
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'P'
)
)
{
fmt
.
p_palette
=
&
palette
;
fmt
.
p_palette
->
i_entries
=
0
;
fmt
.
i_visible_width
=
0
;
fmt
.
i_visible_height
=
0
;
}
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt
);
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_region
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
p_filter
->
pf_sub_buffer_del
(
p_filter
,
p_spu
);
return
NULL
;
}
if
(
!
p_pic
&&
(
fmt
.
i_chroma
==
VLC_FOURCC
(
'Y'
,
'U'
,
'V'
,
'P'
)
)
)
{
p_region
->
fmt
.
p_palette
->
i_entries
=
0
;
p_region
->
fmt
.
i_width
=
p_region
->
fmt
.
i_visible_width
=
0
;
p_region
->
fmt
.
i_height
=
p_region
->
fmt
.
i_visible_height
=
0
;
}
/* FIXME the copy is probably not needed anymore */
if
(
p_pic
)
picture_Copy
(
p_region
->
p_picture
,
p_pic
);
...
...
@@ -570,13 +572,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
if
(
!
p_new
)
{
/* Cleanup when bailing out */
subpicture_region_t
*
p_tmp
=
NULL
;
while
(
p_region_list
)
{
p_tmp
=
p_region_list
->
p_next
;
p_spu
->
pf_destroy_region
(
VLC_OBJECT
(
p_filter
),
p_region_list
);
};
p_spu
->
pf_destroy_region
(
VLC_OBJECT
(
p_filter
),
p_region
);
subpicture_region_ChainDelete
(
p_region_list
);
subpicture_region_Delete
(
p_region
);
p_filter
->
pf_sub_buffer_del
(
p_filter
,
p_spu
);
return
NULL
;
}
...
...
modules/video_filter/remoteosd.c
View file @
f0c76d50
...
...
@@ -1162,7 +1162,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
fmt
.
i_width
=
fmt
.
i_visible_width
=
p_pic
->
p
[
Y_PLANE
].
i_visible_pitch
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
p_pic
->
p
[
Y_PLANE
].
i_visible_lines
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt
);
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_region
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
...
...
modules/video_filter/rss.c
View file @
f0c76d50
...
...
@@ -443,7 +443,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
fmt
.
i_chroma
=
VLC_FOURCC
(
'T'
,
'E'
,
'X'
,
'T'
);
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
p_filter
->
pf_sub_buffer_del
(
p_filter
,
p_spu
);
...
...
@@ -548,7 +548,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
fmt_out
.
i_height
=
fmt_out
.
i_visible_height
=
p_pic
->
p
[
Y_PLANE
].
i_visible_lines
;
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_filter
),
&
fmt_out
);
p_region
=
subpicture_region_New
(
&
fmt_out
);
if
(
!
p_region
)
{
msg_Err
(
p_filter
,
"cannot allocate SPU region"
);
...
...
src/libvlccore.sym
View file @
f0c76d50
...
...
@@ -336,10 +336,8 @@ sout_StreamDelete
sout_StreamNew
sout_UpdateStatistic
__spu_Create
__spu_CreateRegion
spu_CreateSubpicture
spu_Destroy
__spu_DestroyRegion
spu_DestroySubpicture
spu_DisplaySubpicture
spu_Init
...
...
@@ -374,6 +372,8 @@ stream_vaControl
__str_format
__str_format_meta
str_format_time
subpicture_region_New
subpicture_region_Delete
tls_ClientCreate
tls_ClientDelete
ToLocale
...
...
src/osd/osd_text.c
View file @
f0c76d50
...
...
@@ -94,7 +94,7 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
fmt
.
i_aspect
=
0
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_spu_channel
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_spu_channel
,
"cannot allocate SPU region"
);
...
...
src/osd/osd_widgets.c
View file @
f0c76d50
...
...
@@ -164,7 +164,7 @@ static int CreatePicture( spu_t *p_spu, subpicture_t *p_subpic,
fmt
.
i_width
=
fmt
.
i_visible_width
=
i_width
;
fmt
.
i_height
=
fmt
.
i_visible_height
=
i_height
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_subpic
->
p_region
=
p_subpic
->
pf_create_region
(
VLC_OBJECT
(
p_spu
),
&
fmt
);
p_subpic
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_subpic
->
p_region
)
{
msg_Err
(
p_spu
,
"cannot allocate SPU region"
);
...
...
src/video_output/video_text.c
View file @
f0c76d50
...
...
@@ -98,7 +98,7 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
fmt
.
i_aspect
=
0
;
fmt
.
i_width
=
fmt
.
i_height
=
0
;
fmt
.
i_x_offset
=
fmt
.
i_y_offset
=
0
;
p_spu
->
p_region
=
p_spu
->
pf_create_region
(
VLC_OBJECT
(
p_vout
),
&
fmt
);
p_spu
->
p_region
=
subpicture_region_New
(
&
fmt
);
if
(
!
p_spu
->
p_region
)
{
msg_Err
(
p_vout
,
"cannot allocate SPU region"
);
...
...
src/video_output/vout_intf.c
View file @
f0c76d50
...
...
@@ -475,7 +475,7 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, image_handler_t *p_image, pic
fmt_out
.
i_sar_num
=
fmt_out
.
i_sar_den
=
0
;
p_subpic
->
p_region
=
s
pu_CreateRegion
(
p_vout
->
p_spu
,
&
fmt_out
);
p_subpic
->
p_region
=
s
ubpicture_region_New
(
&
fmt_out
);
if
(
p_subpic
->
p_region
)
{
picture_Release
(
p_subpic
->
p_region
->
p_picture
);
...
...
src/video_output/vout_subpictures.c
View file @
f0c76d50
...
...
@@ -253,26 +253,21 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach )
}
}
/**
* Create a subpicture region
*
* \param p_this vlc_object_t
* \param p_fmt the format that this subpicture region should have
*/
subpicture_region_t
*
__spu_CreateRegion
(
vlc_object_t
*
p_this
,
video_format_t
*
p_fmt
)
/* */
subpicture_region_t
*
subpicture_region_New
(
const
video_format_t
*
p_fmt
)
{
subpicture_region_t
*
p_region
=
calloc
(
1
,
sizeof
(
*
p_region
)
);
if
(
!
p_region
)
return
NULL
;
/* FIXME is that *really* wanted? */
if
(
p_fmt
->
i_chroma
==
VLC_FOURCC_YUVP
)
p_fmt
->
p_palette
=
calloc
(
1
,
sizeof
(
video_palette_t
)
);
else
p_fmt
->
p_palette
=
NULL
;
/* XXX and that above all? */
p_region
->
fmt
=
*
p_fmt
;
p_region
->
fmt
.
p_palette
=
NULL
;
if
(
p_fmt
->
i_chroma
==
VLC_FOURCC_YUVP
)
{
p_region
->
fmt
.
p_palette
=
calloc
(
1
,
sizeof
(
*
p_region
->
fmt
.
p_palette
)
);
if
(
p_fmt
->
p_palette
)
*
p_region
->
fmt
.
p_palette
=
*
p_fmt
->
p_palette
;
}
p_region
->
i_alpha
=
0xff
;
p_region
->
p_next
=
NULL
;
p_region
->
p_private
=
NULL
;
...
...
@@ -295,13 +290,8 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
return
p_region
;
}
/**
* Destroy a subpicture region
*
* \param p_this vlc_object_t
* \param p_region the subpicture region to destroy
*/
void
__spu_DestroyRegion
(
vlc_object_t
*
p_this
,
subpicture_region_t
*
p_region
)
/* */
void
subpicture_region_Delete
(
subpicture_region_t
*
p_region
)
{
if
(
!
p_region
)
return
;
...
...
@@ -320,6 +310,19 @@ void __spu_DestroyRegion( vlc_object_t *p_this, subpicture_region_t *p_region )
free
(
p_region
);
}
/* */
void
subpicture_region_ChainDelete
(
subpicture_region_t
*
p_head
)
{
while
(
p_head
)
{
subpicture_region_t
*
p_next
=
p_head
->
p_next
;
subpicture_region_Delete
(
p_head
);
p_head
=
p_next
;
}
}
/**
* Display a subpicture
*
...
...
@@ -403,9 +406,6 @@ subpicture_t *spu_CreateSubpicture( spu_t *p_spu )
p_subpic
->
p_sys
=
NULL
;
vlc_mutex_unlock
(
&
p_spu
->
subpicture_lock
);
p_subpic
->
pf_create_region
=
__spu_CreateRegion
;
p_subpic
->
pf_destroy_region
=
__spu_DestroyRegion
;
return
p_subpic
;
}
...
...
@@ -437,12 +437,8 @@ void spu_DestroySubpicture( spu_t *p_spu, subpicture_t *p_subpic )
p_subpic
,
p_subpic
->
i_status
);
}
while
(
p_subpic
->
p_region
)
{
subpicture_region_t
*
p_region
=
p_subpic
->
p_region
;
p_subpic
->
p_region
=
p_region
->
p_next
;
spu_DestroyRegion
(
p_spu
,
p_region
);
}
subpicture_region_ChainDelete
(
p_subpic
->
p_region
);
p_subpic
->
p_region
=
NULL
;
if
(
p_subpic
->
pf_destroy
)
{
...
...
@@ -1543,12 +1539,8 @@ static void SpuClearChannel( spu_t *p_spu, int i_channel, bool b_locked )
if
(
p_subpic
->
i_channel
==
i_channel
)
{
while
(
p_subpic
->
p_region
)
{
subpicture_region_t
*
p_region
=
p_subpic
->
p_region
;
p_subpic
->
p_region
=
p_region
->
p_next
;
spu_DestroyRegion
(
p_spu
,
p_region
);
}
subpicture_region_ChainDelete
(
p_subpic
->
p_region
);
p_subpic
->
p_region
=
NULL
;
if
(
p_subpic
->
pf_destroy
)
p_subpic
->
pf_destroy
(
p_subpic
);
p_subpic
->
i_status
=
FREE_SUBPICTURE
;
...
...
@@ -1676,21 +1668,13 @@ static subpicture_t *spu_new_buffer( filter_t *p_filter )
p_subpic
->
b_absolute
=
true
;
p_subpic
->
i_alpha
=
0xFF
;
p_subpic
->
pf_create_region
=
__spu_CreateRegion
;
p_subpic
->
pf_destroy_region
=
__spu_DestroyRegion
;
VLC_UNUSED
(
p_filter
);
return
p_subpic
;
}
static
void
spu_del_buffer
(
filter_t
*
p_filter
,
subpicture_t
*
p_subpic
)
{
while
(
p_subpic
->
p_region
)
{
subpicture_region_t
*
p_region
=
p_subpic
->
p_region
;
p_subpic
->
p_region
=
p_region
->
p_next
;
p_subpic
->
pf_destroy_region
(
VLC_OBJECT
(
p_filter
),
p_region
);
}
subpicture_region_ChainDelete
(
p_subpic
->
p_region
);
free
(
p_subpic
);
}
...
...
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