[libbluray-devel] "bd_get_main_title" question
Petri Hintukainen
phintuka at users.sourceforge.net
Thu Jul 31 11:39:35 CEST 2014
On ke, 2014-07-30 at 10:52 -0500, Dave wrote:
> Hello libbluray community, it's my first post here and I just wanted to
> preface my post with the fact that I've searched the archives manually
> for a bit for an answer to my question, but haven't found anything, and
> also don't see a way to search the archives, so that's why I joined in
> to post.
>
> My question is regarding the "bd_get_main_title" function. I've been
> looking for a way to find the MPLS of the main title accurately, ie, the
> title that one's physical Bluray player would play when the disc is
> inserted and the main movie is started.
Physical BluRay player presents user the on-disc menus. Selection is (in
most cases) result of user interaction. Finding the main movie playlist
without user interaction is - and will always be - just a guess.
There may even be different opinions on what should be the main
playlist. Many discs include several versions of the same movie
(theatrical version, alternative cut, director's cut, ...). Even if we
know what playlist each is in, we can't know what one the user wants to
watch.
So, if you're implementing BD player, just use the on-disc menus and let
the user to do the work :)
Also note that you can't mix bd_get_main_title() and on-disc menus.
Player internal state is quite complex and depends on the path menus
were executed (menus are binary programs running inside VM). Skipping to
random playlist is likely to cause serious problems with menus.
Sometimes skipping menus could be nice (ex. when resuming interrupted
session). In such cases we could use some kind of bookmark system so
that the playback could be resumed from the same point where it was
interrupted. This will be more complex than just storing the playlist
number and playback position; full internal state of the player needs to
be saved and restored. Similar features are implemented in some BD-J
discs.
> After compiling libbluray, I
> ended up with a "list_titles" binary that lists all of the available
> indexes on a disc (which works fine), and even calls the
> "bd_get_main_title" function and finds the appropriate index of the main
> title. So I thought I was in the clear and had found a solution.
>
> However, if I play a Bluray with a trial of a commercial piece of
> software (PowerDVD, Arcsoft Totalmedia, etc), I can watch with Process
> Monitor which MPLS file is picked when the main movie starts, and at
> that point I noticed a discrepancy. For example, the Bluray of the
> movie Epic (2013), when played through commercial software, picks
> 00800.MPLS as the main title, but when I run libbluray's "list_titles"
> against the disc it picks 00802.MPLS as the main title. I went poking
> through the code of "bd_get_main_title" and found that, unfortunately,
> it looks like libbluray is just "guessing" as to the main title, as
> there is a comment above the code that says "/* main title guessing */"
> and, per the code, it seems to basically just pick the title with the
> longest duration that comes latest in the index list.
Automatic selection could still be easily improved. In many cases
selecting the longest playlist does not work. Instead, we could score
the playlists based on the length and available audio / subtitle tracks.
We could also "run" the menus by triggering timeouts immediately, until
some of the long playlists is selected. But not all discs will timeout
and start the main movie without user interaction.
Any other ideas ?
> Is this something that will be changed with some of the new BD-J support
> I've been reading about?
Yes and no. BD-J support allows using on-disc Java menus. But it does
not help in automatic main title selection, it always requires user
interaction.
> It's very intriguing to me that this aspect of
> the disc, picking the main title, is so "mysterious" to discover,
> so I will keep tinkering around on my own.
This is not entirely technical problem, there are also some "politics"
involved.
Most BluRay disc authors do not want users to skip menus and/or
warning/... clips. Even less they want some automatic program to be able
to discover the main movie. That's why there's no simple "pointer" to
the main movie on the disc.
Some authors even use techniques that try to confuse main title
selection algorithms on purpose ("structural protection"). There can be
ex. huge amount of identical fake playlists, all seem to be "reachable"
from the menus, but only one will play the correct movie. Bypassing such
protections could be very challenging, requiring careful analysis of the
on-disc (binary) programs.
- Petri
More information about the libbluray-devel
mailing list