[Test] Added tests for CUtil::SplitParams
[xbmc.git] / xbmc / filesystem / XbtFile.h
blob6da937c907426437cbdfce61a1913200d587f3bf
1 /*
2 * Copyright (C) 2015-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "IFile.h"
12 #include "URL.h"
13 #include "guilib/XBTF.h"
14 #include "guilib/XBTFReader.h"
16 #include <cstdint>
17 #include <cstdio>
18 #include <vector>
20 #include "PlatformDefs.h"
22 namespace XFILE
24 class CXbtFile : public IFile
26 public:
27 CXbtFile();
28 ~CXbtFile() override;
30 bool Open(const CURL& url) override;
31 void Close() override;
32 bool Exists(const CURL& url) override;
34 int64_t GetPosition() override;
35 int64_t GetLength() override;
37 int Stat(struct __stat64* buffer) override;
38 int Stat(const CURL& url, struct __stat64* buffer) override;
40 ssize_t Read(void* lpBuf, size_t uiBufSize) override;
41 int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET) override;
43 uint32_t GetImageWidth() const;
44 uint32_t GetImageHeight() const;
45 XB_FMT GetImageFormat() const;
46 bool HasImageAlpha() const;
48 private:
49 bool GetFirstFrame(CXBTFFrame& frame) const;
51 static bool GetReader(const CURL& url, CXBTFReaderPtr& reader);
52 static bool GetReaderAndFile(const CURL& url, CXBTFReaderPtr& reader, CXBTFFile& file);
53 static bool GetFile(const CURL& url, CXBTFFile& file);
55 CURL m_url;
56 bool m_open = false;
57 CXBTFReaderPtr m_xbtfReader;
58 CXBTFFile m_xbtfFile;
60 std::vector<uint64_t> m_frameStartPositions;
61 size_t m_frameIndex = 0;
62 uint64_t m_positionWithinFrame = 0;
63 int64_t m_positionTotal = 0;
65 std::vector<std::vector<uint8_t>> m_unpackedFrames;