{"action":"created","comment":{"url":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments/237359828","pull_request_review_id":179636050,"id":237359828,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzM1OTgyOA==","diff_hunk":"@@ -0,0 +1,184 @@\n+/******************************************************************\n+ *\n+ * Copyright 2018 Samsung Electronics All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ *\n+ ******************************************************************/\n+\n+#include <curl/curl.h>\n+#include <curl/easy.h>\n+#include <debug.h>\n+\n+#include \"HttpStream.h\"\n+\n+namespace media {\n+namespace stream {\n+\n+#define SET_OPTION(curl, opt, val) \\\n+\tdo {\\\n+\t\tauto result = curl_easy_setopt(curl, opt, val);\\\n+\t\tif (result != CURLE_OK) {\\\n+\t\t\tmeddbg(\"curl_easy_setopt(%d...) failed!\\n\", (int)opt);\\\n+\t\t\treturn false;\\\n+\t\t}\\\n+\t} while (0)\n+\n+int HttpStream::mInitialzeCount = 0;\n+\n+std::shared_ptr<HttpStream> HttpStream::create()\n+{\n+\tstd::shared_ptr<HttpStream> stream(new HttpStream());\n+\tif (!stream->init()) {\n+\t\tmeddbg(\"HttpStream instance create failed!\\n\");\n+\t\treturn nullptr;\n+\t}\n+\n+\treturn stream;\n+}\n+\n+HttpStream::HttpStream() :\n+\tmCurl(nullptr), mHttpHeaders(nullptr)\n+{\n+}\n+\n+HttpStream::~HttpStream()\n+{\n+\tcleanup();\n+}\n+\n+bool HttpStream::addHeader(const std::string &header) {\n+\tmHttpHeaders = curl_slist_append(mHttpHeaders, header.c_str());\n+\tif (!mHttpHeaders) {\n+\t\tmeddbg(\"curl_slist_append failed, header %s\\n\", header.c_str());\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+bool HttpStream::setHeaderCallback(CallbackFunc callback, void *userdata)\n+{\n+\tSET_OPTION(mCurl, CURLOPT_HEADERFUNCTION, callback);\n+\tSET_OPTION(mCurl, CURLOPT_HEADERDATA, userdata);\n+\treturn true;\n+}\n+\n+bool HttpStream::setWriteCallback(CallbackFunc callback, void *userdata)\n+{\n+\tSET_OPTION(mCurl, CURLOPT_WRITEFUNCTION, callback);\n+\tSET_OPTION(mCurl, CURLOPT_WRITEDATA, userdata);\n+\treturn true;\n+}\n+\n+bool HttpStream::setReadCallback(CallbackFunc callback, void *userdata)\n+{\n+\tSET_OPTION(mCurl, CURLOPT_READFUNCTION, callback);\n+\tSET_OPTION(mCurl, CURLOPT_READDATA, userdata);\n+\treturn true;\n+}\n+\n+bool HttpStream::init()\n+{\n+\tif (mInitialzeCount == 0) {\n+\t\tif (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {\n+\t\t\tmeddbg(\"curl_global_init failed\\n\");\n+\t\t\treturn false;\n+\t\t}\n+\t}\n+\tmInitialzeCount++;\n+\tmInitialzeFlag = true;\n+\n+\tmCurl = curl_easy_init();\n+\tif (mCurl == nullptr) {\n+\t\tmeddbg(\"HttpStream init failed!\\n\");\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n+void HttpStream::cleanup()\n+{\n+\tif (mHttpHeaders) {\n+\t\tcurl_slist_free_all(mHttpHeaders);\n+\t\tmHttpHeaders = nullptr;\n+\t}\n+\n+\tif (mCurl != nullptr) {\n+\t\tcurl_easy_cleanup(mCurl);\n+\t\tmCurl = nullptr;\n+\t}\n+\n+\tif (mInitialzeFlag) {\n+\t\tmInitialzeCount--;\n+\t\tif (mInitialzeCount == 0) {\n+\t\t\tcurl_global_cleanup();\n+\t\t}\n+\t\tmInitialzeFlag = false;\n+\t}\n+}\n+\n+bool HttpStream::perform()\n+{\n+\tif (mHttpHeaders) {\n+\t\tSET_OPTION(mCurl, CURLOPT_HTTPHEADER, mHttpHeaders);\n+\t}\n+\n+\tCURLcode result;\n+\tresult = curl_easy_perform(mCurl);","path":"framework/src/media/HttpStream.cpp","position":null,"original_position":139,"commit_id":"b21df01cb3468da78658f6cd001ecb6c8f1402ab","original_commit_id":"f7158e4584b71382004a29ae028beed9f445dae1","user":{"login":"zhouxinhe","id":38490562,"node_id":"MDQ6VXNlcjM4NDkwNTYy","avatar_url":"https://avatars2.githubusercontent.com/u/38490562?v=4","gravatar_id":"","url":"https://api.github.com/users/zhouxinhe","html_url":"https://github.com/zhouxinhe","followers_url":"https://api.github.com/users/zhouxinhe/followers","following_url":"https://api.github.com/users/zhouxinhe/following{/other_user}","gists_url":"https://api.github.com/users/zhouxinhe/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouxinhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouxinhe/subscriptions","organizations_url":"https://api.github.com/users/zhouxinhe/orgs","repos_url":"https://api.github.com/users/zhouxinhe/repos","events_url":"https://api.github.com/users/zhouxinhe/events{/privacy}","received_events_url":"https://api.github.com/users/zhouxinhe/received_events","type":"User","site_admin":false},"body":"Fixed","created_at":"2018-11-29T05:46:10Z","updated_at":"2018-11-29T05:46:11Z","html_url":"https://github.com/Samsung/TizenRT/pull/2429#discussion_r237359828","pull_request_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments/237359828"},"html":{"href":"https://github.com/Samsung/TizenRT/pull/2429#discussion_r237359828"},"pull_request":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429"}},"in_reply_to_id":231853758},"pull_request":{"url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429","id":228650903,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4NjUwOTAz","html_url":"https://github.com/Samsung/TizenRT/pull/2429","diff_url":"https://github.com/Samsung/TizenRT/pull/2429.diff","patch_url":"https://github.com/Samsung/TizenRT/pull/2429.patch","issue_url":"https://api.github.com/repos/Samsung/TizenRT/issues/2429","number":2429,"state":"open","locked":false,"title":"framework/media: Add HttpInputDataSource for internet audio stream","user":{"login":"zhouxinhe","id":38490562,"node_id":"MDQ6VXNlcjM4NDkwNTYy","avatar_url":"https://avatars2.githubusercontent.com/u/38490562?v=4","gravatar_id":"","url":"https://api.github.com/users/zhouxinhe","html_url":"https://github.com/zhouxinhe","followers_url":"https://api.github.com/users/zhouxinhe/followers","following_url":"https://api.github.com/users/zhouxinhe/following{/other_user}","gists_url":"https://api.github.com/users/zhouxinhe/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouxinhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouxinhe/subscriptions","organizations_url":"https://api.github.com/users/zhouxinhe/orgs","repos_url":"https://api.github.com/users/zhouxinhe/repos","events_url":"https://api.github.com/users/zhouxinhe/events{/privacy}","received_events_url":"https://api.github.com/users/zhouxinhe/received_events","type":"User","site_admin":false},"body":"1. Add http stream class to download/upload audio stream, basing on libcurl.\r\n2. Add HttpInputDataSource support mp3 and aac type audio stream,\r\n    It requests that there always be content-type in http headers.\r\n3. Add new API  in StreamBuffer, it's used in HttpInputDataSource.\r\n4. Update mediaplayer example app for HttpInputDataSource test.\r\n@Taejun-Kwon @gcjjyy ","created_at":"2018-11-06T10:58:29Z","updated_at":"2018-11-29T05:46:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9a107011c822544f1fdda5d7b60c90a8fc9c104","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/commits","review_comments_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/comments","review_comment_url":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Samsung/TizenRT/issues/2429/comments","statuses_url":"https://api.github.com/repos/Samsung/TizenRT/statuses/b21df01cb3468da78658f6cd001ecb6c8f1402ab","head":{"label":"zhouxinhe:http-source","ref":"http-source","sha":"b21df01cb3468da78658f6cd001ecb6c8f1402ab","user":{"login":"zhouxinhe","id":38490562,"node_id":"MDQ6VXNlcjM4NDkwNTYy","avatar_url":"https://avatars2.githubusercontent.com/u/38490562?v=4","gravatar_id":"","url":"https://api.github.com/users/zhouxinhe","html_url":"https://github.com/zhouxinhe","followers_url":"https://api.github.com/users/zhouxinhe/followers","following_url":"https://api.github.com/users/zhouxinhe/following{/other_user}","gists_url":"https://api.github.com/users/zhouxinhe/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouxinhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouxinhe/subscriptions","organizations_url":"https://api.github.com/users/zhouxinhe/orgs","repos_url":"https://api.github.com/users/zhouxinhe/repos","events_url":"https://api.github.com/users/zhouxinhe/events{/privacy}","received_events_url":"https://api.github.com/users/zhouxinhe/received_events","type":"User","site_admin":false},"repo":{"id":139673965,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk2NzM5NjU=","name":"TizenRT","full_name":"zhouxinhe/TizenRT","private":false,"owner":{"login":"zhouxinhe","id":38490562,"node_id":"MDQ6VXNlcjM4NDkwNTYy","avatar_url":"https://avatars2.githubusercontent.com/u/38490562?v=4","gravatar_id":"","url":"https://api.github.com/users/zhouxinhe","html_url":"https://github.com/zhouxinhe","followers_url":"https://api.github.com/users/zhouxinhe/followers","following_url":"https://api.github.com/users/zhouxinhe/following{/other_user}","gists_url":"https://api.github.com/users/zhouxinhe/gists{/gist_id}","starred_url":"https://api.github.com/users/zhouxinhe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhouxinhe/subscriptions","organizations_url":"https://api.github.com/users/zhouxinhe/orgs","repos_url":"https://api.github.com/users/zhouxinhe/repos","events_url":"https://api.github.com/users/zhouxinhe/events{/privacy}","received_events_url":"https://api.github.com/users/zhouxinhe/received_events","type":"User","site_admin":false},"html_url":"https://github.com/zhouxinhe/TizenRT","description":"TizenRT is a lightweight RTOS-based platform to support low-end IoT devices","fork":true,"url":"https://api.github.com/repos/zhouxinhe/TizenRT","forks_url":"https://api.github.com/repos/zhouxinhe/TizenRT/forks","keys_url":"https://api.github.com/repos/zhouxinhe/TizenRT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhouxinhe/TizenRT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhouxinhe/TizenRT/teams","hooks_url":"https://api.github.com/repos/zhouxinhe/TizenRT/hooks","issue_events_url":"https://api.github.com/repos/zhouxinhe/TizenRT/issues/events{/number}","events_url":"https://api.github.com/repos/zhouxinhe/TizenRT/events","assignees_url":"https://api.github.com/repos/zhouxinhe/TizenRT/assignees{/user}","branches_url":"https://api.github.com/repos/zhouxinhe/TizenRT/branches{/branch}","tags_url":"https://api.github.com/repos/zhouxinhe/TizenRT/tags","blobs_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhouxinhe/TizenRT/statuses/{sha}","languages_url":"https://api.github.com/repos/zhouxinhe/TizenRT/languages","stargazers_url":"https://api.github.com/repos/zhouxinhe/TizenRT/stargazers","contributors_url":"https://api.github.com/repos/zhouxinhe/TizenRT/contributors","subscribers_url":"https://api.github.com/repos/zhouxinhe/TizenRT/subscribers","subscription_url":"https://api.github.com/repos/zhouxinhe/TizenRT/subscription","commits_url":"https://api.github.com/repos/zhouxinhe/TizenRT/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhouxinhe/TizenRT/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhouxinhe/TizenRT/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhouxinhe/TizenRT/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhouxinhe/TizenRT/contents/{+path}","compare_url":"https://api.github.com/repos/zhouxinhe/TizenRT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhouxinhe/TizenRT/merges","archive_url":"https://api.github.com/repos/zhouxinhe/TizenRT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhouxinhe/TizenRT/downloads","issues_url":"https://api.github.com/repos/zhouxinhe/TizenRT/issues{/number}","pulls_url":"https://api.github.com/repos/zhouxinhe/TizenRT/pulls{/number}","milestones_url":"https://api.github.com/repos/zhouxinhe/TizenRT/milestones{/number}","notifications_url":"https://api.github.com/repos/zhouxinhe/TizenRT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhouxinhe/TizenRT/labels{/name}","releases_url":"https://api.github.com/repos/zhouxinhe/TizenRT/releases{/id}","deployments_url":"https://api.github.com/repos/zhouxinhe/TizenRT/deployments","created_at":"2018-07-04T05:47:07Z","updated_at":"2018-10-29T07:55:03Z","pushed_at":"2018-11-29T03:50:33Z","git_url":"git://github.com/zhouxinhe/TizenRT.git","ssh_url":"git@github.com:zhouxinhe/TizenRT.git","clone_url":"https://github.com/zhouxinhe/TizenRT.git","svn_url":"https://github.com/zhouxinhe/TizenRT","homepage":"","size":107186,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Samsung:master","ref":"master","sha":"ef51e0c28ab5af42575d063ecb8f959d76d36d82","user":{"login":"Samsung","id":6210390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMTAzOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/6210390?v=4","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"repo":{"id":82517252,"node_id":"MDEwOlJlcG9zaXRvcnk4MjUxNzI1Mg==","name":"TizenRT","full_name":"Samsung/TizenRT","private":false,"owner":{"login":"Samsung","id":6210390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyMTAzOTA=","avatar_url":"https://avatars3.githubusercontent.com/u/6210390?v=4","gravatar_id":"","url":"https://api.github.com/users/Samsung","html_url":"https://github.com/Samsung","followers_url":"https://api.github.com/users/Samsung/followers","following_url":"https://api.github.com/users/Samsung/following{/other_user}","gists_url":"https://api.github.com/users/Samsung/gists{/gist_id}","starred_url":"https://api.github.com/users/Samsung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Samsung/subscriptions","organizations_url":"https://api.github.com/users/Samsung/orgs","repos_url":"https://api.github.com/users/Samsung/repos","events_url":"https://api.github.com/users/Samsung/events{/privacy}","received_events_url":"https://api.github.com/users/Samsung/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Samsung/TizenRT","description":"TizenRT is a lightweight RTOS-based platform to support low-end IoT devices","fork":false,"url":"https://api.github.com/repos/Samsung/TizenRT","forks_url":"https://api.github.com/repos/Samsung/TizenRT/forks","keys_url":"https://api.github.com/repos/Samsung/TizenRT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Samsung/TizenRT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Samsung/TizenRT/teams","hooks_url":"https://api.github.com/repos/Samsung/TizenRT/hooks","issue_events_url":"https://api.github.com/repos/Samsung/TizenRT/issues/events{/number}","events_url":"https://api.github.com/repos/Samsung/TizenRT/events","assignees_url":"https://api.github.com/repos/Samsung/TizenRT/assignees{/user}","branches_url":"https://api.github.com/repos/Samsung/TizenRT/branches{/branch}","tags_url":"https://api.github.com/repos/Samsung/TizenRT/tags","blobs_url":"https://api.github.com/repos/Samsung/TizenRT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Samsung/TizenRT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Samsung/TizenRT/git/refs{/sha}","trees_url":"https://api.github.com/repos/Samsung/TizenRT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Samsung/TizenRT/statuses/{sha}","languages_url":"https://api.github.com/repos/Samsung/TizenRT/languages","stargazers_url":"https://api.github.com/repos/Samsung/TizenRT/stargazers","contributors_url":"https://api.github.com/repos/Samsung/TizenRT/contributors","subscribers_url":"https://api.github.com/repos/Samsung/TizenRT/subscribers","subscription_url":"https://api.github.com/repos/Samsung/TizenRT/subscription","commits_url":"https://api.github.com/repos/Samsung/TizenRT/commits{/sha}","git_commits_url":"https://api.github.com/repos/Samsung/TizenRT/git/commits{/sha}","comments_url":"https://api.github.com/repos/Samsung/TizenRT/comments{/number}","issue_comment_url":"https://api.github.com/repos/Samsung/TizenRT/issues/comments{/number}","contents_url":"https://api.github.com/repos/Samsung/TizenRT/contents/{+path}","compare_url":"https://api.github.com/repos/Samsung/TizenRT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Samsung/TizenRT/merges","archive_url":"https://api.github.com/repos/Samsung/TizenRT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Samsung/TizenRT/downloads","issues_url":"https://api.github.com/repos/Samsung/TizenRT/issues{/number}","pulls_url":"https://api.github.com/repos/Samsung/TizenRT/pulls{/number}","milestones_url":"https://api.github.com/repos/Samsung/TizenRT/milestones{/number}","notifications_url":"https://api.github.com/repos/Samsung/TizenRT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Samsung/TizenRT/labels{/name}","releases_url":"https://api.github.com/repos/Samsung/TizenRT/releases{/id}","deployments_url":"https://api.github.com/repos/Samsung/TizenRT/deployments","created_at":"2017-02-20T04:38:30Z","updated_at":"2018-11-28T11:27:49Z","pushed_at":"2018-11-29T05:34:39Z","git_url":"git://github.com/Samsung/TizenRT.git","ssh_url":"git@github.com:Samsung/TizenRT.git","clone_url":"https://github.com/Samsung/TizenRT.git","svn_url":"https://github.com/Samsung/TizenRT","homepage":"","size":107192,"stargazers_count":213,"watchers_count":213,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":370,"mirror_url":null,"archived":false,"open_issues_count":68,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":370,"open_issues":68,"watchers":213,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429"},"html":{"href":"https://github.com/Samsung/TizenRT/pull/2429"},"issue":{"href":"https://api.github.com/repos/Samsung/TizenRT/issues/2429"},"comments":{"href":"https://api.github.com/repos/Samsung/TizenRT/issues/2429/comments"},"review_comments":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/comments"},"review_comment":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Samsung/TizenRT/pulls/2429/commits"},"statuses":{"href":"https://api.github.com/repos/Samsung/TizenRT/statuses/b21df01cb3468da78658f6cd001ecb6c8f1402ab"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"zhouxinhe"}}