forked from mia/Aegisub
Fixed directshow... again.
Originally committed to SVN as r1939.
This commit is contained in:
parent
d181c3a7f6
commit
eb5be3115a
2 changed files with 7 additions and 80 deletions
|
@ -93,15 +93,15 @@ void FFT::DoTransform (size_t n_samples,float *input,float *output_r,float *outp
|
|||
ai[2] = sm2;
|
||||
|
||||
for (j=i,n=0;n<BlockEnd;j++,n++) {
|
||||
ar[0] = w*ar[1] - ar[2];
|
||||
ar[2] = ar[1];
|
||||
ar[1] = ar[0];
|
||||
k = j + BlockEnd;
|
||||
|
||||
ar[0] = w*ar[1] - ar[2];
|
||||
ai[0] = w*ai[1] - ai[2];
|
||||
ar[2] = ar[1];
|
||||
ai[2] = ai[1];
|
||||
ar[1] = ar[0];
|
||||
ai[1] = ai[0];
|
||||
|
||||
k = j + BlockEnd;
|
||||
tr = ar[0]*output_r[k] - ai[0]*output_i[k];
|
||||
ti = ar[0]*output_i[k] + ai[0]*output_r[k];
|
||||
|
||||
|
@ -119,10 +119,10 @@ void FFT::DoTransform (size_t n_samples,float *input,float *output_r,float *outp
|
|||
|
||||
// Divide everything by number of samples if it's an inverse transform
|
||||
if (inverse) {
|
||||
float denom = (float)n_samples;
|
||||
float denom = 1.0f/(float)n_samples;
|
||||
for (i=0;i<n_samples;i++) {
|
||||
output_r[i] /= denom;
|
||||
output_i[i] /= denom;
|
||||
output_r[i] *= denom;
|
||||
output_i[i] *= denom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,79 +59,6 @@
|
|||
#include "video_provider_dshow.h"
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
// DirectShow Video Provider class
|
||||
class DirectShowVideoProvider: public VideoProvider {
|
||||
struct DF {
|
||||
public:
|
||||
REFERENCE_TIME timestamp; // DS timestamp that we used for this frame
|
||||
AegiVideoFrame frame;
|
||||
|
||||
DF() : timestamp(-1) { }
|
||||
DF(AegiVideoFrame f) : timestamp(-1), frame(f) { }
|
||||
DF(const DF& f) { operator=(f); }
|
||||
DF& operator=(const DF& f) { timestamp = f.timestamp; frame = f.frame; return *this; }
|
||||
};
|
||||
|
||||
private:
|
||||
wxArrayInt frameTime;
|
||||
|
||||
unsigned int last_fnum;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int num_frames;
|
||||
double fps;
|
||||
int64_t defd;
|
||||
|
||||
HRESULT OpenVideo(wxString _filename);
|
||||
void CloseVideo();
|
||||
|
||||
static void ReadFrame(__int64 timestamp, unsigned format, unsigned bpp, const unsigned char *frame, unsigned width, unsigned height, int stride, unsigned arx, unsigned ary, void *arg);
|
||||
int NextFrame(DF &df,int &fn);
|
||||
|
||||
void RegROT();
|
||||
void UnregROT();
|
||||
|
||||
REFERENCE_TIME duration;
|
||||
DF rdf;
|
||||
CComPtr<IVideoSink> m_pR;
|
||||
CComPtr<IMediaControl> m_pGC;
|
||||
CComPtr<IMediaSeeking> m_pGS;
|
||||
HANDLE m_hFrameReady;
|
||||
bool m_registered;
|
||||
DWORD m_rot_cookie;
|
||||
|
||||
public:
|
||||
DirectShowVideoProvider(wxString _filename, double _fps=0.0);
|
||||
~DirectShowVideoProvider();
|
||||
|
||||
void RefreshSubtitles();
|
||||
|
||||
const AegiVideoFrame DoGetFrame(int n);
|
||||
void GetFloatFrame(float* Buffer, int n);
|
||||
|
||||
int GetPosition() { return last_fnum; };
|
||||
int GetFrameCount() { return num_frames; };
|
||||
double GetFPS() { return fps; };
|
||||
int GetWidth() { return width; };
|
||||
int GetHeight() { return height; };
|
||||
wxString GetDecoderName() { return _("DirectShow"); }
|
||||
|
||||
void OverrideFrameTimeList(wxArrayInt list);
|
||||
};
|
||||
|
||||
|
||||
|
||||
///////////
|
||||
// Factory
|
||||
class DirectShowVideoProviderFactory : public VideoProviderFactory {
|
||||
public:
|
||||
VideoProvider *CreateProvider(wxString video,double fps=0.0) { return new DirectShowVideoProvider(video,fps); }
|
||||
DirectShowVideoProviderFactory() : VideoProviderFactory(_T("dshow")) {}
|
||||
} registerDShow;
|
||||
|
||||
|
||||
|
||||
///////////////
|
||||
// Constructor
|
||||
// Based on Haali's code for DirectShowSource2
|
||||
|
|
Loading…
Reference in a new issue