{"action":"created","comment":{"url":"https://api.github.com/repos/xbmc/xbmc/pulls/comments/56943141","id":56943141,"diff_hunk":"@@ -109,3 +115,148 @@ int64_t CDVDInputStreamFFmpeg::Seek(int64_t offset, int whence)\n   return -1;\n }\n \n+std::string CDVDInputStreamFFmpeg::GetProxyType() const\n+{\n+  return m_item.HasProperty(\"proxy.type\") ?\n+    m_item.GetProperty(\"proxy.type\").asString() : std::string();\n+}\n+\n+std::string CDVDInputStreamFFmpeg::GetProxyHost() const\n+{\n+  return m_item.HasProperty(\"proxy.host\") ?\n+    m_item.GetProperty(\"proxy.host\").asString() : std::string();\n+}\n+\n+uint16_t CDVDInputStreamFFmpeg::GetProxyPort() const\n+{\n+  if (m_item.HasProperty(\"proxy.port\"))\n+    return m_item.GetProperty(\"proxy.port\").asInteger();\n+\n+  // Select the standard port\n+  const std::string value = GetProxyType();\n+  if (value == \"socks4\" && value == \"socks4a\" &&\n+    value == \"socks5\" && value == \"socks5-remote\")\n+    return 1080;\n+  else\n+    return 3128;\n+}\n+\n+std::string CDVDInputStreamFFmpeg::GetProxyUser() const\n+{\n+  return m_item.HasProperty(\"proxy.user\") ?\n+    m_item.GetProperty(\"proxy.user\").asString() : std::string();\n+}\n+\n+std::string CDVDInputStreamFFmpeg::GetProxyPassword() const\n+{\n+  return m_item.HasProperty(\"proxy.password\") ?\n+    m_item.GetProperty(\"proxy.password\").asString() : std::string();\n+}\n+\n+CURL CDVDInputStreamFFmpeg::GetM3UBestBandwidthStream(const CURL &url, size_t bandwidth)\n+{\n+  typedef CPlayListM3U M3U;\n+  using std::string;\n+  using std::map;\n+\n+  // we may be passed a playlist that does not contain playlists of different\n+  // bitrates (eg: this playlist is really the HLS video). So, default the\n+  // return to the filename so it can be played\n+  char szLine[4096];\n+  string strLine;\n+  size_t maxBandwidth = 0;\n+\n+  CCurlFile file;\n+\n+  // set the proxy configuration\n+  const string host = GetProxyHost();\n+  if (!host.empty())\n+  {\n+    const std::string type_str = GetProxyType();\n+    CCurlFile::ProxyType type = CCurlFile::PROXY_HTTP;\n+    if (type_str == \"http\")","path":"xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamFFmpeg.cpp","position":106,"original_position":106,"commit_id":"84f2f0958d1907965e1294516e4d46170bdc84b0","original_commit_id":"84f2f0958d1907965e1294516e4d46170bdc84b0","user":{"login":"FernetMenta","id":576009,"avatar_url":"https://avatars.githubusercontent.com/u/576009?v=3","gravatar_id":"","url":"https://api.github.com/users/FernetMenta","html_url":"https://github.com/FernetMenta","followers_url":"https://api.github.com/users/FernetMenta/followers","following_url":"https://api.github.com/users/FernetMenta/following{/other_user}","gists_url":"https://api.github.com/users/FernetMenta/gists{/gist_id}","starred_url":"https://api.github.com/users/FernetMenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FernetMenta/subscriptions","organizations_url":"https://api.github.com/users/FernetMenta/orgs","repos_url":"https://api.github.com/users/FernetMenta/repos","events_url":"https://api.github.com/users/FernetMenta/events{/privacy}","received_events_url":"https://api.github.com/users/FernetMenta/received_events","type":"User","site_admin":false},"body":"if you move this block into SetProxy and pass a string, it is only required once. If you pass the internal CCurlFile::ProxyType, every client needs to do the conversion.","created_at":"2016-03-22T06:44:32Z","updated_at":"2016-03-22T06:44:32Z","html_url":"https://github.com/xbmc/xbmc/pull/9421#discussion_r56943141","pull_request_url":"https://api.github.com/repos/xbmc/xbmc/pulls/9421","_links":{"self":{"href":"https://api.github.com/repos/xbmc/xbmc/pulls/comments/56943141"},"html":{"href":"https://github.com/xbmc/xbmc/pull/9421#discussion_r56943141"},"pull_request":{"href":"https://api.github.com/repos/xbmc/xbmc/pulls/9421"}}},"pull_request":{"url":"https://api.github.com/repos/xbmc/xbmc/pulls/9421","id":63666780,"html_url":"https://github.com/xbmc/xbmc/pull/9421","diff_url":"https://github.com/xbmc/xbmc/pull/9421.diff","patch_url":"https://github.com/xbmc/xbmc/pull/9421.patch","issue_url":"https://api.github.com/repos/xbmc/xbmc/issues/9421","number":9421,"state":"open","locked":false,"title":"Support per-stream proxies in HLS streams (attempt 5)","user":{"login":"jhol","id":1449493,"avatar_url":"https://avatars.githubusercontent.com/u/1449493?v=3","gravatar_id":"","url":"https://api.github.com/users/jhol","html_url":"https://github.com/jhol","followers_url":"https://api.github.com/users/jhol/followers","following_url":"https://api.github.com/users/jhol/following{/other_user}","gists_url":"https://api.github.com/users/jhol/gists{/gist_id}","starred_url":"https://api.github.com/users/jhol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhol/subscriptions","organizations_url":"https://api.github.com/users/jhol/orgs","repos_url":"https://api.github.com/users/jhol/repos","events_url":"https://api.github.com/users/jhol/events{/privacy}","received_events_url":"https://api.github.com/users/jhol/received_events","type":"User","site_admin":false},"body":"This branch supercedes #9412, #9398, #9240 and #8680, providing another attempt to add the ability for plugins to provide per-stream proxy configuration, including support for proxies with HLS.\r\n\r\nThe flow of URL information from plugins to HTTP requests for HLS streams is as follows:\r\n```\r\n[Plugin]\r\n  -> CListItem\r\n      -> CFileItem\r\n          -> CDVDInputStream/CDVDInputStreamFFmpeg\r\n              -> CPlayListM3U::GetBestBandwidthStream\r\n                  -> CFile::Open\r\n                      -> IFile/CCurlFile\r\n                          -> libcurl\r\n                              [HTTP Request playlist M3U8 file]\r\n\r\n          -> CDVDInputStream\r\n              -> CDVDDemuxFFmpeg\r\n                  -> libffmpeg\r\n                      [HTTP Request media chunks]\r\n```\r\nTo enable per-stream proxy configuration, the five config values (proxy protocol, host, port, user-name and password) must follow the same path-ways.\r\n\r\n- The proxy configurations are carried by five new `CFileItem` properties: `proxy.type`, `proxy.host`, `proxy.port`, `proxy.user` and `proxy.password`.\r\n\r\n- Accessor methods (`GetProxyType` etc.) have been added to `CDVDInputStreamFFmpeg`, which expose these property values.\r\n\r\n- `CPlayListM3U::GetBestBandwidthStream` has been moved to `CDVDInputStreamFFmpeg`, so that it can gain access to the proxy information from `CDVDInputStreamFFmpeg`.\r\n\r\n- Use of the `CFile::Open` factory mechanism has been removed from this method. Instead `CCurlFile` is created directly, so that the proxy values can be applied to the object.\r\n\r\n- `CDVDDemuxFFmpeg` has access to `CDVDInputStreamFFmpeg`, and adds the `http_proxy` string to the options dictionary if one has been specified.","created_at":"2016-03-22T03:53:31Z","updated_at":"2016-03-22T06:44:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"25ed1f6515773012999773c6d91aff382e1f9bf9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xbmc/xbmc/pulls/9421/commits","review_comments_url":"https://api.github.com/repos/xbmc/xbmc/pulls/9421/comments","review_comment_url":"https://api.github.com/repos/xbmc/xbmc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xbmc/xbmc/issues/9421/comments","statuses_url":"https://api.github.com/repos/xbmc/xbmc/statuses/84f2f0958d1907965e1294516e4d46170bdc84b0","head":{"label":"jhol:replace-proxy8","ref":"replace-proxy8","sha":"84f2f0958d1907965e1294516e4d46170bdc84b0","user":{"login":"jhol","id":1449493,"avatar_url":"https://avatars.githubusercontent.com/u/1449493?v=3","gravatar_id":"","url":"https://api.github.com/users/jhol","html_url":"https://github.com/jhol","followers_url":"https://api.github.com/users/jhol/followers","following_url":"https://api.github.com/users/jhol/following{/other_user}","gists_url":"https://api.github.com/users/jhol/gists{/gist_id}","starred_url":"https://api.github.com/users/jhol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhol/subscriptions","organizations_url":"https://api.github.com/users/jhol/orgs","repos_url":"https://api.github.com/users/jhol/repos","events_url":"https://api.github.com/users/jhol/events{/privacy}","received_events_url":"https://api.github.com/users/jhol/received_events","type":"User","site_admin":false},"repo":{"id":48686351,"name":"xbmc","full_name":"jhol/xbmc","owner":{"login":"jhol","id":1449493,"avatar_url":"https://avatars.githubusercontent.com/u/1449493?v=3","gravatar_id":"","url":"https://api.github.com/users/jhol","html_url":"https://github.com/jhol","followers_url":"https://api.github.com/users/jhol/followers","following_url":"https://api.github.com/users/jhol/following{/other_user}","gists_url":"https://api.github.com/users/jhol/gists{/gist_id}","starred_url":"https://api.github.com/users/jhol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhol/subscriptions","organizations_url":"https://api.github.com/users/jhol/orgs","repos_url":"https://api.github.com/users/jhol/repos","events_url":"https://api.github.com/users/jhol/events{/privacy}","received_events_url":"https://api.github.com/users/jhol/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhol/xbmc","description":"Kodi Main Repository - By using this code you agree with our policy and will follow the GPLv2 license as included","fork":true,"url":"https://api.github.com/repos/jhol/xbmc","forks_url":"https://api.github.com/repos/jhol/xbmc/forks","keys_url":"https://api.github.com/repos/jhol/xbmc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhol/xbmc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhol/xbmc/teams","hooks_url":"https://api.github.com/repos/jhol/xbmc/hooks","issue_events_url":"https://api.github.com/repos/jhol/xbmc/issues/events{/number}","events_url":"https://api.github.com/repos/jhol/xbmc/events","assignees_url":"https://api.github.com/repos/jhol/xbmc/assignees{/user}","branches_url":"https://api.github.com/repos/jhol/xbmc/branches{/branch}","tags_url":"https://api.github.com/repos/jhol/xbmc/tags","blobs_url":"https://api.github.com/repos/jhol/xbmc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhol/xbmc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhol/xbmc/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhol/xbmc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhol/xbmc/statuses/{sha}","languages_url":"https://api.github.com/repos/jhol/xbmc/languages","stargazers_url":"https://api.github.com/repos/jhol/xbmc/stargazers","contributors_url":"https://api.github.com/repos/jhol/xbmc/contributors","subscribers_url":"https://api.github.com/repos/jhol/xbmc/subscribers","subscription_url":"https://api.github.com/repos/jhol/xbmc/subscription","commits_url":"https://api.github.com/repos/jhol/xbmc/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhol/xbmc/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhol/xbmc/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhol/xbmc/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhol/xbmc/contents/{+path}","compare_url":"https://api.github.com/repos/jhol/xbmc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhol/xbmc/merges","archive_url":"https://api.github.com/repos/jhol/xbmc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhol/xbmc/downloads","issues_url":"https://api.github.com/repos/jhol/xbmc/issues{/number}","pulls_url":"https://api.github.com/repos/jhol/xbmc/pulls{/number}","milestones_url":"https://api.github.com/repos/jhol/xbmc/milestones{/number}","notifications_url":"https://api.github.com/repos/jhol/xbmc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhol/xbmc/labels{/name}","releases_url":"https://api.github.com/repos/jhol/xbmc/releases{/id}","deployments_url":"https://api.github.com/repos/jhol/xbmc/deployments","created_at":"2015-12-28T10:03:40Z","updated_at":"2015-12-28T10:04:06Z","pushed_at":"2016-03-22T03:49:40Z","git_url":"git://github.com/jhol/xbmc.git","ssh_url":"git@github.com:jhol/xbmc.git","clone_url":"https://github.com/jhol/xbmc.git","svn_url":"https://github.com/jhol/xbmc","homepage":"http://kodi.wiki/view/Official:Trademark_Policy","size":550800,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xbmc:master","ref":"master","sha":"958d4745ebf903a7c48feb32d411801e2c007e66","user":{"login":"xbmc","id":199122,"avatar_url":"https://avatars.githubusercontent.com/u/199122?v=3","gravatar_id":"","url":"https://api.github.com/users/xbmc","html_url":"https://github.com/xbmc","followers_url":"https://api.github.com/users/xbmc/followers","following_url":"https://api.github.com/users/xbmc/following{/other_user}","gists_url":"https://api.github.com/users/xbmc/gists{/gist_id}","starred_url":"https://api.github.com/users/xbmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xbmc/subscriptions","organizations_url":"https://api.github.com/users/xbmc/orgs","repos_url":"https://api.github.com/users/xbmc/repos","events_url":"https://api.github.com/users/xbmc/events{/privacy}","received_events_url":"https://api.github.com/users/xbmc/received_events","type":"Organization","site_admin":false},"repo":{"id":1217614,"name":"xbmc","full_name":"xbmc/xbmc","owner":{"login":"xbmc","id":199122,"avatar_url":"https://avatars.githubusercontent.com/u/199122?v=3","gravatar_id":"","url":"https://api.github.com/users/xbmc","html_url":"https://github.com/xbmc","followers_url":"https://api.github.com/users/xbmc/followers","following_url":"https://api.github.com/users/xbmc/following{/other_user}","gists_url":"https://api.github.com/users/xbmc/gists{/gist_id}","starred_url":"https://api.github.com/users/xbmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xbmc/subscriptions","organizations_url":"https://api.github.com/users/xbmc/orgs","repos_url":"https://api.github.com/users/xbmc/repos","events_url":"https://api.github.com/users/xbmc/events{/privacy}","received_events_url":"https://api.github.com/users/xbmc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xbmc/xbmc","description":"Kodi Main Repository - By using this code you agree with our policy and will follow the GPLv2 license as included","fork":false,"url":"https://api.github.com/repos/xbmc/xbmc","forks_url":"https://api.github.com/repos/xbmc/xbmc/forks","keys_url":"https://api.github.com/repos/xbmc/xbmc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xbmc/xbmc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xbmc/xbmc/teams","hooks_url":"https://api.github.com/repos/xbmc/xbmc/hooks","issue_events_url":"https://api.github.com/repos/xbmc/xbmc/issues/events{/number}","events_url":"https://api.github.com/repos/xbmc/xbmc/events","assignees_url":"https://api.github.com/repos/xbmc/xbmc/assignees{/user}","branches_url":"https://api.github.com/repos/xbmc/xbmc/branches{/branch}","tags_url":"https://api.github.com/repos/xbmc/xbmc/tags","blobs_url":"https://api.github.com/repos/xbmc/xbmc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xbmc/xbmc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xbmc/xbmc/git/refs{/sha}","trees_url":"https://api.github.com/repos/xbmc/xbmc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xbmc/xbmc/statuses/{sha}","languages_url":"https://api.github.com/repos/xbmc/xbmc/languages","stargazers_url":"https://api.github.com/repos/xbmc/xbmc/stargazers","contributors_url":"https://api.github.com/repos/xbmc/xbmc/contributors","subscribers_url":"https://api.github.com/repos/xbmc/xbmc/subscribers","subscription_url":"https://api.github.com/repos/xbmc/xbmc/subscription","commits_url":"https://api.github.com/repos/xbmc/xbmc/commits{/sha}","git_commits_url":"https://api.github.com/repos/xbmc/xbmc/git/commits{/sha}","comments_url":"https://api.github.com/repos/xbmc/xbmc/comments{/number}","issue_comment_url":"https://api.github.com/repos/xbmc/xbmc/issues/comments{/number}","contents_url":"https://api.github.com/repos/xbmc/xbmc/contents/{+path}","compare_url":"https://api.github.com/repos/xbmc/xbmc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xbmc/xbmc/merges","archive_url":"https://api.github.com/repos/xbmc/xbmc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xbmc/xbmc/downloads","issues_url":"https://api.github.com/repos/xbmc/xbmc/issues{/number}","pulls_url":"https://api.github.com/repos/xbmc/xbmc/pulls{/number}","milestones_url":"https://api.github.com/repos/xbmc/xbmc/milestones{/number}","notifications_url":"https://api.github.com/repos/xbmc/xbmc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xbmc/xbmc/labels{/name}","releases_url":"https://api.github.com/repos/xbmc/xbmc/releases{/id}","deployments_url":"https://api.github.com/repos/xbmc/xbmc/deployments","created_at":"2011-01-03T21:18:51Z","updated_at":"2016-03-22T05:29:18Z","pushed_at":"2016-03-22T04:18:44Z","git_url":"git://github.com/xbmc/xbmc.git","ssh_url":"git@github.com:xbmc/xbmc.git","clone_url":"https://github.com/xbmc/xbmc.git","svn_url":"https://github.com/xbmc/xbmc","homepage":"http://kodi.wiki/view/Official:Trademark_Policy","size":1743304,"stargazers_count":4611,"watchers_count":4611,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3397,"mirror_url":null,"open_issues_count":231,"forks":3397,"open_issues":231,"watchers":4611,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xbmc/xbmc/pulls/9421"},"html":{"href":"https://github.com/xbmc/xbmc/pull/9421"},"issue":{"href":"https://api.github.com/repos/xbmc/xbmc/issues/9421"},"comments":{"href":"https://api.github.com/repos/xbmc/xbmc/issues/9421/comments"},"review_comments":{"href":"https://api.github.com/repos/xbmc/xbmc/pulls/9421/comments"},"review_comment":{"href":"https://api.github.com/repos/xbmc/xbmc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xbmc/xbmc/pulls/9421/commits"},"statuses":{"href":"https://api.github.com/repos/xbmc/xbmc/statuses/84f2f0958d1907965e1294516e4d46170bdc84b0"}}}}