]> git.sesse.net Git - vlc/blob - include/vpar_synchro.h
* Fixed a few warnings with gcc 3.0.
[vlc] / include / vpar_synchro.h
1 /*****************************************************************************
2  * vpar_synchro.h : video parser blocks management
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: vpar_synchro.h,v 1.33 2001/05/06 04:32:02 sam Exp $
6  *
7  * Author: Christophe Massiot <massiot@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Requires:
26  *  "config.h"
27  *  "common.h"
28  *  "mtime.h"
29  *  "threads.h"
30  *  "input.h"
31  *  "video.h"
32  *  "video_output.h"
33  *  "decoder_fifo.h"
34  *  "video_fifo.h"
35  *****************************************************************************/
36
37 /*****************************************************************************
38  * video_synchro_t and video_synchro_tab_s : timers for the video synchro
39  *****************************************************************************/
40 #define MAX_DECODING_PIC        16
41 #define MAX_PIC_AVERAGE         8
42
43 /* Read the discussion on top of vpar_synchro.c for more information. */
44 typedef struct video_synchro_s
45 {
46     /* synchro algorithm */
47     int             i_type;
48
49     /* fifo containing decoding dates */
50     mtime_t         p_date_fifo[MAX_DECODING_PIC];
51     int             pi_coding_types[MAX_DECODING_PIC];
52     unsigned int    i_start, i_end;
53     vlc_mutex_t     fifo_lock;
54
55     /* stream properties */
56     unsigned int    i_n_p, i_n_b;
57
58     /* decoding values */
59     mtime_t         p_tau[4];                  /* average decoding durations */
60     unsigned int    pi_meaningful[4];            /* number of durations read */
61     /* and p_vout->render_time (read with p_vout->change_lock) */
62
63     /* stream context */
64     unsigned int    i_eta_p, i_eta_b;
65     boolean_t       b_dropped_last;            /* for special synchros below */
66     mtime_t         backward_pts, current_pts;
67     int             i_current_period;   /* period to add to the next picture */
68     int             i_backward_period;  /* period to add after the next
69                                          * reference picture
70                                          * (backward_period * period / 2) */
71
72 #ifdef STATS
73     unsigned int    i_trashed_pic, i_not_chosen_pic, i_pic;
74 #endif
75 } video_synchro_t;
76
77 #define FIFO_INCREMENT( i_counter )                                         \
78     p_vpar->synchro.i_counter =                                             \
79         (p_vpar->synchro.i_counter + 1) % MAX_DECODING_PIC;
80
81 /* Synchro algorithms */
82 #define VPAR_SYNCHRO_DEFAULT    0
83 #define VPAR_SYNCHRO_I          1
84 #define VPAR_SYNCHRO_Iplus      2
85 #define VPAR_SYNCHRO_IP         3
86 #define VPAR_SYNCHRO_IPplus     4
87 #define VPAR_SYNCHRO_IPB        5
88
89 /*****************************************************************************
90  * Prototypes
91  *****************************************************************************/
92 void vpar_SynchroInit           ( struct vpar_thread_s * p_vpar );
93 boolean_t vpar_SynchroChoose    ( struct vpar_thread_s * p_vpar,
94                                   int i_coding_type, int i_structure );
95 void vpar_SynchroTrash          ( struct vpar_thread_s * p_vpar,
96                                   int i_coding_type, int i_structure );
97 void vpar_SynchroDecode         ( struct vpar_thread_s * p_vpar,
98                                   int i_coding_type, int i_structure );
99 void vpar_SynchroEnd            ( struct vpar_thread_s * p_vpar, int i_garbage );
100 mtime_t vpar_SynchroDate        ( struct vpar_thread_s * p_vpar );
101 void vpar_SynchroNewPicture( struct vpar_thread_s * p_vpar, int i_coding_type,
102                              int i_repeat_field );