Skip to content

Commit

Permalink
[CurlUtils] Removed deprecated use of ADDON_READ_CHUNKED
Browse files Browse the repository at this point in the history
  • Loading branch information
CastagnaIT committed Nov 7, 2024
1 parent ea39649 commit cf0c715
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
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

0 comments on commit cf0c715

Please sign in to comment.