[vlc-devel] [PATCH] demux: json: add json_reader context

Rémi Denis-Courmont remi at remlab.net
Wed Oct 14 19:38:48 CEST 2020


Le keskiviikkona 14. lokakuuta 2020, 20.32.56 EEST Francois Cartegnie a écrit 
:
> Le 14/10/2020 à 18:02, Rémi Denis-Courmont a écrit :
> > Le keskiviikkona 14. lokakuuta 2020, 17.52.52 EEST Francois Cartegnie a
> > écrit> 
> >> diff --git a/modules/demux/json/json.h b/modules/demux/json/json.h
> >> index 8274ceb652..bc254693f3 100644
> >> --- a/modules/demux/json/json.h
> >> +++ b/modules/demux/json/json.h
> >> @@ -59,11 +59,16 @@ struct json_member {
> >> 
> >>      struct json_value value;
> >>  
> >>  };
> >> 
> >> -size_t json_read(void *data, void *buf, size_t max);
> >> -void json_parse_error(void *log, const char *msg);
> >> +struct json_reader {
> >> +    void *priv;
> >> +    ssize_t (*read)(void *, void *, size_t);
> >> +    void (*logger)(void *, const struct json_object *, const char *);
> >> +};
> > 
> > I don't see the point in having a log callback. The VLC logger is already
> > essentially a log callback by itself. We don't need two indirection
> > layers.
> 
> Because we probably might want to use the extra json object info
> provided with the message

Using an object in intermediate state from a failed parser does not strike me 
as a particularly good idea.

> or don't want to pass a mandatory vlc object or vlc logger.

There are no ways to log without a logger. We don't want to write to standard 
error here. You can already pass NULL if you don't care to log at all.

-- 
レミ・デニ-クールモン
http://www.remlab.net/





More information about the vlc-devel mailing list