[MPlayer-dev-eng] [PATCH] Initial Bluray support

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Sep 13 21:27:55 CEST 2009


On Sun, Sep 13, 2009 at 08:02:17PM +0100, Jonathan Nell wrote:
> >> +static int bd_stream_fill_buffer(stream_t *s, char *buf, int len)
> >> +{
> >> +    bd_priv_t *bd = s->priv;
> >> +
> >> +    if(bd->cur_unit_buf_part == 0)
> >> +        bd_read_unit(bd, bd->unit_buf);
> >> +
> >> +    memcpy(buf, &bd->unit_buf[len*bd->cur_unit_buf_part], 2048);
> >
> > What? What is len*bd->cur_unit_buf_part supposed to calculate?
> > Also at least as long as you assume that buf, pos and len are divisible
> > by 16 it should be easy enough to decrypt directly into buf.
> > Or to make it simpler just assume a multiple of 2048 since that's what
> > the code currently does anyway (as well as the DVD code).
> 
> Decrypting into buf might be neater but is inefficient as the same
> unit will then be decrypted three times. The trade off is an extra 6k
> in mem...

No idea how you thought to do it, but it certainly is not what I meant:
If at start of a block, read the unencrypted 16 bytes, generate new key,
initialize IV etc.
If not at a start of the block read requested number of bytes or till the
end of it (whichever is less) and decrypt in-place with the stored aes context
and iv.



More information about the MPlayer-dev-eng mailing list