+ decoder_t *p_dec = (decoder_t*)p_this;
+ decoder_sys_t *p_sys;
+ uint32_t i_accel = 0;
+
+ if( p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','v') &&
+ p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','1') &&
+ /* Pinnacle hardware-mpeg1 */
+ p_dec->fmt_in.i_codec != VLC_FOURCC('P','I','M','1') &&
+ /* ATI Video */
+ p_dec->fmt_in.i_codec != VLC_FOURCC('V','C','R','2') &&
+ p_dec->fmt_in.i_codec != VLC_FOURCC('m','p','g','2') &&
+ p_dec->fmt_in.i_codec != VLC_FOURCC('h','d','v','2') )
+ {
+ return VLC_EGENERIC;
+ }
+
+ /* Allocate the memory needed to store the decoder's structure */
+ if( ( p_dec->p_sys = p_sys =
+ (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
+ {
+ msg_Err( p_dec, "out of memory" );
+ return VLC_EGENERIC;
+ }
+
+ /* Initialize the thread properties */
+ memset( p_sys, 0, sizeof(decoder_sys_t) );
+ p_sys->p_mpeg2dec = NULL;
+ p_sys->p_synchro = NULL;
+ p_sys->p_info = NULL;
+ p_sys->i_current_pts = 0;
+ p_sys->i_previous_pts = 0;
+ p_sys->i_current_dts = 0;
+ p_sys->i_previous_dts = 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;
+ p_sys->b_preroll = VLC_FALSE;
+
+#if defined( __i386__ ) || defined( __x86_64__ )
+ 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;
+ }