[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / cores / dvdplayer / DVDInputStreams / DVDInputStreamBluray.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://www.xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "DVDInputStream.h"
24 #include <list>
25 #include <boost/shared_ptr.hpp>
26
27 extern "C"
28 {
29 #include <libbluray/bluray.h>
30 #include <libbluray/keys.h>
31 #include <libbluray/overlay.h>
32 }
33
34 class CDVDOverlayImage;
35 class DllLibbluray;
36 class IDVDPlayer;
37
38 class CDVDInputStreamBluray 
39   : public CDVDInputStream
40   , public CDVDInputStream::IDisplayTime
41   , public CDVDInputStream::IChapter
42   , public CDVDInputStream::ISeekTime
43   , public CDVDInputStream::IMenus
44 {
45 public:
46   CDVDInputStreamBluray(IDVDPlayer* player);
47   virtual ~CDVDInputStreamBluray();
48   virtual bool Open(const char* strFile, const std::string &content);
49   virtual void Close();
50   virtual int Read(BYTE* buf, int buf_size);
51   virtual int64_t Seek(int64_t offset, int whence);
52   virtual bool Pause(double dTime) { return false; };
53   virtual bool IsEOF();
54   virtual int64_t GetLength();
55   virtual int GetBlockSize() { return 6144; }
56   virtual ENextStream NextStream();
57
58
59   /* IMenus */
60   virtual void ActivateButton()          { UserInput(BD_VK_ENTER); }
61   virtual void SelectButton(int iButton)
62   {
63     if(iButton < 10)
64       UserInput((bd_vk_key_e)(BD_VK_0 + iButton));
65   }
66   virtual int  GetCurrentButton()        { return 0; }
67   virtual int  GetTotalButtons()         { return 0; }
68   virtual void OnUp()                    { UserInput(BD_VK_UP); }
69   virtual void OnDown()                  { UserInput(BD_VK_DOWN); }
70   virtual void OnLeft()                  { UserInput(BD_VK_LEFT); }
71   virtual void OnRight()                 { UserInput(BD_VK_RIGHT); }
72   virtual void OnMenu();
73   virtual void OnBack()
74   {
75     if(IsInMenu())
76       OnMenu();
77   }
78   virtual void OnNext()                  {}
79   virtual void OnPrevious()              {}
80   virtual bool IsInMenu();
81   virtual bool OnMouseMove(const CPoint &point)  { return false; }
82   virtual bool OnMouseClick(const CPoint &point) { return false; }
83   virtual double GetTimeStampCorrection()        { return 0.0; }
84
85   void UserInput(bd_vk_key_e vk);
86
87   int GetChapter();
88   int GetChapterCount();
89   void GetChapterName(std::string& name) {};
90   bool SeekChapter(int ch);
91
92   int GetTotalTime();
93   int GetTime();
94   bool SeekTime(int ms);
95
96   void GetStreamInfo(int pid, char* language);
97
98   void OverlayCallback(const BD_OVERLAY * const);
99
100   BLURAY_TITLE_INFO* GetTitleLongest();
101   BLURAY_TITLE_INFO* GetTitleFile(const std::string& name);
102
103 protected:
104   IDVDPlayer*   m_player;
105   DllLibbluray *m_dll;
106   BLURAY* m_bd;
107   BLURAY_TITLE_INFO* m_title;
108   bool               m_title_playing;
109   uint32_t           m_clip;
110   bool m_navmode;
111
112   typedef boost::shared_ptr<CDVDOverlayImage> SOverlay;
113   typedef std::list<SOverlay>                 SOverlays;
114
115   struct SPlane
116   {
117     SOverlays o;
118     int       w;
119     int       h;
120
121     SPlane()
122     : w(0)
123     , h(0)
124     {}
125   };
126
127   SPlane m_planes[2];
128   enum EHoldState {
129     HOLD_NONE = 0,
130     HOLD_HELD,
131     HOLD_SKIP,
132     HOLD_DATA,
133   } m_hold;
134   BD_EVENT m_event;
135 };