Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CurlUtils] Removed deprecated use of ADDON_READ_CHUNKED #1721

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/AdaptiveStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool adaptive::AdaptiveStream::DownloadImpl(const DownloadInfo& downloadInfo,
CURL::CUrl curl{url};
curl.AddHeaders(headers);

int statusCode = curl.Open(true);
int statusCode = curl.Open();

if (statusCode == -1)
LOG::Log(LOGERROR, "[AS-%u] Download failed, internal error: %s", clsId, url.c_str());
Expand Down
2 changes: 1 addition & 1 deletion src/samplereader/SubtitleSampleReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool CSubtitleSampleReader::InitializeFile(std::string url)
// Download the file
CURL::CUrl curl(url);
curl.AddHeaders(kodiProps.GetStreamHeaders());
int statusCode = curl.Open(true);
int statusCode = curl.Open();
if (statusCode == -1)
{
LOG::Log(LOGERROR, "Download failed, internal error: %s", url.c_str());
Expand Down
5 changes: 3 additions & 2 deletions src/test/KodiStubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ typedef enum FilePropertyTypes
typedef enum OpenFileFlags
{
ADDON_READ_TRUNCATED = 0x01,
ADDON_READ_CHUNKED = 0x02,
ADDON_READ_CHUNKED = 0x02, // deprecated
ADDON_READ_CACHED = 0x04,
ADDON_READ_NO_CACHE = 0x08,
ADDON_READ_BITRATE = 0x10,
ADDON_READ_MULTI_STREAM = 0x20,
ADDON_READ_AUDIO_VIDEO = 0x40,
ADDON_READ_AFTER_WRITE = 0x80,
ADDON_READ_REOPEN = 0x100
ADDON_READ_REOPEN = 0x100,
ADDON_READ_NO_BUFFER = 0x200,
} OpenFileFlags;

enum AdjustRefreshRateStatus
Expand Down
8 changes: 2 additions & 6 deletions src/utils/CurlUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,9 @@ UTILS::CURL::CUrl::~CUrl()
m_file.Close();
}

int UTILS::CURL::CUrl::Open(bool isMediaStream /* = false */)
int UTILS::CURL::CUrl::Open()
{
unsigned int flags = ADDON_READ_NO_CACHE | ADDON_READ_CHUNKED;
if (isMediaStream)
flags |= ADDON_READ_AUDIO_VIDEO;

if (!m_file.CURLOpen(flags))
if (!m_file.CURLOpen(ADDON_READ_NO_CACHE | ADDON_READ_NO_BUFFER))
{
LOG::LogF(LOGERROR, "CURLOpen failed");
return -1;
Expand Down
3 changes: 1 addition & 2 deletions src/utils/CurlUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ class ATTR_DLL_LOCAL CUrl

/*!
* \brief Open the url.
* \param isMediaStream Set true if the download is a media stream (audio/video/subtitles)
* \return Return HTTP status code, or -1 for any internal error
*/
int Open(bool isMediaStream = false);
int Open();

void AddHeader(std::string_view name, std::string_view value);
void AddHeaders(const std::map<std::string, std::string>& headers);
Expand Down