+ /* Initialize the thread properties */
+ memset( p_sys, 0, sizeof(decoder_sys_t) );
+ p_sys->p_pes = NULL;
+ p_sys->p_mpeg2dec = NULL;
+ p_sys->p_synchro = NULL;
+ p_sys->p_info = NULL;
+ p_sys->i_pts = mdate() + DEFAULT_PTS_DELAY;
+ p_sys->i_current_pts = 0;
+ p_sys->i_previous_pts = 0;
+ p_sys->p_picture_to_destroy = NULL;
+ p_sys->b_garbage_pic = 0;
+ p_sys->b_slice_i = 0;
+ p_sys->b_skip = 0;
+
+#if defined( __i386__ )
+ if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_MMX )
+ {
+ i_accel |= MPEG2_ACCEL_X86_MMX;
+ }
+
+ if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_3DNOW )
+ {
+ i_accel |= MPEG2_ACCEL_X86_3DNOW;
+ }
+
+ if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_MMXEXT )
+ {
+ i_accel |= MPEG2_ACCEL_X86_MMXEXT;
+ }
+
+#elif defined( __powerpc__ ) || defined( SYS_DARWIN )
+ if( p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_ALTIVEC )
+ {
+ i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
+ }
+
+#else
+ /* If we do not know this CPU, trust libmpeg2's feature detection */
+ i_accel = MPEG2_ACCEL_DETECT;
+
+#endif
+
+ /* Set CPU acceleration features */
+ mpeg2_accel( i_accel );
+
+ /* Initialize decoder */
+ p_sys->p_mpeg2dec = mpeg2_init();
+ if( p_sys->p_mpeg2dec == NULL)
+ {
+ msg_Err( p_dec, "mpeg2_init() failed" );
+ free( p_sys );
+ return VLC_EGENERIC;
+ }
+
+ p_sys->p_info = mpeg2_info( p_sys->p_mpeg2dec );
+
+ p_dec->pf_decode_video = DecodeBlock;
+