forked from Frieve-A/Frieve-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdsdecoder.h
More file actions
105 lines (85 loc) · 2.49 KB
/
Copy pathdsdecoder.h
File metadata and controls
105 lines (85 loc) · 2.49 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
97
98
99
100
101
102
103
104
105
//---------------------------------------------------------------------------
#ifndef dsdecoderH
#define dsdecoderH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Dialogs.hpp>
#include <dshow.h>
#include <qedit.h>
/*
#include <windows.h>
#include <iostream.h>
#include <control.h>
#include <mediaobj.h>
#include <strmif.h>
#include <dmodshow.h>
#include <objbase.h>
*/
//---------------------------------------------------------------------------
class ICBBMP
{
public:
virtual void CBBMP(Graphics::TBitmap *BMP) = 0;
};
//---------------------------------------------------------------------------
class ICBWAVE
{
public:
virtual void CBWAVE(double time, void *buf, int len) = 0;
};
class TDSDecoder : public TThread, ISampleGrabberCB
{
public: // ユーザー宣言
__fastcall TDSDecoder(bool CreateSuspended);
void __fastcall Execute();
//設定
AnsiString m_FN;
ICBBMP *CBBMP;
ICBWAVE *CBWAVE;
bool m_bGrub;//データぶっこ抜き
bool m_bUnsync;
bool m_bLoop;//最後まで再生したら自動的に先頭に戻る
double m_fLoopStartPos, m_fLoopEndPos;//ループ箇所(ms)
//状態
bool m_bExecuted;//スレッドが実行に入っている
bool m_bPrepared;//準備済み
bool m_bWaitToPlay;//再生待ちする
bool m_bFinished;//再生終了フラグ
//操作
double GetLength();
double GetPosition();
void SetPosition(double ms);
void WaitPrepared();
WAVEFORMATEX *GetWaveFormatEx();
VIDEOINFOHEADER *GetVideoInfoHeader();
void GetBMP(Graphics::TBitmap *BMP);
IGraphBuilder *pGraphBuilder;
IMediaControl *pMediaControl;
IMediaFilter *pMediaFilter;
IMediaSeeking *pMediaSeeking;
ISampleGrabber *pSampleGrabber;
VIDEOINFOHEADER *pVideoInfoHeader;
WAVEFORMATEX *pWaveFormatEx;
AM_MEDIA_TYPE am_media_type;
STDMETHODIMP_(ULONG) AddRef() { return 2; }
STDMETHODIMP_(ULONG) Release() { return 1; }
STDMETHODIMP QueryInterface(REFIID riid, void ** ppv){
if( riid == IID_ISampleGrabberCB || riid == IID_IUnknown ){
//*ppv = (void *) static_cast<ISampleGrabberCB*> ( this );
*ppv = (void *)this;
return NOERROR;
}
return E_NOINTERFACE;
}
HRESULT __stdcall SampleCB(
double SampleTime,
IMediaSample *pSample);
HRESULT __stdcall BufferCB(
double SampleTime,
BYTE *pBuffer,
long BufferLen);
};
#endif