/*****************************************************************************
* video_parser.h : video parser thread
- * (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"
* "mtime.h"
- * "vlc_thread.h"
+ * "threads.h"
* "input.h"
* "video.h"
* "video_output.h"
/*****************************************************************************
* vpar_thread_t: video parser thread descriptor
*****************************************************************************
- * ??
+ * XXX??
*****************************************************************************/
typedef struct vpar_thread_s
{
vlc_thread_t thread_id; /* id for thread functions */
/* Thread configuration */
- /* ?? */
- /*??*/
+ /* XXX?? */
// int *pi_status;
/* Input properties */
- decoder_fifo_t fifo; /* PES input fifo */
-
- /* The bit stream structure handles the PES stream at the bit level */
+ decoder_fifo_t * p_fifo; /* PES input fifo */
bit_stream_t bit_stream;
+ vdec_config_t * p_config;
+
/* Output properties */
vout_thread_t * p_vout; /* video output thread */
/* Structure to store the tables B14 & B15 (ISO/CEI 13818-2 B.4) */
dct_lookup_t ppl_dct_coef[2][16384];
-
+
#ifdef STATS
/* Statistics */
count_t c_loops; /* number of loops */
- count_t c_idle_loops; /* number of idle loops */
count_t c_sequences; /* number of sequences */
- count_t c_pictures; /* number of pictures read */
- count_t c_i_pictures; /* number of I pictures read */
- count_t c_p_pictures; /* number of P pictures read */
- count_t c_b_pictures; /* number of B pictures read */
- count_t c_decoded_pictures; /* number of pictures decoded */
- count_t c_decoded_i_pictures; /* number of I pictures decoded */
- count_t c_decoded_p_pictures; /* number of P pictures decoded */
- count_t c_decoded_b_pictures; /* number of B pictures decoded */
+ count_t pc_pictures[4]; /* number of (coding_type) pictures read */
+ count_t pc_decoded_pictures[4]; /* number of (coding_type)
+ * pictures decoded */
+ count_t pc_malformed_pictures[4]; /* number of pictures trashed
+ * during parsing */
#endif
} vpar_thread_t;
*****************************************************************************/
/* Thread management functions */
-vpar_thread_t * vpar_CreateThread ( /* video_cfg_t *p_cfg, */ input_thread_t *p_input /*,
- vout_thread_t *p_vout, int *pi_status */ );
-void vpar_DestroyThread ( vpar_thread_t *p_vpar /*, int *pi_status */ );
-
-/* Time management functions */
-/* ?? */
-
-/* Dynamic thread settings */
-/* ?? */
-
+vlc_thread_t vpar_CreateThread ( vdec_config_t * );
/*****************************************************************************
* NextStartCode : Find the next start code
*****************************************************************************/
-static __inline__ void NextStartCode( vpar_thread_t * p_vpar )
+static __inline__ void NextStartCode( bit_stream_t * p_bit_stream )
{
/* Re-align the buffer on an 8-bit boundary */
- RealignBits( &p_vpar->bit_stream );
+ RealignBits( p_bit_stream );
- while( ShowBits( &p_vpar->bit_stream, 24 ) != 0x01L && !p_vpar->b_die )
+ while( ShowBits( p_bit_stream, 24 ) != 0x01L
+ && !p_bit_stream->p_decoder_fifo->b_die )
{
- RemoveBits( &p_vpar->bit_stream, 8 );
+ RemoveBits( p_bit_stream, 8 );
}
}