]> git.sesse.net Git - vlc/blobdiff - include/vlc_vout.h
Clean up a bit subpicture region API.
[vlc] / include / vlc_vout.h
index 420ad51faa38d95665b3abd80dce0de2ea5c8fd4..c10710aa3482ac0086fabd02602772d90da2b2c6 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-#ifndef _VLC_VOUT_H_
-#define _VLC_VOUT_H_ 1
+#ifndef VLC_VOUT_H_
+#define VLC_VOUT_H_ 1
+
+/**
+ * \file
+ * This file defines common video output structures and functions in vlc
+ */
 
 #include <vlc_es.h>
 #include <vlc_filter.h>
@@ -95,6 +100,9 @@ struct picture_t
     bool            b_progressive;          /**< is it a progressive frame ? */
     unsigned int    i_nb_fields;                  /**< # of displayed fields */
     bool            b_top_field_first;             /**< which field is first */
+    uint8_t        *p_q;                           /**< quantification table */
+    int             i_qstride;                    /**< quantification stride */
+    int             i_qtype;                       /**< quantification style */
     /**@}*/
 
     /** The picture heap we are attached to */
@@ -118,7 +126,7 @@ struct picture_t
 /**
  * This function will create a new picture.
  * The picture created will implement a default release management compatible
- * with picture_Yield and picture_Release. This default management will release
+ * with picture_Hold and picture_Release. This default management will release
  * picture_sys_t *p_sys field if non NULL.
  */
 VLC_EXPORT( picture_t *, picture_New, ( vlc_fourcc_t i_chroma, int i_width, int i_height, int i_aspect ) );
@@ -136,7 +144,7 @@ VLC_EXPORT( void, picture_Delete, ( picture_t * ) );
  * This function will increase the picture reference count.
  * It will not have any effect on picture obtained from vout
  */
-static inline void picture_Yield( picture_t *p_picture )
+static inline void picture_Hold( picture_t *p_picture )
 {
     if( p_picture->pf_release )
         p_picture->i_refcount++;
@@ -152,6 +160,17 @@ static inline void picture_Release( picture_t *p_picture )
         p_picture->pf_release( p_picture );
 }
 
+/**
+ * Cleanup quantization matrix data and set to 0
+ */
+static inline void picture_CleanupQuant( picture_t *p_pic )
+{
+    free( p_pic->p_q );
+    p_pic->p_q = NULL;
+    p_pic->i_qstride = 0;
+    p_pic->i_qtype = 0;
+}
+
 /**
  * This function will copy all picture dynamic properties.
  */
@@ -163,18 +182,26 @@ static inline void picture_CopyProperties( picture_t *p_dst, const picture_t *p_
     p_dst->b_progressive = p_src->b_progressive;
     p_dst->i_nb_fields = p_src->i_nb_fields;
     p_dst->b_top_field_first = p_src->b_top_field_first;
+
+    /* FIXME: copy ->p_q and ->p_qstride */
 }
 
 /**
  * This function will copy the picture pixels.
+ * You can safely copy between pictures that do not have the same size,
+ * only the compatible(smaller) part will be copied.
  */
 VLC_EXPORT( void, picture_CopyPixels, ( picture_t *p_dst, const picture_t *p_src ) );
