/*****************************************************************************
* video_fifo.h : FIFO for the pool of video_decoders
- * (c)1999 VideoLAN
- *****************************************************************************
*****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
* Requires:
* "config.h"
* "common.h"
- * "vlc_thread.h"
+ * "threads.h"
* "video_parser.h"
* "undec_picture.h"
*****************************************************************************/
*****************************************************************************/
#ifdef VDEC_SMP
-/* ?? move to inline functions */
+/* FIXME: move to inline functions ??*/
#define VIDEO_FIFO_ISEMPTY( fifo ) ( (fifo).i_start == (fifo).i_end )
-#define VIDEO_FIFO_ISFULL( fifo ) ( ( ( (fifo).i_end + 1 - (fifo).i_start ) \
+#define VIDEO_FIFO_ISFULL( fifo ) ( ( ( (fifo).i_end + 1 - (fifo).i_start )\
& VFIFO_SIZE ) == 0 )
#define VIDEO_FIFO_START( fifo ) ( (fifo).buffer[ (fifo).i_start ] )
#define VIDEO_FIFO_INCSTART( fifo ) ( (fifo).i_start = ((fifo).i_start + 1) \
- & VFIFO_SIZE )
+ & VFIFO_SIZE )
#define VIDEO_FIFO_END( fifo ) ( (fifo).buffer[ (fifo).i_end ] )
#define VIDEO_FIFO_INCEND( fifo ) ( (fifo).i_end = ((fifo).i_end + 1) \
& VFIFO_SIZE )
return( NULL );
}
}
-
+
p_mb = VIDEO_FIFO_START( *p_fifo );
VIDEO_FIFO_INCSTART( *p_fifo );
vlc_mutex_unlock( &p_fifo->lock );
-
+
return( p_mb );
#else
/* Shouldn't normally be used without SMP. */
/* No more structures available. This should not happen ! */
intf_DbgMsg("vpar debug: macroblock list is empty, delaying\n");
vlc_mutex_unlock( &P_buffer.lock );
+ if( p_fifo->p_vpar->b_die )
+ {
+ return( NULL );
+ }
msleep(VPAR_OUTMEM_SLEEP);
vlc_mutex_lock( &P_buffer.lock );
}
#ifdef VDEC_SMP
/* Place picture in the video FIFO */
vlc_mutex_lock( &p_fifo->lock );
-
+
/* By construction, the video FIFO cannot be full */
VIDEO_FIFO_END( *p_fifo ) = p_mb;
VIDEO_FIFO_INCEND( *p_fifo );
vlc_mutex_unlock( &p_fifo->lock );
+#else
+ p_fifo->p_vpar->p_vout->vdec_DecodeMacroblock(
+ p_fifo->p_vpar->pp_vdec[0], p_mb );
#endif
- /* Shouldn't normally be used without SMP. */
}
/*****************************************************************************
p_mb->p_picture->i_deccount--;
b_finished = (p_mb->p_picture->i_deccount == 1);
vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
-//fprintf(stderr, "%d ", p_mb->p_picture->i_deccount);
+//intf_DbgMsg( "%d ", p_mb->p_picture->i_deccount );
/* Test if it was the last block of the picture */
if( b_finished )
{
-//fprintf(stderr, "Image decodee\n");
+//intf_DbgMsg( "Image decodee\n" );
/* Mark the picture to be displayed */
vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
-
+ vpar_SynchroEnd( p_fifo->p_vpar, 0 );
+
/* Unlink referenced pictures */
if( p_mb->p_forward != NULL )
{
- vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
+ vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
}
if( p_mb->p_backward != NULL )
{
vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
+ vpar_SynchroEnd( p_fifo->p_vpar, 0 );
}
#endif
}
/* Test if it was the last block of the picture */
if( b_finished )
{
-fprintf(stderr, "Image trashee\n");
+ intf_DbgMsg( "Image trashee\n" );
/* Mark the picture to be trashed */
vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
+ vpar_SynchroEnd( p_fifo->p_vpar, 1 );
/* Unlink referenced pictures */
if( p_mb->p_forward != NULL )
vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
- vpar_SynchroEnd( p_fifo->p_vpar );
+ vpar_SynchroEnd( p_fifo->p_vpar, 1 );
}
#endif
}