FFmpegfs Fuse Multi Media Filesystem 2.16
blurayio.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
34#ifndef BLURAYIO_H
35#define BLURAYIO_H
36
37#pragma once
38
39#ifdef USE_LIBBLURAY
40
41#include "fileio.h"
42
43#include <array>
44
45typedef struct bluray BLURAY;
50class BlurayIO : public FileIO
51{
52public:
56 explicit BlurayIO();
60 virtual ~BlurayIO();
61
66 virtual VIRTUALTYPE type() const override;
71 virtual size_t bufsize() const override;
72
79 virtual int openio(LPVIRTUALFILE virtualfile) override;
89 virtual size_t readio(void *data, size_t size) override;
94 virtual int error() const override;
99 virtual int64_t duration() const override;
104 virtual size_t size() const override;
109 virtual size_t tell() const override;
124 virtual int seek(int64_t offset, int whence) override;
129 virtual bool eof() const override;
133 virtual void closeio() override;
134
135private:
140 void pvt_close();
141
142protected:
145 bool m_is_eof;
147 size_t m_rest_size;
148 size_t m_rest_pos;
149 int64_t m_cur_pos;
150 int64_t m_start_pos;
151 int64_t m_end_pos;
154 uint32_t m_title_idx;
155 unsigned m_chapter_idx;
156 unsigned m_angle_idx;
158 std::array<uint8_t, 192 * 1024> m_data;
160 int64_t m_duration;
161};
162#endif // USE_LIBBLURAY
163
164#endif // BLURAYIO_H
struct bluray BLURAY
Forward declaration of libbluray handle.
Definition: blurayio.h:45
Blu-ray I/O class.
Definition: blurayio.h:51
virtual size_t readio(void *data, size_t size) override
Read data from file.
Definition: blurayio.cc:171
std::array< uint8_t, 192 *1024 > m_data
Buffer for readio() data.
Definition: blurayio.h:158
int64_t m_cur_pos
Current position in virtual file.
Definition: blurayio.h:149
size_t m_rest_pos
Position in buffer.
Definition: blurayio.h:148
int64_t m_end_pos
End offset in bytes (not including this byte)
Definition: blurayio.h:151
int64_t m_duration
Track/chapter duration, in AV_TIME_BASE fractional seconds.
Definition: blurayio.h:160
virtual int seek(int64_t offset, int whence) override
Seek to position in file.
Definition: blurayio.cc:251
virtual int error() const override
Get last error.
Definition: blurayio.cc:231
int m_errno
Last errno.
Definition: blurayio.h:146
BlurayIO()
Create BlurayIO object.
Definition: blurayio.cc:39
BLURAY * m_bd
Blu-ray disk handle.
Definition: blurayio.h:143
virtual ~BlurayIO()
Free BlurayIO object.
Definition: blurayio.cc:57
unsigned m_angle_idx
Selected angle index (angle number -1)
Definition: blurayio.h:156
uint32_t m_title_idx
Track index (track number - 1)
Definition: blurayio.h:154
bool m_full_title
If true, ignore m_chapter_no and provide full track.
Definition: blurayio.h:153
virtual int openio(LPVIRTUALFILE virtualfile) override
Open a virtual file.
Definition: blurayio.cc:72
size_t m_rest_size
Rest bytes in buffer.
Definition: blurayio.h:147
virtual size_t bufsize() const override
Get the ideal buffer size.
Definition: blurayio.cc:67
unsigned m_chapter_idx
Chapter index (chapter number - 1)
Definition: blurayio.h:155
virtual size_t size() const override
Get the file size.
Definition: blurayio.cc:241
void pvt_close()
Close virtual file. Non-virtual version to be safely called from constructor/destructor.
Definition: blurayio.cc:306
virtual bool eof() const override
Check if at end of file.
Definition: blurayio.cc:296
virtual void closeio() override
Close virtual file.
Definition: blurayio.cc:301
int64_t m_start_pos
Start offset in bytes.
Definition: blurayio.h:150
virtual int64_t duration() const override
Get the duration of the file, in AV_TIME_BASE fractional seconds.
Definition: blurayio.cc:236
virtual size_t tell() const override
Get current read position.
Definition: blurayio.cc:246
bool m_is_eof
true if at end of virtual file
Definition: blurayio.h:145
virtual VIRTUALTYPE type() const override
Get type of the virtual file.
Definition: blurayio.cc:62
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