xbmc
HTTPImageTransformationHandler.h
1 /*
2  * Copyright (C) 2015-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "XBDateTime.h"
12 #include "network/httprequesthandler/IHTTPRequestHandler.h"
13 
14 #include <stdint.h>
15 #include <string>
16 
18 {
19 public:
22 
23  IHTTPRequestHandler* Create(const HTTPRequest &request) const override { return new CHTTPImageTransformationHandler(request); }
24  bool CanHandleRequest(const HTTPRequest &request)const override;
25 
26  MHD_RESULT HandleRequest() override;
27 
28  bool CanHandleRanges() const override { return true; }
29  bool CanBeCached() const override { return true; }
30  bool GetLastModifiedDate(CDateTime &lastModified) const override;
31 
32  HttpResponseRanges GetResponseData() const override { return m_responseData; }
33 
34  // priority must be higher than the one of CHTTPImageHandler
35  int GetPriority() const override { return 6; }
36 
37 protected:
38  explicit CHTTPImageTransformationHandler(const HTTPRequest &request);
39 
40 private:
41  std::string m_url;
42  CDateTime m_lastModified;
43 
44  uint8_t* m_buffer;
45  HttpResponseRanges m_responseData;
46 };
Definition: IHTTPRequestHandler.h:66
bool GetLastModifiedDate(CDateTime &lastModified) const override
Returns the last modification date of the response data.
Definition: HTTPImageTransformationHandler.cpp:163
bool CanBeCached() const override
Whether the HTTP response can be cached.
Definition: HTTPImageTransformationHandler.h:29
Definition: HTTPImageTransformationHandler.h:17
MHD_RESULT HandleRequest() override
Handles the HTTP request.
Definition: HTTPImageTransformationHandler.cpp:108
IHTTPRequestHandler * Create(const HTTPRequest &request) const override
Creates a new HTTP request handler for the given request.
Definition: HTTPImageTransformationHandler.h:23
int GetPriority() const override
Returns the priority of the HTTP request handler.
Definition: HTTPImageTransformationHandler.h:35
HttpResponseRanges GetResponseData() const override
Returns the ranges with raw data belonging to the response.
Definition: HTTPImageTransformationHandler.h:32
DateTime class, which uses FileTime as it&#39;s base.
Definition: XBDateTime.h:63
bool CanHandleRequest(const HTTPRequest &request) const override
Checks if the HTTP request handler can handle the given request.
Definition: HTTPImageTransformationHandler.cpp:94
bool CanHandleRanges() const override
Whether the HTTP response could also be provided in ranges.
Definition: HTTPImageTransformationHandler.h:28
Definition: IHTTPRequestHandler.h:85