]> git.sesse.net Git - vlc/blob - include/vout_synchro.h
275547870728875ca3196175434c620907e1430d
[vlc] / include / vout_synchro.h
1 /*****************************************************************************
2  * vout_synchro.h: frame-dropping structures
3  * Only used in libmpeg2 decoder at the moment
4  *****************************************************************************
5  * Copyright (C) 1999-2005 the VideoLAN team
6  * $Id$
7  *
8  * Authors: Christophe Massiot <massiot@via.ecp.fr>
9  *          Jean-Marc Dressler <polux@via.ecp.fr>
10  *          Stéphane Borel <stef@via.ecp.fr>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 /*****************************************************************************
28  * vout_synchro_t : timers for the video synchro
29  *****************************************************************************/
30 #define MAX_PIC_AVERAGE         8
31
32 /* Read the discussion on top of vout_synchro.c for more information. */
33 struct vout_synchro_t
34 {
35     VLC_COMMON_MEMBERS
36
37     vout_thread_t * p_vout;
38     int             i_frame_rate;
39     int             i_current_rate;
40     vlc_bool_t      b_no_skip;
41     vlc_bool_t      b_quiet;
42
43     /* date of the beginning of the decoding of the current picture */
44     mtime_t         decoding_start;
45
46     /* stream properties */
47     unsigned int    i_n_p, i_n_b;
48
49     /* decoding values */
50     mtime_t         p_tau[4];                  /* average decoding durations */
51     unsigned int    pi_meaningful[4];            /* number of durations read */
52
53     /* render_time filled by SynchroChoose() */
54     int i_render_time;
55
56     /* stream context */
57     int             i_nb_ref;                /* Number of reference pictures */
58     int             i_dec_nb_ref;      /* Number of reference pictures we'll *
59                                         * have if we decode the current pic  */
60     int             i_trash_nb_ref;    /* Number of reference pictures we'll *
61                                         * have if we trash the current pic   */
62     unsigned int    i_eta_p, i_eta_b;
63     mtime_t         backward_pts, current_pts;
64     int             i_current_period;   /* period to add to the next picture */
65     int             i_backward_period;  /* period to add after the next
66                                          * reference picture
67                                          * (backward_period * period / 2) */
68
69     /* statistics */
70     unsigned int    i_trashed_pic, i_not_chosen_pic, i_pic;
71 };
72
73 /* Pictures types */
74 #define I_CODING_TYPE           1
75 #define P_CODING_TYPE           2
76 #define B_CODING_TYPE           3
77 #define D_CODING_TYPE           4 /* MPEG-1 ONLY */
78 /* other values are reserved */
79
80 /* Structures */
81 #define TOP_FIELD               1
82 #define BOTTOM_FIELD            2
83 #define FRAME_STRUCTURE         3
84
85 /*****************************************************************************
86  * Prototypes
87  *****************************************************************************/
88 #define vout_SynchroInit(a,b) __vout_SynchroInit(VLC_OBJECT(a),b)
89 VLC_EXPORT( vout_synchro_t *, __vout_SynchroInit, ( vlc_object_t *, int ) );
90 VLC_EXPORT( void, vout_SynchroRelease,        ( vout_synchro_t * ) );
91 VLC_EXPORT( void, vout_SynchroReset,          ( vout_synchro_t * ) );
92 VLC_EXPORT( vlc_bool_t, vout_SynchroChoose,   ( vout_synchro_t *, int, int, vlc_bool_t ) );
93 VLC_EXPORT( void, vout_SynchroTrash,          ( vout_synchro_t * ) );
94 VLC_EXPORT( void, vout_SynchroDecode,         ( vout_synchro_t * ) );
95 VLC_EXPORT( void, vout_SynchroEnd,            ( vout_synchro_t *, int, vlc_bool_t ) );
96 VLC_EXPORT( mtime_t, vout_SynchroDate,        ( vout_synchro_t * ) );
97 VLC_EXPORT( void, vout_SynchroNewPicture,     ( vout_synchro_t *, int, int, mtime_t, mtime_t, int, vlc_bool_t ) );
98