/*****************************************************************************
- * mash.c: Video decoder using openmash codec implementations
+ * mash.cpp: Video decoder using openmash codec implementations
*****************************************************************************
- * Copyright (C) 2004 the VideoLAN team
+ * Copyright (C) 2004 VLC authors and VideoLAN
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
- * 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.
*****************************************************************************/
/*****************************************************************************
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
-#include <vlc_vout.h>
#include <vlc_block.h>
#include <p64/p64.h>
(decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
return VLC_ENOMEM;
/* Misc init */
- p_sys->i_pts = 0;
+ p_sys->i_pts = VLC_TS_INVALID;
p_sys->b_inited = false;
p_sys->i_counter = 0;
p_block = *pp_block;
- if( !p_sys->i_pts && !p_block->i_pts && !p_block->i_dts )
+ if( p_sys->i_pts <= VLC_TS_INVALID && p_block->i_pts <= VLC_TS_INVALID &&
+ p_block->i_dts <= VLC_TS_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
block_Release( p_block );
/* Date management */
- if( p_block->i_pts > 0 || p_block->i_dts > 0 )
- {
- if( p_block->i_pts > 0 ) p_sys->i_pts = p_block->i_pts;
- else if( p_block->i_dts > 0 ) p_sys->i_pts = p_block->i_dts;
- }
+ if( p_block->i_pts > VLC_TS_INVALID )
+ p_sys->i_pts = p_block->i_pts;
+ else if( p_block->i_dts > VLC_TS_INVALID )
+ p_sys->i_pts = p_block->i_dts;
i_video_header = *(uint32_t*)p_block->p_buffer; /* yes, it is native endian */
sbit = i_video_header >> 29; /* start bit position */
mvdv = i_video_header & 0x1f; /* vertical motion vector data */
cc = p_block->i_buffer - 4;
msg_Dbg( p_dec, "packet size %d", cc );
-
+
/* Find out p_vdec->i_raw_size */
p_sys->p_decoder->decode( p_block->p_buffer + 4 /*bp?*/,
cc /*cc?*/,
{
msg_Dbg( p_dec, "video size is perhaps %dx%d", i_width,
i_height);
- vout_InitFormat( &p_dec->fmt_out.video, VLC_CODEC_I420,
- i_width, i_height,
- VOUT_ASPECT_FACTOR * i_width / i_height );
+ video_format_Setup( &p_dec->fmt_out.video, VLC_CODEC_I420,
+ i_width, i_height,
+ 1, 1 );
p_sys->b_inited = true;
}
p_pic = NULL;
p_sys->p_decoder->sync();
p_sys->i_counter = 0;
p_frame = p_sys->p_decoder->frame();
- vlc_memcpy( p_dec, p_pic->p[0].p_pixels, p_frame, i_width*i_height );
+ memcpy( p_dec, p_pic->p[0].p_pixels, p_frame, i_width*i_height );
p_frame += i_width * i_height;
- vlc_memcpy( p_dec, p_pic->p[1].p_pixels, p_frame, i_width*i_height/4 );
+ memcpy( p_dec, p_pic->p[1].p_pixels, p_frame, i_width*i_height/4 );
p_frame += i_width * i_height/4;
- vlc_memcpy( p_dec, p_pic->p[2].p_pixels, p_frame, i_width*i_height/4 );
+ memcpy( p_dec, p_pic->p[2].p_pixels, p_frame, i_width*i_height/4 );
p_pic->date = p_sys->i_pts;
}
block_Release( p_block);