2 * Copyright (c) 2002 Frodo
3 * Portions Copyright (c) by the authors of ffmpeg and xvid
4 * Copyright (C) 2002-2018 Team Kodi
5 * This file is part of Kodi - https://kodi.tv
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 * See LICENSES/README.md for more information.
13 // FilePipe.h: interface for the CPipeFile class.
15 //////////////////////////////////////////////////////////////////////
18 #include "PipesManager.h"
19 #include "threads/CriticalSection.h"
27 class CPipeFile
: public IFile
, public IPipeListener
31 ~CPipeFile() override
;
32 int64_t GetPosition() override
;
33 int64_t GetLength() override
;
34 virtual void SetLength(int64_t len
);
35 bool Open(const CURL
& url
) override
;
36 bool Exists(const CURL
& url
) override
;
37 int Stat(const CURL
& url
, struct __stat64
* buffer
) override
;
38 int Stat(struct __stat64
* buffer
) override
;
39 ssize_t
Read(void* lpBuf
, size_t uiBufSize
) override
;
40 ssize_t
Write(const void* lpBuf
, size_t uiBufSize
) override
;
41 int64_t Seek(int64_t iFilePosition
, int iWhence
= SEEK_SET
) override
;
42 void Close() override
;
43 void Flush() override
;
44 virtual int64_t GetAvailableRead();
46 bool OpenForWrite(const CURL
& url
, bool bOverWrite
= false) override
;
48 bool Delete(const CURL
& url
) override
;
49 bool Rename(const CURL
& url
, const CURL
& urlnew
) override
;
50 int IoControl(EIoControl request
, void* param
) override
;
52 std::string
GetName() const;
54 void OnPipeOverFlow() override
;
55 void OnPipeUnderFlow() override
;
57 void AddListener(IPipeListener
*l
);
58 void RemoveListener(IPipeListener
*l
);
65 void SetOpenThreshold(int threshold
);
69 int64_t m_length
= -1;
73 CCriticalSection m_lock
;
74 std::vector
<XFILE::IPipeListener
*> m_listeners
;