[MPlayer-dev-eng] [RFC] fixing SUB_SELECT
Joey Parrish
joey at nicewarrior.org
Sat Sep 18 04:44:25 CEST 2004
Hello,
Okay, SUB_SELECT is busted. The current code (thanks to a bad commit
from me) makes it such that there's no clear order for which subtitles
are invoked when there's more than one source.
We have many different options for subtitle source.
1) -sub on the command line
2) -vobsub on the command line
3) dvd subtitles
4) ogg text subtitles
5) matroska subs
6) (did i miss one? i don't think i did.)
Well, 3, 4 and 5 are mutually exclusive.
But 1 and/or 2 can happen at the same time as any of the others.
We also (IMHO) have two options for how to handle these.
1) We want to select them independantly.
Pro: You can display mpsubs at the same time as DVD subs.
Con: Do we want to be able to that in the first place?
Con: It makes things stranger for the casual user,
who has to press one key to switch for these files,
and a different key to switch for DVDs...
2) We want only one subtitle source at a time.
Pro: Nice for users.
Con: Requires us to change some of mplayer.c's subtitle code.
Con: The changes for this are potentially going to be cheap,
and a True Solution(tm) won't be available in G1 at all.
I want everyone's opinion on these choices,
I want criticisms on my rationale...
But now I'm going to explore a possible solution if we choose #2.
We could create a (I guess you would call it) meta-numbering scheme.
For example, the way -sub is handled right now is that add_subtitle
is called for each string in the list provided. This creates an
array of sub_data structures and keeps track of how many subs we have.
What we could do is perform a similar step for vobsub, dvd subs, etc.,
depending on what is available. A grand total of available subtitles
would then be stored somewhere along with an array of indices such that:
#define SUB_SOURCE_SUB 1
#define SUB_SOURCE_VOBSUB 2
...
index[SUB_SOURCE_VOBSUB] == 9 means that in the meta-numbering,
sub source 9 is where we start using vobsubs instead of subs, and so on.
The #defines are not strictly neccessary, but you get the idea.
Then sub_select would increment the sub source id, check indices array
to decide where the new subtitles should come from, then enable them,
very similar to the SUB_SELECT block in CVS right now. The difference
is just that this would use a numbering system that encompasses all
of the different formats.
The advantage of this meta-numbering is that we can avoid more serious
architectural changes (like a single sub struct that can describe any
of the many subtitle formats MPlayer supports) until we are really ready
to overhaul the sub system.
This is my proposal, so that
1) the sub_select code can be un-broken,
2) we don't need to reimplement anything.
If there are no objections, I'm going to make a patch for this in the
next couple of weeks. But when are there never objections? :)
Thanks,
--Joey
--
"The Hell Law says that Hell is reserved exclusively for them that believe
in it. Further, the lowest Rung in Hell is reserved for them that believe
in it on the supposition that they'll go there if they don't."
HBT; The Gospel According to Fred, 3:1
More information about the MPlayer-dev-eng
mailing list