Merge pull request #4196 from arnova/sub_fallback
[vuplus_xbmc] / xbmc / cores / dvdplayer / DVDCodecs / Video / AMLCodec.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2013 Team XBMC
4  *      http://xbmc.org
5  *
6  *  This Program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This Program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, see
18  *  <http://www.gnu.org/licenses/>.
19  *
20  */
21
22 #include "DVDVideoCodec.h"
23 #include "cores/dvdplayer/DVDStreamInfo.h"
24 #include "cores/VideoRenderers/RenderFeatures.h"
25 #include "guilib/Geometry.h"
26 #include "rendering/RenderSystem.h"
27 #include "threads/Thread.h"
28
29 typedef struct am_private_t am_private_t;
30
31 class DllLibAmCodec;
32
33 class CAMLCodec : public CThread
34 {
35 public:
36   CAMLCodec();
37   virtual ~CAMLCodec();
38
39   bool          OpenDecoder(CDVDStreamInfo &hints);
40   void          CloseDecoder();
41   void          Reset();
42
43   int           Decode(uint8_t *pData, size_t size, double dts, double pts);
44
45   bool          GetPicture(DVDVideoPicture* pDvdVideoPicture);
46   void          SetSpeed(int speed);
47   int           GetDataSize();
48   double        GetTimeSize();
49
50 protected:
51   virtual void  Process();
52
53 private:
54   double        GetPlayerPtsSeconds();
55   void          SetVideoPtsSeconds(double pts);
56   void          ShowMainVideo(const bool show);
57   void          SetVideoZoom(const float zoom);
58   void          SetVideoContrast(const int contrast);
59   void          SetVideoBrightness(const int brightness);
60   void          SetVideoSaturation(const int saturation);
61   void          GetRenderFeatures(Features &renderFeatures);
62   void          SetVideo3dMode(const int mode3d);
63   std::string   GetStereoMode();
64   static void   RenderFeaturesCallBack(const void *ctx, Features &renderFeatures);
65   void          SetVideoRect(const CRect &SrcRect, const CRect &DestRect);
66   static void   RenderUpdateCallBack(const void *ctx, const CRect &SrcRect, const CRect &DestRect);
67
68   DllLibAmCodec   *m_dll;
69   bool             m_opened;
70   am_private_t    *am_private;
71   CDVDStreamInfo   m_hints;
72   volatile int     m_speed;
73   volatile int64_t m_1st_pts;
74   volatile int64_t m_cur_pts;
75   volatile int64_t m_cur_pictcnt;
76   volatile int64_t m_old_pictcnt;
77   volatile double  m_timesize;
78   volatile int64_t m_vbufsize;
79   int64_t          m_start_dts;
80   int64_t          m_start_pts;
81   CEvent           m_ready_event;
82
83   CRect            m_dst_rect;
84   int              m_view_mode;
85   RENDER_STEREO_MODE m_stereo_mode;
86   RENDER_STEREO_VIEW m_stereo_view;
87   float            m_zoom;
88   int              m_contrast;
89   int              m_brightness;
90 };