Welcome to mirror list, hosted at ThFree Co, Russian Federation.

VMROSD.h « mpc-hc « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 418523866ab12752428c4318f071db8b6c26d225 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * (C) 2006-2013 see Authors.txt
 *
 * This file is part of MPC-HC.
 *
 * MPC-HC is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * MPC-HC is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#pragma once

#include <atlbase.h>
#include <d3d9.h>
#include <evr9.h>
#include <vmr9.h>
#include "madVRAllocatorPresenter.h"


typedef enum {
    OSD_TRANSPARENT,
    OSD_BACKGROUND,
    OSD_BORDER,
    OSD_TEXT,
    OSD_BAR,
    OSD_CURSOR,
    OSD_DEBUGCLR,
    OSD_LAST
} OSD_COLORS;

typedef enum {
    OSD_NOMESSAGE,
    OSD_TOPLEFT,
    OSD_TOPRIGHT,
    OSD_DEBUG
} OSD_MESSAGEPOS;


class CVMROSD
{
public:
    CVMROSD();
    ~CVMROSD();

    void Start(CWnd* pWnd, IVMRMixerBitmap9* pVMB, bool bShowSeekBar);
    void Start(CWnd* pWnd, IMFVideoMixerBitmap* pVMB, bool bShowSeekBar);
    void Start(CWnd* pWnd, IMadVRTextOsd* pMVTO);
    void Stop();

    void DisplayMessage(OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration = 5000, int iFontSize = 0, CString fontName = _T(""));
    void DebugMessage(LPCTSTR format, ...);
    void ClearMessage(bool hide = false);
    void HideMessage(bool hide);
    void EnableShowMessage(bool enabled = true);

    __int64 GetPos() const;
    void SetPos(__int64 pos);
    void SetRange(__int64 start,  __int64 stop);
    void GetRange(__int64& start, __int64& stop);

    void SetSize(CRect wndRect, CRect videoRect);
    bool OnMouseMove(UINT nFlags, CPoint point);
    bool OnLButtonDown(UINT nFlags, CPoint point);
    bool OnLButtonUp(UINT nFlags, CPoint point);

private:
    CComPtr<IVMRMixerBitmap9>    m_pVMB;
    CComPtr<IMFVideoMixerBitmap> m_pMFVMB;
    CComPtr<IMadVRTextOsd>       m_pMVTO;

    CWnd* m_pWnd;

    CCritSec           m_csLock;
    CDC                m_memDC;
    VMR9AlphaBitmap    m_VMR9AlphaBitmap;
    MFVideoAlphaBitmap m_MFVideoAlphaBitmap;
    BITMAP             m_bitmapInfo;

    CFont   m_mainFont;
    CPen    m_penBorder;
    CPen    m_penCursor;
    CBrush  m_brushBack;
    CBrush  m_brushBar;
    CPen    m_debugPenBorder;
    CBrush  m_debugBrushBack;
    int     m_iFontSize;
    CString m_fontName;

    CRect    m_rectWnd;
    COLORREF m_colors[OSD_LAST];

    // Seekbar
    CRect   m_rectSeekBar;
    CRect   m_rectCursor;
    CRect   m_rectBar;
    bool    m_bCursorMoving;
    bool    m_bShowSeekBar;
    bool    m_bSeekBarVisible;
    __int64 m_llSeekMin;
    __int64 m_llSeekMax;
    __int64 m_llSeekPos;

    bool    m_bShowMessage;

    // Messages
    CString        m_strMessage;
    OSD_MESSAGEPOS m_nMessagePos;
    CList<CString> m_debugMessages;

    void UpdateBitmap();
    void UpdateSeekBarPos(CPoint point);
    void DrawSlider(CRect* rect, __int64 llMin, __int64 llMax, __int64 llPos);
    void DrawRect(CRect* rect, CBrush* pBrush = NULL, CPen* pPen = NULL);
    void Invalidate();
    void DrawMessage();
    void DrawDebug();

    static void CALLBACK TimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime);
};