vlc_subpicture.h 7.79 KB
 Laurent Aimar committed May 16, 2009 1 2 3 ``````/***************************************************************************** * vlc_subpicture.h: subpicture definitions ***************************************************************************** `````` Jean-Baptiste Kempf committed Nov 27, 2011 4 `````` * Copyright (C) 1999 - 2009 VLC authors and VideoLAN `````` Laurent Aimar committed May 16, 2009 5 6 7 8 9 10 `````` * \$Id\$ * * Authors: Vincent Seguin * Samuel Hocevar * Olivier Aubert * `````` Jean-Baptiste Kempf committed Nov 27, 2011 11 12 13 `````` * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or `````` Laurent Aimar committed May 16, 2009 14 15 16 17 `````` * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of `````` Jean-Baptiste Kempf committed Nov 27, 2011 18 19 `````` * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. `````` Laurent Aimar committed May 16, 2009 20 `````` * `````` Jean-Baptiste Kempf committed Nov 27, 2011 21 22 23 `````` * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. `````` Laurent Aimar committed May 16, 2009 24 25 26 27 28 29 30 31 32 `````` *****************************************************************************/ #ifndef VLC_SUBPICTURE_H #define VLC_SUBPICTURE_H 1 /** */ #include `````` Laurent Aimar committed May 04, 2010 33 ``````#include `````` Laurent Aimar committed May 16, 2009 34 35 `````` /** `````` Rémi Denis-Courmont committed Jun 14, 2015 36 37 `````` * \defgroup subpicture Video sub-pictures * \ingroup video_output `````` Laurent Aimar committed May 16, 2009 38 39 40 `````` * Subpictures are pictures that should be displayed on top of the video, like * subtitles and OSD * @{ `````` Rémi Denis-Courmont committed Jun 14, 2015 41 42 `````` * \file * Subpictures functions `````` Laurent Aimar committed May 16, 2009 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 `````` */ /** * Video subtitle region spu core private */ typedef struct subpicture_region_private_t subpicture_region_private_t; /** * Video subtitle region * * A subtitle region is defined by a picture (graphic) and its rendering * coordinates. * Subtitles contain a list of regions. */ struct subpicture_region_t { video_format_t fmt; /**< format of the picture */ picture_t *p_picture; /**< picture comprising this region */ int i_x; /**< position of region */ int i_y; /**< position of region */ int i_align; /**< alignment within a region */ int i_alpha; /**< transparency */ char *psz_text; /**< text string comprising this region */ char *psz_html; /**< HTML version of subtitle (NULL = use psz_text) */ text_style_t *p_style; /**< a description of the text style formatting */ `````` Devin Heitmueller committed Jan 10, 2013 70 `````` bool b_renderbg; /**< render black background under text */ `````` Laurent Aimar committed May 16, 2009 71 72 73 74 75 76 77 78 79 80 `````` subpicture_region_t *p_next; /**< next region in the list */ subpicture_region_private_t *p_private; /**< Private data for spu_t *only* */ }; /* Subpicture region position flags */ #define SUBPICTURE_ALIGN_LEFT 0x1 #define SUBPICTURE_ALIGN_RIGHT 0x2 #define SUBPICTURE_ALIGN_TOP 0x4 #define SUBPICTURE_ALIGN_BOTTOM 0x8 `````` Devin Heitmueller committed Dec 31, 2012 81 ``````#define SUBPICTURE_ALIGN_LEAVETEXT 0x10 /**< Align the subpicture, but not the text inside */ `````` Laurent Aimar committed May 16, 2009 82 ``````#define SUBPICTURE_ALIGN_MASK ( SUBPICTURE_ALIGN_LEFT|SUBPICTURE_ALIGN_RIGHT| \ `````` Devin Heitmueller committed Dec 31, 2012 83 84 `````` SUBPICTURE_ALIGN_TOP |SUBPICTURE_ALIGN_BOTTOM| \ SUBPICTURE_ALIGN_LEAVETEXT ) `````` Laurent Aimar committed May 16, 2009 85 86 87 88 89 ``````/** * This function will create a new subpicture region. * * You must use subpicture_region_Delete to destroy it. */ `````` Rémi Denis-Courmont committed May 07, 2011 90 ``````VLC_API subpicture_region_t * subpicture_region_New( const video_format_t *p_fmt ); `````` Laurent Aimar committed May 16, 2009 91 92 93 94 95 96 97 `````` /** * This function will destroy a subpicture region allocated by * subpicture_region_New. * * You may give it NULL. */ `````` Rémi Denis-Courmont committed May 07, 2011 98 ``````VLC_API void subpicture_region_Delete( subpicture_region_t *p_region ); `````` Laurent Aimar committed May 16, 2009 99 100 101 102 103 104 105 `````` /** * This function will destroy a list of subpicture regions allocated by * subpicture_region_New. * * Provided for convenience. */ `````` Rémi Denis-Courmont committed May 07, 2011 106 ``````VLC_API void subpicture_region_ChainDelete( subpicture_region_t *p_head ); `````` Laurent Aimar committed May 16, 2009 107 `````` `````` Laurent Aimar committed Apr 29, 2010 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 ``````/** * */ typedef struct subpicture_updater_sys_t subpicture_updater_sys_t; typedef struct { int (*pf_validate)( subpicture_t *, bool has_src_changed, const video_format_t *p_fmt_src, bool has_dst_changed, const video_format_t *p_fmt_dst, mtime_t); void (*pf_update) ( subpicture_t *, const video_format_t *p_fmt_src, const video_format_t *p_fmt_dst, mtime_t ); void (*pf_destroy) ( subpicture_t * ); subpicture_updater_sys_t *p_sys; } subpicture_updater_t; typedef struct subpicture_private_t subpicture_private_t; `````` Laurent Aimar committed May 16, 2009 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 ``````/** * Video subtitle * * Any subtitle destined to be displayed by a video output thread should * be stored in this structure from it's creation to it's effective display. * Subtitle type and flags should only be modified by the output thread. Note * that an empty subtitle MUST have its flags set to 0. */ struct subpicture_t { /** \name Channel ID */ /**@{*/ int i_channel; /**< subpicture channel ID */ /**@}*/ /** \name Type and flags Should NOT be modified except by the vout thread */ /**@{*/ int64_t i_order; /** an increasing unique number */ subpicture_t * p_next; /**< next subtitle to be displayed */ /**@}*/ `````` Rémi Duraffort committed Dec 28, 2009 150 151 `````` subpicture_region_t *p_region; /**< region list composing this subtitle */ `````` Laurent Aimar committed May 16, 2009 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 `````` /** \name Date properties */ /**@{*/ mtime_t i_start; /**< beginning of display date */ mtime_t i_stop; /**< end of display date */ bool b_ephemer; /**< If this flag is set to true the subtitle will be displayed untill the next one appear */ bool b_fade; /**< enable fading */ /**@}*/ /** \name Display properties * These properties are only indicative and may be * changed by the video output thread, or simply ignored depending of the * subtitle type. */ /**@{*/ bool b_subtitle; /**< the picture is a movie subtitle */ bool b_absolute; /**< position is absolute */ `````` Rémi Duraffort committed Dec 28, 2009 168 169 `````` int i_original_picture_width; /**< original width of the movie */ int i_original_picture_height;/**< original height of the movie */ `````` Laurent Aimar committed May 16, 2009 170 171 172 `````` int i_alpha; /**< transparency */ /**@}*/ `````` Laurent Aimar committed Apr 29, 2010 173 `````` subpicture_updater_t updater; `````` Laurent Aimar committed May 16, 2009 174 `````` `````` Laurent Aimar committed Apr 29, 2010 175 `````` subpicture_private_t *p_private; /* Reserved to the core */ `````` Laurent Aimar committed May 16, 2009 176 177 178 179 180 181 182 ``````}; /** * This function create a new empty subpicture. * * You must use subpicture_Delete to destroy it. */ `````` Rémi Denis-Courmont committed May 07, 2011 183 ``````VLC_API subpicture_t * subpicture_New( const subpicture_updater_t * ); `````` Laurent Aimar committed May 16, 2009 184 185 186 187 188 `````` /** * This function delete a subpicture created by subpicture_New. * You may give it NULL. */ `````` Rémi Denis-Courmont committed May 07, 2011 189 ``````VLC_API void subpicture_Delete( subpicture_t *p_subpic ); `````` Laurent Aimar committed May 16, 2009 190 `````` `````` Laurent Aimar committed May 31, 2009 191 192 193 194 195 196 197 ``````/** * This function will create a subpicture having one region in the requested * chroma showing the given picture. * * The picture_t given is not released nor used inside the * returned subpicture_t. */ `````` Rémi Denis-Courmont committed May 07, 2011 198 ``````VLC_API subpicture_t * subpicture_NewFromPicture( vlc_object_t *, picture_t *, vlc_fourcc_t i_chroma ); `````` Laurent Aimar committed May 31, 2009 199 `````` `````` Laurent Aimar committed Jun 03, 2010 200 201 202 203 ``````/** * This function will update the content of a subpicture created with * a non NULL subpicture_updater_t. */ `````` Rémi Denis-Courmont committed May 07, 2011 204 ``````VLC_API void subpicture_Update( subpicture_t *, const video_format_t *src, const video_format_t *, mtime_t ); `````` Laurent Aimar committed Jun 03, 2010 205 `````` `````` Rémi Denis-Courmont committed Jun 24, 2015 206 207 208 209 210 211 212 213 214 215 216 217 ``````/** * This function will blend a given subpicture onto a picture. * * The subpicture and all its region must: * - be absolute. * - not be ephemere. * - not have the fade flag. * - contains only picture (no text rendering). * \return the number of region(s) succesfully blent */ VLC_API unsigned picture_BlendSubpicture( picture_t *, filter_t *p_blend, subpicture_t * ); `````` Laurent Aimar committed May 16, 2009 218 219 220 ``````/**@}*/ #endif /* _VLC_VIDEO_H */``````