]> git.sesse.net Git - vlc/blob - include/vpar_synchro.h
. suppression d'un bug cosm�tique dans l'affichage des plugins qui en
[vlc] / include / vpar_synchro.h
1 /*****************************************************************************
2  * vpar_synchro.h : video parser blocks management
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  *
6  * Authors:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  * 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
21  *****************************************************************************/
22
23 /*****************************************************************************
24  * Requires:
25  *  "config.h"
26  *  "common.h"
27  *  "mtime.h"
28  *  "threads.h"
29  *  "input.h"
30  *  "video.h"
31  *  "video_output.h"
32  *  "decoder_fifo.h"
33  *  "video_fifo.h"
34  *****************************************************************************/
35
36 #define POLUX_SYNCHRO
37
38 /*****************************************************************************
39  * video_synchro_t and video_synchro_tab_s : timers for the video synchro
40  *****************************************************************************/
41 #ifdef SAM_SYNCHRO
42 typedef struct video_synchro_tab_s
43 {
44     double mean;
45     double deviation;
46
47 } video_synchro_tab_t;
48
49 typedef struct video_synchro_fifo_s
50 {
51     /* type of image to be decoded, and decoding date */
52     int i_image_type;
53     mtime_t i_decode_date;
54     mtime_t i_pts;
55
56 } video_synchro_fifo_t;
57
58 typedef struct video_synchro_s
59 {
60     /* fifo containing decoding dates */
61     video_synchro_fifo_t fifo[16];
62     unsigned int i_fifo_start;
63     unsigned int i_fifo_stop;
64
65     /* mean decoding time */
66     mtime_t i_mean_decode_time;
67     /* dates */
68     mtime_t i_last_display_pts;           /* pts of the last displayed image */
69     mtime_t i_last_decode_pts;              /* pts of the last decoded image */
70     mtime_t i_last_i_pts;                         /* pts of the last I image */
71     mtime_t i_last_nondropped_i_pts;      /* pts of last non-dropped I image */
72     unsigned int i_images_since_pts;
73
74     /* il manquait un compteur */
75     unsigned int modulo;
76
77     /* P images since the last I */
78     unsigned int current_p_count;
79     unsigned int nondropped_p_count;
80     double p_count_predict;
81     /* B images since the last I */
82     unsigned int current_b_count;
83     unsigned int nondropped_b_count;
84     double b_count_predict;
85
86     /* can we display pictures ? */
87     unsigned int    can_display_i;
88     unsigned int    can_display_p;
89     double          displayable_p;
90     unsigned int    can_display_b;
91     double          displayable_b;
92
93     /* 1 for linear count, 2 for binary count, 3 for ternary count */
94     video_synchro_tab_t tab_p[6];
95     video_synchro_tab_t tab_b[6];
96
97     double theorical_fps;
98     double actual_fps;
99
100 } video_synchro_t;
101 #endif
102
103 #ifdef MEUUH_SYNCHRO
104 typedef struct video_synchro_s
105 {
106     int         kludge_level, kludge_p, kludge_b, kludge_nbp, kludge_nbb;
107     int         kludge_nbframes;
108     mtime_t     kludge_date, kludge_prevdate;
109     int         i_coding_type;
110 } video_synchro_t;
111
112 #define SYNC_TOLERATE   ((int)(0.010*CLOCK_FREQ))                   /* 10 ms */
113 #define SYNC_DELAY      ((int)(0.500*CLOCK_FREQ))                  /* 500 ms */
114 #endif
115
116 #ifdef POLUX_SYNCHRO
117
118 #define SYNC_AVERAGE_COUNT 10
119
120 typedef struct video_synchro_s
121 {
122     /* Date Section */
123
124     /* Dates needed to compute the date of the current frame
125      * We also use the stream frame rate (sequence.r_frame_rate) */
126     mtime_t     i_current_frame_date;
127     mtime_t     i_backward_frame_date;
128
129     /* Frame Trashing Section */
130
131     int         i_b_nb, i_p_nb;   /* number of decoded P and B between two I */
132     float       r_b_average, r_p_average;
133     int         i_b_count, i_p_count, i_i_count;
134     int         i_b_trasher;                /* used for brensenham algorithm */
135
136 } video_synchro_t;
137
138 #endif
139
140 /*****************************************************************************
141  * Prototypes
142  *****************************************************************************/
143 boolean_t vpar_SynchroChoose( struct vpar_thread_s * p_vpar, int i_coding_type,
144                          int i_structure );
145 void vpar_SynchroTrash( struct vpar_thread_s * p_vpar, int i_coding_type,
146                         int i_structure );
147 void vpar_SynchroDecode( struct vpar_thread_s * p_vpar, int i_coding_type,
148                             int i_structure );
149 void vpar_SynchroEnd( struct vpar_thread_s * p_vpar );
150 mtime_t vpar_SynchroDate( struct vpar_thread_s * p_vpar );
151
152 #ifndef SAM_SYNCHRO
153 void vpar_SynchroKludge( struct vpar_thread_s *, mtime_t );
154 #endif