-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathInfoPanelDlg.cpp
More file actions
98 lines (87 loc) · 2.43 KB
/
InfoPanelDlg.cpp
File metadata and controls
98 lines (87 loc) · 2.43 KB
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
#include "stdafx.h"
enum ShowMode
{
SECOND_MODE,
GOP_MODE,
FRAME_MODE,
};
LRESULT CInfoPanelDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CComboBox clShowMode(GetDlgItem(IDC_SHOWMODE));
clShowMode.ResetContent();
clShowMode.AddString(_T("Second mode"));
clShowMode.AddString(_T("GOP mode"));
clShowMode.AddString(_T("Frame mode"));
clShowMode.SetItemData(0, (DWORD_PTR)SECOND_MODE);
clShowMode.SetItemData(1, (DWORD_PTR)GOP_MODE);
clShowMode.SetItemData(2, (DWORD_PTR)FRAME_MODE);
CComboBox clStreamInfo = GetDlgItem(IDC_STREAMINFO);
clStreamInfo.ResetContent();
m_clFrameInfoList.Init(GetDlgItem(IDC_PTSLIST));
return TRUE;
}
LRESULT CInfoPanelDlg::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
m_clFrameInfoList.Uninit();
bHandled = FALSE;
return 0;
}
LRESULT CInfoPanelDlg::OnOpenFile(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CFileDialog clFileDialog(TRUE);
if (clFileDialog.DoModal(m_hWnd) == IDOK)
{
Open(clFileDialog.m_ofn.lpstrFile);
}
return 0;
}
LRESULT CInfoPanelDlg::OnParse(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
CComboBox clStreamInfo = GetDlgItem(IDC_STREAMINFO);
LONG lSel = clStreamInfo.GetCurSel();
if (lSel != CB_ERR)
{
UINT video_selected_stream_index = (UINT)clStreamInfo.GetItemData(lSel);
if (m_clGetVideoBitrate.Parse(video_selected_stream_index))
{
StreamInfo stStreamInfo;
m_clGetVideoBitrate.GetStreamInfo(video_selected_stream_index, &stStreamInfo);
m_clFrameInfoList.AddListItem(&stStreamInfo, &m_clGetVideoBitrate.GetFrameList());
}
}
else
{
MessageBox(_T("Please select a stream."), _T("Error"), MB_OK);
}
return 0;
}
BOOL CInfoPanelDlg::Open(LPCTSTR lpszFileName)
{
if (!m_clGetVideoBitrate.Open(lpszFileName))
{
MessageBox(m_clGetVideoBitrate.GetErrorMsg(), _T("Error"), MB_OK);
return FALSE;
}
else
{
UINT count = m_clGetVideoBitrate.GetStreamCount();
if (count > 0)
{
for (UINT i = 0; i < count; ++i)
{
StreamInfo stStreamInfo;
if (m_clGetVideoBitrate.GetStreamInfo(i, &stStreamInfo))
{
AddStreamInfo(stStreamInfo.strStreamName, i);
}
}
}
}
return TRUE;
}
void CInfoPanelDlg::AddStreamInfo(CString strDesc, UINT index)
{
CComboBox clStreamInfo = GetDlgItem(IDC_STREAMINFO);
int nAddedIndex = clStreamInfo.AddString(strDesc);
clStreamInfo.SetItemData(nAddedIndex, (DWORD_PTR)index);
}