summaryrefslogtreecommitdiffstats
path: root/src/part/videoWindow.h
blob: 76d2b6c805ea72efe87f1ed8424e8ec525b786d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// (C) 2005 Max Howell (max.howell@methylblue.com)
// See COPYING file for licensing information

#ifndef CODEINE_VIDEO_WINDOW_H
#define CODEINE_VIDEO_WINDOW_H

#include "../codeine.h"
#include <tqtimer.h>
#include <tqwidget.h>
#include <kurl.h>

typedef struct xine_s xine_t;
typedef struct xine_stream_s xine_stream_t;
typedef struct xine_video_port_s xine_video_port_t;
typedef struct xine_audio_port_s xine_audio_port_t;
typedef struct xine_event_queue_s xine_event_queue_t;
typedef struct xine_post_s xine_post_t;
typedef struct xine_osd_s xine_osd_t;


namespace Codeine
{
   class VideoWindow : public TQWidget
   {
      Q_OBJECT

      static VideoWindow *s_instance;
      static const uint CURSOR_HIDE_TIMEOUT = 2000;

      friend VideoWindow* const videoWindow();

   public:
      VideoWindow( TQWidget *parent, const char *name );
     ~VideoWindow();

      bool init();

      bool play( KURL );
      void eject();

      int position();

   signals:
      void statusMessage( const TQString& );
      void titleChanged( const TQString& );

   private:
      /// @see xineEngine.cpp
      #ifdef HAVE_XINE_H
      static void xineEventListener( void*, const xine_event_t* );
      #endif

      void showErrorMessage(); //TODO don't use this, just show delayed message

      virtual void customEvent( TQCustomEvent* );
      virtual bool x11Event( XEvent* );
      virtual bool event( TQEvent* );

      xine_osd_t         *m_osd;
      xine_stream_t      *m_stream;
      xine_event_queue_t *m_eventQueue;
      xine_video_port_t  *m_videoPort;
      xine_audio_port_t  *m_audioPort;
      xine_t             *m_xine;

      KURL m_url;

   private:
      void *x11Visual() const;

      static void destSizeCallBack( void*, int, int, double, int*, int*, double* );
      static void frameOutputCallBack( void*, int, int, double, int*, int*, int*, int*, double*, int*, int* );

      double m_displayRatio;
      TQTimer m_timer;

   public slots:
      void togglePlay();
      void toggleMute();

   private slots:
      void hideCursor();

   private:
      /// prevent compiler generated functions
      VideoWindow( const VideoWindow& );
      VideoWindow &operator=( const VideoWindow& );
      bool operator==( const VideoWindow& );
   };

   inline VideoWindow* const videoWindow() { return VideoWindow::s_instance; }
}

#endif