]> git.sesse.net Git - vlc/blobdiff - src/video_output/vout_internal.h
Reworked the way pictures are handled by the vout core.
[vlc] / src / video_output / vout_internal.h
index 6a754a1aeeb7033cd767291e43f5243ff2344901..d466ac1026044817260cec354060430721305ffc 100644 (file)
 #ifndef _VOUT_INTERNAL_H
 #define _VOUT_INTERNAL_H 1
 
+#include <vlc_picture_fifo.h>
+#include <vlc_picture_pool.h>
 #include "vout_control.h"
 #include "snapshot.h"
 #include "statistic.h"
+#include "chrono.h"
 
 /* Number of pictures required to computes the FPS rate */
 #define VOUT_FPS_SAMPLES                20
 /* */
 typedef struct vout_sys_t vout_sys_t;
 
-/**
- * Video picture heap, either render (to store pictures used
- * by the decoder) or output (to store pictures displayed by the vout plugin)
- */
-typedef struct
-{
-    int i_pictures;                                   /**< current heap size */
-
-    /* Real pictures */
-    picture_t*      pp_picture[VOUT_MAX_PICTURES];             /**< pictures */
-    int             i_last_used_pic;              /**< last used pic in heap */
-} picture_heap_t;
-
 /* */
 struct vout_thread_sys_t
 {
@@ -73,27 +63,28 @@ struct vout_thread_sys_t
     bool            b_error;
 
     /* */
-    bool            b_picture_displayed;
     bool            b_picture_empty;
-    mtime_t         i_picture_displayed_date;
-    picture_t       *p_picture_displayed;
-    int             i_picture_qtype;
-    bool            b_picture_interlaced;
     vlc_cond_t      picture_wait;
+    struct {
+        mtime_t     clock;
+        mtime_t     timestampX;
+        int         qtype;
+        bool        is_interlaced;
+        picture_t   *decoded;
+    } displayed;
+    struct {
+        bool        is_requested;
+        mtime_t     last;
+        mtime_t     timestamp;
+    } step;
 
     /* */
     vlc_mutex_t     vfilter_lock;         /**< video filter2 lock */
 
     /* */
-    uint32_t        render_time;           /**< last picture render time */
     unsigned int    i_par_num;           /**< monitor pixel aspect-ratio */
     unsigned int    i_par_den;           /**< monitor pixel aspect-ratio */
-
-    /**
-     * These numbers are not supposed to be accurate, but are a
-     * good indication of the thread status */
-    count_t         c_fps_samples;                         /**< picture counts */
-    mtime_t         p_fps_sample[VOUT_FPS_SAMPLES];     /**< FPS samples dates */
+    bool            is_late_dropped;
 
     /* Statistics */
     vout_statistic_t statistic;
@@ -129,24 +120,21 @@ struct vout_thread_sys_t
 
     /* */
     vlc_mutex_t         picture_lock;                 /**< picture heap lock */
+    picture_pool_t      *private_pool;
+    picture_pool_t      *display_pool;
+    picture_pool_t      *decoder_pool;
+    picture_fifo_t      *decoder_fifo;
+    bool                is_decoder_pool_slow;
+    vout_chrono_t       render;           /**< picture render time estimator */
+
     vlc_mutex_t         change_lock;                 /**< thread change lock */
 
     uint16_t            i_changes;          /**< changes made to the thread.
                                                       \see \ref vout_changes */
     unsigned            b_fullscreen:1;       /**< toogle fullscreen display */
     unsigned            b_on_top:1; /**< stay always on top of other windows */
-
-    picture_heap_t      render;                       /**< rendered pictures */
-    picture_heap_t      output;                          /**< direct buffers */
-
-    picture_t           p_picture[2*VOUT_MAX_PICTURES+1];      /**< pictures */
 };
 
-#define I_OUTPUTPICTURES p_vout->p->output.i_pictures
-#define PP_OUTPUTPICTURE p_vout->p->output.pp_picture
-#define I_RENDERPICTURES p_vout->p->render.i_pictures
-#define PP_RENDERPICTURE p_vout->p->render.pp_picture
-
 /** \defgroup vout_changes Flags for changes
  * These flags are set in the vout_thread_t::i_changes field when another
  * thread changed a variable
@@ -164,20 +152,10 @@ struct vout_thread_sys_t
 #define VOUT_CROP_CHANGE        0x1000
 /** aspect ratio changed */
 #define VOUT_ASPECT_CHANGE      0x2000
-/** change/recreate picture buffers */
-#define VOUT_PICTURE_BUFFERS_CHANGE 0x4000
 /**@}*/
 
 
 /* */
-int vout_AllocatePicture( vlc_object_t *, picture_t *, uint32_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den );
-#define vout_AllocatePicture(a,b,c,d,e,f,g) \
-        vout_AllocatePicture(VLC_OBJECT(a),b,c,d,e,f,g)
-
-/* DO NOT use vout_RenderPicture/vout_IntfInit unless you are in src/video_ouput */
-picture_t *vout_RenderPicture( vout_thread_t *, picture_t *,
-                               subpicture_t *,
-                               mtime_t render_date );
 void vout_IntfInit( vout_thread_t * );
 
 /* DO NOT use vout_UsePictureLocked unless you are in src/video_ouput