Apparently long long isn't safe, trying with int64_t instead then...

Originally committed to SVN as r1547.
This commit is contained in:
Niels Martin Hansen 2007-08-31 14:11:35 +00:00
parent a228af752a
commit 89d076c760
36 changed files with 205 additions and 195 deletions

View File

@ -212,7 +212,7 @@ public:
void SetTypes(unsigned t) { m_types = t; }
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())
return VFW_E_NOT_CONNECTED;
@ -449,7 +449,7 @@ public:
m_hNotify = hEvent;
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(width, E_POINTER);
CheckPointer(height, E_POINTER);

View File

@ -21,7 +21,7 @@ interface IVideoSinkNotify : public IUnknown {
#define IVS_YUY2 4
#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,
unsigned arx, unsigned ary,
void *arg);
@ -43,7 +43,7 @@ interface IVideoSink : public IUnknown {
[uuid("80CADA0E-DFA5-4fcc-99DD-52F7C1B0E575")]
interface IVideoSink2 : public IUnknown {
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);

View File

@ -203,8 +203,8 @@ void AudioDisplay::UpdateImage(bool weak) {
lineEnd = 0;
selStartCap = 0;
selEndCap = 0;
long long drawSelStart = 0;
long long drawSelEnd = 0;
int64_t drawSelStart = 0;
int64_t drawSelEnd = 0;
if (dialogue) {
GetDialoguePos(lineStart,lineEnd,false);
hasSel = true;
@ -247,7 +247,7 @@ void AudioDisplay::UpdateImage(bool weak) {
// Draw seconds boundaries
if (draw_boundary_lines) {
long long start = Position*samples;
int64_t start = Position*samples;
int rate = provider->GetSampleRate();
int pixBounds = rate / samples;
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")));
else dc.SetTextForeground(wxColour(255,255,255));
size_t karn = karaoke->syllables.size();
long long pos1,pos2;
int64_t pos1,pos2;
int len,curpos;
wxCoord tw=0,th=0;
AudioKaraokeSyllable *curSyl;
@ -479,13 +479,13 @@ void AudioDisplay::DrawTimescale(wxDC &dc) {
dc.SetFont(scaleFont);
// Timescale ticks
long long start = Position*samples;
int64_t start = Position*samples;
int rate = provider->GetSampleRate();
for (int i=1;i<32;i*=2) {
int pixBounds = rate / (samples * 4 / i);
if (pixBounds >= 8) {
for (int x=0;x<w;x++) {
long long pos = (x*samples)+start;
int64_t pos = (x*samples)+start;
// Second boundary
if (pos % rate < samples) {
dc.DrawLine(x,h+2,x,h+8);
@ -541,7 +541,7 @@ void AudioDisplay::DrawWaveform(wxDC &dc,bool weak) {
// Draw pre-selection
if (!hasSel) selStartCap = w;
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);
}
@ -551,13 +551,13 @@ void AudioDisplay::DrawWaveform(wxDC &dc,bool weak) {
if (NeedCommit && !karaoke->enabled) dc.SetPen(wxPen(Options.AsColour(_T("Audio Waveform Modified"))));
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);
}
// Draw post-selection
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);
}
}
@ -618,7 +618,7 @@ void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
//////////////////////////
// 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);
selEnd = GetXAtMS(curEndMS);
@ -633,7 +633,7 @@ void AudioDisplay::GetDialoguePos(long long &selStart,long long &selEnd, bool ca
////////////////////////
// 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 {
// Wrap around
int nsyls = (int)karaoke->syllables.size();
@ -759,7 +759,7 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
// Center scroll
int oldSamples = samples;
UpdateSamples();
PositionSample += long long((oldSamples-samples)*w*pivot);
PositionSample += int64_t((oldSamples-samples)*w*pivot);
if (PositionSample < 0) PositionSample = 0;
// Update
@ -776,7 +776,7 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) {
void AudioDisplay::UpdateSamples() {
// Set samples
if (!provider) return;
long long totalSamples = provider->GetNumSamples();
int64_t totalSamples = provider->GetNumSamples();
int total = totalSamples / w;
int max = 5760000 / w; // 2 minutes at 48 kHz maximum
if (total > max) total = max;
@ -949,42 +949,42 @@ void AudioDisplay::UpdateScrollbar() {
//////////////////////////////////////////////
// Gets the sample number at the x coordinate
long long AudioDisplay::GetSampleAtX(int x) {
int64_t AudioDisplay::GetSampleAtX(int x) {
return (x+Position)*samples;
}
/////////////////////////////////////////////////
// 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;
}
/////////////////
// Get MS from X
int AudioDisplay::GetMSAtX(long long x) {
int AudioDisplay::GetMSAtX(int64_t x) {
return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate();
}
/////////////////
// Get X from MS
int AudioDisplay::GetXAtMS(long long ms) {
int AudioDisplay::GetXAtMS(int64_t ms) {
return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples;
}
////////////////////
// Get MS At sample
int AudioDisplay::GetMSAtSample(long long x) {
int AudioDisplay::GetMSAtSample(int64_t x) {
return x * 1000 / provider->GetSampleRate();
}
////////////////////
// Get Sample at MS
long long AudioDisplay::GetSampleAtMS(long long ms) {
int64_t AudioDisplay::GetSampleAtMS(int64_t ms) {
return ms * provider->GetSampleRate() / 1000;
}
@ -1026,7 +1026,7 @@ void AudioDisplay::Play(int start,int end) {
// Set defaults
wxLogDebug(_T("AudioDisplay::Play: initialising playback"));
long long num_samples = provider->GetNumSamples();
int64_t num_samples = provider->GetNumSamples();
start = GetSampleAtMS(start);
if (end != -1) end = GetSampleAtMS(end);
else end = num_samples-1;
@ -1301,8 +1301,8 @@ void AudioDisplay::OnPaint(wxPaintEvent& event) {
// Mouse event
void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
// Get x,y
long long x = event.GetX();
long long y = event.GetY();
int64_t x = event.GetX();
int64_t y = event.GetY();
bool karMode = karaoke->enabled;
bool shiftDown = event.m_shiftDown;
int timelineHeight = Options.AsBool(_T("Audio Draw Timeline")) ? 20 : 0;
@ -1511,7 +1511,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
// Karaoke mode
else {
// Look for a syllable
long long pos,len,curpos;
int64_t pos,len,curpos;
AudioKaraokeSyllable *curSyl;
size_t karn = karaoke->syllables.size();
for (size_t i=0;i<karn;i++) {
@ -1625,7 +1625,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
pos = GetXAtMS(curStartMS+(len+curpos)*10);
if (x != pos) {
// 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
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"));
if (shiftHeld) snapKey = !snapKey;
if (snapKey && VideoContext::Get()->KeyFramesLoaded() && Options.AsBool(_T("Audio Draw Keyframes"))) {
long long keyMS;
int64_t keyMS;
wxArrayInt keyFrames = VideoContext::Get()->GetKeyFrames();
int frame;
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
if (scrubbing && scrubButton) {
// Get current data
long long exactPos = MAX(0,GetSampleAtX(x));
int64_t exactPos = MAX(0,GetSampleAtX(x));
int curScrubTime = clock();
int scrubDeltaTime = curScrubTime - scrubTime;
bool invert = exactPos < scrubLastPos;
long long curScrubPos = exactPos;
int64_t curScrubPos = exactPos;
if (scrubDeltaTime > 0) {
// 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));
if (abs(curRate-scrubLastRate) < rateChange) curRate = scrubLastRate;
curScrubPos = scrubLastPos + (curRate * scrubDeltaTime / CLOCKS_PER_SEC * (invert ? -1 : 1));
long long scrubDelta = curScrubPos - scrubLastPos;
int64_t scrubDelta = curScrubPos - scrubLastPos;
scrubLastRate = curRate;
// Copy data to buffer
@ -1913,7 +1913,7 @@ void AudioDisplay::OnUpdateTimer(wxTimerEvent &event) {
// Draw cursor
int curpos = -1;
if (player->IsPlaying()) {
long long curPos = player->GetCurrentPosition();
int64_t curPos = player->GetCurrentPosition();
if (curPos > player->GetStartPosition() && curPos < player->GetEndPosition()) {
// Scroll if needed
int posX = GetXAtSample(curPos);

View File

@ -41,6 +41,7 @@
///////////
// Headers
#include <wx/wxprec.h>
#include <stdint.h>
#include "audio_provider.h"
#include "audio_player.h"
#include "audio_spectrum.h"
@ -71,10 +72,10 @@ private:
wxBitmap *origImage;
wxBitmap *spectrumDisplay;
wxBitmap *spectrumDisplaySelected;
long long PositionSample;
int64_t PositionSample;
float scale;
int samples;
long long Position;
int64_t Position;
int samplesPercent;
int oldCurPos;
bool hasFocus;
@ -86,12 +87,12 @@ private:
bool diagUpdated;
bool holding;
bool draggingScale;
long long selStart;
long long selEnd;
long long lineStart;
long long lineEnd;
long long selStartCap;
long long selEndCap;
int64_t selStart;
int64_t selEnd;
int64_t lineStart;
int64_t lineEnd;
int64_t selStartCap;
int64_t selEndCap;
int hold;
int lastX;
int lastDragX;
@ -103,7 +104,7 @@ private:
int *min;
int scrubTime;
long long scrubLastPos;
int64_t scrubLastPos;
bool scrubbing;
int scrubLastRate;
@ -122,8 +123,8 @@ private:
void DrawInactiveLines(wxDC &dc);
void DrawWaveform(wxDC &dc,bool weak);
void DrawSpectrum(wxDC &dc,bool weak);
void GetDialoguePos(long long &start,long long &end,bool cap);
void GetKaraokePos(long long &start,long long &end,bool cap);
void GetDialoguePos(int64_t &start,int64_t &end,bool cap);
void GetKaraokePos(int64_t &start,int64_t &end,bool cap);
void UpdatePosition(int pos,bool IsSample=false);
int GetBoundarySnap(int x,int range,bool shiftHeld,bool start=true);
@ -169,12 +170,12 @@ public:
void Play(int start,int end);
void Stop();
long long GetSampleAtX(int x);
int GetXAtSample(long long n);
int GetMSAtX(long long x);
int GetXAtMS(long long ms);
int GetMSAtSample(long long x);
long long GetSampleAtMS(long long ms);
int64_t GetSampleAtX(int x);
int GetXAtSample(int64_t n);
int GetMSAtX(int64_t x);
int GetXAtMS(int64_t ms);
int GetMSAtSample(int64_t x);
int64_t GetSampleAtMS(int64_t ms);
int GetSyllableAtX(int x);
void GetTimesDialogue(int &start,int &end);

View File

@ -40,6 +40,7 @@
///////////
// Headers
#include <wx/wxprec.h>
#include <stdint.h>
#include "factory.h"
@ -67,7 +68,7 @@ public:
virtual void OpenStream() {}
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 RequestStop(); // Request it to stop playing in a thread-safe way
virtual bool IsPlaying()=0;
@ -75,11 +76,11 @@ public:
virtual void SetVolume(double volume)=0;
virtual double GetVolume()=0;
virtual long long GetStartPosition()=0;
virtual long long GetEndPosition()=0;
virtual long long GetCurrentPosition()=0;
virtual void SetEndPosition(long long pos)=0;
virtual void SetCurrentPosition(long long pos)=0;
virtual int64_t GetStartPosition()=0;
virtual int64_t GetEndPosition()=0;
virtual int64_t GetCurrentPosition()=0;
virtual void SetEndPosition(int64_t pos)=0;
virtual void SetCurrentPosition(int64_t pos)=0;
virtual wxMutex *GetMutex();

View File

@ -85,15 +85,15 @@ public:
void OpenStream();
void CloseStream();
void Play(long long start,long long count);
void Play(int64_t start,int64_t count);
void Stop(bool timerToo=true);
bool IsPlaying();
long long GetStartPosition();
long long GetEndPosition();
long long GetCurrentPosition();
void SetEndPosition(long long pos);
void SetCurrentPosition(long long pos);
int64_t GetStartPosition();
int64_t GetEndPosition();
int64_t GetCurrentPosition();
void SetEndPosition(int64_t pos);
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
@ -311,7 +311,7 @@ void AlsaPlayer::CloseStream()
////////
// Play
void AlsaPlayer::Play(long long start,long long count)
void AlsaPlayer::Play(int64_t start,int64_t count)
{
if (playing) {
// Quick reset
@ -367,7 +367,7 @@ bool AlsaPlayer::IsPlaying()
///////////
// Set end
void AlsaPlayer::SetEndPosition(long long pos)
void AlsaPlayer::SetEndPosition(int64_t pos)
{
end_frame = pos;
}
@ -375,19 +375,19 @@ void AlsaPlayer::SetEndPosition(long long pos)
////////////////////////
// Set current position
void AlsaPlayer::SetCurrentPosition(long long pos)
void AlsaPlayer::SetCurrentPosition(int64_t pos)
{
cur_frame = pos;
}
long long AlsaPlayer::GetStartPosition()
int64_t AlsaPlayer::GetStartPosition()
{
return start_frame;
}
long long AlsaPlayer::GetEndPosition()
int64_t AlsaPlayer::GetEndPosition()
{
return end_frame;
}
@ -395,7 +395,7 @@ long long AlsaPlayer::GetEndPosition()
////////////////////////
// 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
// (during vidoeo playback, cur_frame might get changed to resync)

View File

@ -88,9 +88,9 @@ private:
int offset;
DWORD bufSize;
volatile long long playPos;
long long startPos;
volatile long long endPos;
volatile int64_t playPos;
int64_t startPos;
volatile int64_t endPos;
DWORD startTime;
IDirectSound8 *directSound;
@ -107,15 +107,15 @@ public:
void OpenStream();
void CloseStream();
void Play(long long start,long long count);
void Play(int64_t start,int64_t count);
void Stop(bool timerToo=true);
bool IsPlaying() { return playing; }
long long GetStartPosition() { return startPos; }
long long GetEndPosition() { return endPos; }
long long GetCurrentPosition();
void SetEndPosition(long long pos);
void SetCurrentPosition(long long pos);
int64_t GetStartPosition() { return startPos; }
int64_t GetEndPosition() { return endPos; }
int64_t GetCurrentPosition();
void SetEndPosition(int64_t pos);
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
@ -318,7 +318,7 @@ RetryLock:
////////
// 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
Stop();
// The thread is now guaranteed dead
@ -389,14 +389,14 @@ void DirectSoundPlayer::Stop(bool timerToo) {
///////////
// Set end
void DirectSoundPlayer::SetEndPosition(long long pos) {
void DirectSoundPlayer::SetEndPosition(int64_t pos) {
if (playing) endPos = pos;
}
////////////////////////
// Set current position
void DirectSoundPlayer::SetCurrentPosition(long long pos) {
void DirectSoundPlayer::SetCurrentPosition(int64_t pos) {
startPos = playPos = pos;
startTime = GetTickCount();
}
@ -404,14 +404,14 @@ void DirectSoundPlayer::SetCurrentPosition(long long pos) {
////////////////////////
// Get current position
long long DirectSoundPlayer::GetCurrentPosition() {
int64_t DirectSoundPlayer::GetCurrentPosition() {
// Check if buffer is loaded
if (!buffer || !playing) return 0;
// FIXME: this should be based on not duration played but actual sample being heard
// (during vidoeo playback, cur_frame might get changed to resync)
DWORD curtime = GetTickCount();
long long tdiff = curtime - startTime;
int64_t tdiff = curtime - startTime;
return startPos + tdiff * provider->GetSampleRate() / 1000;
}

View File

@ -95,15 +95,15 @@ public:
void OpenStream();
void CloseStream();
void Play(long long start,long long count);
void Play(int64_t start,int64_t count);
void Stop(bool timerToo=true);
bool IsPlaying();
long long GetStartPosition();
long long GetEndPosition();
long long GetCurrentPosition();
void SetEndPosition(long long pos);
void SetCurrentPosition(long long pos);
int64_t GetStartPosition();
int64_t GetEndPosition();
int64_t GetCurrentPosition();
void SetEndPosition(int64_t pos);
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
@ -217,7 +217,7 @@ void OpenALPlayer::CloseStream()
////////
// Play
void OpenALPlayer::Play(long long start,long long count)
void OpenALPlayer::Play(int64_t start,int64_t count)
{
if (playing) {
// Quick reset
@ -354,7 +354,7 @@ bool OpenALPlayer::IsPlaying()
///////////
// Set end
void OpenALPlayer::SetEndPosition(long long pos)
void OpenALPlayer::SetEndPosition(int64_t pos)
{
end_frame = pos;
}
@ -362,19 +362,19 @@ void OpenALPlayer::SetEndPosition(long long pos)
////////////////////////
// Set current position
void OpenALPlayer::SetCurrentPosition(long long pos)
void OpenALPlayer::SetCurrentPosition(int64_t pos)
{
cur_frame = pos;
}
long long OpenALPlayer::GetStartPosition()
int64_t OpenALPlayer::GetStartPosition()
{
return start_frame;
}
long long OpenALPlayer::GetEndPosition()
int64_t OpenALPlayer::GetEndPosition()
{
return end_frame;
}
@ -382,7 +382,7 @@ long long OpenALPlayer::GetEndPosition()
////////////////////////
// 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
// (during vidoeo playback, cur_frame might get changed to resync)

View File

@ -67,12 +67,12 @@ private:
bool playing;
float volume;
volatile long long playPos;
volatile long long startPos;
volatile long long endPos;
volatile int64_t playPos;
volatile int64_t startPos;
volatile int64_t endPos;
void *stream;
PaTimestamp paStart;
volatile long long realPlayPos;
volatile int64_t realPlayPos;
#ifndef HAVE_PA_GETSTREAMTIME
static int paCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, PaTimestamp outTime, void *userData);
@ -90,15 +90,15 @@ public:
void OpenStream();
void CloseStream();
void Play(long long start,long long count);
void Play(int64_t start,int64_t count);
void Stop(bool timerToo=true);
bool IsPlaying() { return playing; }
long long GetStartPosition() { return startPos; }
long long GetEndPosition() { return endPos; }
long long GetCurrentPosition() { return realPlayPos; }
void SetEndPosition(long long pos) { endPos = pos; }
void SetCurrentPosition(long long pos) { playPos = pos; realPlayPos = pos; }
int64_t GetStartPosition() { return startPos; }
int64_t GetEndPosition() { return endPos; }
int64_t GetCurrentPosition() { return realPlayPos; }
void SetEndPosition(int64_t pos) { endPos = pos; }
void SetCurrentPosition(int64_t pos) { playPos = pos; realPlayPos = pos; }
void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
@ -165,8 +165,8 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer,
int end = 0;
// Calculate how much left
long long lenAvailable = player->endPos - player->playPos;
unsigned long long avail = 0;
int64_t lenAvailable = player->endPos - player->playPos;
unsigned int64_t avail = 0;
if (lenAvailable > 0) {
avail = lenAvailable;
if (avail > framesPerBuffer) {
@ -194,7 +194,7 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer,
// Set play position (and real one)
player->playPos += framesPerBuffer;
#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
// AudioDeviceGetCurrentTime(), used by Pa_StreamTime() on OS X, is buggered, so use playPos for now
player->realPlayPos = player->playPos;
@ -207,7 +207,7 @@ int PortAudioPlayer::paCallback(const void *inputBuffer, void *outputBuffer,
////////
// 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
wxMutexLocker locker(PAMutex);

View File

@ -100,15 +100,15 @@ public:
void OpenStream();
void CloseStream();
void Play(long long start,long long count);
void Play(int64_t start,int64_t count);
void Stop(bool timerToo=true);
bool IsPlaying();
long long GetStartPosition();
long long GetEndPosition();
long long GetCurrentPosition();
void SetEndPosition(long long pos);
void SetCurrentPosition(long long pos);
int64_t GetStartPosition();
int64_t GetEndPosition();
int64_t GetCurrentPosition();
void SetEndPosition(int64_t pos);
void SetCurrentPosition(int64_t pos);
void SetVolume(double vol) { volume = vol; }
double GetVolume() { return volume; }
@ -271,7 +271,7 @@ void PulseAudioPlayer::CloseStream()
////////
// Play
void PulseAudioPlayer::Play(long long start,long long count)
void PulseAudioPlayer::Play(int64_t start,int64_t count)
{
//printf("Starting PulseAudio playback\n");
if (!open) OpenStream();
@ -365,7 +365,7 @@ bool PulseAudioPlayer::IsPlaying()
///////////
// Set end
void PulseAudioPlayer::SetEndPosition(long long pos)
void PulseAudioPlayer::SetEndPosition(int64_t pos)
{
end_frame = pos;
}
@ -373,19 +373,19 @@ void PulseAudioPlayer::SetEndPosition(long long pos)
////////////////////////
// Set current position
void PulseAudioPlayer::SetCurrentPosition(long long pos)
void PulseAudioPlayer::SetCurrentPosition(int64_t pos)
{
cur_frame = pos;
}
long long PulseAudioPlayer::GetStartPosition()
int64_t PulseAudioPlayer::GetStartPosition()
{
return start_frame;
}
long long PulseAudioPlayer::GetEndPosition()
int64_t PulseAudioPlayer::GetEndPosition()
{
return end_frame;
}
@ -393,7 +393,7 @@ long long PulseAudioPlayer::GetEndPosition()
////////////////////////
// Get current position
long long PulseAudioPlayer::GetCurrentPosition()
int64_t PulseAudioPlayer::GetCurrentPosition()
{
if (!is_playing) return 0;

View File

@ -68,7 +68,7 @@ int AudioProvider::GetChannels() {
//////////////////////////
// Get number of samples
long long AudioProvider::GetNumSamples() {
int64_t AudioProvider::GetNumSamples() {
return num_samples;
}
@ -96,7 +96,7 @@ wxString AudioProvider::GetFilename() {
////////////////
// 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
int channels = GetChannels();
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
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);
if (volume == 1.0) return;
@ -171,7 +171,7 @@ void AudioProvider::GetAudioWithVolume(void *buf, long long start, long long cou
int value;
// Modify
for (long long i=0;i<count;i++) {
for (int64_t i=0;i<count;i++) {
value = (int)(buffer[i]*volume+0.5);
if (value < -0x8000) value = -0x8000;
if (value > 0x7FFF) value = 0x7FFF;

View File

@ -40,6 +40,7 @@
///////////
// Headers
#include <wx/wxprec.h>
#include <stdint.h>
#include "factory.h"
@ -58,7 +59,7 @@ private:
protected:
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 bytes_per_sample;
@ -69,15 +70,15 @@ public:
virtual ~AudioProvider();
virtual wxString GetFilename();
virtual void GetAudio(void *buf, long long start, long long count)=0;
void GetAudioWithVolume(void *buf, long long start, long long count, double volume);
virtual void GetAudio(void *buf, int64_t start, int64_t count)=0;
void GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume);
long long GetNumSamples();
int64_t GetNumSamples();
int GetSampleRate();
int GetBytesPerSample();
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);
};

View File

@ -66,8 +66,8 @@ public:
wxString GetFilename();
void GetAudio(void *buf, long long start, long long count);
void GetWaveForm(int *min,int *peak,long long start,int w,int h,int samples,float scale);
void GetAudio(void *buf, int64_t start, int64_t count);
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
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
if (start+count > num_samples) {
long long oldcount = count;
int64_t oldcount = count;
count = num_samples-start;
if (count < 0) count = 0;

View File

@ -47,7 +47,7 @@ DummyAudioProvider::DummyAudioProvider(unsigned long dur_ms, bool _noise) {
channels = 1;
sample_rate = 44100;
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
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;
if (noise) {

View File

@ -52,5 +52,5 @@ public:
DummyAudioProvider(unsigned long dur_ms, bool _noise);
~DummyAudioProvider();
void GetAudio(void *buf, long long start, long long count);
void GetAudio(void *buf, int64_t start, int64_t count);
};

View File

@ -78,7 +78,7 @@ HDAudioProvider::HDAudioProvider(AudioProvider *source) {
// Write to disk
int block = 4096;
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;
source->GetAudio(temp,i,block);
file_cache.Write(temp,block * channels * bytes_per_sample);
@ -107,10 +107,10 @@ HDAudioProvider::~HDAudioProvider() {
/////////////
// 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
if (start+count > num_samples) {
long long oldcount = count;
int64_t oldcount = count;
count = num_samples-start;
if (count < 0) count = 0;

View File

@ -58,5 +58,5 @@ public:
HDAudioProvider(AudioProvider *source);
~HDAudioProvider();
void GetAudio(void *buf, long long start, long long count);
void GetAudio(void *buf, int64_t start, int64_t count);
};

View File

@ -80,7 +80,7 @@ private:
public:
LAVCAudioProvider(wxString _filename);
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;
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);
if (!buffer)
@ -181,10 +181,10 @@ void LAVCAudioProvider::Destroy()
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;
long long _count = num_samples - start;
int64_t _count = num_samples - start;
if (count < _count)
_count = count;
if (_count < 0)
@ -203,8 +203,8 @@ void LAVCAudioProvider::GetAudio(void *buf, long long start, long long count)
samples = bytesout >> 1;
if (rsct) {
if ((long long)(samples * resample_ratio / codecContext->channels) > _count)
samples = (long long)(_count / resample_ratio * codecContext->channels);
if ((int64_t)(samples * resample_ratio / codecContext->channels) > _count)
samples = (int64_t)(_count / resample_ratio * codecContext->channels);
samples = audio_resample(rsct, _buf, buffer, samples / codecContext->channels);
assert(samples <= _count);

View File

@ -41,7 +41,7 @@
#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
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) {
// 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;
// Read as many samples we can
@ -166,8 +166,8 @@ public:
// This won't pick up 'data' chunks inside 'wavl' chunks
// since the 'wavl' chunks wrap those.
long long samples = ch.size / bytes_per_sample;
long long frames = samples / channels;
int64_t samples = ch.size / bytes_per_sample;
int64_t frames = samples / channels;
IndexPoint ip;
ip.start_sample = num_samples;
@ -217,7 +217,7 @@ public:
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;

View File

@ -54,18 +54,18 @@ protected:
// Hold data for an index point,
// to support files where audio data are
// split into multiple blocks.
// Using long long's should be safe on most compilers,
// wx defines wxFileOffset as long long when possible
// Using int64_t's should be safe on most compilers,
// wx defines wxFileOffset as int64 when possible
struct IndexPoint {
long long start_byte;
long long start_sample;
long long num_samples;
int64_t start_byte;
int64_t start_sample;
int64_t num_samples;
};
typedef std::vector<IndexPoint> IndexVector;
IndexVector index_points;
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

View File

@ -55,7 +55,7 @@ RAMAudioProvider::RAMAudioProvider(AudioProvider *source) {
blockcount = 0;
// Allocate cache
long long ssize = source->GetNumSamples() * source->GetBytesPerSample();
int64_t ssize = source->GetNumSamples() * source->GetBytesPerSample();
blockcount = (ssize + CacheBlockSize - 1) >> CacheBits;
blockcache = new char*[blockcount];
for (int i = 0; i < blockcount; i++) {
@ -124,10 +124,10 @@ void RAMAudioProvider::Clear() {
/////////////
// 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
if (start+count > num_samples) {
long long oldcount = count;
int64_t oldcount = count;
count = num_samples-start;
if (count < 0) count = 0;
@ -151,7 +151,7 @@ void RAMAudioProvider::GetAudio(void *buf, long long start, long long count) {
char *charbuf = (char *)buf;
int i = (start*bytes_per_sample) >> CacheBits;
int start_offset = (start*bytes_per_sample) & (CacheBlockSize-1);
long long bytesremaining = count*bytes_per_sample;
int64_t bytesremaining = count*bytes_per_sample;
// Copy
while (bytesremaining) {

View File

@ -55,5 +55,5 @@ public:
RAMAudioProvider(AudioProvider *source);
~RAMAudioProvider();
void GetAudio(void *buf, long long start, long long count);
void GetAudio(void *buf, int64_t start, int64_t count);
};

View File

@ -67,9 +67,9 @@ StreamAudioProvider::~StreamAudioProvider() {
/////////////
// 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
long long left = count;
int64_t left = count;
int written = 0;
int toWrite;
short *dst = (short*) buf;
@ -101,7 +101,7 @@ void StreamAudioProvider::GetAudio(void *buf, long long start, long long count)
// Still left, fill with zero
if (left > 0) {
hasBuf = false;
for (long long i=written;i<count;i++) {
for (int64_t i=written;i<count;i++) {
dst[i] = 0;
}
}
@ -110,9 +110,9 @@ void StreamAudioProvider::GetAudio(void *buf, long long start, long long count)
//////////////////////////
// Append audio to stream
void StreamAudioProvider::Append(void *voidptr, long long count) {
void StreamAudioProvider::Append(void *voidptr, int64_t count) {
// Read
long long left = count;
int64_t left = count;
int read = 0;
int toRead;
short *src = (short*) voidptr;

View File

@ -68,7 +68,7 @@ public:
StreamAudioProvider();
~StreamAudioProvider();
void GetAudio(void *buf, long long start, long long count);
void Append(void *buf, long long count);
void GetAudio(void *buf, int64_t start, int64_t count);
void Append(void *buf, int64_t count);
void SetParams(int channels,int rate,int bps);
};

View File

@ -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
// a Fourier transform of real data is redundant, and not interesting for the purpose of creating
// 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) {
provider->GetAudio(raw_sample_data, sample, line_length*2);
@ -405,7 +405,7 @@ AudioSpectrum::AudioSpectrum(AudioProvider *_provider)
else
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...
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 last_line = (unsigned long)(fft_overlaps * range_end / line_length / 2);

View File

@ -38,6 +38,7 @@
#define AUDIO_SPECTRUM_H
#include <wx/wxprec.h>
#include <stdint.h>
#include "audio_provider.h"
@ -67,7 +68,7 @@ public:
AudioSpectrum(AudioProvider *_provider);
~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);
};

View File

@ -38,6 +38,7 @@
// Headers
#include <algorithm>
#include <errno.h>
#include <stdint.h>
#include <wx/tokenzr.h>
#include <wx/choicdlg.h>
#include <wx/filename.h>

View File

@ -43,6 +43,7 @@
#include <stdio.h>
#include <vector>
#include <list>
#include <stdint.h>
#include "MatroskaParser.h"
#include "vfr.h"
@ -68,14 +69,14 @@ class MkvFrame {
public:
double time;
bool isKey;
long long filePos;
int64_t filePos;
MkvFrame() {
time = 0;
isKey = false;
filePos = -1;
}
MkvFrame(bool keyframe,double timecode,long long _filePos) {
MkvFrame(bool keyframe,double timecode,int64_t _filePos) {
isKey = keyframe;
time = timecode;
filePos = _filePos;

View File

@ -651,7 +651,7 @@ void SubtitlesGrid::OnRecombine(wxCommandEvent &event) {
//////////////
// Export audio clip of line
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;
AudioProvider *provider = audioDisplay->provider;
AssDialogue *cur;

View File

@ -47,7 +47,7 @@
#ifndef __LINUX__
//////////////////////////
// Absolute of 64 bit int
long long abs64(long long input) {
int64_t abs64(int64_t input) {
if (input < 0) return -input;
return input;
}

View File

@ -41,6 +41,7 @@
// Headers
#include <vector>
#include <utility>
#include <stdint.h>
////////////
@ -51,7 +52,7 @@ typedef std::vector<std::pair<int,int> > IntPairVector;
///////////////////////
// Function prototypes
#ifndef __LINUX__
long long abs64(long long input);
int64_t abs64(int64_t input);
#endif
int CountMatches(wxString parent,wxString child);
bool CopyFile(wxString src,wxString dst);

View File

@ -742,8 +742,8 @@ void VideoContext::OnPlayTimer(wxTimerEvent &event) {
// Sync audio
if (keepAudioSync && nextFrame % 10 == 0 && audio && audio->provider && audio->player) {
long long audPos = audio->GetSampleAtMS(VFR_Output.GetTimeAtFrame(nextFrame));
long long curPos = audio->player->GetCurrentPosition();
int64_t audPos = audio->GetSampleAtMS(VFR_Output.GetTimeAtFrame(nextFrame));
int64_t curPos = audio->player->GetCurrentPosition();
int delta = int(audPos-curPos);
if (delta < 0) delta = -delta;
int maxDelta = audio->provider->GetSampleRate();

View File

@ -346,6 +346,9 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
}
// 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()) {
script = env->Invoke("ConvertToRGB32", script);
AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Converted to RGB32"));

View File

@ -87,12 +87,12 @@ private:
unsigned int height;
unsigned int num_frames;
double fps;
long long defd;
int64_t defd;
HRESULT OpenVideo(wxString _filename);
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);
void RegROT();
@ -359,7 +359,7 @@ HRESULT DirectShowVideoProvider::OpenVideo(wxString _filename) {
// Set FPS and frame duration
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);
// Set number of frames
@ -404,7 +404,7 @@ void DirectShowVideoProvider::CloseVideo() {
/////////////////////////
// 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
DF *df = (DF*) arg;
df->timestamp = timestamp;
@ -472,7 +472,7 @@ int DirectShowVideoProvider::NextFrame(DF &df,int &_fn) {
// VFR
else {
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;
break;
}

View File

@ -84,7 +84,7 @@ private:
wxArrayInt bytePos;
bool isMkv;
long long lastDecodeTime;
int64_t lastDecodeTime;
int frameNumber;
int length;
AegiVideoFrame curFrame;
@ -375,16 +375,16 @@ const AegiVideoFrame LAVCVideoProvider::DoGetFrame(int n) {
// Needs to seek
else {
// Prepare seek
long long seekTo;
int64_t seekTo;
int result = 0;
#if 0
// Get time to seek to
if (isMkv) {
//long long base = AV_TIME_BASE;
//long long 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 = long long(n) * 1000 * stream->r_frame_rate.den / stream->r_frame_rate.num;
//int64_t base = AV_TIME_BASE;
//int64_t time = VFR_Output.GetTimeAtFrame(n,true) * base / 1000000;
//seekTo = av_rescale(time,stream->time_base.den,AV_TIME_BASE * int64_t(stream->time_base.num));
//seekTo = int64_t(n) * 1000 * stream->r_frame_rate.den / stream->r_frame_rate.num;
//seekTo = bytePos[n];
//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
ulonglong startTime, endTime, filePos;
unsigned int rt, frameSize, frameFlags;
ulonglong targetTime = (long long)(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)(VFR_Output.GetTimeAtFrame(n,true,true))*1000000;
//ulonglong targetTime = (int64_t)(n) * 1000 * stream->r_frame_rate.den / stream->r_frame_rate.num;
//ulonglong targetTime = mkv.rawFrames[n].time * 1000000;
mkv_Seek(mkv.file,targetTime,MKVF_SEEK_TO_PREV_KEYFRAME);

View File

@ -101,7 +101,7 @@ int VideoSlider::GetValueAtX(int x) {
if (w <= 10) return 0;
// 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;
// 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;
}