PageRenderTime 120ms CodeModel.GetById 110ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h

http://github.com/xbmc/xbmc
C++ Header | 95 lines | 63 code | 13 blank | 19 comment | 0 complexity | ccc1ddcccc0463c9d25676e4f56a5daa MD5 | raw file
 1/*
 2 *      Copyright (C) 2005-2013 Team XBMC
 3 *      http://xbmc.org
 4 *
 5 *  This Program is free software; you can redistribute it and/or modify
 6 *  it under the terms of the GNU General Public License as published by
 7 *  the Free Software Foundation; either version 2, or (at your option)
 8 *  any later version.
 9 *
10 *  This Program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *  GNU General Public License for more details.
14 *
15 *  You should have received a copy of the GNU General Public License
16 *  along with XBMC; see the file COPYING.  If not, see
17 *  <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22#include "DVDInputStream.h"
23#include "filesystem/HTSPSession.h"
24
25class CDVDInputStreamHTSP
26  : public CDVDInputStream
27  , public CDVDInputStream::IChannel
28  , public CDVDInputStream::IDisplayTime
29{
30public:
31  CDVDInputStreamHTSP();
32  virtual ~CDVDInputStreamHTSP();
33  virtual bool    Open(const char* file, const std::string &content);
34  virtual void    Close();
35  virtual int     Read(uint8_t* buf, int buf_size);
36  virtual int64_t Seek(int64_t offset, int whence) { return -1; }
37  virtual bool Pause(double dTime) { return false; };
38  virtual bool    IsEOF();
39  virtual int64_t GetLength()                      { return -1; }
40
41  virtual ENextStream NextStream() { return m_startup ? NEXTSTREAM_OPEN : NEXTSTREAM_NONE; }
42
43  virtual void    Abort();
44
45  bool            NextChannel(bool preview = false);
46  bool            PrevChannel(bool preview = false);
47  bool            SelectChannelByNumber(unsigned int channel);
48  bool            SelectChannel(const PVR::CPVRChannel &channel) { return false; }
49  static bool     GetSelectedChannel(PVR::CPVRChannel *channel) {return false; }
50  bool            UpdateItem(CFileItem& item);
51
52  bool            CanRecord()         { return false; }
53  bool            IsRecording()       { return false; }
54  bool            Record(bool bOnOff) { return false; }
55
56  bool            CanPause()          { return false; }
57  bool            CanSeek()           { return false; }
58
59  int             GetTotalTime();
60  int             GetTime();
61
62  htsmsg_t* ReadStream();
63
64private:
65  typedef std::vector<HTSP::SChannel> SChannelV;
66  typedef HTSP::const_circular_iter<SChannelV::iterator> SChannelC;
67  bool      GetChannels(SChannelV &channels, SChannelV::iterator &it);
68  bool      SetChannel(int channel);
69  unsigned           m_subs;
70  bool               m_startup;
71  HTSP::CHTSPSession m_session;
72  int                m_channel;
73  int                m_tag;
74  HTSP::SChannels    m_channels;
75  HTSP::SEvent       m_event;
76
77  struct SRead
78  {
79    SRead() { buf = NULL; Clear(); }
80   ~SRead() { Clear(); }
81
82    int  Size() { return end - cur; }
83    void Clear()
84    {
85      free(buf);
86      buf = NULL;
87      cur = NULL;
88      end = NULL;
89    }
90
91    uint8_t* buf;
92    uint8_t* cur;
93    uint8_t* end;
94  } m_read;
95};