home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / vlc-2-0-5-win32.exe / sdk / include / vlc / plugins / vlc_subpicture.h < prev    next >
C/C++ Source or Header  |  2012-12-12  |  7KB  |  207 lines

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