1 /*****************************************************************************
2 * vpar_synchro.h : video parser blocks management
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
6 * Author: Christophe Massiot <massiot@via.ecp.fr>
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.
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.
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 *****************************************************************************/
23 /*****************************************************************************
34 *****************************************************************************/
36 /*****************************************************************************
37 * video_synchro_t and video_synchro_tab_s : timers for the video synchro
38 *****************************************************************************/
39 #define MAX_DECODING_PIC 16
40 #define MAX_PIC_AVERAGE 8
42 /* Read the discussion on top of vpar_synchro.c for more information. */
43 typedef struct video_synchro_s
45 /* synchro algorithm */
48 /* fifo containing decoding dates */
49 mtime_t p_date_fifo[MAX_DECODING_PIC];
50 int pi_coding_types[MAX_DECODING_PIC];
51 unsigned int i_start, i_end;
52 vlc_mutex_t fifo_lock;
54 /* stream properties */
55 unsigned int i_n_p, i_n_b;
58 mtime_t p_tau[4]; /* average decoding durations */
59 unsigned int pi_meaningful[4]; /* number of durations read */
60 /* and p_vout->render_time (read with p_vout->change_lock) */
63 unsigned int i_eta_p, i_eta_b;
64 boolean_t b_dropped_last; /* for special synchros below */
65 mtime_t backward_pts, current_pts;
68 unsigned int i_B_self, i_B_next, i_B_last, i_B_I;
72 #define FIFO_INCREMENT( i_counter ) \
73 p_vpar->synchro.i_counter = \
74 (p_vpar->synchro.i_counter + 1) % MAX_DECODING_PIC;
76 /* Synchro algorithms */
77 #define VPAR_SYNCHRO_DEFAULT 0
78 #define VPAR_SYNCHRO_I 1
79 #define VPAR_SYNCHRO_Iplus 2
80 #define VPAR_SYNCHRO_IP 3
81 #define VPAR_SYNCHRO_IPplus 4
82 #define VPAR_SYNCHRO_IPB 5
84 /*****************************************************************************
86 *****************************************************************************/
87 void vpar_SynchroInit ( struct vpar_thread_s * p_vpar );
88 boolean_t vpar_SynchroChoose ( struct vpar_thread_s * p_vpar,
89 int i_coding_type, int i_structure );
90 void vpar_SynchroTrash ( struct vpar_thread_s * p_vpar,
91 int i_coding_type, int i_structure );
92 void vpar_SynchroDecode ( struct vpar_thread_s * p_vpar,
93 int i_coding_type, int i_structure );
94 void vpar_SynchroEnd ( struct vpar_thread_s * p_vpar );
95 mtime_t vpar_SynchroDate ( struct vpar_thread_s * p_vpar );