[MPlayer-dev-eng] [PATCH] New command support select sub by source and ID

Alban Bedel albeu at free.fr
Fri Nov 2 14:17:06 CET 2007


On Wed, 31 Oct 2007 22:54:46 +0800
Ulion <ulion2002 at gmail.com> wrote:

> Hello,
> 
> As a response for
> http://lists.mplayerhq.hu/pipermail/mplayer-users/2007-October/069452.html,
> I make this patch as a solution for accurate selecting subtitles by
> mplayer command.
> This hide the internal implement of mplayer global_sub_pos stuff.
> External program can now accurately select any subtitles identified by
> mplayer output message.
> 
> There is another reason push me to make this patch:
> With this standard interface of selecting subtitles, we can then have
> chance to change internal implement of subtitles list without break
> programs using this interface in the future.

> +                for (i = 0; set_prop_cmd[i].name; ++i)
> +                    if (set_prop_cmd[i].cmd == MP_CMD_SUB_SELECT)
> +                        break;
> +                set_osd_msg(OSD_MSG_PROPERTY + i,
> +                        1, osd_duration, MSGTR_SubSelectStatus, val);

That's not the right way to print a message with the same id as a
property. It should be done the otherway around, you define an id and
make the command-property bridge use it (ie. set the osd_id field in
the set_prop_cmd array).

The patch itself look ok. However imho it would be much better to add a
new set of properties. One for each subtitle type to allow
setting/cycling only the given type, and one to query the current
subtitle type. The command could then be implemented in some generic
way, for example by using a string for the sub type and just looking up
the property sub_$type.

	Albeu




More information about the MPlayer-dev-eng mailing list