diff --git a/aegisub/src/audio_provider_avs.cpp b/aegisub/src/audio_provider_avs.cpp index 098db66e3..82e9b4ec6 100644 --- a/aegisub/src/audio_provider_avs.cpp +++ b/aegisub/src/audio_provider_avs.cpp @@ -53,7 +53,7 @@ ////////////// // Constructor AvisynthAudioProvider::AvisynthAudioProvider(wxString _filename) { - filename = _filename.c_str(); + filename = _filename; try { OpenAVSAudio(); diff --git a/aegisub/src/audio_provider_ffmpegsource.cpp b/aegisub/src/audio_provider_ffmpegsource.cpp index 614c6f42a..2448197e1 100644 --- a/aegisub/src/audio_provider_ffmpegsource.cpp +++ b/aegisub/src/audio_provider_ffmpegsource.cpp @@ -82,9 +82,9 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { // clean up Close(); - wxString FileNameWX = wxFileName(wxString(filename.wc_str(), wxConvFile)).GetShortPath(); + wxString FileNameShort = wxFileName(filename).GetShortPath(); - FFIndexer *Indexer = FFMS_CreateIndexer(FileNameWX.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize); + FFIndexer *Indexer = FFMS_CreateIndexer(FileNameShort.utf8_str(), FFMSErrMsg, MsgSize); if (Indexer == NULL) { // error messages that can possibly contain a filename use this method instead of // wxString::Format because they may contain utf8 characters @@ -107,14 +107,14 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { } // generate a name for the cache file - wxString CacheName = GetCacheFilename(filename.c_str()); + wxString CacheName = GetCacheFilename(filename); // try to read index FFIndex *Index = NULL; - Index = FFMS_ReadIndex(CacheName.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize); + Index = FFMS_ReadIndex(CacheName.utf8_str(), FFMSErrMsg, MsgSize); bool IndexIsValid = false; if (Index != NULL) { - if (FFMS_IndexBelongsToFile(Index, FileNameWX.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize)) { + if (FFMS_IndexBelongsToFile(Index, FileNameShort.utf8_str(), FFMSErrMsg, MsgSize)) { FFMS_DestroyIndex(Index); Index = NULL; } @@ -164,7 +164,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) { // update access time of index file so it won't get cleaned away wxFileName(CacheName).Touch(); - AudioSource = FFMS_CreateAudioSource(FileNameWX.mb_str(wxConvUTF8), TrackNumber, Index, FFMSErrMsg, MsgSize); + AudioSource = FFMS_CreateAudioSource(FileNameShort.utf8_str(), TrackNumber, Index, FFMSErrMsg, MsgSize); FFMS_DestroyIndex(Index); Index = NULL; if (!AudioSource) { diff --git a/aegisub/src/video_provider_avs.cpp b/aegisub/src/video_provider_avs.cpp index 629d9160d..ce104ea7f 100644 --- a/aegisub/src/video_provider_avs.cpp +++ b/aegisub/src/video_provider_avs.cpp @@ -105,7 +105,7 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori usedDirectShow = false; decoderName = _("Unknown"); - wxString extension = wxString(_filename.c_str()).Right(4); + wxString extension = _filename.Right(4); extension.LowerCase(); try { diff --git a/aegisub/src/video_provider_dummy.cpp b/aegisub/src/video_provider_dummy.cpp index deeac9dcc..f12f842b0 100644 --- a/aegisub/src/video_provider_dummy.cpp +++ b/aegisub/src/video_provider_dummy.cpp @@ -122,9 +122,8 @@ void DummyVideoProvider::Create(double _fps, int frames, int _width, int _height /////////////////////// // Parsing constructor -DummyVideoProvider::DummyVideoProvider(wxString _filename) +DummyVideoProvider::DummyVideoProvider(wxString filename) { - wxString filename = _filename.c_str(); wxString params; if (!filename.StartsWith(_T("?dummy:"), ¶ms)) { throw _T("Attempted creating dummy video provider with non-dummy filename"); diff --git a/aegisub/src/video_provider_ffmpegsource.cpp b/aegisub/src/video_provider_ffmpegsource.cpp index f547e86be..0bc9fbea5 100644 --- a/aegisub/src/video_provider_ffmpegsource.cpp +++ b/aegisub/src/video_provider_ffmpegsource.cpp @@ -100,9 +100,9 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { // make sure we don't have anything messy lying around Close(); - wxString FileNameWX = wxFileName(wxString(filename.wc_str(), wxConvFile)).GetShortPath(); + wxString FileNameShort = wxFileName(filename).GetShortPath(); - FFIndexer *Indexer = FFMS_CreateIndexer(FileNameWX.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize); + FFIndexer *Indexer = FFMS_CreateIndexer(FileNameShort.utf8_str(), FFMSErrMsg, MsgSize); if (Indexer == NULL) { // error messages that can possibly contain a filename use this method instead of // wxString::Format because they may contain utf8 characters @@ -125,14 +125,14 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { } // generate a name for the cache file - wxString CacheName = GetCacheFilename(filename.c_str()); + wxString CacheName = GetCacheFilename(filename); // try to read index FFIndex *Index = NULL; - Index = FFMS_ReadIndex(CacheName.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize); + Index = FFMS_ReadIndex(CacheName.utf8_str(), FFMSErrMsg, MsgSize); bool IndexIsValid = false; if (Index != NULL) { - if (FFMS_IndexBelongsToFile(Index, FileNameWX.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize)) { + if (FFMS_IndexBelongsToFile(Index, FileNameShort.utf8_str(), FFMSErrMsg, MsgSize)) { FFMS_DestroyIndex(Index); Index = NULL; } @@ -204,7 +204,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) { else SeekMode = FFMS_SEEK_NORMAL; - VideoSource = FFMS_CreateVideoSource(FileNameWX.mb_str(wxConvUTF8), TrackNumber, Index, "", Threads, SeekMode, FFMSErrMsg, MsgSize); + VideoSource = FFMS_CreateVideoSource(FileNameShort.utf8_str(), TrackNumber, Index, "", Threads, SeekMode, FFMSErrMsg, MsgSize); FFMS_DestroyIndex(Index); Index = NULL; if (VideoSource == NULL) { diff --git a/aegisub/src/video_provider_quicktime.cpp b/aegisub/src/video_provider_quicktime.cpp index 22316e811..9a8ba8254 100644 --- a/aegisub/src/video_provider_quicktime.cpp +++ b/aegisub/src/video_provider_quicktime.cpp @@ -36,9 +36,13 @@ #ifdef WITH_QUICKTIME -#include "include/aegisub/aegisub.h" -#include "aegisub_endian.h" #include "video_provider_quicktime.h" +#include "aegisub_endian.h" + +#ifndef WIN32 +#define MacOffsetRect OffsetRect +#endif + QuickTimeVideoProvider::QuickTimeVideoProvider(wxString filename) { in_dataref = NULL; @@ -123,8 +127,8 @@ void QuickTimeVideoProvider::LoadVideo(const wxString _filename) { Close(); // convert filename, first to a CFStringRef... - wxString wx_filename = wxFileName(wxString(_filename.c_str(), wxConvFile)).GetShortPath(); - CFStringRef qt_filename = CFStringCreateWithCString(NULL, wx_filename.mb_str(wxConvUTF8), kCFStringEncodingUTF8); + wxString wx_filename = wxFileName(_filename).GetShortPath(); + CFStringRef qt_filename = CFStringCreateWithCString(NULL, wx_filename.utf8_str(), kCFStringEncodingUTF8); // and then to a data reference OSType in_dataref_type; diff --git a/aegisub/src/video_provider_quicktime.h b/aegisub/src/video_provider_quicktime.h index 35cf5d90b..a79ec2d44 100644 --- a/aegisub/src/video_provider_quicktime.h +++ b/aegisub/src/video_provider_quicktime.h @@ -36,34 +36,11 @@ #pragma once -#include "config.h" #include #ifdef WITH_QUICKTIME - -#ifdef _MSC_VER -// avoid conflicts between MSVC's stdint.h and QT's stdint.h -#define _STDINT_H -// get MSVC to shut up about a macro redefinition in QT's ConditionalMacros.h -#pragma warning(disable: 4004) -#endif - -#ifndef WIN32 -#define MacOffsetRect OffsetRect -#endif - - #include "include/aegisub/video_provider.h" -extern "C" { -#ifdef WIN32 -#include -#include -#include -#include -#else -#include // not sure about this path, someone on mac needs to test it -#endif -} +#include "quicktime_common.h" #include #include #include @@ -71,7 +48,7 @@ extern "C" { #include "vfr.h" -class QuickTimeVideoProvider : public VideoProvider { +class QuickTimeVideoProvider : public VideoProvider, QuickTimeProvider { private: Movie movie; // source object GWorldPtr gw, gw_tmp; // render buffers @@ -111,7 +88,6 @@ public: wxArrayInt GetKeyFrames(); bool QuickTimeVideoProvider::AreKeyFramesLoaded(); wxString GetDecoderName() { return L"QuickTime"; }; - bool IsNativelyByFrames() { return true; }; int GetDesiredCacheSize() { return 8; }; }; diff --git a/aegisub/src/video_provider_yuv4mpeg.cpp b/aegisub/src/video_provider_yuv4mpeg.cpp index f4a2ef65e..997f9f360 100644 --- a/aegisub/src/video_provider_yuv4mpeg.cpp +++ b/aegisub/src/video_provider_yuv4mpeg.cpp @@ -85,12 +85,12 @@ YUV4MPEGVideoProvider::~YUV4MPEGVideoProvider() { void YUV4MPEGVideoProvider::LoadVideo(const wxString _filename) { Close(); - wxString filename = wxFileName(wxString(_filename.wc_str(), wxConvFile)).GetShortPath(); + wxString filename = wxFileName(_filename).GetShortPath(); #ifdef WIN32 sf = _wfopen(filename.wc_str(), _T("rb")); #else - sf = fopen(filename.mb_str(wxConvUTF8), "rb"); + sf = fopen(filename.utf8_str(), "rb"); #endif if (sf == NULL)