/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. #pragma once
  21. #include "DVDInputStream.h"
  22. #include "filesystem/HTSPSession.h"
  23. class CDVDInputStreamHTSP
  24. : public CDVDInputStream
  25. , public CDVDInputStream::IChannel
  26. , public CDVDInputStream::IDisplayTime
  27. {
  28. public:
  29. CDVDInputStreamHTSP();
  30. virtual ~CDVDInputStreamHTSP();
  31. virtual bool Open(const char* file, const std::string &content);
  32. virtual void Close();
  33. virtual int Read(uint8_t* buf, int buf_size);
  34. virtual int64_t Seek(int64_t offset, int whence) { return -1; }
  35. virtual bool Pause(double dTime) { return false; };
  36. virtual bool IsEOF();
  37. virtual int64_t GetLength() { return -1; }
  38. virtual ENextStream NextStream() { return m_startup ? NEXTSTREAM_OPEN : NEXTSTREAM_NONE; }
  39. virtual void Abort();
  40. bool NextChannel(bool preview = false);
  41. bool PrevChannel(bool preview = false);
  42. bool SelectChannelByNumber(unsigned int channel);
  43. bool SelectChannel(const PVR::CPVRChannel &channel) { return false; }
  44. static bool GetSelectedChannel(PVR::CPVRChannel *channel) {return false; }
  45. bool UpdateItem(CFileItem& item);
  46. bool CanRecord() { return false; }
  47. bool IsRecording() { return false; }
  48. bool Record(bool bOnOff) { return false; }
  49. bool CanPause() { return false; }
  50. bool CanSeek() { return false; }
  51. int GetTotalTime();
  52. int GetTime();
  53. htsmsg_t* ReadStream();
  54. private:
  55. typedef std::vector<HTSP::SChannel> SChannelV;
  56. typedef HTSP::const_circular_iter<SChannelV::iterator> SChannelC;
  57. bool GetChannels(SChannelV &channels, SChannelV::iterator &it);
  58. bool SetChannel(int channel);
  59. unsigned m_subs;
  60. bool m_startup;
  61. HTSP::CHTSPSession m_session;
  62. int m_channel;
  63. int m_tag;
  64. HTSP::SChannels m_channels;
  65. HTSP::SEvent m_event;
  66. struct SRead
  67. {
  68. SRead() { buf = NULL; Clear(); }
  69. ~SRead() { Clear(); }
  70. int Size() { return end - cur; }
  71. void Clear()
  72. {
  73. free(buf);
  74. buf = NULL;
  75. cur = NULL;
  76. end = NULL;
  77. }
  78. uint8_t* buf;
  79. uint8_t* cur;
  80. uint8_t* end;
  81. } m_read;
  82. };