/*****************************************************************************
* libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.
*****************************************************************************
- * Copyright (C) 1999-2001 the VideoLAN team
+ * Copyright (C) 1999-2001 VLC authors and VideoLAN
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
* 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
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+/*****************************************************************************
+ * NOTA BENE: this module requires the linking against a library which is
+ * known to require licensing under the GNU General Public License version 2
+ * (or later). Therefore, the result of compiling this module will normally
+ * be subject to the terms of that later license.
+ *****************************************************************************/
+
+
/*****************************************************************************
* Preamble
*****************************************************************************/
p_sys->i_gop_user_data = 0;
#if defined( __i386__ ) || defined( __x86_64__ )
- unsigned cpu = vlc_CPU();
- if( cpu & CPU_CAPABILITY_MMX )
+ if( vlc_CPU_MMX() )
i_accel |= MPEG2_ACCEL_X86_MMX;
- if( cpu & CPU_CAPABILITY_3DNOW )
+ if( vlc_CPU_3dNOW() )
i_accel |= MPEG2_ACCEL_X86_3DNOW;
- if( cpu & CPU_CAPABILITY_MMXEXT )
+ if( vlc_CPU_MMXEXT() )
i_accel |= MPEG2_ACCEL_X86_MMXEXT;
#elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
- if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC )
+ if( vlc_CPU_ALTIVEC() )
i_accel |= MPEG2_ACCEL_PPC_ALTIVEC;
#elif defined(__arm__)
i_accel |= MPEG2_ACCEL_ARM;
# endif
# ifdef MPEG2_ACCEL_ARM_NEON
- if( vlc_CPU() & CPU_CAPABILITY_NEON )
- i_accel |= MPEG2_ACCEL_ARM_NEON;
+ if( vlc_CPU_ARM_NEON() )
+ i_accel |= MPEG2_ACCEL_ARM_NEON;
# endif
/* TODO: sparc */
{
decoder_sys_t *p_sys = p_dec->p_sys;
mpeg2_state_t state;
- picture_t *p_pic;
block_t *p_block;
p_info->sequence->flags & SEQ_FLAG_LOW_DELAY );
- bool b_skip = false;
+ picture_t *p_pic;
+
if( !p_dec->b_pace_control && !p_sys->b_preroll &&
!(p_sys->b_slice_i
&& ((p_current->flags
& PIC_MASK_CODING_TYPE,
/*p_sys->p_vout->render_time*/ 0 /*FIXME*/,
p_info->sequence->flags & SEQ_FLAG_LOW_DELAY ) )
- {
- b_skip = true;
- }
-
- p_pic = NULL;
- if( !b_skip )
+ p_pic = NULL;
+ else
{
p_pic = DpbNewPicture( p_dec );
if( !p_pic )
}
}
- if( b_skip || !p_pic )
- {
- mpeg2_skip( p_sys->p_mpeg2dec, 1 );
- p_sys->b_skip = true;
+ mpeg2_skip( p_sys->p_mpeg2dec, p_pic == NULL );
+ p_sys->b_skip = p_pic == NULL;
+ if( p_pic != NULL )
+ decoder_SynchroDecode( p_sys->p_synchro );
+ else
decoder_SynchroTrash( p_sys->p_synchro );
- PutPicture( p_dec, NULL );
+ PutPicture( p_dec, p_pic );
- if( !b_skip )
- {
- block_Release( p_block );
- return NULL;
- }
- }
- else
- {
- mpeg2_skip( p_sys->p_mpeg2dec, 0 );
- p_sys->b_skip = false;
- decoder_SynchroDecode( p_sys->p_synchro );
-
- PutPicture( p_dec, p_pic );
- }
if( p_info->user_data_len > 2 || p_sys->i_gop_user_data > 2 )
{
p_sys->i_cc_pts = i_pts;
case STATE_INVALID_END:
case STATE_END:
case STATE_SLICE:
- p_pic = NULL;
+ {
+ picture_t *p_pic = NULL;
+
if( p_sys->p_info->display_fbuf &&
p_sys->p_info->display_fbuf->id )
{
DpbUnlinkPicture( p_dec, p_sys->p_info->discard_fbuf->id );
}
- /* For still frames */
- if( state == STATE_END && p_pic )
- p_pic->b_force = true;
-
if( p_pic )
{
+ if( state == STATE_END )
+ p_pic->b_force = true; /* For still frames */
+
/* Avoid frames with identical timestamps.
* Especially needed for still frames in DVD menus. */
if( p_sys->i_last_frame_pts == p_pic->date )
return p_pic;
}
break;
+ }
case STATE_INVALID:
{
if( p_sys->cc.i_data <= 0 )
return NULL;
- p_cc = block_New( p_dec, p_sys->cc.i_data);
+ p_cc = block_Alloc( p_sys->cc.i_data);
if( p_cc )
{
memcpy( p_cc->p_buffer, p_sys->cc.p_data, p_sys->cc.i_data );
if( !p->p_picture )
continue;
if( p->b_linked )
- decoder_UnlinkPicture( p_dec, p->p_picture );
+ picture_Release( p->p_picture );
if( !p->b_displayed )
- decoder_DeletePicture( p_dec, p->p_picture );
+ picture_Release( p->p_picture );
p->p_picture = NULL;
}
p->p_picture = GetNewPicture( p_dec );
if( p->p_picture )
{
- decoder_LinkPicture( p_dec, p->p_picture );
+ picture_Hold( p->p_picture );
p->b_linked = true;
p->b_displayed = false;
assert( p && p->b_linked );
- decoder_UnlinkPicture( p_dec, p->p_picture );
+ picture_Release( p->p_picture );
p->b_linked = false;
if( !p->b_displayed )
- decoder_DeletePicture( p_dec, p->p_picture );
+ picture_Release( p->p_picture );
p->p_picture = NULL;
}
/**