[MPlayer-dev-eng] [PATCH] Bluray stream support
Diego Biurrun
diego at biurrun.de
Wed Sep 16 10:20:15 CEST 2009
On Mon, Sep 14, 2009 at 11:50:53AM +0300, Jonathan Nell wrote:
> Refactored as per (most) suggestions. Still no real error checking or Doxy.
>
> --- stream/stream_bd.c (revision 0)
> +++ stream/stream_bd.c (revision 0)
> @@ -0,0 +1,254 @@
> +
> + pos = AV_RB32(buf);
> + if (pos < file_size) {
> + bd->uks.count = AV_RB16(&buf[pos]);
> + bd->uks.keys = calloc(bd->uks.count,sizeof(struct uk));
> +
> + a = av_malloc(av_aes_size);
> + av_aes_init(a, bd->vuk ,128 ,1);
> +
> + for (i = 0; i < bd->uks.count; i++) {
> + int key_pos = pos + i * 48 + 48;
> + if (key_pos + 16 <= file_size)
> + av_aes_crypt(a, bd->uks.keys[i].key, &buf[key_pos], 1, NULL, 1); // decrypt unit key
indentation
> + if ( (read_len = fread(buf, 1, len, bd->title_file)) == len) {
> + if (bd->pos % BD_UNIT_SIZE) {
> + // decrypt in place
> + av_aes_crypt(bd->aescbc, buf, buf, len / 16, bd->iv, 1);
indentation
> + // set up AES key from uk and seed
> + a = av_malloc(av_aes_size);
> + av_aes_init(a, bd->uks.keys[0].key, 128, 0);
> +
> + // perform encryption of first 16 bytes of unit (seed)
> + av_aes_crypt(a, enc_seed, buf, 1, NULL, 0);
> + av_free(a);
indentation
> + // perform xor
> + int i;
> + for(i = 0; i < 16; i++)
for (
> + s->sector_size = BD_UNIT_SIZE;
> + s->flags = STREAM_READ | STREAM_SEEK;
> + s->fill_buffer = bd_stream_fill_buffer;
> + s->seek = bd_stream_seek;
> + s->close = bd_stream_close;
> + s->start_pos = 0;
> + s->priv = bd;
> + s->type = STREAMTYPE_BD;
> + s->url = strdup("bd://");
align
> + bd->pos = 0;
> + bd->title = p->title;
> + bd->device = p->device;
align
I guess you need a new editor or need to fix yours....
Diego
More information about the MPlayer-dev-eng
mailing list