+VLC_EXPORT( void, plane_CopyPixels, ( plane_t *p_dst, const plane_t *p_src ) );
 
 /**
  * This function will copy both picture dynamic properties and pixels.
- * You have to notice that sometime a simple picture_Yield may do what
+ * You have to notice that sometime a simple picture_Hold may do what
  * you want without the copy overhead.
  * Provided for convenience.
+ *
+ * \param p_dst pointer to the destination picture.
+ * \param p_src pointer to the source picture.
  */
 static inline void picture_Copy( picture_t *p_dst, const picture_t *p_src )
 {
@@ -232,6 +259,11 @@ struct picture_heap_t
 #define DISPLAYED_PICTURE       5            /* been displayed but is linked */
 #define DESTROYED_PICTURE       6              /* allocated but no more used */
 
+/* Quantification type */
+#define QTYPE_MPEG1            0
+#define QTYPE_MPEG2            1
+#define QTYPE_H264             2
+
 /*****************************************************************************
  * Shortcuts to access image components
  *****************************************************************************/
@@ -260,6 +292,11 @@ struct picture_heap_t
  * @{
  */
 
+/**
+ * Video subtitle region spu core private
+ */
+typedef struct subpicture_region_private_t subpicture_region_private_t;
+
 /**
  * Video subtitle region
  *
@@ -270,7 +307,7 @@ struct picture_heap_t
 struct subpicture_region_t
 {
     video_format_t  fmt;                          /**< format of the picture */
-    picture_t       picture;             /**< picture comprising this region */
+    picture_t       *p_picture;          /**< picture comprising this region */
 
     int             i_x;                             /**< position of region */
     int             i_y;                             /**< position of region */
@@ -282,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_t *p_cache;       /**< 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
  *
@@ -303,6 +362,7 @@ struct subpicture_t
     /** \name Type and flags
        Should NOT be modified except by the vout thread */
     /**@{*/
+    int64_t         i_order;                 /** an increasing unique number */
     int             i_type;                                        /**< type */
     int             i_status;                                     /**< flags */
     subpicture_t *  p_next;               /**< next subtitle to be displayed */
@@ -315,8 +375,6 @@ struct subpicture_t
     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 */
-    bool            b_pausable;               /**< subpicture will be paused if
-                                                            stream is paused */
     /**@}*/
 
     subpicture_region_t *p_region;  /**< region list composing this subtitle */
@@ -326,15 +384,11 @@ struct subpicture_t
      * changed by the video output thread, or simply ignored depending of the
      * subtitle type. */
     /**@{*/
-    int          i_x;                    /**< offset from alignment position */
-    int          i_y;                    /**< offset from alignment position */
-    int          i_width;                                 /**< picture width */
-    int          i_height;                               /**< picture height */
-    int          i_alpha;                                  /**< transparency */
     int          i_original_picture_width;  /**< original width of the movie */
     int          i_original_picture_height;/**< original height of the movie */
+    bool         b_subtitle;            /**< the picture is a movie subtitle */
     bool         b_absolute;                       /**< position is absolute */
-    int          i_flags;                                /**< position flags */
+    int          i_alpha;                                  /**< transparency */
      /**@}*/
 
     /** Pointer to function that renders this subtitle in a picture */
@@ -343,15 +397,9 @@ 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 * );
-    subpicture_region_t * ( *pf_make_region ) ( vlc_object_t *,
-                                                video_format_t *, picture_t * );
-    void ( *pf_destroy_region ) ( vlc_object_t *, subpicture_region_t * );
-
-    void ( *pf_pre_render ) ( video_format_t *, spu_t *, subpicture_t *, mtime_t );
-    subpicture_region_t * ( *pf_update_regions ) ( video_format_t *, spu_t *,
-                                                   subpicture_t *, mtime_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 );
 
     /** Private data - the subtitle plugin might want to put stuff here to
      * keep track of the subpicture */
@@ -385,15 +433,6 @@ struct subpicture_t
  * Prototypes
  *****************************************************************************/
 
-/**
- * Copy the source picture onto the destination picture.
- * \param p_this a vlc object
- * \param p_dst pointer to the destination picture.
- * \param p_src pointer to the source picture.
- */
-#define vout_CopyPicture(a,b,c) __vout_CopyPicture(VLC_OBJECT(a),b,c)
-VLC_EXPORT( void, __vout_CopyPicture, ( vlc_object_t *p_this, picture_t *p_dst, picture_t *p_src ) );
-
 /**
  * Initialise different fields of a picture_t (but does not allocate memory).
  * \param p_this a vlc object