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:
Karl Blomster 2009-07-23 19:57:57 +00:00
parent c11bf12504
commit ab1993467a
8 changed files with 27 additions and 48 deletions

View file

@ -53,7 +53,7 @@
//////////////
// Constructor
AvisynthAudioProvider::AvisynthAudioProvider(wxString _filename) {
filename = _filename.c_str();
filename = _filename;
try {
OpenAVSAudio();

View file

@ -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) {

View file

@ -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 {

View file

@ -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:"), &params)) {
throw _T("Attempted creating dummy video provider with non-dummy filename");

View file

@ -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) {

View file

@ -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;

View file

@ -36,34 +36,11 @@
#pragma once
#include "config.h"
#include <wx/wxprec.h>
#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 <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 "quicktime_common.h"
#include <wx/dynarray.h>
#include <wx/filename.h>
#include <vector>
@ -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; };
};

View file

@ -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)