[MPlayer-cvslog] r34338 - trunk/libvo/vo_caca.c

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Nov 9 08:45:24 CET 2011



On 9 Nov 2011, at 03:35, diego <subversion at mplayerhq.hu> wrote:

> Author: diego
> Date: Wed Nov  9 03:35:04 2011
> New Revision: 34338
> 
> Log:
> vo_caca: Port to libcaca 1.x API, which is widespread enough nowadays.
> 
> patch by Paul B. Mahol, onemda gmail com

Nits following.

> +    if (dither == NULL) {

!dither (also in other places) I think would be more consistent with both old and other MPlayer code.

> +static void set_next_str(const char * const *list, const char **str,
> +                         const char **msg)
> +{
> +    int ind;
> +    for (ind = 0; list[ind]; ind += 2) {
> +        if (strcmp(list[ind], *str) == 0) {
> +            if (list[ind + 2] == NULL)
> +                ind = -2;
> +            *str = list[ind + 2];
> +            *msg = list[ind + 3];
> +            return;
> +        }
> +    }
> +
> +    *str = list[0];
> +    *msg = list[1];
> }

Replacing the ind=-2 by break would be less confusing.
Alternatively the whole if could be removed and the loop condition changed to list[ind] && list[ind+2]

> static void check_events(void)
> {
> -    unsigned int cev;
> +    caca_event_t cev;
> +    if (!caca_get_event(display, CACA_EVENT_ANY, &cev, 1))
> +        return;
> 
> -    if ((cev = caca_get_event(CACA_EVENT_ANY))) {
> -        if (cev & CACA_EVENT_RESIZE) {
> -            caca_refresh();
> -            resize();
> -        } else if (cev & CACA_EVENT_KEY_RELEASE) {
> -            int key = (cev & 0x00ffffff);
> -            enum caca_feature cf;
> +    switch (cev.type) {
> +    case CACA_EVENT_RESIZE:

Since it is the same as before I don't really get to complain, but:
This only handles a single even each time.
It really should handle all available at once, for low fps videos the current code can make it take an insanely long time if for example someone accidentally pressed a lot of keys.


More information about the MPlayer-cvslog mailing list