[FFmpeg-devel] [PATCH] BluRay protocol using libbluray
Petri Hintukainen
phintuka at users.sourceforge.net
Mon Feb 20 09:24:08 CET 2012
Michael Niedermayer wrote:
> On Mon, Feb 13, 2012 at 01:22:02PM +0200, Petri Hintukainen wrote:
> [...]
> > + BlurayContext *bd = (BlurayContext *)h->priv_data;
>
> useless cast
>
>
> > + const BLURAY_DISC_INFO *disc_info;
> > +
> > + disc_info = bd_get_disc_info(bd->bd);
> > + if (!disc_info) {
> > + av_log(h, AV_LOG_ERROR, "bd_get_disc_info() failed\n");
> > + return 0;
>
> within ffmpeg negative values are generally used as errors
> for consistency and avoiding confusing its probably best to do this
> here too
>
>
> [...]
> > +static int bluray_open(URLContext *h, const char *path, int flags)
> > +{
> > + BlurayContext *bd = (BlurayContext *)h->priv_data;
> > + int num_title_idx;
> > + const char *diskname = path;
> > +
> > + av_strstart(path, BLURAY_PROTO_PREFIX, &diskname);
> > +
> > + bd->bd = bd_open(diskname, NULL);
> > + if (!bd->bd) {
> > + av_log(h, AV_LOG_ERROR, "bd_open() failed\n");
> > + return AVERROR(EIO);
> > + }
> > +
> > + /* check if disc can be played */
> > + if (!check_disc_info(h)) {
> > + return AVERROR(EIO);
> > + }
> > +
> > + /* setup player registers */
> > + /* region code has no effect without menus
> > + if (bd->region > 0 && bd->region < 5) {
> > + av_log(h, AV_LOG_INFO, "setting region code to %d (%c)\n", bd->region, 'A' + (bd->region - 1));
> > + bd_set_player_setting(bd->bd, BLURAY_PLAYER_SETTING_REGION_CODE, bd->region);
> > + }
> > + */
> > +
> > + /* load title list */
> > + num_title_idx = bd_get_titles(bd->bd, TITLES_RELEVANT, MIN_PLAYLIST_LENGTH);
>
> > + av_log(0, AV_LOG_INFO, "%d usable playlists:\n", num_title_idx);
>
> s/0/h/
>
> also, if you want to officially maintain this code for ffmpeg, then
> please add yourself to MAINTAINERS as well
>
> overall the code looks good
Updated patch attached.
There's also lot of metadata available from libbluray. That could be
used when ex. remuxing to matroska. Is there any way to set chapter
info, title name, track languages, ... from protocol handler, or is the only way to
export libbluray handle to mpeg-ts demuxer and fetch the data there ?
Seeking to time offsets (url_read_seek) can be implemented using BluRay
clip indexes. There can be multiple indexes for different sub-streams,
so to fully implement url_read_seek() one would need to know what pid
stream_index is referring to. I've attached simple implementation that
seeks to time offset relative to the main video stream. Using binary
search with real BluRay device is very slow...
- Petri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bluray_v3.diff
Type: text/x-patch
Size: 11903 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120220/759e7546/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bluray_read_seek.diff
Type: text/x-patch
Size: 1061 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120220/759e7546/attachment-0001.bin>
More information about the ffmpeg-devel
mailing list