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

Ulion ulion2002 at gmail.com
Sun Nov 25 13:50:03 CET 2007


2007/11/25, Chris Welton <electrostatic_1 at yahoo.com>:
>
> --- Ulion <ulion2002 at gmail.com> wrote:
>
> > 2007/11/22, Ulion <ulion2002 at gmail.com>:
> > > 2007/11/18, Ulion <ulion2002 at gmail.com>:
> > > > 2007/11/16, Ulion <ulion2002 at gmail.com>:
> > > > > 2007/11/16, Alban Bedel <albeu at free.fr>:
> > > > > > On Thu, 15 Nov 2007 18:11:46 +0800
> > > > > > Ulion <ulion2002 at gmail.com> wrote:
> > > > > >
> > > > > >
> > > > > > > > > +    case M_PROPERTY_SET:
> > > > > > > > > +        if (!arg || *(int *) arg < -1
> > || *(int *) arg >=
> > > > > > > > > SUB_SOURCES)
> > > > > > > > > +            return M_PROPERTY_ERROR;
> > > > > > > >
> > > > > > > > It should just clamp the parameter into
> > the valid range instead of
> > > > > > > > returning an error.
> > > > > > >
> > > > > > > I already did that, at:
> > > > > > >     { "sub_source",
> > mp_property_sub_source, CONF_TYPE_INT,
> > > > > > >      M_OPT_RANGE, -1, SUB_SOURCES - 1,
> > NULL },
> > > > > >
> > > > > > No, this just fill in the info, you still
> > have to use it. With the
> > > > > > M_PROPERTY_CLAMP() macro for ex.
> > > > >
> > > > > OK, now I known.
> > > > >
> > > > > >
> > > > > > > >
> > > > > > > > > +        if (*(int *) arg < 0)
> > > > > > > > > +            mpctx->global_sub_pos =
> > -1;
> > > > > > > > > +        else if (*(int *) arg !=
> > sub_source(mpctx)) {
> > > > > > > > > +            if (*(int *) arg !=
> > sub_source_by_pos(mpctx,
> > > > > > > > > mpctx->global_sub_indices[*(int *)
> > arg]))
> > > > > > > > > +                return
> > M_PROPERTY_UNAVAILABLE;
> > > > > > > > > +            mpctx->global_sub_pos =
> > mpctx->global_sub_indices[*
> > > > > > > > > (int *) arg];
> > > > > > > > > +        }
> > > > > > > > > +        break;
> > > > > > > >
> > > > > > > > And it should return the value
> > effectively set (like GET do).
> > > > > > >
> > > > > > > Indeed the code did return the value
> > effectively set, when arg < 0, it
> > > > > > > must be -1, we set -1, and the effectively
> > set value also -1, no need
> > > > > > > to change the value. when arg >= 0, I have
> > a check call
> > > > > > > sub_source_by_pos to see whether the
> > effectively set value is same
> > > > > > > with the input arg, when they not match,
> > set fail, else set it, the
> > > > > > > input arg is just the effectively set
> > value we make it sure here.
> > > > > >
> > > > > > It might not if the input was out of range
> > and needed to be clamped to
> > > > > > the valid range.
> > > > >
> > > > > OK, clamped version here.
> > > >
> > > > Then, I think it's ready to commit, I will wait
> > a week to apply if no
> > > > objects or suggestions.
> > > >
> > >
> > > If no objects, I will apply in 3 days.
> >
> > Done.
> >
> > --
> > Ulion
> > _______________________________________________
> > MPlayer-dev-eng mailing list
> > MPlayer-dev-eng at mplayerhq.hu
> >
> http://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
> >
>
> command.c is now broken after svn update
>
> command.c: In function 'mp_property_sub_source':
> command.c:1393: error: 'MSGTR_SubSourceFile'
> undeclared (first use in this function)
> command.c:1393: error: (Each undeclared identifier is
> reported only once
> command.c:1393: error: for each function it appears
> in.)
> command.c:1396: error: 'MSGTR_SubSourceVobsub'
> undeclared (first use in this function)
> command.c:1399: error: 'MSGTR_SubSourceDemux'
> undeclared (first use in this function)
> command.c: At top level:
> command.c:2015: error: 'MSGTR_SubSourceStatus'
> undeclared here (not in a function)
> command.c:2015: error: initializer element is not
> constant
> command.c:2015: error: (near initialization for
> 'set_prop_cmd[19].osd_msg')
> command.c:2015: error: initializer element is not
> constant
> command.c:2015: error: (near initialization for
> 'set_prop_cmd[19]')
> ...
> ...
> ...

I'm really sorry for this mistake, already fixed the svn, I lost a
file when I last commit.

-- 
Ulion



More information about the MPlayer-dev-eng mailing list