3
MediaTomb - http://www.mediatomb.cc/
5
dvdnav_read.h - this file is part of MediaTomb.
7
Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
8
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
10
Copyright (C) 2006-2009 Gena Batyan <bgeradz@mediatomb.cc>,
11
Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
12
Leonhard Wimmer <leo@mediatomb.cc>
14
MediaTomb is free software; you can redistribute it and/or modify
15
it under the terms of the GNU General Public License version 2
16
as published by the Free Software Foundation.
18
MediaTomb is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
GNU General Public License for more details.
23
You should have received a copy of the GNU General Public License
24
version 2 along with MediaTomb; if not, write to the Free Software
25
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
30
/// \file dvdnav_read.h
31
/// \brief Definition of the FileIOHandler class.
32
#ifndef __DVDNAV_READ_H__
33
#define __DVDNAV_READ_H__
37
#include <sys/types.h>
38
#include <dvdnav/dvdnav.h>
42
/// \brief Allows to read selected streams from a DVD image.
44
/// There are some constraints on the usage of this class:
45
/// First of all - you *must* call the selectPGC() function before you
46
/// attempt to read data or get the stream length.
48
/// You must call selectPGC() each time when you want to reset read; calling
49
/// read consequently will return the stream data and advance further in the
52
/// The class is thread safe, meaning that locks are in place, however it's
53
/// design does not suggest multithreaded usage. selectPGC(), read(),
54
/// getLength() will not work in parallel but block if one of the functions
56
class DVDNavReader : public zmm::Object
59
/// \brief Sets the filename to work with. Can be an ISO, device or
61
DVDNavReader(zmm::String path);
64
/// \brief returns the number of titles on the DVD
67
/// \brief returns the number of chapters for a given title
68
/// \param title_idx index of the title
69
int chapterCount(int title_idx);
71
/// \brief Returns the number of audio streams for the selected PGC
72
int audioTrackCount();
74
/// \brief Selects the title, chapter and angle to play, returns the
75
/// number of bytes for the selection.
77
/// The DVD is divided into titles, each title is didvided into chapters
78
/// and can have one or more angles. This function selects what data we
79
/// want to retrieve from the DVD (i.e. what stream we want to watch),
80
/// and returns the size of the stream in bytes.
81
/// Note, that we will always treat the chapter as "starting point", i.e.
82
/// we will play from the given chapter to the very end, we will not stop
83
/// at the end of the chapter.
85
/// \param title_idx index of the title
86
/// \param chapter_idx index of the chapter from where we start
87
void selectPGC(int title_idx, int chapter_idx);
89
/// \brief Reads the stream, specified by selectPGC from the DVD.
91
/// \param buffer buffer to store the data
92
/// \param length length of the buffer
93
/// \return number of bytes read (can be shorter than buffer length), value
94
/// of 0 indicates end of stream.
95
size_t readSector(unsigned char *buffer, size_t length);
97
/// \brief Returns a human readable language string of the audio stream
98
zmm::String audioLanguage(int stream_idx);
100
/// \brief Returns the sampling frequency of the given audio stream
101
int audioSampleFrequency(int stream_idx);
103
/// \brief Returns the number of channels for the given audio stream
104
int audioChannels(int stream_idx);
106
/// \brief Returns the id of the audio stream
107
int audioStreamID(int stream_idx);
109
/// \brief Returns a human readable name of the audio format
110
zmm::String audioFormat(int stream_idx);
113
/// \brief Name of the DVD file.
114
zmm::String dvd_path;
116
/// \brief DVD handle
119
/// \brief end of title flag
122
zmm::Ref<Mutex> mutex;
124
zmm::String getLanguage(char *code);
128
#endif // __DVDNAV_READ_H__