mirror of https://github.com/odrling/Aegisub
Remove a bunch of no longer needed (since we removed Aegisub::string) string conversions via c_str()/wc_str(), and replace mb_str(wxConvUTF8) with utf8_str() where appropriate.
Originally committed to SVN as r3224.
This commit is contained in:
parent
c11bf12504
commit
ab1993467a
|
@ -53,7 +53,7 @@
|
||||||
//////////////
|
//////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
AvisynthAudioProvider::AvisynthAudioProvider(wxString _filename) {
|
AvisynthAudioProvider::AvisynthAudioProvider(wxString _filename) {
|
||||||
filename = _filename.c_str();
|
filename = _filename;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OpenAVSAudio();
|
OpenAVSAudio();
|
||||||
|
|
|
@ -82,9 +82,9 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
|
||||||
// clean up
|
// clean up
|
||||||
Close();
|
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) {
|
if (Indexer == NULL) {
|
||||||
// error messages that can possibly contain a filename use this method instead of
|
// error messages that can possibly contain a filename use this method instead of
|
||||||
// wxString::Format because they may contain utf8 characters
|
// wxString::Format because they may contain utf8 characters
|
||||||
|
@ -107,14 +107,14 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a name for the cache file
|
// generate a name for the cache file
|
||||||
wxString CacheName = GetCacheFilename(filename.c_str());
|
wxString CacheName = GetCacheFilename(filename);
|
||||||
|
|
||||||
// try to read index
|
// try to read index
|
||||||
FFIndex *Index = NULL;
|
FFIndex *Index = NULL;
|
||||||
Index = FFMS_ReadIndex(CacheName.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize);
|
Index = FFMS_ReadIndex(CacheName.utf8_str(), FFMSErrMsg, MsgSize);
|
||||||
bool IndexIsValid = false;
|
bool IndexIsValid = false;
|
||||||
if (Index != NULL) {
|
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);
|
FFMS_DestroyIndex(Index);
|
||||||
Index = NULL;
|
Index = NULL;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ void FFmpegSourceAudioProvider::LoadAudio(wxString filename) {
|
||||||
// update access time of index file so it won't get cleaned away
|
// update access time of index file so it won't get cleaned away
|
||||||
wxFileName(CacheName).Touch();
|
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);
|
FFMS_DestroyIndex(Index);
|
||||||
Index = NULL;
|
Index = NULL;
|
||||||
if (!AudioSource) {
|
if (!AudioSource) {
|
||||||
|
|
|
@ -105,7 +105,7 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
|
||||||
usedDirectShow = false;
|
usedDirectShow = false;
|
||||||
decoderName = _("Unknown");
|
decoderName = _("Unknown");
|
||||||
|
|
||||||
wxString extension = wxString(_filename.c_str()).Right(4);
|
wxString extension = _filename.Right(4);
|
||||||
extension.LowerCase();
|
extension.LowerCase();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -122,9 +122,8 @@ void DummyVideoProvider::Create(double _fps, int frames, int _width, int _height
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Parsing constructor
|
// Parsing constructor
|
||||||
DummyVideoProvider::DummyVideoProvider(wxString _filename)
|
DummyVideoProvider::DummyVideoProvider(wxString filename)
|
||||||
{
|
{
|
||||||
wxString filename = _filename.c_str();
|
|
||||||
wxString params;
|
wxString params;
|
||||||
if (!filename.StartsWith(_T("?dummy:"), ¶ms)) {
|
if (!filename.StartsWith(_T("?dummy:"), ¶ms)) {
|
||||||
throw _T("Attempted creating dummy video provider with non-dummy filename");
|
throw _T("Attempted creating dummy video provider with non-dummy filename");
|
||||||
|
|
|
@ -100,9 +100,9 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
|
||||||
// make sure we don't have anything messy lying around
|
// make sure we don't have anything messy lying around
|
||||||
Close();
|
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) {
|
if (Indexer == NULL) {
|
||||||
// error messages that can possibly contain a filename use this method instead of
|
// error messages that can possibly contain a filename use this method instead of
|
||||||
// wxString::Format because they may contain utf8 characters
|
// wxString::Format because they may contain utf8 characters
|
||||||
|
@ -125,14 +125,14 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a name for the cache file
|
// generate a name for the cache file
|
||||||
wxString CacheName = GetCacheFilename(filename.c_str());
|
wxString CacheName = GetCacheFilename(filename);
|
||||||
|
|
||||||
// try to read index
|
// try to read index
|
||||||
FFIndex *Index = NULL;
|
FFIndex *Index = NULL;
|
||||||
Index = FFMS_ReadIndex(CacheName.mb_str(wxConvUTF8), FFMSErrMsg, MsgSize);
|
Index = FFMS_ReadIndex(CacheName.utf8_str(), FFMSErrMsg, MsgSize);
|
||||||
bool IndexIsValid = false;
|
bool IndexIsValid = false;
|
||||||
if (Index != NULL) {
|
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);
|
FFMS_DestroyIndex(Index);
|
||||||
Index = NULL;
|
Index = NULL;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ void FFmpegSourceVideoProvider::LoadVideo(wxString filename) {
|
||||||
else
|
else
|
||||||
SeekMode = FFMS_SEEK_NORMAL;
|
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);
|
FFMS_DestroyIndex(Index);
|
||||||
Index = NULL;
|
Index = NULL;
|
||||||
if (VideoSource == NULL) {
|
if (VideoSource == NULL) {
|
||||||
|
|
|
@ -36,9 +36,13 @@
|
||||||
|
|
||||||
#ifdef WITH_QUICKTIME
|
#ifdef WITH_QUICKTIME
|
||||||
|
|
||||||
#include "include/aegisub/aegisub.h"
|
|
||||||
#include "aegisub_endian.h"
|
|
||||||
#include "video_provider_quicktime.h"
|
#include "video_provider_quicktime.h"
|
||||||
|
#include "aegisub_endian.h"
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
#define MacOffsetRect OffsetRect
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
QuickTimeVideoProvider::QuickTimeVideoProvider(wxString filename) {
|
QuickTimeVideoProvider::QuickTimeVideoProvider(wxString filename) {
|
||||||
in_dataref = NULL;
|
in_dataref = NULL;
|
||||||
|
@ -123,8 +127,8 @@ void QuickTimeVideoProvider::LoadVideo(const wxString _filename) {
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
// convert filename, first to a CFStringRef...
|
// convert filename, first to a CFStringRef...
|
||||||
wxString wx_filename = wxFileName(wxString(_filename.c_str(), wxConvFile)).GetShortPath();
|
wxString wx_filename = wxFileName(_filename).GetShortPath();
|
||||||
CFStringRef qt_filename = CFStringCreateWithCString(NULL, wx_filename.mb_str(wxConvUTF8), kCFStringEncodingUTF8);
|
CFStringRef qt_filename = CFStringCreateWithCString(NULL, wx_filename.utf8_str(), kCFStringEncodingUTF8);
|
||||||
|
|
||||||
// and then to a data reference
|
// and then to a data reference
|
||||||
OSType in_dataref_type;
|
OSType in_dataref_type;
|
||||||
|
|
|
@ -36,34 +36,11 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
#ifdef WITH_QUICKTIME
|
#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"
|
#include "include/aegisub/video_provider.h"
|
||||||
extern "C" {
|
#include "quicktime_common.h"
|
||||||
#ifdef WIN32
|
|
||||||
#include <QTML.h>
|
|
||||||
#include <Movies.h>
|
|
||||||
#include <Files.h>
|
|
||||||
#include <QDOffscreen.h>
|
|
||||||
#else
|
|
||||||
#include <QuickTime/QuickTime.h> // not sure about this path, someone on mac needs to test it
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#include <wx/dynarray.h>
|
#include <wx/dynarray.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -71,7 +48,7 @@ extern "C" {
|
||||||
#include "vfr.h"
|
#include "vfr.h"
|
||||||
|
|
||||||
|
|
||||||
class QuickTimeVideoProvider : public VideoProvider {
|
class QuickTimeVideoProvider : public VideoProvider, QuickTimeProvider {
|
||||||
private:
|
private:
|
||||||
Movie movie; // source object
|
Movie movie; // source object
|
||||||
GWorldPtr gw, gw_tmp; // render buffers
|
GWorldPtr gw, gw_tmp; // render buffers
|
||||||
|
@ -111,7 +88,6 @@ public:
|
||||||
wxArrayInt GetKeyFrames();
|
wxArrayInt GetKeyFrames();
|
||||||
bool QuickTimeVideoProvider::AreKeyFramesLoaded();
|
bool QuickTimeVideoProvider::AreKeyFramesLoaded();
|
||||||
wxString GetDecoderName() { return L"QuickTime"; };
|
wxString GetDecoderName() { return L"QuickTime"; };
|
||||||
bool IsNativelyByFrames() { return true; };
|
|
||||||
int GetDesiredCacheSize() { return 8; };
|
int GetDesiredCacheSize() { return 8; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -85,12 +85,12 @@ YUV4MPEGVideoProvider::~YUV4MPEGVideoProvider() {
|
||||||
void YUV4MPEGVideoProvider::LoadVideo(const wxString _filename) {
|
void YUV4MPEGVideoProvider::LoadVideo(const wxString _filename) {
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
wxString filename = wxFileName(wxString(_filename.wc_str(), wxConvFile)).GetShortPath();
|
wxString filename = wxFileName(_filename).GetShortPath();
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
sf = _wfopen(filename.wc_str(), _T("rb"));
|
sf = _wfopen(filename.wc_str(), _T("rb"));
|
||||||
#else
|
#else
|
||||||
sf = fopen(filename.mb_str(wxConvUTF8), "rb");
|
sf = fopen(filename.utf8_str(), "rb");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sf == NULL)
|
if (sf == NULL)
|
||||||
|
|
Loading…
Reference in New Issue