]> git.sesse.net Git - vlc/blob - src/video_parser/vpar_synchro.c
Corrections de quelques petits bugs et surtout nouvelle synchro qui ne semble
[vlc] / src / video_parser / vpar_synchro.c
1 /*****************************************************************************
2  * vpar_motion.c : motion vectors parsing
3  * (c)1999 VideoLAN
4  *****************************************************************************/
5
6 /*****************************************************************************
7  * Preamble
8  *****************************************************************************/
9 #include <errno.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <unistd.h>
13 #include <string.h>
14 #include <sys/uio.h>
15
16 #include "config.h"
17 #include "common.h"
18 #include "mtime.h"
19 #include "vlc_thread.h"
20
21 #include "intf_msg.h"
22 #include "debug.h"                    /* ?? temporaire, requis par netlist.h */
23
24 #include "input.h"
25 #include "input_netlist.h"
26 #include "decoder_fifo.h"
27 #include "video.h"
28 #include "video_output.h"
29
30 #include "vdec_idct.h"
31 #include "video_decoder.h"
32 #include "vdec_motion.h"
33
34 #include "vpar_blocks.h"
35 #include "vpar_headers.h"
36 #include "vpar_synchro.h"
37 #include "video_parser.h"
38 #include "video_fifo.h"
39
40 #define MAX_COUNT 3
41
42 /*
43  * Local prototypes
44  */
45
46 #ifdef SAM_SYNCHRO
47 /*****************************************************************************
48  * vpar_SynchroUpdateTab : Update a mean table in the synchro structure
49  *****************************************************************************/
50 float vpar_SynchroUpdateTab( video_synchro_tab_t * tab, int count )
51 {
52         
53     tab->mean = ( tab->mean + MAX_COUNT * count ) / ( MAX_COUNT + 1 );
54     tab->deviation = ( tab->deviation + MAX_COUNT * abs (tab->mean - count) )
55                         / ( MAX_COUNT + 1 );
56
57     return tab->deviation;
58 }
59
60 /*****************************************************************************
61  * vpar_SynchroUpdateStructures : Update the synchro structures
62  *****************************************************************************/
63 void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
64                                    int i_coding_type, int dropped )
65 {
66     float candidate_deviation;
67     float optimal_deviation;
68     float predict;
69     mtime_t i_current_pts;
70     mtime_t i_delay;
71     mtime_t i_displaydate;
72     decoder_fifo_t * decoder_fifo = p_vpar->bit_stream.p_decoder_fifo;
73
74     /* interpolate the current _decode_ PTS */
75     i_current_pts = decoder_fifo->buffer[decoder_fifo->i_start]->b_has_pts ?
76                     decoder_fifo->buffer[decoder_fifo->i_start]->i_pts :
77                     0;
78     if( !i_current_pts )
79     {
80         i_current_pts = p_vpar->synchro.i_last_decode_pts
81                        + 1000000.0 / (1 + p_vpar->synchro.actual_fps);
82     }
83     p_vpar->synchro.i_last_decode_pts = i_current_pts;
84
85     /* see if the current image has a pts - if not, set to 0 */
86     p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].i_pts
87             = i_current_pts;
88
89     /* update display time */
90     i_displaydate = decoder_fifo->buffer[decoder_fifo->i_start]->b_has_pts ?
91                     decoder_fifo->buffer[decoder_fifo->i_start]->i_pts :
92                     0;
93     if( !i_displaydate || i_coding_type != I_CODING_TYPE )
94     {
95         if (!p_vpar->synchro.i_images_since_pts )
96             p_vpar->synchro.i_images_since_pts = 10;
97
98         i_displaydate = p_vpar->synchro.i_last_display_pts
99                        + 1000000.0 / (p_vpar->synchro.theorical_fps);
100         //fprintf (stderr, "  ");
101     }
102
103     decoder_fifo->buffer[decoder_fifo->i_start]->b_has_pts = 0;
104
105     /* else fprintf (stderr, "R ");
106     if (dropped) fprintf (stderr, "  "); else fprintf (stderr, "* ");
107     fprintf (stderr, "%i ", i_coding_type);
108     fprintf (stderr, "pts %lli delta %lli\n", i_displaydate, i_displaydate - p_vpar->synchro.i_last_display_pts); */
109
110     p_vpar->synchro.i_images_since_pts--;
111     p_vpar->synchro.i_last_display_pts = i_displaydate;
112
113
114
115     /* update structures */
116     switch(i_coding_type)
117     {
118         case P_CODING_TYPE:
119
120             p_vpar->synchro.current_p_count++;
121             if( !dropped ) p_vpar->synchro.nondropped_p_count++;
122             break;
123
124         case B_CODING_TYPE:
125             p_vpar->synchro.current_b_count++;
126             if( !dropped ) p_vpar->synchro.nondropped_b_count++;
127             break;
128
129         case I_CODING_TYPE:
130
131             /* update information about images we can decode */
132             if (i_current_pts != p_vpar->synchro.i_last_i_pts)
133             {
134                 if ( p_vpar->synchro.i_last_i_pts && i_current_pts != p_vpar->synchro.i_last_i_pts)
135                 {
136                     p_vpar->synchro.theorical_fps = (p_vpar->synchro.theorical_fps + 1000000.0 * (1 + p_vpar->synchro.current_b_count + p_vpar->synchro.current_p_count) / (i_current_pts - p_vpar->synchro.i_last_i_pts)) / 2;
137                 }
138                 p_vpar->synchro.i_last_i_pts = i_current_pts;
139             }
140
141             if( !dropped )
142             {
143                 if ( p_vpar->synchro.i_last_nondropped_i_pts && i_current_pts != p_vpar->synchro.i_last_nondropped_i_pts)
144                 {
145                     p_vpar->synchro.actual_fps = (p_vpar->synchro.actual_fps + 1000000.0 * (1 + p_vpar->synchro.nondropped_b_count + p_vpar->synchro.nondropped_p_count) / (i_current_pts - p_vpar->synchro.i_last_nondropped_i_pts)) / 2;
146                 }
147
148             }
149
150
151             /* update all the structures for P images */
152
153             /* period == 1 */
154             optimal_deviation = vpar_SynchroUpdateTab(
155                             &p_vpar->synchro.tab_p[0],
156                             p_vpar->synchro.current_p_count);
157             predict = p_vpar->synchro.tab_p[0].mean;
158
159             /* period == 2 */
160             candidate_deviation = vpar_SynchroUpdateTab(
161                             &p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)],
162                             p_vpar->synchro.current_p_count);
163             if (candidate_deviation < optimal_deviation)
164             {
165                 optimal_deviation = candidate_deviation;
166                 predict = p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)].mean;
167             }
168
169             /* period == 3 */
170             candidate_deviation = vpar_SynchroUpdateTab(
171                             &p_vpar->synchro.tab_p[3 + (p_vpar->synchro.modulo % 3)],
172                             p_vpar->synchro.current_p_count);
173             if (candidate_deviation < optimal_deviation)
174             {
175                 optimal_deviation = candidate_deviation;
176                 predict = p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo % 3)].mean;
177             }
178
179             p_vpar->synchro.p_count_predict = predict;
180             p_vpar->synchro.current_p_count = 0;
181
182
183             /* update all the structures for B images */
184
185             /* period == 1 */
186             optimal_deviation = vpar_SynchroUpdateTab(
187                             &p_vpar->synchro.tab_b[0],
188                             p_vpar->synchro.current_b_count);
189             predict = p_vpar->synchro.tab_b[0].mean;
190
191             /* period == 2 */
192             candidate_deviation = vpar_SynchroUpdateTab(
193                             &p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)],
194                             p_vpar->synchro.current_b_count);
195             if (candidate_deviation < optimal_deviation)
196             {
197                 optimal_deviation = candidate_deviation;
198                 predict = p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)].mean;
199             }
200
201             /* period == 3 */
202             candidate_deviation = vpar_SynchroUpdateTab(
203                             &p_vpar->synchro.tab_b[3 + (p_vpar->synchro.modulo % 3)],
204                             p_vpar->synchro.current_b_count);
205             if (candidate_deviation < optimal_deviation)
206             {
207                 optimal_deviation = candidate_deviation;
208                 predict = p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo % 3)].mean;
209             }
210
211             p_vpar->synchro.b_count_predict = predict;
212             p_vpar->synchro.current_b_count = 0;
213         
214             /* now we calculated all statistics, it's time to
215              * decide what we have the time to display
216              */
217             i_delay = i_current_pts - p_vpar->synchro.i_last_nondropped_i_pts;
218
219             p_vpar->synchro.can_display_i
220                 = ( p_vpar->synchro.i_mean_decode_time < i_delay );
221
222             p_vpar->synchro.can_display_p
223                     = ( p_vpar->synchro.i_mean_decode_time
224                     * (1 + p_vpar->synchro.p_count_predict) < i_delay );
225
226             if( !p_vpar->synchro.can_display_p )
227             {
228                 p_vpar->synchro.displayable_p
229                     = -1 + i_delay / p_vpar->synchro.i_mean_decode_time;
230                 if( p_vpar->synchro.displayable_p < 0 )
231                     p_vpar->synchro.displayable_p = 0;
232             }
233             else
234                 p_vpar->synchro.displayable_p = 0;
235
236             if( p_vpar->synchro.can_display_p
237                 && !(p_vpar->synchro.can_display_b
238                     = ( p_vpar->synchro.i_mean_decode_time
239                     * (1 + p_vpar->synchro.b_count_predict
240                         + p_vpar->synchro.p_count_predict)) < i_delay) )
241             {
242                 p_vpar->synchro.displayable_b
243                     = -2.0 + i_delay / p_vpar->synchro.i_mean_decode_time
244                         - p_vpar->synchro.can_display_p;
245             }
246             else
247                 p_vpar->synchro.displayable_b = 0;
248
249 #if 0
250             fprintf( stderr,
251                 "I %i  P %i (%f)  B %i (%f)\n",
252                 p_vpar->synchro.can_display_i,
253                 p_vpar->synchro.can_display_p,
254                 p_vpar->synchro.displayable_p,
255                 p_vpar->synchro.can_display_b,
256                 p_vpar->synchro.displayable_b );
257 #endif
258
259             /* update some values */
260             if( !dropped )
261             {
262                 p_vpar->synchro.i_last_nondropped_i_pts = i_current_pts;
263                 p_vpar->synchro.nondropped_p_count = 0;
264                 p_vpar->synchro.nondropped_b_count = 0;
265             }
266
267             break;
268
269     }
270
271     p_vpar->synchro.modulo++;
272
273 }
274
275 /*****************************************************************************
276  * vpar_SynchroChoose : Decide whether we will decode a picture or not
277  *****************************************************************************/
278 boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
279                               int i_structure )
280 {
281     mtime_t i_delay = p_vpar->synchro.i_last_decode_pts - mdate();
282
283     switch( i_coding_type )
284     {
285         case I_CODING_TYPE:
286
287             return( p_vpar->synchro.can_display_i );
288
289         case P_CODING_TYPE:
290
291             if( p_vpar->synchro.can_display_p )
292                 return( 1 );
293
294             if( p_vpar->synchro.displayable_p * i_delay
295                 < p_vpar->synchro.i_mean_decode_time )
296             {
297                 //fprintf( stderr, "trashed a P\n");
298                 return( 0 );
299             }
300
301             p_vpar->synchro.displayable_p--;
302             return( 1 );
303
304         case B_CODING_TYPE:
305
306             if( p_vpar->synchro.can_display_b )
307                 return( 1 );
308
309             /* modulo & 0x3 is here to add some randomness */
310             if( i_delay < (1 + (p_vpar->synchro.modulo & 0x3))
311                 * p_vpar->synchro.i_mean_decode_time )
312             {
313                 //fprintf( stderr, "trashed a B\n");
314                 return( 0 );
315             }
316
317             if( p_vpar->synchro.displayable_b <= 0 )
318                 return( 0 );
319
320             p_vpar->synchro.displayable_b--;
321             return( 1 );
322     }
323
324     return( 0 );
325
326 }
327
328 /*****************************************************************************
329  * vpar_SynchroTrash : Update timers when we trash a picture
330  *****************************************************************************/
331 void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
332                         int i_structure )
333 {
334     vpar_SynchroUpdateStructures (p_vpar, i_coding_type, 1);
335
336 }
337
338 /*****************************************************************************
339  * vpar_SynchroDecode : Update timers when we decide to decode a picture
340  *****************************************************************************/
341 void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
342                             int i_structure )
343 {
344     vpar_SynchroUpdateStructures (p_vpar, i_coding_type, 0);
345
346     p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].i_decode_date = mdate();
347     p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].i_image_type
348         = i_coding_type;
349
350     p_vpar->synchro.i_fifo_stop = (p_vpar->synchro.i_fifo_stop + 1) & 0xf;
351
352 }
353
354 /*****************************************************************************
355  * vpar_SynchroEnd : Called when the image is totally decoded
356  *****************************************************************************/
357 void vpar_SynchroEnd( vpar_thread_t * p_vpar )
358 {
359     mtime_t i_decode_time;
360
361     i_decode_time = (mdate() -
362             p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_decode_date)
363         / ( (p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start) & 0x0f);
364
365     p_vpar->synchro.i_mean_decode_time =
366         ( 7 * p_vpar->synchro.i_mean_decode_time + i_decode_time ) / 8;
367
368     /* fprintf (stderr,
369         "decoding time was %lli\n",
370         p_vpar->synchro.i_mean_decode_time); */
371
372     p_vpar->synchro.i_fifo_start = (p_vpar->synchro.i_fifo_start + 1) & 0xf;
373
374 }
375
376 /*****************************************************************************
377  * vpar_SynchroDate : When an image has been decoded, ask for its date
378  *****************************************************************************/
379 mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
380 {
381     mtime_t i_displaydate = p_vpar->synchro.i_last_display_pts;
382
383 #if 0
384     static mtime_t i_delta = 0;
385
386     fprintf( stderr,
387         "displaying type %i with delay %lli and delta %lli\n",
388         p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type,
389         i_displaydate - mdate(),
390         i_displaydate - i_delta );
391
392     fprintf (stderr,
393         "theorical fps: %f - actual fps: %f \n",
394         p_vpar->synchro.theorical_fps, p_vpar->synchro.actual_fps );
395
396     i_delta = i_displaydate;
397 #endif
398
399     return i_displaydate;
400 }
401
402 #endif
403
404 #ifdef MEUUH_SYNCHRO
405
406 /* synchro a deux balles backportee du decodeur de reference. NE MARCHE PAS
407 AVEC LES IMAGES MONOTRAMES */
408
409 boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
410                               int i_structure )
411 {
412     switch (i_coding_type)
413     {
414     case B_CODING_TYPE:
415         if ((p_vpar->synchro.kludge_level <= p_vpar->synchro.kludge_nbp))
416         {
417             p_vpar->synchro.kludge_b++;
418             return( 0 );
419         }
420         if (p_vpar->synchro.kludge_b %
421              (p_vpar->synchro.kludge_nbb /
422                 (p_vpar->synchro.kludge_level - p_vpar->synchro.kludge_nbp)))
423         {
424             p_vpar->synchro.kludge_b++;
425             return( 0 );
426         }
427         p_vpar->synchro.kludge_b++;
428         return( 1 );
429
430     case P_CODING_TYPE:
431         if (p_vpar->synchro.kludge_p++ >= p_vpar->synchro.kludge_level)
432         {
433             return( 0 );
434         }
435         return( 1 );
436
437     default:
438         return( 1 );
439     }
440 }
441
442 void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
443                         int i_structure )
444 {
445     if (DECODER_FIFO_START(p_vpar->fifo)->b_has_pts && i_coding_type == I_CODING_TYPE)
446     {
447         p_vpar->synchro.kludge_nbframes = 0;
448         p_vpar->synchro.kludge_date = DECODER_FIFO_START(p_vpar->fifo)->i_pts;
449     }
450     else
451         p_vpar->synchro.kludge_nbframes++;
452     DECODER_FIFO_START(p_vpar->fifo)->b_has_pts = 0;
453 }
454
455 void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
456                             int i_structure )
457 {
458     if (DECODER_FIFO_START(p_vpar->fifo)->b_has_pts && i_coding_type == I_CODING_TYPE)
459     {
460         p_vpar->synchro.kludge_nbframes = 0;
461         p_vpar->synchro.kludge_date = DECODER_FIFO_START(p_vpar->fifo)->i_pts;
462         DECODER_FIFO_START(p_vpar->fifo)->b_has_pts = 0;
463     }
464     else
465         p_vpar->synchro.kludge_nbframes++;
466 }
467
468 mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
469 {
470     return( p_vpar->synchro.kludge_date
471             + p_vpar->synchro.kludge_nbframes*1000000/(p_vpar->sequence.r_frame_rate ) );
472 }
473
474 void vpar_SynchroEnd( vpar_thread_t * p_vpar )
475 {
476 }
477
478 void vpar_SynchroKludge( vpar_thread_t * p_vpar, mtime_t date )
479 {
480     mtime_t     show_date;
481     int         temp = p_vpar->synchro.kludge_level;
482
483     p_vpar->synchro.kludge_nbp = p_vpar->synchro.kludge_p ? p_vpar->synchro.kludge_p : 5;
484     p_vpar->synchro.kludge_nbb = p_vpar->synchro.kludge_b ? p_vpar->synchro.kludge_b : 6;
485     show_date = date - mdate();
486     p_vpar->synchro.kludge_p = 0;
487     p_vpar->synchro.kludge_b = 0;
488
489     if (show_date < (SYNC_DELAY - SYNC_TOLERATE) && show_date <= p_vpar->synchro.kludge_prevdate)
490     {
491         p_vpar->synchro.kludge_level--;
492         if (p_vpar->synchro.kludge_level < 0)
493             p_vpar->synchro.kludge_level = 0;
494         else if (p_vpar->synchro.kludge_level >
495                      p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb)
496             p_vpar->synchro.kludge_level = p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb;
497 #ifdef DEBUG
498         if (temp != p_vpar->synchro.kludge_level)
499             intf_DbgMsg("vdec debug: Level changed from %d to %d (%Ld)\n",
500                         temp, p_vpar->synchro.kludge_level, show_date );
501 #endif
502     }
503     else if (show_date > (SYNC_DELAY + SYNC_TOLERATE) && show_date >= p_vpar->synchro.kludge_prevdate)
504     {
505         p_vpar->synchro.kludge_level++;
506         if (p_vpar->synchro.kludge_level > p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb)
507             p_vpar->synchro.kludge_level = p_vpar->synchro.kludge_nbp + p_vpar->synchro.kludge_nbb;
508 #ifdef DEBUG
509         if (temp != p_vpar->synchro.kludge_level)
510             intf_DbgMsg("vdec debug: Level changed from %d to %d (%Ld)\n",
511                         temp, p_vpar->synchro.kludge_level, show_date );
512 #endif
513     }
514
515     p_vpar->synchro.kludge_prevdate = show_date;
516     if ((p_vpar->synchro.kludge_level - p_vpar->synchro.kludge_nbp) > p_vpar->synchro.kludge_nbb)
517         p_vpar->synchro.kludge_level = p_vpar->synchro.kludge_nbb + p_vpar->synchro.kludge_nbp;
518 }
519
520 #endif
521
522
523 #ifdef POLUX_SYNCHRO
524
525 void vpar_SynchroSetCurrentDate( vpar_thread_t * p_vpar, int i_coding_type )
526 {
527     pes_packet_t * p_pes = 
528         p_vpar->bit_stream.p_decoder_fifo->buffer[p_vpar->bit_stream.p_decoder_fifo->i_start]; 
529
530     
531     switch( i_coding_type )
532     {
533     case B_CODING_TYPE:
534         if( p_pes->b_has_pts )
535         {
536             if( p_pes->i_pts < p_vpar->synchro.i_current_frame_date )
537             {
538                 fprintf( stderr, "vpar warning: pts_date < current_date\n" );
539             }
540             p_vpar->synchro.i_current_frame_date = p_pes->i_pts;
541             p_pes->b_has_pts = 0;
542         }
543         else
544         {
545             p_vpar->synchro.i_current_frame_date += 1000000/(1+p_vpar->sequence.r_frame_rate);
546         }
547         break;
548         
549     default:
550
551         if( p_vpar->synchro.i_backward_frame_date == 0 )
552         {
553             p_vpar->synchro.i_current_frame_date += 1000000/(1+p_vpar->sequence.r_frame_rate);
554         }
555         else
556         {
557             if( p_vpar->synchro.i_backward_frame_date < p_vpar->synchro.i_current_frame_date )
558             {
559                 fprintf( stderr, "vpar warning: backward_date < current_date (%Ld)\n",
560                          p_vpar->synchro.i_backward_frame_date - p_vpar->synchro.i_current_frame_date );
561             }
562             p_vpar->synchro.i_current_frame_date = p_vpar->synchro.i_backward_frame_date;
563             p_vpar->synchro.i_backward_frame_date = 0;
564         }
565
566         if( p_pes->b_has_pts )
567         {
568             p_vpar->synchro.i_backward_frame_date = p_pes->i_pts;
569             p_pes->b_has_pts = 0;
570         }
571        break;
572     }
573 }
574
575 boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
576                               int i_structure )
577 {
578     boolean_t b_result = 1;
579     int i_synchro_level = p_vpar->p_vout->i_synchro_level;
580     
581     vpar_SynchroSetCurrentDate( p_vpar, i_coding_type );
582
583     /* 
584      * The synchro level is updated by the video input (see SynchroLevelUpdate)
585      * so we just use the synchro_level to decide which frame to trash
586      */
587     
588     switch( i_coding_type )
589     {
590     case I_CODING_TYPE:
591        if( p_vpar->synchro.i_i_count != 0 )
592         {
593             p_vpar->synchro.i_p_nb = p_vpar->synchro.i_p_count;
594             p_vpar->synchro.i_b_nb = p_vpar->synchro.i_b_count;
595         }
596         p_vpar->synchro.i_p_count = p_vpar->synchro.i_b_count = 0;
597         p_vpar->synchro.i_b_trasher = p_vpar->synchro.i_b_nb / 2;
598         p_vpar->synchro.i_i_count++;
599         break;
600
601     case P_CODING_TYPE:
602         p_vpar->synchro.i_p_count++;
603         if( p_vpar->synchro.i_p_count > i_synchro_level )
604         {
605             b_result = 0;
606         }
607         break;
608         
609     case B_CODING_TYPE:
610         p_vpar->synchro.i_b_count++;
611         if( p_vpar->synchro.i_p_nb >= i_synchro_level )
612         {
613             /* We must trash all the B */
614             b_result = 0;
615         }
616         else
617         {
618             /* We use the brensenham algorithm to decide which B to trash */
619             p_vpar->synchro.i_b_trasher +=
620                 p_vpar->synchro.i_b_nb - (i_synchro_level-p_vpar->synchro.i_p_nb);
621             if( p_vpar->synchro.i_b_trasher >= p_vpar->synchro.i_b_nb )
622             {
623                 b_result = 0;
624                 p_vpar->synchro.i_b_trasher -= p_vpar->synchro.i_b_nb;
625             }
626         }
627         break;
628     }
629    
630     return( b_result );
631 }
632
633 void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
634                         int i_structure )
635 {
636     vpar_SynchroChoose( p_vpar, i_coding_type, i_structure );
637 }
638
639 void vpar_SynchroUpdateLevel()
640 {
641     //vlc_mutex_lock( &level_lock );
642     //vlc_mutex_unlock( &level_lock );
643 }
644
645 mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
646 {
647 //fprintf( stderr, "delay : %Ld\n" , mdate() - p_vpar->synchro.i_current_frame_date );
648     return( p_vpar->synchro.i_current_frame_date );
649 }
650
651 /* functions with no use */
652
653 void vpar_SynchroEnd( vpar_thread_t * p_vpar )
654 {
655 }
656
657 void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
658                             int i_structure )
659 {
660 }
661
662 #endif