[vlc-commits] player: add missing cookie jar

Thomas Guillem git at videolan.org
Mon Nov 2 11:30:58 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Oct 30 14:41:54 2020 +0100| [c44f6927cc0d73d770aea7024e6b566f5fd0c6af] | committer: Thomas Guillem

player: add missing cookie jar

Regression from the initial vlc_player introduction. It was handled in
the old playlist engine but not in the new player.

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

 src/player/player.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/player/player.c b/src/player/player.c
index f4b82a4bd2..c4ba5b120d 100644
--- a/src/player/player.c
+++ b/src/player/player.c
@@ -31,6 +31,7 @@
 #include <vlc_tick.h>
 #include <vlc_decoder.h>
 #include <vlc_memstream.h>
+#include <vlc_http.h>
 
 #include "libvlc.h"
 #include "input/resource.h"
@@ -1911,6 +1912,13 @@ vlc_player_Delete(vlc_player_t *player)
     if (player->renderer)
         vlc_renderer_item_release(player->renderer);
 
+    vlc_http_cookie_jar_t *cookies = var_GetAddress(player, "http-cookies");
+    if (cookies != NULL)
+    {
+        var_Destroy(player, "http-cookies");
+        vlc_http_cookies_destroy(cookies);
+    }
+
     vlc_object_delete(player);
 }
 
@@ -1986,6 +1994,14 @@ vlc_player_New(vlc_object_t *parent, enum vlc_player_lock_type lock_type,
     VAR_CREATE("start-paused", VLC_VAR_BOOL);
     VAR_CREATE("play-and-pause", VLC_VAR_BOOL);
 
+    /* Initialize the shared HTTP cookie jar */
+    vlc_value_t cookies;
+    cookies.p_address = vlc_http_cookies_new();
+    if (likely(cookies.p_address != NULL))
+    {
+        VAR_CREATE("http-cookies", VLC_VAR_ADDRESS);
+        var_SetChecked(player, "http-cookies", VLC_VAR_ADDRESS, cookies);
+    }
 #undef VAR_CREATE
 
     player->resource = input_resource_New(VLC_OBJECT(player));



More information about the vlc-commits mailing list