69 std::string src_filename;
92 Logging::info(src_filename.c_str(),
"Opening the input VCD.");
94 m_fpi = fopen(src_filename.c_str(),
"rb");
101 return seek(0, SEEK_SET);
121 return ferror(
m_fpi);
126 return AV_NOPTS_VALUE;
131 if (
m_fpi ==
nullptr)
143 fstat(fileno(
m_fpi), &stbuf);
144 return static_cast<size_t>(stbuf.st_size);
149 return static_cast<size_t>(
static_cast<uint64_t
>(ftell(
m_fpi)) -
m_start_pos);
159 seek_pos =
static_cast<off_t
>(
m_start_pos) + offset;
169 seek_pos =
static_cast<off_t
>(
m_end_pos) - offset;
179 if (
static_cast<uint64_t
>(seek_pos) >
m_end_pos)
181 seek_pos =
static_cast<off_t
>(
m_end_pos);
190 return fseek(
m_fpi,
static_cast<long int>(seek_pos), SEEK_SET);
195 return ((feof(
m_fpi) || (
static_cast<uint64_t
>(ftell(
m_fpi)) >=
m_end_pos)) ?
true :
false);
const std::string & path() const
Path to source file (without file name)
LPVIRTUALFILE virtualfile()
Get virtual file object.
void set_virtualfile(LPVIRTUALFILE virtualfile)
Set the virtual file object.
static void info(const T filename, const std::string &format_string, Args &&...args)
Write info level log entry.
virtual ~VcdIO()
Free VcdIO object.
bool m_full_title
If true, ignore m_chapter_no and provide full track.
virtual int seek(int64_t offset, int whence) override
Seek to position in file.
virtual size_t size() const override
Get the file size.
virtual void closeio() override
Close virtual file.
VcdIO()
Create VcdIO object.
int m_chapter_no
Chapter number (1..)
void pvt_close()
Close virtual file. Non-virtual version to be safely called from constructor/destructor.
uint64_t m_end_pos
End offset in bytes (not including this byte)
virtual int openio(LPVIRTUALFILE virtualfile) override
Open a virtual file.
FILE * m_fpi
File pointer to source media.
int m_track_no
Track number (1..)
virtual int64_t duration() const override
Get the duration of the file, in AV_TIME_BASE fractional seconds.
virtual size_t readio(void *data, size_t size) override
Read data from file.
uint64_t m_start_pos
Start offset in bytes.
virtual VIRTUALTYPE type() const override
Get type of the virtual file.
virtual bool eof() const override
Check if at end of file.
virtual int error() const override
Get last error.
virtual size_t bufsize() const override
Get the ideal buffer size.
virtual size_t tell() const override
Get current read position.
VIRTUALTYPE
Virtual file types enum.
Provide various log facilities to stderr, disk or syslog.
int locate_video(const std::string &path, int track_no, std::string &fullname)
Locate AVSEQ*DAT/MPEG video file for track_no.
int m_chapter_no
Chapter number (1..)
uint64_t m_start_pos
Start offset in bytes.
uint64_t m_end_pos
End offset in bytes (not including this byte)
int m_track_no
Track number (1..)
bool m_full_title
If true, ignore m_chapter_no and provide full track.
struct VIRTUALFILE::VCD_CHAPTER m_vcd
S/VCD track/chapter info.
Video CD and Super Video CD I/O.