[MPlayer-dev-eng] [PATCH] Teletext support try3 (4/5, configure, slaves, etc)

Alban Bedel albeu at free.fr
Sun Jul 15 20:41:06 CEST 2007


On Mon, 16 Jul 2007 00:41:04 +0700
"Vladimir Voroshilov" <voroshil at gmail.com> wrote:

> 2007/7/15, Alban Bedel <albeu at free.fr>:
> > On Sun, 15 Jul 2007 21:13:21 +0700
> > "Vladimir Voroshilov" <voroshil at gmail.com> wrote:
> >
> > > +    // this line could be reached only for SET and STEP
> > > properties with DEMUXER_TYPE_TV
> > > +    if(base_ioctl==TV_VBI_CONTROL_GET_MODE){
> > > +        if(tvh->functions->control(tvh->priv, base_ioctl, &val)
> > > ==TVI_CONTROL_TRUE && val)
> > > +            mp_input_set_section("teletext");
> > > +        else
> > > +            mp_input_set_section("tv");
> > > +    }
> >
> > This is a bit ugly and with such approch PRINT will also need to
> > switch on base_ioctl. In fact I was more thinking of simply having a
> > function that take the needed VBI_CONTROL as extra argument. Then
> > each property use its own function where special stuff like this
> > can be implemented.
> >
> > BTW imho it would be better if turning the teletext on and off, and
> > setting the rendering mode where two different control. Dunno what
> > others think about it.
> 
> I didn't undestant your idea clearly.
> Could you provide small example?

Sure, something like this:

static int mp_property_teletext(m_option_t * prop, int action,
                                void *arg, MPContext * mpctx,
                                int vbi_ioctl, char** names) {
    // Implement get/set/step/print
}

static int mp_property_teletext_page(m_option_t * prop, int action,
                                     void *arg, MPContext * mpctx) {
    return mp_property_teletext(prop,action,arg,mpctx,
                                TV_VBI_CONTROL_GET_PAGE, NULL);
}

static int mp_property_teletext_mode(m_option_t * prop, int action,
                                     void *arg, MPContext * mpctx) {
    char** names = { "off", "opaque", "transparent",
                     "transparent - black"};
    int r = mp_property_teletext (prop,action,arg,mpctx,
                                  TV_VBI_CONTROL_GET_MODE, names);  
    if(r <= 0) return r;
    switch(action) {
    case M_PROPERTY_SET:
    case M_PROPERTY_STEP_UP:
    case M_PROPERTY_STEP_DOWN:
        // set the input section
    }
    return r;
}

It's a bit more verbose, but it make thing simpler if the properties
need to be extanded later.

	Albeu




More information about the MPlayer-dev-eng mailing list