p_sys->ti.frame_width, p_sys->ti.frame_height,
p_sys->ti.offset_x, p_sys->ti.offset_y );
+ /* Sanity check that seems necessary for some corrupted files */
+ if( p_sys->ti.width < p_sys->ti.frame_width ||
+ p_sys->ti.height < p_sys->ti.frame_height )
+ {
+ msg_Warn( p_dec, "trying to correct invalid theora header "
+ "(frame size (%dx%d) is smaller than frame content (%d,%d))",
+ p_sys->ti.width, p_sys->ti.height,
+ p_sys->ti.frame_width, p_sys->ti.frame_height );
+
+ if( p_sys->ti.width < p_sys->ti.frame_width )
+ p_sys->ti.width = p_sys->ti.frame_width;
+ if( p_sys->ti.height < p_sys->ti.frame_height )
+ p_sys->ti.height = p_sys->ti.frame_height;
+ }
+
/* The next packet in order is the comments header */
oggpacket.b_o_s = 0;
oggpacket.bytes = *(p_extra++) << 8;
block_t *p_block = *pp_block;
void *p_buf;
- if( ( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY ) != 0 )
+ if( ( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) ) != 0 )
{
/* Don't send the the first packet after a discontinuity to
* theora_decode, otherwise we get purple/green display artifacts
theora_decode_packetin( &p_sys->td, p_oggpacket );
- if( theora_packet_iskeyframe( p_oggpacket ) == 1 )
+ /* Check for keyframe */
+ if( !(p_oggpacket->packet[0] & 0x80) /* data packet */ &&
+ !(p_oggpacket->packet[0] & 0x40) /* intra frame */ )
p_sys->b_decoded_first_keyframe = VLC_TRUE;
/* If we haven't seen a single keyframe yet, don't let Theora decode
for( i_line = 0; i_line < p_pic->p[i_plane].i_visible_lines; i_line++ )
{
- p_dec->p_vlc->pf_memcpy( p_dst, p_src, i_width );
+ p_dec->p_vlc->pf_memcpy( p_dst, p_src + i_src_xoffset,
+ i_plane ? yuv->uv_width : yuv->y_width );
p_src += i_src_stride;
p_dst += i_dst_stride;
}