1 /*****************************************************************************
2 * vpar_synchro.h : video parser blocks management
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: vpar_synchro.h,v 1.8 2001/03/06 15:16:42 massiot Exp $
7 * Author: Christophe Massiot <massiot@via.ecp.fr>
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.
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.
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 *****************************************************************************/
24 /*****************************************************************************
35 *****************************************************************************/
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
43 /* Read the discussion on top of vpar_synchro.c for more information. */
44 typedef struct video_synchro_s
46 /* synchro algorithm */
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;
55 /* stream properties */
56 unsigned int i_n_p, i_n_b;
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) */
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
70 * (backward_period * period / 2) */
73 unsigned int i_trashed_pic, i_not_chosen_pic, i_pic;
77 #define FIFO_INCREMENT( i_counter ) \
78 p_vpar->synchro.i_counter = \
79 (p_vpar->synchro.i_counter + 1) % MAX_DECODING_PIC;
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
89 /*****************************************************************************
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 );