[MPlayer-dev-eng] simple Blu-ray playback [Patch]

Diego Biurrun diego at biurrun.de
Fri Jul 2 10:30:01 CEST 2010


On Fri, Jul 02, 2010 at 01:07:24AM +0200, Alexander Roalter wrote:
> 
> Attached is the patch for normal blu-ray playback when you have a
> working key database file for the Blu-ray. It does the automatic lookup
> and bails out when no key is found. No support for BD+ and titles that
> are not found in one piece on the BD (i.e. no playlist support).

Sorry for the probably very naive question, but I haven't followed the
Bluray discussion in any sort of detail:

Is no library support required for playing Bluray discs?


some small comments below..

> --- stream/stream_bd.c	(revision 0)
> +++ stream/stream_bd.c	(revision 0)
> @@ -0,0 +1,351 @@
> +
> +#include "libavutil/aes.h"
> +#include "libavutil/sha.h"
> +#include "libmpdemux/demuxer.h"
> +#include "libavutil/intreadwrite.h"
> +
> +#include "m_struct.h"
> +#include "m_option.h"
> +
> +#include "stream.h"

alphabetical order

> +const uint8_t BD_CBC_IV[] = 
> +{ 

{ on the same line

> +static int bd_stream_open(stream_t *s, int mode, void* opts, int* file_format);

Reorder the functions to avoid ugly forward declarations.

> +static int bd_stream_seek(stream_t *s, off_t pos)
> +{
> +    struct bd_priv *bd = s->priv;
> +
> +    // must seek to start of unit
> +    pos -= pos % BD_UNIT_SIZE;
> +    bd->pos = pos;
> +    s->pos = pos;

Align the =.

> +    if (file == 0) 
> +    {

if (!file) {

same below

> +        mp_msg(MSGT_OPEN, MSGL_ERR, "Cannot open file %s to get UK and DiscID\n", filename);

Please break such overly long lines where easily possible.

> +    if (!vukfound) 
> +    {

{ on the same line as the if

> +        bd->uks.count = AV_RB16(&buf[pos]);
> +        bd->uks.keys = calloc(bd->uks.count, sizeof(struct uk));

align

> +    if (p->device)
> +      bd->device = p->device;
> +    else if (dvd_device)
> +      bd->device = dvd_device;
> +    else
> +      bd->device = DEFAULT_BD_DEVICE;

4 spaces indentation please

> +    s->sector_size = BD_UNIT_SIZE;
> +    s->flags = STREAM_READ | MP_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 the =

> +    bd->pos = 0;
> +    bd->title = p->title;

align the =

> +    // get and decrypt unit keys
> +    if (!bd_get_uks(bd)) return STREAM_ERROR;

Place the return on the next line.

> +    if (bd->title_file == 0) return STREAM_ERROR;

ditto

Diego



More information about the MPlayer-dev-eng mailing list