Commit be7cf826 authored by Antoine Cellerier's avatar Antoine Cellerier Committed by Jean-Paul Saman

Fix video decoding for most samples.

Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent 50044fd9
......@@ -281,7 +281,8 @@ static picture_t *DecodeVideoBlock( decoder_t *p_dec, block_t **pp_block )
}
}
if( VIDDEC_control( p_sys->d, XDM_GETSTATUS, &dparams, &status ) != VIDDEC_EOK )
if( VIDDEC_control( p_sys->d, XDM_GETSTATUS, &dparams, &status )
!= VIDDEC_EOK )
{
msg_Err( p_dec, "Failed to get decoder status" );
goto error;
......@@ -289,7 +290,8 @@ static picture_t *DecodeVideoBlock( decoder_t *p_dec, block_t **pp_block )
/* Setup input arguments */
in_args.size = sizeof( in_args );
in_args.numBytes = __MIN( p_block->i_buffer, p_sys->in.bufSizes[0] );
in_args.numBytes = __MIN( p_dec->fmt_in.i_extra + p_block->i_buffer,
p_sys->in.bufSizes[0] );
in_args.inputID = 0; /* FIXME? */
/* Setup input buffer */
......@@ -297,8 +299,17 @@ static picture_t *DecodeVideoBlock( decoder_t *p_dec, block_t **pp_block )
if( p_block->i_buffer > p_sys->in.bufSizes[0] )
msg_Dbg( p_dec, "Woah! Not enough room to store the whole block" );
#endif
memcpy( p_sys->in.bufs[0], p_block->p_buffer, in_args.numBytes );
msg_Warn( p_dec, "Sending %d bytes", (int)in_args.numBytes );
if( p_dec->fmt_in.i_extra > 0 )
{
memcpy( p_sys->in.bufs[0], p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra );
}
memcpy( p_sys->in.bufs[0] + p_dec->fmt_in.i_extra, p_block->p_buffer,
in_args.numBytes - p_dec->fmt_in.i_extra );
#ifdef DEBUG_DAVINCI
msg_Dbg( p_dec, "Sending %d + %d bytes", p_dec->fmt_in.i_extra,
(int)in_args.numBytes - p_dec->fmt_in.i_extra );
#endif
#if 0
/* This obviously doesn't work (at least for mpeg2 video */
......@@ -352,17 +363,24 @@ static picture_t *DecodeVideoBlock( decoder_t *p_dec, block_t **pp_block )
}
#endif
#ifdef DEBUG_DAVINCI
msg_Info( p_dec, "Frame info: " );
msg_Info( p_dec, " Width: %d", (int)status.outputWidth );
msg_Info( p_dec, " Height: %d", (int)status.outputHeight );
msg_Info( p_dec, " Content type: %s", status.contentType == IVIDEO_PROGRESSIVE ? "progressive" : status.contentType == IVIDEO_INTERLACED ? "interlaced" : "not available" );
msg_Info( p_dec, " Content type: %s",
status.contentType == IVIDEO_PROGRESSIVE ? "progressive" :
status.contentType == IVIDEO_INTERLACED ? "interlaced" :
"not available" );
#endif
/* Setup output arguemnts */
out_args.size = sizeof( out_args );
/* That was easy :p */
/* Decode the video */
#ifdef DEBUG_DAVINCI
printf("%s %s %d\n", __FILE__, __func__, __LINE__);
#endif
if( ( i = VIDDEC_process( p_sys->d, &p_sys->in, &p_sys->out, &in_args, &out_args ) )
!= VIDDEC_EOK )
{
......@@ -371,10 +389,8 @@ static picture_t *DecodeVideoBlock( decoder_t *p_dec, block_t **pp_block )
PrintExtendedError( p_dec, out_args.extendedError );
goto error;
}
printf("%s %s %d\n", __FILE__, __func__, __LINE__);
#ifdef DEBUG_DAVINCI
msg_Info( p_dec, "%s %d", __func__, __LINE__ );
printf("%s %s %d\n", __FILE__, __func__, __LINE__);
#endif
if( VIDDEC_control( p_sys->d, XDM_GETSTATUS, &dparams, &status ) != VIDDEC_EOK )
......@@ -391,12 +407,13 @@ static picture_t *DecodeVideoBlock( decoder_t *p_dec, block_t **pp_block )
msg_Info( p_dec, " Bytes consumed: %d", (int)out_args.bytesConsumed );
#endif
p_block->p_buffer += out_args.bytesConsumed;
p_block->i_buffer -= out_args.bytesConsumed;
p_block->p_buffer += out_args.bytesConsumed - p_dec->fmt_in.i_extra;
p_block->i_buffer -= out_args.bytesConsumed - p_dec->fmt_in.i_extra;
p_dec->fmt_out.video.i_width = status.outputWidth;
p_dec->fmt_out.video.i_height = status.outputHeight;
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * status.outputWidth / status.outputHeight; /* FIXME */
p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * status.outputWidth
/ status.outputHeight; /* FIXME */
/* Get a new picture */
p_pic = p_dec->pf_vout_buffer_new( p_dec );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment