~vanvugt/ubuntu/oneiric/mediatomb/fix-770964-784431

« back to all changes in this revision

Viewing changes to src/dvd_io_handler.h

  • Committer: Bazaar Package Importer
  • Author(s): Andres Mejia
  • Date: 2009-04-22 21:39:19 UTC
  • mto: (4.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090422213919-52m015y6gcpv1m1g
Tags: upstream-0.12.0~svn2018
ImportĀ upstreamĀ versionĀ 0.12.0~svn2018

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*MT*
 
2
    
 
3
    MediaTomb - http://www.mediatomb.cc/
 
4
    
 
5
    dvd_io_handler.h - this file is part of MediaTomb.
 
6
    
 
7
    Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
 
8
                       Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
 
9
    
 
10
    Copyright (C) 2006-2009 Gena Batyan <bgeradz@mediatomb.cc>,
 
11
                            Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
 
12
                            Leonhard Wimmer <leo@mediatomb.cc>
 
13
    
 
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.
 
17
    
 
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.
 
22
    
 
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.
 
26
    
 
27
    $Id$
 
28
*/
 
29
 
 
30
/// \file dvd_io_handler.h
 
31
 
 
32
/// \brief Definition of the DVDIOHandler class.
 
33
#ifndef __DVD_IO_HANDLER_H__
 
34
#define __DVD_IO_HANDLER_H__
 
35
 
 
36
#include "common.h"
 
37
#include "io_handler.h"
 
38
#include "dvdnav_read.h"
 
39
 
 
40
/// \brief Allows the web server to read from a dvd.
 
41
class DVDIOHandler : public IOHandler
 
42
{
 
43
protected:
 
44
    /// \brief Name of the DVD image.
 
45
    zmm::String dvdname;
 
46
 
 
47
    /// \brief Handle of the DVD.
 
48
    zmm::Ref<DVDNavReader> dvd;
 
49
 
 
50
    off_t total_size;
 
51
 
 
52
    unsigned char *small_buffer;
 
53
    unsigned char *small_buffer_pos;
 
54
    bool last_read;
 
55
 
 
56
public:
 
57
    /// \brief Sets the dvdname to work with.
 
58
    DVDIOHandler(zmm::String dvdname, int track, int chapter, 
 
59
                 int audio_stream_id);
 
60
 
 
61
    ~DVDIOHandler();
 
62
    /// \brief Opens dvd for reading (writing is not supported)
 
63
    virtual void open(IN enum UpnpOpenFileMode mode);
 
64
 
 
65
    /// \brief Reads a previously opened dvd sequentially.
 
66
    /// \param buf Data from the dvd will be copied into this buffer.
 
67
    /// \param length Number of bytes to be copied into the buffer.
 
68
    virtual int read(OUT char *buf, IN size_t length);
 
69
   
 
70
    /// \brief Writes to a previously opened dvd.
 
71
    /// \param buf Data from the buffer will be written to the dvd.
 
72
    /// \param length Number of bytes to be written from the buffer.
 
73
    /// \return number of bytes written.
 
74
    virtual int write(OUT char *buf, IN size_t length);
 
75
 
 
76
    /// \brief Performs seek on an open dvd.
 
77
    /// \param offset Number of bytes to move in the dvd. For seeking forwards
 
78
    /// positive values are used, for seeking backwards - negative. Offset must
 
79
    /// be positive if origin is set to SEEK_SET
 
80
    /// \param whence The position to move relative to. SEEK_CUR to move relative
 
81
    /// to current position, SEEK_END to move relative to the end of dvd,
 
82
    /// SEEK_SET to specify an absolute offset.
 
83
    virtual void seek(IN off_t offset, IN int whence);
 
84
 
 
85
    /// \brief Close a previously opened dvd.
 
86
    virtual void close();
 
87
 
 
88
    /// \brief Returns the length of the stream in bytes
 
89
    off_t length();
 
90
};
 
91
 
 
92
 
 
93
#endif // __DVD_IO_HANDLER_H__