[vlc-commits] ytdl: pass custom data to JSON parser

Rémi Denis-Courmont git at videolan.org
Wed Sep 30 20:53:10 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Sep 30 21:28:08 2020 +0300| [43977a3ac305626f90a066fd600ca94db2e092e9] | committer: Rémi Denis-Courmont

ytdl: pass custom data to JSON parser

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43977a3ac305626f90a066fd600ca94db2e092e9
---

 modules/demux/ytdl.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/demux/ytdl.c b/modules/demux/ytdl.c
index 8b21b067ee..243d9dc143 100644
--- a/modules/demux/ytdl.c
+++ b/modules/demux/ytdl.c
@@ -37,11 +37,15 @@
 #include <vlc_plugin.h>
 #include <vlc_spawn.h>
 
+struct ytdl_json {
+    struct vlc_logger *logger;
+};
+
 void json_parse_error(void *data, const char *msg)
 {
-    struct vlc_logger *log = data;
+    struct ytdl_json *sys = data;
 
-    vlc_error(log, "%s", msg);
+    vlc_error(sys->logger, "%s", msg);
 }
 
 static
@@ -351,7 +355,8 @@ static int OpenCommon(vlc_object_t *obj)
 
     free(path);
 
-    int val = json_parse(obj->logger, input, &sys->json);
+    struct ytdl_json jsdata = { s->obj.logger };
+    int val = json_parse(&jsdata, input, &sys->json);
 
     kill(pid, SIGTERM);
     fclose(input);



More information about the vlc-commits mailing list