mirror of https://github.com/odrling/Aegisub
Apparently long long isn't safe, trying with int64_t instead then...
Originally committed to SVN as r1547.
This commit is contained in:
parent
a228af752a
commit
89d076c760
|
@ -212,7 +212,7 @@ public:
|
||||||
void SetTypes(unsigned t) { m_types = t; }
|
void SetTypes(unsigned t) { m_types = t; }
|
||||||
|
|
||||||
HRESULT GetFrameFormat(unsigned *type, unsigned *width, unsigned *height, int *stride,
|
HRESULT GetFrameFormat(unsigned *type, unsigned *width, unsigned *height, int *stride,
|
||||||
unsigned *pbpp, unsigned *arx, unsigned *ary, long long *def_duration)
|
unsigned *pbpp, unsigned *arx, unsigned *ary, __int64 *def_duration)
|
||||||
{
|
{
|
||||||
if (!IsConnected())
|
if (!IsConnected())
|
||||||
return VFW_E_NOT_CONNECTED;
|
return VFW_E_NOT_CONNECTED;
|
||||||
|
@ -449,7 +449,7 @@ public:
|
||||||
m_hNotify = hEvent;
|
m_hNotify = hEvent;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
STDMETHOD(GetFrameFormat)(unsigned *type, unsigned *width, unsigned *height, unsigned *arx, unsigned *ary, long long *def_duration) {
|
STDMETHOD(GetFrameFormat)(unsigned *type, unsigned *width, unsigned *height, unsigned *arx, unsigned *ary, __int64 *def_duration) {
|
||||||
CheckPointer(type, E_POINTER);
|
CheckPointer(type, E_POINTER);
|
||||||
CheckPointer(width, E_POINTER);
|
CheckPointer(width, E_POINTER);
|
||||||
CheckPointer(height, E_POINTER);
|
CheckPointer(height, E_POINTER);
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface IVideoSinkNotify : public IUnknown {
|
||||||
#define IVS_YUY2 4
|
#define IVS_YUY2 4
|
||||||
#define IVS_YV12 8
|
#define IVS_YV12 8
|
||||||
|
|
||||||
typedef void (*ReadFrameFunc)(long long timestamp, unsigned format, unsigned bpp,
|
typedef void (*ReadFrameFunc)(__int64 timestamp, unsigned format, unsigned bpp,
|
||||||
const unsigned char *frame, unsigned width, unsigned height, int stride,
|
const unsigned char *frame, unsigned width, unsigned height, int stride,
|
||||||
unsigned arx, unsigned ary,
|
unsigned arx, unsigned ary,
|
||||||
void *arg);
|
void *arg);
|
||||||
|
@ -43,7 +43,7 @@ interface IVideoSink : public IUnknown {
|
||||||
[uuid("80CADA0E-DFA5-4fcc-99DD-52F7C1B0E575")]
|
[uuid("80CADA0E-DFA5-4fcc-99DD-52F7C1B0E575")]
|
||||||
interface IVideoSink2 : public IUnknown {
|
interface IVideoSink2 : public IUnknown {
|
||||||
STDMETHOD(NotifyFrame)(HANDLE hEvent) = 0;
|
STDMETHOD(NotifyFrame)(HANDLE hEvent) = 0;
|
||||||
STDMETHOD(GetFrameFormat)(unsigned *type, unsigned *width, unsigned *height, unsigned *arx, unsigned *ary, long long *def_duration) = 0;
|
STDMETHOD(GetFrameFormat)(unsigned *type, unsigned *width, unsigned *height, unsigned *arx, unsigned *ary, __int64 *def_duration) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT CreateVideoSink(IBaseFilter **pVS);
|
HRESULT CreateVideoSink(IBaseFilter **pVS);
|
||||||
|
|
|
@ -203,8 +203,8 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
lineEnd = 0;
|
lineEnd = 0;
|
||||||
selStartCap = 0;
|
selStartCap = 0;
|
||||||
selEndCap = 0;
|
selEndCap = 0;
|
||||||
long long drawSelStart = 0;
|
int64_t drawSelStart = 0;
|
||||||
long long drawSelEnd = 0;
|
int64_t drawSelEnd = 0;
|
||||||
if (dialogue) {
|
if (dialogue) {
|
||||||
GetDialoguePos(lineStart,lineEnd,false);
|
GetDialoguePos(lineStart,lineEnd,false);
|
||||||
hasSel = true;
|
hasSel = true;
|
||||||
|
@ -247,7 +247,7 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
|
|
||||||
// Draw seconds boundaries
|
// Draw seconds boundaries
|
||||||
if (draw_boundary_lines) {
|
if (draw_boundary_lines) {
|
||||||
long long start = Position*samples;
|
int64_t start = Position*samples;
|
||||||
int rate = provider->GetSampleRate();
|
int rate = provider->GetSampleRate();
|
||||||
int pixBounds = rate / samples;
|
int pixBounds = rate / samples;
|
||||||
dc.SetPen(wxPen(Options.AsColour(_T("Audio Seconds Boundaries")),1,wxDOT));
|
dc.SetPen(wxPen(Options.AsColour(_T("Audio Seconds Boundaries")),1,wxDOT));
|
||||||
|
@ -302,7 +302,7 @@ void AudioDisplay::UpdateImage(bool weak) {
|
||||||
if (!spectrum) dc.SetTextForeground(Options.AsColour(_T("Audio Syllable text")));
|
if (!spectrum) dc.SetTextForeground(Options.AsColour(_T("Audio Syllable text")));
|
||||||
else dc.SetTextForeground(wxColour(255,255,255));
|
else dc.SetTextForeground(wxColour(255,255,255));
|
||||||
size_t karn = karaoke->syllables.size();
|
size_t karn = karaoke->syllables.size();
|
||||||
long long pos1,pos2;
|
int64_t pos1,pos2;
|
||||||
int len,curpos;
|
int len,curpos;
|
||||||
wxCoord tw=0,th=0;
|
wxCoord tw=0,th=0;
|
||||||
AudioKaraokeSyllable *curSyl;
|
AudioKaraokeSyllable *curSyl;
|
||||||
|
@ -479,13 +479,13 @@ void AudioDisplay::DrawTimescale(wxDC &dc) {
|
||||||
dc.SetFont(scaleFont);
|
dc.SetFont(scaleFont);
|
||||||
|
|
||||||
// Timescale ticks
|
// Timescale ticks
|
||||||
long long start = Position*samples;
|
int64_t start = Position*samples;
|
||||||
int rate = provider->GetSampleRate();
|
int rate = provider->GetSampleRate();
|
||||||
for (int i=1;i<32;i*=2) {
|
for (int i=1;i<32;i*=2) {
|
||||||
int pixBounds = rate / (samples * 4 / i);
|
int pixBounds = rate / (samples * 4 / i);
|
||||||
if (pixBounds >= 8) {
|
if (pixBounds >= 8) {
|
||||||
for (int x=0;x<w;x++) {
|
for (int x=0;x<w;x++) {
|
||||||
long long pos = (x*samples)+start;
|
int64_t pos = (x*samples)+start;
|
||||||
// Second boundary
|
// Second boundary
|
||||||
if (pos % rate < samples) {
|
if (pos % rate < samples) {
|
||||||
dc.DrawLine(x,h+2,x,h+8);
|
dc.DrawLine(x,h+2,x,h+8);
|
||||||
|
@ -541,7 +541,7 @@ void AudioDisplay::DrawWaveform(wxDC &dc,bool weak) {
|
||||||
// Draw pre-selection
|
// Draw pre-selection
|
||||||
if (!hasSel) selStartCap = w;
|
if (!hasSel) selStartCap = w;
|
||||||
dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform"))));
|
dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform"))));
|
||||||
for (long long i=0;i<selStartCap;i++) {
|
for (int64_t i=0;i<selStartCap;i++) {
|
||||||
dc.DrawLine(i,peak[i],i,min[i]-1);
|
dc.DrawLine(i,peak[i],i,min[i]-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,13 +551,13 @@ void AudioDisplay::DrawWaveform(wxDC &dc,bool weak) {
|
||||||
if (NeedCommit && !karaoke->enabled) dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform Modified"))));
|
if (NeedCommit && !karaoke->enabled) dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform Modified"))));
|
||||||
else dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform Selected"))));
|
else dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform Selected"))));
|
||||||
}
|
}
|
||||||
for (long long i=selStartCap;i<selEndCap;i++) {
|
for (int64_t i=selStartCap;i<selEndCap;i++) {
|
||||||
dc.DrawLine(i,peak[i],i,min[i]-1);
|
dc.DrawLine(i,peak[i],i,min[i]-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw post-selection
|
// Draw post-selection
|
||||||
dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform"))));
|
dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform"))));
|
||||||
for (long long i=selEndCap;i<w;i++) {
|
for (int64_t i=selEndCap;i<w;i++) {
|
||||||
dc.DrawLine(i,peak[i],i,min[i]-1);
|
dc.DrawLine(i,peak[i],i,min[i]-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,7 +618,7 @@ void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Get selection position
|
// Get selection position
|
||||||
void AudioDisplay::GetDialoguePos(long long &selStart,long long &selEnd, bool cap) {
|
void AudioDisplay::GetDialoguePos(int64_t &selStart,int64_t &selEnd, bool cap) {
|
||||||
selStart = GetXAtMS(curStartMS);
|
selStart = GetXAtMS(curStartMS);
|
||||||
selEnd = GetXAtMS(curEndMS);
|
selEnd = GetXAtMS(curEndMS);
|
||||||
|
|
||||||
|
@ -633,7 +633,7 @@ void AudioDisplay::GetDialoguePos(long long &selStart,long long &selEnd, bool ca
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Get karaoke position
|
// Get karaoke position
|
||||||
void AudioDisplay::GetKaraokePos(long long &karStart,long long &karEnd, bool cap) {
|
void AudioDisplay::GetKaraokePos(int64_t &karStart,int64_t &karEnd, bool cap) {
|
||||||
try {
|
try {
|
||||||
// Wrap around
|
// Wrap around
|
||||||
int nsyls = (int)karaoke->syllables.size();
|
int nsyls = (int)karaoke->syllables.size();
|
||||||
|
@ -759,7 +759,7 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
|
||||||
// Center scroll
|
// Center scroll
|
||||||
int oldSamples = samples;
|
int oldSamples = samples;
|
||||||
UpdateSamples();
|
UpdateSamples();
|
||||||
PositionSample += long long((oldSamples-samples)*w*pivot);
|
PositionSample += int64_t((oldSamples-samples)*w*pivot);
|
||||||
if (PositionSample < 0) PositionSample = 0;
|
if (PositionSample < 0) PositionSample = 0;
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
@ -776,7 +776,7 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
|
||||||
void AudioDisplay::UpdateSamples() {
|
void AudioDisplay::UpdateSamples() {
|
||||||
// Set samples
|
// Set samples
|
||||||
if (!provider) return;
|
if (!provider) return;
|
||||||
long long totalSamples = provider->GetNumSamples();
|
int64_t totalSamples = provider->GetNumSamples();
|
||||||
int total = totalSamples / w;
|
int total = totalSamples / w;
|
||||||
int max = 5760000 / w; // 2 minutes at 48 kHz maximum
|
int max = 5760000 / w; // 2 minutes at 48 kHz maximum
|
||||||
if (total > max) total = max;
|
if (total > max) total = max;
|
||||||
|
@ -949,42 +949,42 @@ void AudioDisplay::UpdateScrollbar() {
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// Gets the sample number at the x coordinate
|
// Gets the sample number at the x coordinate
|
||||||
long long AudioDisplay::GetSampleAtX(int x) {
|
int64_t AudioDisplay::GetSampleAtX(int x) {
|
||||||
return (x+Position)*samples;
|
return (x+Position)*samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// Gets the x coordinate corresponding to sample
|
// Gets the x coordinate corresponding to sample
|
||||||
int AudioDisplay::GetXAtSample(long long n) {
|
int AudioDisplay::GetXAtSample(int64_t n) {
|
||||||
return samples ? (n/samples)-Position : 0;
|
return samples ? (n/samples)-Position : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Get MS from X
|
// Get MS from X
|
||||||
int AudioDisplay::GetMSAtX(long long x) {
|
int AudioDisplay::GetMSAtX(int64_t x) {
|
||||||
return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate();
|
return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Get X from MS
|
// Get X from MS
|
||||||
int AudioDisplay::GetXAtMS(long long ms) {
|
int AudioDisplay::GetXAtMS(int64_t ms) {
|
||||||
return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples;
|
return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Get MS At sample
|
// Get MS At sample
|
||||||
int AudioDisplay::GetMSAtSample(long long x) {
|
int AudioDisplay::GetMSAtSample(int64_t x) {
|
||||||
return x * 1000 / provider->GetSampleRate();
|
return x * 1000 / provider->GetSampleRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// Get Sample at MS
|
// Get Sample at MS
|
||||||
long long AudioDisplay::GetSampleAtMS(long long ms) {
|
int64_t AudioDisplay::GetSampleAtMS(int64_t ms) {
|
||||||
return ms * provider->GetSampleRate() / 1000;
|
return ms * provider->GetSampleRate() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ void AudioDisplay::Play(int start,int end) {
|
||||||
|
|
||||||
// Set defaults
|
// Set defaults
|
||||||
wxLogDebug(_T("AudioDisplay::Play: initialising playback"));
|
wxLogDebug(_T("AudioDisplay::Play: initialising playback"));
|
||||||
long long num_samples = provider->GetNumSamples();
|
int64_t num_samples = provider->GetNumSamples();
|
||||||
start = GetSampleAtMS(start);
|
start = GetSampleAtMS(start);
|
||||||
if (end != -1) end = GetSampleAtMS(end);
|
if (end != -1) end = GetSampleAtMS(end);
|
||||||
else end = num_samples-1;
|
else end = num_samples-1;
|
||||||
|
@ -1301,8 +1301,8 @@ void AudioDisplay::OnPaint(wxPaintEvent& event) {
|
||||||
// Mouse event
|
// Mouse event
|
||||||
void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
// Get x,y
|
// Get x,y
|
||||||
long long x = event.GetX();
|
int64_t x = event.GetX();
|
||||||
long long y = event.GetY();
|
int64_t y = event.GetY();
|
||||||
bool karMode = karaoke->enabled;
|
bool karMode = karaoke->enabled;
|
||||||
bool shiftDown = event.m_shiftDown;
|
bool shiftDown = event.m_shiftDown;
|
||||||
int timelineHeight = Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
int timelineHeight = Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
|
||||||
|
@ -1511,7 +1511,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
// Karaoke mode
|
// Karaoke mode
|
||||||
else {
|
else {
|
||||||
// Look for a syllable
|
// Look for a syllable
|
||||||
long long pos,len,curpos;
|
int64_t pos,len,curpos;
|
||||||
AudioKaraokeSyllable *curSyl;
|
AudioKaraokeSyllable *curSyl;
|
||||||
size_t karn = karaoke->syllables.size();
|
size_t karn = karaoke->syllables.size();
|
||||||
for (size_t i=0;i<karn;i++) {
|
for (size_t i=0;i<karn;i++) {
|
||||||
|
@ -1625,7 +1625,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
pos = GetXAtMS(curStartMS+(len+curpos)*10);
|
pos = GetXAtMS(curStartMS+(len+curpos)*10);
|
||||||
if (x != pos) {
|
if (x != pos) {
|
||||||
// Calculate delta in centiseconds
|
// Calculate delta in centiseconds
|
||||||
int delta = ((long long)(x-pos)*samples*100)/provider->GetSampleRate();
|
int delta = ((int64_t)(x-pos)*samples*100)/provider->GetSampleRate();
|
||||||
|
|
||||||
// Apply delta
|
// Apply delta
|
||||||
int deltaMode = 0;
|
int deltaMode = 0;
|
||||||
|
@ -1701,7 +1701,7 @@ int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) {
|
||||||
bool snapKey = Options.AsBool(_T("Audio snap to keyframes"));
|
bool snapKey = Options.AsBool(_T("Audio snap to keyframes"));
|
||||||
if (shiftHeld) snapKey = !snapKey;
|
if (shiftHeld) snapKey = !snapKey;
|
||||||
if (snapKey && VideoContext::Get()->KeyFramesLoaded() && Options.AsBool(_T("Audio Draw Keyframes"))) {
|
if (snapKey && VideoContext::Get()->KeyFramesLoaded() && Options.AsBool(_T("Audio Draw Keyframes"))) {
|
||||||
long long keyMS;
|
int64_t keyMS;
|
||||||
wxArrayInt keyFrames = VideoContext::Get()->GetKeyFrames();
|
wxArrayInt keyFrames = VideoContext::Get()->GetKeyFrames();
|
||||||
int frame;
|
int frame;
|
||||||
for (unsigned int i=0;i<keyFrames.Count();i++) {
|
for (unsigned int i=0;i<keyFrames.Count();i++) {
|
||||||
|
@ -1799,11 +1799,11 @@ int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) {
|
||||||
// Scrub
|
// Scrub
|
||||||
if (scrubbing && scrubButton) {
|
if (scrubbing && scrubButton) {
|
||||||
// Get current data
|
// Get current data
|
||||||
long long exactPos = MAX(0,GetSampleAtX(x));
|
int64_t exactPos = MAX(0,GetSampleAtX(x));
|
||||||
int curScrubTime = clock();
|
int curScrubTime = clock();
|
||||||
int scrubDeltaTime = curScrubTime - scrubTime;
|
int scrubDeltaTime = curScrubTime - scrubTime;
|
||||||
bool invert = exactPos < scrubLastPos;
|
bool invert = exactPos < scrubLastPos;
|
||||||
long long curScrubPos = exactPos;
|
int64_t curScrubPos = exactPos;
|
||||||
|
|
||||||
if (scrubDeltaTime > 0) {
|
if (scrubDeltaTime > 0) {
|
||||||
// Get derived data
|
// Get derived data
|
||||||
|
@ -1811,7 +1811,7 @@ int AudioDisplay::GetBoundarySnap(int ms,int rangeX,bool shiftHeld,bool start) {
|
||||||
int curRate = MID(int(scrubLastRate-rateChange),abs(int(exactPos - scrubLastPos)) * CLOCKS_PER_SEC / scrubDeltaTime,int(scrubLastRate+rateChange));
|
int curRate = MID(int(scrubLastRate-rateChange),abs(int(exactPos - scrubLastPos)) * CLOCKS_PER_SEC / scrubDeltaTime,int(scrubLastRate+rateChange));
|
||||||
if (abs(curRate-scrubLastRate) < rateChange) curRate = scrubLastRate;
|
if (abs(curRate-scrubLastRate) < rateChange) curRate = scrubLastRate;
|
||||||
curScrubPos = scrubLastPos + (curRate * scrubDeltaTime / CLOCKS_PER_SEC * (invert ? -1 : 1));
|
curScrubPos = scrubLastPos + (curRate * scrubDeltaTime / CLOCKS_PER_SEC * (invert ? -1 : 1));
|
||||||
long long scrubDelta = curScrubPos - scrubLastPos;
|
int64_t scrubDelta = curScrubPos - scrubLastPos;
|
||||||
scrubLastRate = curRate;
|
scrubLastRate = curRate;
|
||||||
|
|
||||||
// Copy data to buffer
|
// Copy data to buffer
|
||||||
|
@ -1913,7 +1913,7 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
|
||||||
// Draw cursor
|
// Draw cursor
|
||||||
int curpos = -1;
|
int curpos = -1;
|
||||||
if (player->IsPlaying()) {
|
if (player->IsPlaying()) {
|
||||||
long long curPos = player->GetCurrentPosition();
|
int64_t curPos = player->GetCurrentPosition();
|
||||||
if (curPos > player->GetStartPosition() && curPos < player->GetEndPosition()) {
|
if (curPos > player->GetStartPosition() && curPos < player->GetEndPosition()) {
|
||||||
// Scroll if needed
|
// Scroll if needed
|
||||||
int posX = GetXAtSample(curPos);
|
int posX = GetXAtSample(curPos);
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include "audio_provider.h"
|
#include "audio_provider.h"
|
||||||
#include "audio_player.h"
|
#include "audio_player.h"
|
||||||
#include "audio_spectrum.h"
|
#include "audio_spectrum.h"
|
||||||
|
@ -71,10 +72,10 @@ private:
|
||||||
wxBitmap *origImage;
|
wxBitmap *origImage;
|
||||||
wxBitmap *spectrumDisplay;
|
wxBitmap *spectrumDisplay;
|
||||||
wxBitmap *spectrumDisplaySelected;
|
wxBitmap *spectrumDisplaySelected;
|
||||||
long long PositionSample;
|
int64_t PositionSample;
|
||||||
float scale;
|
float scale;
|
||||||
int samples;
|
int samples;
|
||||||
long long Position;
|
int64_t Position;
|
||||||
int samplesPercent;
|
int samplesPercent;
|
||||||
int oldCurPos;
|
int oldCurPos;
|
||||||
bool hasFocus;
|
bool hasFocus;
|
||||||
|
@ -86,12 +87,12 @@ private:
|
||||||
bool diagUpdated;
|
bool diagUpdated;
|
||||||
bool holding;
|
bool holding;
|
||||||
bool draggingScale;
|
bool draggingScale;
|
||||||
long long selStart;
|
int64_t selStart;
|
||||||
long long selEnd;
|
int64_t selEnd;
|
||||||
long long lineStart;
|
int64_t lineStart;
|
||||||
long long lineEnd;
|
int64_t lineEnd;
|
||||||
long long selStartCap;
|
int64_t selStartCap;
|
||||||
long long selEndCap;
|
int64_t selEndCap;
|
||||||
int hold;
|
int hold;
|
||||||
int lastX;
|
int lastX;
|
||||||
int lastDragX;
|
int lastDragX;
|
||||||
|
@ -103,7 +104,7 @@ private:
|
||||||
int *min;
|
int *min;
|
||||||
|
|
||||||
int scrubTime;
|
int scrubTime;
|
||||||
long long scrubLastPos;
|
int64_t scrubLastPos;
|
||||||
bool scrubbing;
|
bool scrubbing;
|
||||||
int scrubLastRate;
|
int scrubLastRate;
|
||||||
|
|
||||||
|
@ -122,8 +123,8 @@ private:
|
||||||
void DrawInactiveLines(wxDC &dc);
|
void DrawInactiveLines(wxDC &dc);
|
||||||
void DrawWaveform(wxDC &dc,bool weak);
|
void DrawWaveform(wxDC &dc,bool weak);
|
||||||
void DrawSpectrum(wxDC &dc,bool weak);
|
void DrawSpectrum(wxDC &dc,bool weak);
|
||||||
void GetDialoguePos(long long &start,long long &end,bool cap);
|
void GetDialoguePos(int64_t &start,int64_t &end,bool cap);
|
||||||
void GetKaraokePos(long long &start,long long &end,bool cap);
|
void GetKaraokePos(int64_t &start,int64_t &end,bool cap);
|
||||||
void UpdatePosition(int pos,bool IsSample=false);
|
void UpdatePosition(int pos,bool IsSample=false);
|
||||||
|
|
||||||
int GetBoundarySnap(int x,int range,bool shiftHeld,bool start=true);
|
int GetBoundarySnap(int x,int range,bool shiftHeld,bool start=true);
|
||||||
|
@ -169,12 +170,12 @@ public:
|
||||||
void Play(int start,int end);
|
void Play(int start,int end);
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
long long GetSampleAtX(int x);
|
int64_t GetSampleAtX(int x);
|
||||||
int GetXAtSample(long long n);
|
int GetXAtSample(int64_t n);
|
||||||
int GetMSAtX(long long x);
|
int GetMSAtX(int64_t x);
|
||||||
int GetXAtMS(long long ms);
|
int GetXAtMS(int64_t ms);
|
||||||
int GetMSAtSample(long long x);
|
int GetMSAtSample(int64_t x);
|
||||||
long long GetSampleAtMS(long long ms);
|
int64_t GetSampleAtMS(int64_t ms);
|
||||||
int GetSyllableAtX(int x);
|
int GetSyllableAtX(int x);
|
||||||
|
|
||||||
void GetTimesDialogue(int &start,int &end);
|
void GetTimesDialogue(int &start,int &end);
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ public:
|
||||||
virtual void OpenStream() {}
|
virtual void OpenStream() {}
|
||||||
virtual void CloseStream() {}
|
virtual void CloseStream() {}
|
||||||
|
|
||||||
virtual void Play(long long start,long long count)=0; // Play sample range
|
virtual void Play(int64_t start,int64_t count)=0; // Play sample range
|
||||||
virtual void Stop(bool timerToo=true)=0; // Stop playing
|
virtual void Stop(bool timerToo=true)=0; // Stop playing
|
||||||
virtual void RequestStop(); // Request it to stop playing in a thread-safe way
|
virtual void RequestStop(); // Request it to stop playing in a thread-safe way
|
||||||
virtual bool IsPlaying()=0;
|
virtual bool IsPlaying()=0;
|
||||||
|
@ -75,11 +76,11 @@ public:
|
||||||
virtual void SetVolume(double volume)=0;
|
virtual void SetVolume(double volume)=0;
|
||||||
virtual double GetVolume()=0;
|
virtual double GetVolume()=0;
|
||||||
|
|
||||||
virtual long long GetStartPosition()=0;
|
virtual int64_t GetStartPosition()=0;
|
||||||
virtual long long GetEndPosition()=0;
|
virtual int64_t GetEndPosition()=0;
|
||||||
virtual long long GetCurrentPosition()=0;
|
virtual int64_t GetCurrentPosition()=0;
|
||||||
virtual void SetEndPosition(long long pos)=0;
|
virtual void SetEndPosition(int64_t pos)=0;
|
||||||
virtual void SetCurrentPosition(long long pos)=0;
|
virtual void SetCurrentPosition(int64_t pos)=0;
|
||||||
|
|
||||||
virtual wxMutex *GetMutex();
|
virtual wxMutex *GetMutex();
|
||||||
|
|
||||||
|
|
|
@ -85,15 +85,15 @@ public:
|
||||||
void OpenStream();
|
void OpenStream();
|
||||||
void CloseStream();
|
void CloseStream();
|
||||||
|
|
||||||
void Play(long long start,long long count);
|
void Play(int64_t start,int64_t count);
|
||||||
void Stop(bool timerToo=true);
|
void Stop(bool timerToo=true);
|
||||||
bool IsPlaying();
|
bool IsPlaying();
|
||||||
|
|
||||||
long long GetStartPosition();
|
int64_t GetStartPosition();
|
||||||
long long GetEndPosition();
|
int64_t GetEndPosition();
|
||||||
long long GetCurrentPosition();
|
int64_t GetCurrentPosition();
|
||||||
void SetEndPosition(long long pos);
|
void SetEndPosition(int64_t pos);
|
||||||
void SetCurrentPosition(long long pos);
|
void SetCurrentPosition(int64_t pos);
|
||||||
|
|
||||||
void SetVolume(double vol) { volume = vol; }
|
void SetVolume(double vol) { volume = vol; }
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
|
@ -311,7 +311,7 @@ void AlsaPlayer::CloseStream()
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// Play
|
// Play
|
||||||
void AlsaPlayer::Play(long long start,long long count)
|
void AlsaPlayer::Play(int64_t start,int64_t count)
|
||||||
{
|
{
|
||||||
if (playing) {
|
if (playing) {
|
||||||
// Quick reset
|
// Quick reset
|
||||||
|
@ -367,7 +367,7 @@ bool AlsaPlayer::IsPlaying()
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Set end
|
// Set end
|
||||||
void AlsaPlayer::SetEndPosition(long long pos)
|
void AlsaPlayer::SetEndPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
end_frame = pos;
|
end_frame = pos;
|
||||||
}
|
}
|
||||||
|
@ -375,19 +375,19 @@ void AlsaPlayer::SetEndPosition(long long pos)
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Set current position
|
// Set current position
|
||||||
void AlsaPlayer::SetCurrentPosition(long long pos)
|
void AlsaPlayer::SetCurrentPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
cur_frame = pos;
|
cur_frame = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long AlsaPlayer::GetStartPosition()
|
int64_t AlsaPlayer::GetStartPosition()
|
||||||
{
|
{
|
||||||
return start_frame;
|
return start_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long AlsaPlayer::GetEndPosition()
|
int64_t AlsaPlayer::GetEndPosition()
|
||||||
{
|
{
|
||||||
return end_frame;
|
return end_frame;
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ long long AlsaPlayer::GetEndPosition()
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Get current position
|
// Get current position
|
||||||
long long AlsaPlayer::GetCurrentPosition()
|
int64_t AlsaPlayer::GetCurrentPosition()
|
||||||
{
|
{
|
||||||
// FIXME: this should be based on not duration played but actual sample being heard
|
// FIXME: this should be based on not duration played but actual sample being heard
|
||||||
// (during vidoeo playback, cur_frame might get changed to resync)
|
// (during vidoeo playback, cur_frame might get changed to resync)
|
||||||
|
|
|
@ -88,9 +88,9 @@ private:
|
||||||
int offset;
|
int offset;
|
||||||
DWORD bufSize;
|
DWORD bufSize;
|
||||||
|
|
||||||
volatile long long playPos;
|
volatile int64_t playPos;
|
||||||
long long startPos;
|
int64_t startPos;
|
||||||
volatile long long endPos;
|
volatile int64_t endPos;
|
||||||
DWORD startTime;
|
DWORD startTime;
|
||||||
|
|
||||||
IDirectSound8 *directSound;
|
IDirectSound8 *directSound;
|
||||||
|
@ -107,15 +107,15 @@ public:
|
||||||
void OpenStream();
|
void OpenStream();
|
||||||
void CloseStream();
|
void CloseStream();
|
||||||
|
|
||||||
void Play(long long start,long long count);
|
void Play(int64_t start,int64_t count);
|
||||||
void Stop(bool timerToo=true);
|
void Stop(bool timerToo=true);
|
||||||
bool IsPlaying() { return playing; }
|
bool IsPlaying() { return playing; }
|
||||||
|
|
||||||
long long GetStartPosition() { return startPos; }
|
int64_t GetStartPosition() { return startPos; }
|
||||||
long long GetEndPosition() { return endPos; }
|
int64_t GetEndPosition() { return endPos; }
|
||||||
long long GetCurrentPosition();
|
int64_t GetCurrentPosition();
|
||||||
void SetEndPosition(long long pos);
|
void SetEndPosition(int64_t pos);
|
||||||
void SetCurrentPosition(long long pos);
|
void SetCurrentPosition(int64_t pos);
|
||||||
|
|
||||||
void SetVolume(double vol) { volume = vol; }
|
void SetVolume(double vol) { volume = vol; }
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
|
@ -318,7 +318,7 @@ RetryLock:
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// Play
|
// Play
|
||||||
void DirectSoundPlayer::Play(long long start,long long count) {
|
void DirectSoundPlayer::Play(int64_t start,int64_t count) {
|
||||||
// Make sure that it's stopped
|
// Make sure that it's stopped
|
||||||
Stop();
|
Stop();
|
||||||
// The thread is now guaranteed dead
|
// The thread is now guaranteed dead
|
||||||
|
@ -389,14 +389,14 @@ void DirectSoundPlayer::Stop(bool timerToo) {
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Set end
|
// Set end
|
||||||
void DirectSoundPlayer::SetEndPosition(long long pos) {
|
void DirectSoundPlayer::SetEndPosition(int64_t pos) {
|
||||||
if (playing) endPos = pos;
|
if (playing) endPos = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Set current position
|
// Set current position
|
||||||
void DirectSoundPlayer::SetCurrentPosition(long long pos) {
|
void DirectSoundPlayer::SetCurrentPosition(int64_t pos) {
|
||||||
startPos = playPos = pos;
|
startPos = playPos = pos;
|
||||||
startTime = GetTickCount();
|
startTime = GetTickCount();
|
||||||
}
|
}
|
||||||
|
@ -404,14 +404,14 @@ void DirectSoundPlayer::SetCurrentPosition(long long pos) {
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Get current position
|
// Get current position
|
||||||
long long DirectSoundPlayer::GetCurrentPosition() {
|
int64_t DirectSoundPlayer::GetCurrentPosition() {
|
||||||
// Check if buffer is loaded
|
// Check if buffer is loaded
|
||||||
if (!buffer || !playing) return 0;
|
if (!buffer || !playing) return 0;
|
||||||
|
|
||||||
// FIXME: this should be based on not duration played but actual sample being heard
|
// FIXME: this should be based on not duration played but actual sample being heard
|
||||||
// (during vidoeo playback, cur_frame might get changed to resync)
|
// (during vidoeo playback, cur_frame might get changed to resync)
|
||||||
DWORD curtime = GetTickCount();
|
DWORD curtime = GetTickCount();
|
||||||
long long tdiff = curtime - startTime;
|
int64_t tdiff = curtime - startTime;
|
||||||
return startPos + tdiff * provider->GetSampleRate() / 1000;
|
return startPos + tdiff * provider->GetSampleRate() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,15 +95,15 @@ public:
|
||||||
void OpenStream();
|
void OpenStream();
|
||||||
void CloseStream();
|
void CloseStream();
|
||||||
|
|
||||||
void Play(long long start,long long count);
|
void Play(int64_t start,int64_t count);
|
||||||
void Stop(bool timerToo=true);
|
void Stop(bool timerToo=true);
|
||||||
bool IsPlaying();
|
bool IsPlaying();
|
||||||
|
|
||||||
long long GetStartPosition();
|
int64_t GetStartPosition();
|
||||||
long long GetEndPosition();
|
int64_t GetEndPosition();
|
||||||
long long GetCurrentPosition();
|
int64_t GetCurrentPosition();
|
||||||
void SetEndPosition(long long pos);
|
void SetEndPosition(int64_t pos);
|
||||||
void SetCurrentPosition(long long pos);
|
void SetCurrentPosition(int64_t pos);
|
||||||
|
|
||||||
void SetVolume(double vol) { volume = vol; }
|
void SetVolume(double vol) { volume = vol; }
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
|
@ -217,7 +217,7 @@ void OpenALPlayer::CloseStream()
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// Play
|
// Play
|
||||||
void OpenALPlayer::Play(long long start,long long count)
|
void OpenALPlayer::Play(int64_t start,int64_t count)
|
||||||
{
|
{
|
||||||
if (playing) {
|
if (playing) {
|
||||||
// Quick reset
|
// Quick reset
|
||||||
|
@ -354,7 +354,7 @@ bool OpenALPlayer::IsPlaying()
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Set end
|
// Set end
|
||||||
void OpenALPlayer::SetEndPosition(long long pos)
|
void OpenALPlayer::SetEndPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
end_frame = pos;
|
end_frame = pos;
|
||||||
}
|
}
|
||||||
|
@ -362,19 +362,19 @@ void OpenALPlayer::SetEndPosition(long long pos)
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Set current position
|
// Set current position
|
||||||
void OpenALPlayer::SetCurrentPosition(long long pos)
|
void OpenALPlayer::SetCurrentPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
cur_frame = pos;
|
cur_frame = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long OpenALPlayer::GetStartPosition()
|
int64_t OpenALPlayer::GetStartPosition()
|
||||||
{
|
{
|
||||||
return start_frame;
|
return start_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long OpenALPlayer::GetEndPosition()
|
int64_t OpenALPlayer::GetEndPosition()
|
||||||
{
|
{
|
||||||
return end_frame;
|
return end_frame;
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ long long OpenALPlayer::GetEndPosition()
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Get current position
|
// Get current position
|
||||||
long long OpenALPlayer::GetCurrentPosition()
|
int64_t OpenALPlayer::GetCurrentPosition()
|
||||||
{
|
{
|
||||||
// FIXME: this should be based on not duration played but actual sample being heard
|
// FIXME: this should be based on not duration played but actual sample being heard
|
||||||
// (during vidoeo playback, cur_frame might get changed to resync)
|
// (during vidoeo playback, cur_frame might get changed to resync)
|
||||||
|
|
|
@ -67,12 +67,12 @@ private:
|
||||||
bool playing;
|
bool playing;
|
||||||
float volume;
|
float volume;
|
||||||
|
|
||||||
volatile long long playPos;
|
volatile int64_t playPos;
|
||||||
volatile long long startPos;
|
volatile int64_t startPos;
|
||||||
volatile long long endPos;
|
volatile int64_t endPos;
|
||||||
void *stream;
|
void *stream;
|
||||||
PaTimestamp paStart;
|
PaTimestamp paStart;
|
||||||
volatile long long realPlayPos;
|
volatile int64_t realPlayPos;
|
||||||
|
|
||||||
#ifndef HAVE_PA_GETSTREAMTIME
|
#ifndef HAVE_PA_GETSTREAMTIME
|
||||||
static int paCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, PaTimestamp outTime, void *userData);
|
static int paCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, PaTimestamp outTime, void *userData);
|
||||||
|
@ -90,15 +90,15 @@ public:
|
||||||
void OpenStream();
|
void OpenStream();
|
||||||
void CloseStream();
|
void CloseStream();
|
||||||
|
|
||||||
void Play(long long start,long long count);
|
void Play(int64_t start,int64_t count);
|
||||||
void Stop(bool timerToo=true);
|
void Stop(bool timerToo=true);
|
||||||
bool IsPlaying() { return playing; }
|
bool IsPlaying() { return playing; }
|
||||||
|
|
||||||
long long GetStartPosition() { return startPos; }
|
int64_t GetStartPosition() { return startPos; }
|
||||||
long long GetEndPosition() { return endPos; }
|
int64_t GetEndPosition() { return endPos; }
|
||||||
long long GetCurrentPosition() { return realPlayPos; }
|
int64_t GetCurrentPosition() { return realPlayPos; }
|
||||||
void SetEndPosition(long long pos) { endPos = pos; }
|
void SetEndPosition(int64_t pos) { endPos = pos; }
|
||||||
void SetCurrentPosition(long long pos) { playPos = pos; realPlayPos = pos; }
|
void SetCurrentPosition(int64_t pos) { playPos = pos; realPlayPos = pos; }
|
||||||
|
|
||||||
void SetVolume(double vol) { volume = vol; }
|
void SetVolume(double vol) { volume = vol; }
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
|
@ -165,8 +165,8 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer,
|
||||||
int end = 0;
|
int end = 0;
|
||||||
|
|
||||||
// Calculate how much left
|
// Calculate how much left
|
||||||
long long lenAvailable = player->endPos - player->playPos;
|
int64_t lenAvailable = player->endPos - player->playPos;
|
||||||
unsigned long long avail = 0;
|
unsigned int64_t avail = 0;
|
||||||
if (lenAvailable > 0) {
|
if (lenAvailable > 0) {
|
||||||
avail = lenAvailable;
|
avail = lenAvailable;
|
||||||
if (avail > framesPerBuffer) {
|
if (avail > framesPerBuffer) {
|
||||||
|
@ -194,7 +194,7 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer,
|
||||||
// Set play position (and real one)
|
// Set play position (and real one)
|
||||||
player->playPos += framesPerBuffer;
|
player->playPos += framesPerBuffer;
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
player->realPlayPos = (long long)(Pa_StreamTime(player->stream) - player->paStart) + player->startPos;
|
player->realPlayPos = (int64_t)(Pa_StreamTime(player->stream) - player->paStart) + player->startPos;
|
||||||
#else
|
#else
|
||||||
// AudioDeviceGetCurrentTime(), used by Pa_StreamTime() on OS X, is buggered, so use playPos for now
|
// AudioDeviceGetCurrentTime(), used by Pa_StreamTime() on OS X, is buggered, so use playPos for now
|
||||||
player->realPlayPos = player->playPos;
|
player->realPlayPos = player->playPos;
|
||||||
|
@ -207,7 +207,7 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer,
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// Play
|
// Play
|
||||||
void PortAudioPlayer::Play(long long start,long long count) {
|
void PortAudioPlayer::Play(int64_t start,int64_t count) {
|
||||||
// Stop if it's already playing
|
// Stop if it's already playing
|
||||||
wxMutexLocker locker(PAMutex);
|
wxMutexLocker locker(PAMutex);
|
||||||
|
|
||||||
|
|
|
@ -100,15 +100,15 @@ public:
|
||||||
void OpenStream();
|
void OpenStream();
|
||||||
void CloseStream();
|
void CloseStream();
|
||||||
|
|
||||||
void Play(long long start,long long count);
|
void Play(int64_t start,int64_t count);
|
||||||
void Stop(bool timerToo=true);
|
void Stop(bool timerToo=true);
|
||||||
bool IsPlaying();
|
bool IsPlaying();
|
||||||
|
|
||||||
long long GetStartPosition();
|
int64_t GetStartPosition();
|
||||||
long long GetEndPosition();
|
int64_t GetEndPosition();
|
||||||
long long GetCurrentPosition();
|
int64_t GetCurrentPosition();
|
||||||
void SetEndPosition(long long pos);
|
void SetEndPosition(int64_t pos);
|
||||||
void SetCurrentPosition(long long pos);
|
void SetCurrentPosition(int64_t pos);
|
||||||
|
|
||||||
void SetVolume(double vol) { volume = vol; }
|
void SetVolume(double vol) { volume = vol; }
|
||||||
double GetVolume() { return volume; }
|
double GetVolume() { return volume; }
|
||||||
|
@ -271,7 +271,7 @@ void PulseAudioPlayer::CloseStream()
|
||||||
|
|
||||||
////////
|
////////
|
||||||
// Play
|
// Play
|
||||||
void PulseAudioPlayer::Play(long long start,long long count)
|
void PulseAudioPlayer::Play(int64_t start,int64_t count)
|
||||||
{
|
{
|
||||||
//printf("Starting PulseAudio playback\n");
|
//printf("Starting PulseAudio playback\n");
|
||||||
if (!open) OpenStream();
|
if (!open) OpenStream();
|
||||||
|
@ -365,7 +365,7 @@ bool PulseAudioPlayer::IsPlaying()
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
// Set end
|
// Set end
|
||||||
void PulseAudioPlayer::SetEndPosition(long long pos)
|
void PulseAudioPlayer::SetEndPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
end_frame = pos;
|
end_frame = pos;
|
||||||
}
|
}
|
||||||
|
@ -373,19 +373,19 @@ void PulseAudioPlayer::SetEndPosition(long long pos)
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Set current position
|
// Set current position
|
||||||
void PulseAudioPlayer::SetCurrentPosition(long long pos)
|
void PulseAudioPlayer::SetCurrentPosition(int64_t pos)
|
||||||
{
|
{
|
||||||
cur_frame = pos;
|
cur_frame = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long PulseAudioPlayer::GetStartPosition()
|
int64_t PulseAudioPlayer::GetStartPosition()
|
||||||
{
|
{
|
||||||
return start_frame;
|
return start_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long long PulseAudioPlayer::GetEndPosition()
|
int64_t PulseAudioPlayer::GetEndPosition()
|
||||||
{
|
{
|
||||||
return end_frame;
|
return end_frame;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ long long PulseAudioPlayer::GetEndPosition()
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Get current position
|
// Get current position
|
||||||
long long PulseAudioPlayer::GetCurrentPosition()
|
int64_t PulseAudioPlayer::GetCurrentPosition()
|
||||||
{
|
{
|
||||||
if (!is_playing) return 0;
|
if (!is_playing) return 0;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ int AudioProvider::GetChannels() {
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Get number of samples
|
// Get number of samples
|
||||||
long long AudioProvider::GetNumSamples() {
|
int64_t AudioProvider::GetNumSamples() {
|
||||||
return num_samples;
|
return num_samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ wxString AudioProvider::GetFilename() {
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// Get waveform
|
// Get waveform
|
||||||
void AudioProvider::GetWaveForm(int *min,int *peak,long long start,int w,int h,int samples,float scale) {
|
void AudioProvider::GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale) {
|
||||||
// Setup
|
// Setup
|
||||||
int channels = GetChannels();
|
int channels = GetChannels();
|
||||||
int n = w * samples;
|
int n = w * samples;
|
||||||
|
@ -161,7 +161,7 @@ void AudioProvider::GetWaveForm(int *min,int *peak,long long start,int w,int h,i
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Get audio with volume
|
// Get audio with volume
|
||||||
void AudioProvider::GetAudioWithVolume(void *buf, long long start, long long count, double volume) {
|
void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) {
|
||||||
GetAudio(buf,start,count);
|
GetAudio(buf,start,count);
|
||||||
if (volume == 1.0) return;
|
if (volume == 1.0) return;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ void AudioProvider::GetAudioWithVolume(void *buf, long long start, long long cou
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
// Modify
|
// Modify
|
||||||
for (long long i=0;i<count;i++) {
|
for (int64_t i=0;i<count;i++) {
|
||||||
value = (int)(buffer[i]*volume+0.5);
|
value = (int)(buffer[i]*volume+0.5);
|
||||||
if (value < -0x8000) value = -0x8000;
|
if (value < -0x8000) value = -0x8000;
|
||||||
if (value > 0x7FFF) value = 0x7FFF;
|
if (value > 0x7FFF) value = 0x7FFF;
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
///////////
|
///////////
|
||||||
// Headers
|
// Headers
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include "factory.h"
|
#include "factory.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int channels;
|
int channels;
|
||||||
long long num_samples; // for one channel, ie. number of PCM frames
|
int64_t num_samples; // for one channel, ie. number of PCM frames
|
||||||
int sample_rate;
|
int sample_rate;
|
||||||
int bytes_per_sample;
|
int bytes_per_sample;
|
||||||
|
|
||||||
|
@ -69,15 +70,15 @@ public:
|
||||||
virtual ~AudioProvider();
|
virtual ~AudioProvider();
|
||||||
|
|
||||||
virtual wxString GetFilename();
|
virtual wxString GetFilename();
|
||||||
virtual void GetAudio(void *buf, long long start, long long count)=0;
|
virtual void GetAudio(void *buf, int64_t start, int64_t count)=0;
|
||||||
void GetAudioWithVolume(void *buf, long long start, long long count, double volume);
|
void GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume);
|
||||||
|
|
||||||
long long GetNumSamples();
|
int64_t GetNumSamples();
|
||||||
int GetSampleRate();
|
int GetSampleRate();
|
||||||
int GetBytesPerSample();
|
int GetBytesPerSample();
|
||||||
int GetChannels();
|
int GetChannels();
|
||||||
|
|
||||||
void GetWaveForm(int *min,int *peak,long long start,int w,int h,int samples,float scale);
|
void GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ public:
|
||||||
|
|
||||||
wxString GetFilename();
|
wxString GetFilename();
|
||||||
|
|
||||||
void GetAudio(void *buf, long long start, long long count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
void GetWaveForm(int *min,int *peak,long long start,int w,int h,int samples,float scale);
|
void GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int samples,float scale);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,10 +206,10 @@ wxString AvisynthAudioProvider::GetFilename() {
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// Get audio
|
// Get audio
|
||||||
void AvisynthAudioProvider::GetAudio(void *buf, long long start, long long count) {
|
void AvisynthAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) {
|
||||||
// Requested beyond the length of audio
|
// Requested beyond the length of audio
|
||||||
if (start+count > num_samples) {
|
if (start+count > num_samples) {
|
||||||
long long oldcount = count;
|
int64_t oldcount = count;
|
||||||
count = num_samples-start;
|
count = num_samples-start;
|
||||||
if (count < 0) count = 0;
|
if (count < 0) count = 0;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ DummyAudioProvider::DummyAudioProvider(unsigned long dur_ms, bool _noise) {
|
||||||
channels = 1;
|
channels = 1;
|
||||||
sample_rate = 44100;
|
sample_rate = 44100;
|
||||||
bytes_per_sample = 2;
|
bytes_per_sample = 2;
|
||||||
num_samples = (long long)dur_ms * sample_rate / 1000;
|
num_samples = (int64_t)dur_ms * sample_rate / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ DummyAudioProvider::~DummyAudioProvider() {
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// Get audio
|
// Get audio
|
||||||
void DummyAudioProvider::GetAudio(void *buf, long long start, long long count) {
|
void DummyAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) {
|
||||||
short *workbuf = (short*)buf;
|
short *workbuf = (short*)buf;
|
||||||
|
|
||||||
if (noise) {
|
if (noise) {
|
||||||
|
|
|
@ -52,5 +52,5 @@ public:
|
||||||
DummyAudioProvider(unsigned long dur_ms, bool _noise);
|
DummyAudioProvider(unsigned long dur_ms, bool _noise);
|
||||||
~DummyAudioProvider();
|
~DummyAudioProvider();
|
||||||
|
|
||||||
void GetAudio(void *buf, long long start, long long count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,7 +78,7 @@ HDAudioProvider::HDAudioProvider(AudioProvider *source) {
|
||||||
// Write to disk
|
// Write to disk
|
||||||
int block = 4096;
|
int block = 4096;
|
||||||
char *temp = new char[block * channels * bytes_per_sample];
|
char *temp = new char[block * channels * bytes_per_sample];
|
||||||
for (long long i=0;i<num_samples && !canceled; i+=block) {
|
for (int64_t i=0;i<num_samples && !canceled; i+=block) {
|
||||||
if (block+i > num_samples) block = num_samples - i;
|
if (block+i > num_samples) block = num_samples - i;
|
||||||
source->GetAudio(temp,i,block);
|
source->GetAudio(temp,i,block);
|
||||||
file_cache.Write(temp,block * channels * bytes_per_sample);
|
file_cache.Write(temp,block * channels * bytes_per_sample);
|
||||||
|
@ -107,10 +107,10 @@ HDAudioProvider::~HDAudioProvider() {
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// Get audio
|
// Get audio
|
||||||
void HDAudioProvider::GetAudio(void *buf, long long start, long long count) {
|
void HDAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) {
|
||||||
// Requested beyond the length of audio
|
// Requested beyond the length of audio
|
||||||
if (start+count > num_samples) {
|
if (start+count > num_samples) {
|
||||||
long long oldcount = count;
|
int64_t oldcount = count;
|
||||||
count = num_samples-start;
|
count = num_samples-start;
|
||||||
if (count < 0) count = 0;
|
if (count < 0) count = 0;
|
||||||
|
|
||||||
|
|
|
@ -58,5 +58,5 @@ public:
|
||||||
HDAudioProvider(AudioProvider *source);
|
HDAudioProvider(AudioProvider *source);
|
||||||
~HDAudioProvider();
|
~HDAudioProvider();
|
||||||
|
|
||||||
void GetAudio(void *buf, long long start, long long count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
public:
|
public:
|
||||||
LAVCAudioProvider(wxString _filename);
|
LAVCAudioProvider(wxString _filename);
|
||||||
virtual ~LAVCAudioProvider();
|
virtual ~LAVCAudioProvider();
|
||||||
virtual void GetAudio(void *buf, long long start, long long count);
|
virtual void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ LAVCAudioProvider::LAVCAudioProvider(wxString _filename)
|
||||||
resample_ratio = (float)sample_rate / (float)codecContext->sample_rate;
|
resample_ratio = (float)sample_rate / (float)codecContext->sample_rate;
|
||||||
|
|
||||||
double length = (double)stream->duration * av_q2d(stream->time_base);
|
double length = (double)stream->duration * av_q2d(stream->time_base);
|
||||||
num_samples = (long long)(length * sample_rate);
|
num_samples = (int64_t)(length * sample_rate);
|
||||||
|
|
||||||
buffer = (int16_t *)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
buffer = (int16_t *)malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
|
@ -181,10 +181,10 @@ void LAVCAudioProvider::Destroy()
|
||||||
lavcfile->Release();
|
lavcfile->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LAVCAudioProvider::GetAudio(void *buf, long long start, long long count)
|
void LAVCAudioProvider::GetAudio(void *buf, int64_t start, int64_t count)
|
||||||
{
|
{
|
||||||
int16_t *_buf = (int16_t *)buf;
|
int16_t *_buf = (int16_t *)buf;
|
||||||
long long _count = num_samples - start;
|
int64_t _count = num_samples - start;
|
||||||
if (count < _count)
|
if (count < _count)
|
||||||
_count = count;
|
_count = count;
|
||||||
if (_count < 0)
|
if (_count < 0)
|
||||||
|
@ -203,8 +203,8 @@ void LAVCAudioProvider::GetAudio(void *buf, long long start, long long count)
|
||||||
|
|
||||||
samples = bytesout >> 1;
|
samples = bytesout >> 1;
|
||||||
if (rsct) {
|
if (rsct) {
|
||||||
if ((long long)(samples * resample_ratio / codecContext->channels) > _count)
|
if ((int64_t)(samples * resample_ratio / codecContext->channels) > _count)
|
||||||
samples = (long long)(_count / resample_ratio * codecContext->channels);
|
samples = (int64_t)(_count / resample_ratio * codecContext->channels);
|
||||||
samples = audio_resample(rsct, _buf, buffer, samples / codecContext->channels);
|
samples = audio_resample(rsct, _buf, buffer, samples / codecContext->channels);
|
||||||
|
|
||||||
assert(samples <= _count);
|
assert(samples <= _count);
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
void PCMAudioProvider::GetAudio(void *buf, long long start, long long count)
|
void PCMAudioProvider::GetAudio(void *buf, int64_t start, int64_t count)
|
||||||
{
|
{
|
||||||
// We'll be seeking in the file so state can become inconsistent
|
// We'll be seeking in the file so state can become inconsistent
|
||||||
wxMutexLocker _fml(filemutex);
|
wxMutexLocker _fml(filemutex);
|
||||||
|
@ -54,7 +54,7 @@ void PCMAudioProvider::GetAudio(void *buf, long long start, long long count)
|
||||||
if (ip.start_sample <= start && ip.start_sample+ip.num_samples > start) {
|
if (ip.start_sample <= start && ip.start_sample+ip.num_samples > start) {
|
||||||
|
|
||||||
// How many samples we can maximum take from this block
|
// How many samples we can maximum take from this block
|
||||||
long long samples_can_do = ip.num_samples - start + ip.start_sample;
|
int64_t samples_can_do = ip.num_samples - start + ip.start_sample;
|
||||||
if (samples_can_do > count) samples_can_do = count;
|
if (samples_can_do > count) samples_can_do = count;
|
||||||
|
|
||||||
// Read as many samples we can
|
// Read as many samples we can
|
||||||
|
@ -166,8 +166,8 @@ public:
|
||||||
// This won't pick up 'data' chunks inside 'wavl' chunks
|
// This won't pick up 'data' chunks inside 'wavl' chunks
|
||||||
// since the 'wavl' chunks wrap those.
|
// since the 'wavl' chunks wrap those.
|
||||||
|
|
||||||
long long samples = ch.size / bytes_per_sample;
|
int64_t samples = ch.size / bytes_per_sample;
|
||||||
long long frames = samples / channels;
|
int64_t frames = samples / channels;
|
||||||
|
|
||||||
IndexPoint ip;
|
IndexPoint ip;
|
||||||
ip.start_sample = num_samples;
|
ip.start_sample = num_samples;
|
||||||
|
@ -217,7 +217,7 @@ public:
|
||||||
delete provider;
|
delete provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetAudio(void *buf, long long start, long long count)
|
void GetAudio(void *buf, int64_t start, int64_t count)
|
||||||
{
|
{
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
|
|
||||||
|
|
|
@ -54,18 +54,18 @@ protected:
|
||||||
// Hold data for an index point,
|
// Hold data for an index point,
|
||||||
// to support files where audio data are
|
// to support files where audio data are
|
||||||
// split into multiple blocks.
|
// split into multiple blocks.
|
||||||
// Using long long's should be safe on most compilers,
|
// Using int64_t's should be safe on most compilers,
|
||||||
// wx defines wxFileOffset as long long when possible
|
// wx defines wxFileOffset as int64 when possible
|
||||||
struct IndexPoint {
|
struct IndexPoint {
|
||||||
long long start_byte;
|
int64_t start_byte;
|
||||||
long long start_sample;
|
int64_t start_sample;
|
||||||
long long num_samples;
|
int64_t num_samples;
|
||||||
};
|
};
|
||||||
typedef std::vector<IndexPoint> IndexVector;
|
typedef std::vector<IndexPoint> IndexVector;
|
||||||
IndexVector index_points;
|
IndexVector index_points;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void GetAudio(void *buf, long long start, long long count);
|
virtual void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Construct the right PCM audio provider (if any) for the file
|
// Construct the right PCM audio provider (if any) for the file
|
||||||
|
|
|
@ -55,7 +55,7 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *source) {
|
||||||
blockcount = 0;
|
blockcount = 0;
|
||||||
|
|
||||||
// Allocate cache
|
// Allocate cache
|
||||||
long long ssize = source->GetNumSamples() * source->GetBytesPerSample();
|
int64_t ssize = source->GetNumSamples() * source->GetBytesPerSample();
|
||||||
blockcount = (ssize + CacheBlockSize - 1) >> CacheBits;
|
blockcount = (ssize + CacheBlockSize - 1) >> CacheBits;
|
||||||
blockcache = new char*[blockcount];
|
blockcache = new char*[blockcount];
|
||||||
for (int i = 0; i < blockcount; i++) {
|
for (int i = 0; i < blockcount; i++) {
|
||||||
|
@ -124,10 +124,10 @@ void RAMAudioProvider::Clear() {
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// Get audio
|
// Get audio
|
||||||
void RAMAudioProvider::GetAudio(void *buf, long long start, long long count) {
|
void RAMAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) {
|
||||||
// Requested beyond the length of audio
|
// Requested beyond the length of audio
|
||||||
if (start+count > num_samples) {
|
if (start+count > num_samples) {
|
||||||
long long oldcount = count;
|
int64_t oldcount = count;
|
||||||
count = num_samples-start;
|
count = num_samples-start;
|
||||||
if (count < 0) count = 0;
|
if (count < 0) count = 0;
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void RAMAudioProvider::GetAudio(void *buf, long long start, long long count) {
|
||||||
char *charbuf = (char *)buf;
|
char *charbuf = (char *)buf;
|
||||||
int i = (start*bytes_per_sample) >> CacheBits;
|
int i = (start*bytes_per_sample) >> CacheBits;
|
||||||
int start_offset = (start*bytes_per_sample) & (CacheBlockSize-1);
|
int start_offset = (start*bytes_per_sample) & (CacheBlockSize-1);
|
||||||
long long bytesremaining = count*bytes_per_sample;
|
int64_t bytesremaining = count*bytes_per_sample;
|
||||||
|
|
||||||
// Copy
|
// Copy
|
||||||
while (bytesremaining) {
|
while (bytesremaining) {
|
||||||
|
|
|
@ -55,5 +55,5 @@ public:
|
||||||
RAMAudioProvider(AudioProvider *source);
|
RAMAudioProvider(AudioProvider *source);
|
||||||
~RAMAudioProvider();
|
~RAMAudioProvider();
|
||||||
|
|
||||||
void GetAudio(void *buf, long long start, long long count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,9 +67,9 @@ StreamAudioProvider::~StreamAudioProvider() {
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// Get audio
|
// Get audio
|
||||||
void StreamAudioProvider::GetAudio(void *buf, long long start, long long count) {
|
void StreamAudioProvider::GetAudio(void *buf, int64_t start, int64_t count) {
|
||||||
// Write
|
// Write
|
||||||
long long left = count;
|
int64_t left = count;
|
||||||
int written = 0;
|
int written = 0;
|
||||||
int toWrite;
|
int toWrite;
|
||||||
short *dst = (short*) buf;
|
short *dst = (short*) buf;
|
||||||
|
@ -101,7 +101,7 @@ void StreamAudioProvider::GetAudio(void *buf, long long start, long long count)
|
||||||
// Still left, fill with zero
|
// Still left, fill with zero
|
||||||
if (left > 0) {
|
if (left > 0) {
|
||||||
hasBuf = false;
|
hasBuf = false;
|
||||||
for (long long i=written;i<count;i++) {
|
for (int64_t i=written;i<count;i++) {
|
||||||
dst[i] = 0;
|
dst[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,9 +110,9 @@ void StreamAudioProvider::GetAudio(void *buf, long long start, long long count)
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Append audio to stream
|
// Append audio to stream
|
||||||
void StreamAudioProvider::Append(void *voidptr, long long count) {
|
void StreamAudioProvider::Append(void *voidptr, int64_t count) {
|
||||||
// Read
|
// Read
|
||||||
long long left = count;
|
int64_t left = count;
|
||||||
int read = 0;
|
int read = 0;
|
||||||
int toRead;
|
int toRead;
|
||||||
short *src = (short*) voidptr;
|
short *src = (short*) voidptr;
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
StreamAudioProvider();
|
StreamAudioProvider();
|
||||||
~StreamAudioProvider();
|
~StreamAudioProvider();
|
||||||
|
|
||||||
void GetAudio(void *buf, long long start, long long count);
|
void GetAudio(void *buf, int64_t start, int64_t count);
|
||||||
void Append(void *buf, long long count);
|
void Append(void *buf, int64_t count);
|
||||||
void SetParams(int channels,int rate,int bps);
|
void SetParams(int channels,int rate,int bps);
|
||||||
};
|
};
|
||||||
|
|
|
@ -167,7 +167,7 @@ public:
|
||||||
// line_length is half of the number of samples used to calculate a line, since half of the output from
|
// line_length is half of the number of samples used to calculate a line, since half of the output from
|
||||||
// a Fourier transform of real data is redundant, and not interesting for the purpose of creating
|
// a Fourier transform of real data is redundant, and not interesting for the purpose of creating
|
||||||
// a frequenmcy/power spectrum.
|
// a frequenmcy/power spectrum.
|
||||||
long long sample = start * line_length*2 + overlap*overlap_offset;
|
int64_t sample = start * line_length*2 + overlap*overlap_offset;
|
||||||
|
|
||||||
for (unsigned long i = 0; i < length; ++i) {
|
for (unsigned long i = 0; i < length; ++i) {
|
||||||
provider->GetAudio(raw_sample_data, sample, line_length*2);
|
provider->GetAudio(raw_sample_data, sample, line_length*2);
|
||||||
|
@ -405,7 +405,7 @@ AudioSpectrum::AudioSpectrum(AudioProvider *_provider)
|
||||||
else
|
else
|
||||||
fft_overlaps = 1 << quality_index;
|
fft_overlaps = 1 << quality_index;
|
||||||
|
|
||||||
long long _num_lines = provider->GetNumSamples() / line_length / 2;
|
int64_t _num_lines = provider->GetNumSamples() / line_length / 2;
|
||||||
//assert (_num_lines < (1<<31)); // hope it fits into 32 bits...
|
//assert (_num_lines < (1<<31)); // hope it fits into 32 bits...
|
||||||
num_lines = (unsigned long)_num_lines;
|
num_lines = (unsigned long)_num_lines;
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ AudioSpectrum::~AudioSpectrum()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AudioSpectrum::RenderRange(long long range_start, long long range_end, bool selected, unsigned char *img, int imgleft, int imgwidth, int imgpitch, int imgheight)
|
void AudioSpectrum::RenderRange(int64_t range_start, int64_t range_end, bool selected, unsigned char *img, int imgleft, int imgwidth, int imgpitch, int imgheight)
|
||||||
{
|
{
|
||||||
unsigned long first_line = (unsigned long)(fft_overlaps * range_start / line_length / 2);
|
unsigned long first_line = (unsigned long)(fft_overlaps * range_start / line_length / 2);
|
||||||
unsigned long last_line = (unsigned long)(fft_overlaps * range_end / line_length / 2);
|
unsigned long last_line = (unsigned long)(fft_overlaps * range_end / line_length / 2);
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#define AUDIO_SPECTRUM_H
|
#define AUDIO_SPECTRUM_H
|
||||||
|
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include "audio_provider.h"
|
#include "audio_provider.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +68,7 @@ public:
|
||||||
AudioSpectrum(AudioProvider *_provider);
|
AudioSpectrum(AudioProvider *_provider);
|
||||||
~AudioSpectrum();
|
~AudioSpectrum();
|
||||||
|
|
||||||
void RenderRange(long long range_start, long long range_end, bool selected, unsigned char *img, int imgleft, int imgwidth, int imgpitch, int imgheight);
|
void RenderRange(int64_t range_start, int64_t range_end, bool selected, unsigned char *img, int imgleft, int imgwidth, int imgpitch, int imgheight);
|
||||||
|
|
||||||
void SetScaling(float _power_scale);
|
void SetScaling(float _power_scale);
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
// Headers
|
// Headers
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
#include <wx/choicdlg.h>
|
#include <wx/choicdlg.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <stdint.h>
|
||||||
#include "MatroskaParser.h"
|
#include "MatroskaParser.h"
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
|
|
||||||
|
@ -68,14 +69,14 @@ class MkvFrame {
|
||||||
public:
|
public:
|
||||||
double time;
|
double time;
|
||||||
bool isKey;
|
bool isKey;
|
||||||
long long filePos;
|
int64_t filePos;
|
||||||
|
|
||||||
MkvFrame() {
|
MkvFrame() {
|
||||||
time = 0;
|
time = 0;
|
||||||
isKey = false;
|
isKey = false;
|
||||||
filePos = -1;
|
filePos = -1;
|
||||||
}
|
}
|
||||||
MkvFrame(bool keyframe,double timecode,long long _filePos) {
|
MkvFrame(bool keyframe,double timecode,int64_t _filePos) {
|
||||||
isKey = keyframe;
|
isKey = keyframe;
|
||||||
time = timecode;
|
time = timecode;
|
||||||
filePos = _filePos;
|
filePos = _filePos;
|
||||||
|
|
|
@ -651,7 +651,7 @@ void SubtitlesGrid::OnRecombine(wxCommandEvent &event) {
|
||||||
//////////////
|
//////////////
|
||||||
// Export audio clip of line
|
// Export audio clip of line
|
||||||
void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) {
|
void SubtitlesGrid::OnAudioClip(wxCommandEvent &event) {
|
||||||
long long num_samples,start=0,end=0,temp;
|
int64_t num_samples,start=0,end=0,temp;
|
||||||
AudioDisplay *audioDisplay = parentFrame->audioBox->audioDisplay;
|
AudioDisplay *audioDisplay = parentFrame->audioBox->audioDisplay;
|
||||||
AudioProvider *provider = audioDisplay->provider;
|
AudioProvider *provider = audioDisplay->provider;
|
||||||
AssDialogue *cur;
|
AssDialogue *cur;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#ifndef __LINUX__
|
#ifndef __LINUX__
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
// Absolute of 64 bit int
|
// Absolute of 64 bit int
|
||||||
long long abs64(long long input) {
|
int64_t abs64(int64_t input) {
|
||||||
if (input < 0) return -input;
|
if (input < 0) return -input;
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
// Headers
|
// Headers
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
////////////
|
////////////
|
||||||
|
@ -51,7 +52,7 @@ typedef std::vector<std::pair<int,int> > IntPairVector;
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
#ifndef __LINUX__
|
#ifndef __LINUX__
|
||||||
long long abs64(long long input);
|
int64_t abs64(int64_t input);
|
||||||
#endif
|
#endif
|
||||||
int CountMatches(wxString parent,wxString child);
|
int CountMatches(wxString parent,wxString child);
|
||||||
bool CopyFile(wxString src,wxString dst);
|
bool CopyFile(wxString src,wxString dst);
|
||||||
|
|
|
@ -742,8 +742,8 @@ void VideoContext::OnPlayTimer(wxTimerEvent &event) {
|
||||||
|
|
||||||
// Sync audio
|
// Sync audio
|
||||||
if (keepAudioSync && nextFrame % 10 == 0 && audio && audio->provider && audio->player) {
|
if (keepAudioSync && nextFrame % 10 == 0 && audio && audio->provider && audio->player) {
|
||||||
long long audPos = audio->GetSampleAtMS(VFR_Output.GetTimeAtFrame(nextFrame));
|
int64_t audPos = audio->GetSampleAtMS(VFR_Output.GetTimeAtFrame(nextFrame));
|
||||||
long long curPos = audio->player->GetCurrentPosition();
|
int64_t curPos = audio->player->GetCurrentPosition();
|
||||||
int delta = int(audPos-curPos);
|
int delta = int(audPos-curPos);
|
||||||
if (delta < 0) delta = -delta;
|
if (delta < 0) delta = -delta;
|
||||||
int maxDelta = audio->provider->GetSampleRate();
|
int maxDelta = audio->provider->GetSampleRate();
|
||||||
|
|
|
@ -346,6 +346,9 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to RGB32
|
// Convert to RGB32
|
||||||
|
// If "Avisynth renders its own subs" is enabled, this should always be done,
|
||||||
|
// regardless of shaders being enabled or not. (Since VSFilter will convert
|
||||||
|
// to RGB32 and back again itself either way.)
|
||||||
if (!OpenGLWrapper::UseShaders()) {
|
if (!OpenGLWrapper::UseShaders()) {
|
||||||
script = env->Invoke("ConvertToRGB32", script);
|
script = env->Invoke("ConvertToRGB32", script);
|
||||||
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Converted to RGB32"));
|
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Converted to RGB32"));
|
||||||
|
|
|
@ -87,12 +87,12 @@ private:
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
unsigned int num_frames;
|
unsigned int num_frames;
|
||||||
double fps;
|
double fps;
|
||||||
long long defd;
|
int64_t defd;
|
||||||
|
|
||||||
HRESULT OpenVideo(wxString _filename);
|
HRESULT OpenVideo(wxString _filename);
|
||||||
void CloseVideo();
|
void CloseVideo();
|
||||||
|
|
||||||
static void ReadFrame(long long timestamp, unsigned format, unsigned bpp, const unsigned char *frame, unsigned width, unsigned height, int stride, unsigned arx, unsigned ary, void *arg);
|
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);
|
int NextFrame(DF &df,int &fn);
|
||||||
|
|
||||||
void RegROT();
|
void RegROT();
|
||||||
|
@ -359,7 +359,7 @@ HRESULT DirectShowVideoProvider::OpenVideo(wxString _filename) {
|
||||||
|
|
||||||
// Set FPS and frame duration
|
// Set FPS and frame duration
|
||||||
if (defd == 0) defd = 417083;
|
if (defd == 0) defd = 417083;
|
||||||
if (fps != 0.0) defd = long long (10000000.0 / fps) + 1;
|
if (fps != 0.0) defd = int64_t (10000000.0 / fps) + 1;
|
||||||
else fps = 10000000.0 / double(++defd);
|
else fps = 10000000.0 / double(++defd);
|
||||||
|
|
||||||
// Set number of frames
|
// Set number of frames
|
||||||
|
@ -404,7 +404,7 @@ void DirectShowVideoProvider::CloseVideo() {
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Read DirectShow frame
|
// Read DirectShow frame
|
||||||
void DirectShowVideoProvider::ReadFrame(long long timestamp, unsigned format, unsigned bpp, const unsigned char *frame, unsigned width, unsigned height, int stride, unsigned arx, unsigned ary, void *arg) {
|
void DirectShowVideoProvider::ReadFrame(int64_t timestamp, unsigned format, unsigned bpp, const unsigned char *frame, unsigned width, unsigned height, int stride, unsigned arx, unsigned ary, void *arg) {
|
||||||
// Set frame
|
// Set frame
|
||||||
DF *df = (DF*) arg;
|
DF *df = (DF*) arg;
|
||||||
df->timestamp = timestamp;
|
df->timestamp = timestamp;
|
||||||
|
@ -472,7 +472,7 @@ int DirectShowVideoProvider::NextFrame(DF &df,int &_fn) {
|
||||||
// VFR
|
// VFR
|
||||||
else {
|
else {
|
||||||
for (unsigned int i=0;i<frameTime.Count();i++) {
|
for (unsigned int i=0;i<frameTime.Count();i++) {
|
||||||
if (df.timestamp < (long long) frameTime[i] * 10000) {
|
if (df.timestamp < (int64_t) frameTime[i] * 10000) {
|
||||||
frameno = i-1;
|
frameno = i-1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ private:
|
||||||
wxArrayInt bytePos;
|
wxArrayInt bytePos;
|
||||||
|
|
||||||
bool isMkv;
|
bool isMkv;
|
||||||
long long lastDecodeTime;
|
int64_t lastDecodeTime;
|
||||||
int frameNumber;
|
int frameNumber;
|
||||||
int length;
|
int length;
|
||||||
AegiVideoFrame curFrame;
|
AegiVideoFrame curFrame;
|
||||||
|
@ -375,16 +375,16 @@ const AegiVideoFrame LAVCVideoProvider::DoGetFrame(int n) {
|
||||||
// Needs to seek
|
// Needs to seek
|
||||||
else {
|
else {
|
||||||
// Prepare seek
|
// Prepare seek
|
||||||
long long seekTo;
|
int64_t seekTo;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Get time to seek to
|
// Get time to seek to
|
||||||
if (isMkv) {
|
if (isMkv) {
|
||||||
//long long base = AV_TIME_BASE;
|
//int64_t base = AV_TIME_BASE;
|
||||||
//long long time = VFR_Output.GetTimeAtFrame(n,true) * base / 1000000;
|
//int64_t time = VFR_Output.GetTimeAtFrame(n,true) * base / 1000000;
|
||||||
//seekTo = av_rescale(time,stream->time_base.den,AV_TIME_BASE * long long(stream->time_base.num));
|
//seekTo = av_rescale(time,stream->time_base.den,AV_TIME_BASE * int64_t(stream->time_base.num));
|
||||||
//seekTo = long long(n) * 1000 * stream->r_frame_rate.den / stream->r_frame_rate.num;
|
//seekTo = int64_t(n) * 1000 * stream->r_frame_rate.den / stream->r_frame_rate.num;
|
||||||
//seekTo = bytePos[n];
|
//seekTo = bytePos[n];
|
||||||
|
|
||||||
//result = av_seek_frame(formatContext,vidStream,seekTo,AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_BYTE);
|
//result = av_seek_frame(formatContext,vidStream,seekTo,AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_BYTE);
|
||||||
|
@ -392,8 +392,8 @@ const AegiVideoFrame LAVCVideoProvider::DoGetFrame(int n) {
|
||||||
// Prepare mkv seek
|
// Prepare mkv seek
|
||||||
ulonglong startTime, endTime, filePos;
|
ulonglong startTime, endTime, filePos;
|
||||||
unsigned int rt, frameSize, frameFlags;
|
unsigned int rt, frameSize, frameFlags;
|
||||||
ulonglong targetTime = (long long)(VFR_Output.GetTimeAtFrame(n,true,true))*1000000;
|
ulonglong targetTime = (int64_t)(VFR_Output.GetTimeAtFrame(n,true,true))*1000000;
|
||||||
//ulonglong targetTime = (long long)(n) * 1000 * stream->r_frame_rate.den / stream->r_frame_rate.num;
|
//ulonglong targetTime = (int64_t)(n) * 1000 * stream->r_frame_rate.den / stream->r_frame_rate.num;
|
||||||
//ulonglong targetTime = mkv.rawFrames[n].time * 1000000;
|
//ulonglong targetTime = mkv.rawFrames[n].time * 1000000;
|
||||||
mkv_Seek(mkv.file,targetTime,MKVF_SEEK_TO_PREV_KEYFRAME);
|
mkv_Seek(mkv.file,targetTime,MKVF_SEEK_TO_PREV_KEYFRAME);
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ int VideoSlider::GetValueAtX(int x) {
|
||||||
if (w <= 10) return 0;
|
if (w <= 10) return 0;
|
||||||
|
|
||||||
// Calculate
|
// Calculate
|
||||||
return (long long)(x-5)*(long long)(max-min)/(long long)(w-10)+min;
|
return (int64_t)(x-5)*(int64_t)(max-min)/(int64_t)(w-10)+min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ int VideoSlider::GetXAtValue(int value) {
|
||||||
if (max-min <= 0) return 0;
|
if (max-min <= 0) return 0;
|
||||||
|
|
||||||
// Calculate
|
// Calculate
|
||||||
return (long long)(value-min)*(long long)(w-10)/(long long)(max-min)+5;
|
return (int64_t)(value-min)*(int64_t)(w-10)/(int64_t)(max-min)+5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue