FFmpegfs Fuse Multi Media Filesystem 2.16
diskio.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2024 by Norbert Schlia (nschlia@oblivion-software.de)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 * On Debian systems, the complete text of the GNU General Public License
19 * Version 3 can be found in `/usr/share/common-licenses/GPL-3'.
20 */
21
32#ifndef DISKIO_H
33#define DISKIO_H
34
35#pragma once
36
37#include "fileio.h"
38
41class DiskIO : public FileIO
42{
43public:
44 explicit DiskIO();
45 virtual ~DiskIO();
46
51 virtual VIRTUALTYPE type() const override;
56 virtual size_t bufsize() const override;
57
63 virtual int openio(LPVIRTUALFILE virtualfile) override;
72 virtual size_t readio(void *data, size_t size) override;
77 virtual int error() const override;
82 virtual int64_t duration() const override;
87 virtual size_t size() const override;
92 virtual size_t tell() const override;
106 virtual int seek(int64_t offset, int whence) override;
111 virtual bool eof() const override;
115 virtual void closeio() override;
116
117private:
122 void pvt_close();
123
124protected:
125 FILE * m_fpi;
126};
127
128#endif // DISKIO_H
Disk file I/O class.
Definition: diskio.h:42
virtual int openio(LPVIRTUALFILE virtualfile) override
Open a file.
Definition: diskio.cc:58
virtual int seek(int64_t offset, int whence) override
Seek to position in file.
Definition: diskio.cc:109
virtual int64_t duration() const override
Get the duration of the file, in AV_TIME_BASE fractional seconds.
Definition: diskio.cc:86
virtual VIRTUALTYPE type() const override
Get type of the virtual file.
Definition: diskio.cc:48
virtual bool eof() const override
Check if at end of file.
Definition: diskio.cc:114
virtual int error() const override
Get last error.
Definition: diskio.cc:81
virtual size_t bufsize() const override
Get the ideal buffer size.
Definition: diskio.cc:53
virtual void closeio() override
Close virtual file.
Definition: diskio.cc:119
virtual size_t readio(void *data, size_t size) override
Read data from file.
Definition: diskio.cc:76
void pvt_close()
Close virtual file. Non-virtual version to be safely called from constructor/destructor.
Definition: diskio.cc:124
FILE * m_fpi
File pointer to source media.
Definition: diskio.h:125
virtual size_t size() const override
Get the file size.
Definition: diskio.cc:91
virtual size_t tell() const override
Get current read position.
Definition: diskio.cc:104
Base class for I/O.
Definition: fileio.h:260
LPVIRTUALFILE virtualfile()
Get virtual file object.
Definition: fileio.cc:113
FileIO class.
VIRTUALTYPE
Virtual file types enum.
Definition: fileio.h:92
Virtual file definition.
Definition: fileio.h:123