[Drdivx-commits] SF.net SVN: drdivx: [430] DrDivX/trunk/drdivx2
Brought to you by:
harikrishnan_v,
seabass089
From: <har...@us...> - 2006-09-06 20:29:27
|
Revision: 430 http://svn.sourceforge.net/drdivx/?rev=430&view=rev Author: harikrishnan_v Date: 2006-09-06 13:29:11 -0700 (Wed, 06 Sep 2006) Log Message: ----------- Merge os x port changes from private branch Modified Paths: -------------- DrDivX/trunk/drdivx2/include/JobBatch.h DrDivX/trunk/drdivx2/include/Plugin.h DrDivX/trunk/drdivx2/src/builder/DivXMediaFileBuilder.cpp DrDivX/trunk/drdivx2/src/dvd/DvdNavigator.cpp DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp DrDivX/trunk/drdivx2/src/encoder/MetaDataTrackEncoder.cpp DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp DrDivX/trunk/drdivx2/src/encoder/SubtitleTrackEncoder.cpp DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp DrDivX/trunk/drdivx2/src/gui/Batch.cpp DrDivX/trunk/drdivx2/src/gui/BatchEncodeThread.cpp DrDivX/trunk/drdivx2/src/gui/CodeDictionary.cpp DrDivX/trunk/drdivx2/src/gui/Expert.cpp DrDivX/trunk/drdivx2/src/gui/InputWidget.cpp DrDivX/trunk/drdivx2/src/gui/JobBatchWidget.cpp DrDivX/trunk/drdivx2/src/gui/JobStatusWidget.cpp DrDivX/trunk/drdivx2/src/gui/StatusGraphWidget.cpp DrDivX/trunk/drdivx2/src/gui/TrackSelectionDialog.cpp DrDivX/trunk/drdivx2/src/gui/main.cpp DrDivX/trunk/drdivx2/src/job/JobBatchImpl.cpp DrDivX/trunk/drdivx2/src/job/JobBatchImpl.h DrDivX/trunk/drdivx2/src/job/JobImpl.cpp DrDivX/trunk/drdivx2/src/job/TrackMapperImpl.cpp DrDivX/trunk/drdivx2/src/job/VideoBitrateCompensator.cpp DrDivX/trunk/drdivx2/src/media/ContainerBundleImpl.cpp DrDivX/trunk/drdivx2/src/profile/ProfileBundleManager.cpp DrDivX/trunk/drdivx2/src/property/OpaqueProperty.cpp DrDivX/trunk/drdivx2/src/util/WhiteList.cpp Added Paths: ----------- DrDivX/trunk/drdivx2/include/ApiCompatibility.h Added: DrDivX/trunk/drdivx2/include/ApiCompatibility.h =================================================================== --- DrDivX/trunk/drdivx2/include/ApiCompatibility.h (rev 0) +++ DrDivX/trunk/drdivx2/include/ApiCompatibility.h 2006-09-06 20:29:11 UTC (rev 430) @@ -0,0 +1,32 @@ +/* + * Hide win32, posix, os x api differences + * + * Copyright (c) 2006 DivX, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef API_COMPATIBILITY_H +#define API_COMPATIBILITY_H + +#ifdef _MSC_VER +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#define access _access +#define mkdir(A,B) _mkdir(A) +#define PATH_MAX _MAX_PATH +#endif + +#endif \ No newline at end of file Modified: DrDivX/trunk/drdivx2/include/JobBatch.h =================================================================== --- DrDivX/trunk/drdivx2/include/JobBatch.h 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/include/JobBatch.h 2006-09-06 20:29:11 UTC (rev 430) @@ -53,7 +53,7 @@ virtual void ApplyDeserialized() = 0; - virtual void setFolder(const std::wstring &folder) = 0; + virtual void SetFolder(const std::wstring &folder) = 0; virtual size_t GetPendingJobs() = 0; Modified: DrDivX/trunk/drdivx2/include/Plugin.h =================================================================== --- DrDivX/trunk/drdivx2/include/Plugin.h 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/include/Plugin.h 2006-09-06 20:29:11 UTC (rev 430) @@ -24,11 +24,15 @@ struct IPluginListener; +#ifdef _WIN32 #ifdef PLUGIN_EXPORTS #define PLUGIN_API __declspec(dllexport) #else #define PLUGIN_API __declspec(dllimport) #endif +#else +#define PLUGIN_API +#endif #define PLUGIN_API_VERSION 1 Modified: DrDivX/trunk/drdivx2/src/builder/DivXMediaFileBuilder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/builder/DivXMediaFileBuilder.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/builder/DivXMediaFileBuilder.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -21,8 +21,6 @@ #include <config.h> #endif -#include <windows.h> - #include "PropertyHelper.h" #include "PropertyID.h" #include "DrError.h" @@ -32,9 +30,6 @@ #include "MediaFileBuilder.h" #include "MediaFileBuilderImpl.h" #include "DivXMediaFileBuilder.h" - -#include <divxmux/DivXMuxInterface.h> - #include "ModuleId.h" #include "LogManager.h" #include "StringUtility.h" @@ -42,10 +37,14 @@ using namespace std; +#ifdef _WIN32 +#include <windows.h> +#include <divxmux/DivXMuxInterface.h> #define DLL_NAME "DivXMux.dll" #define CREATE_FUNC_NAME "CreateDivXMux" #define DESTROY_FUNC_NAME "DestroyDivXMux" - +#define USE_DIVX_MUX +#else int opt_input_file(const char *); int opt_video_codec(const char *); int opt_audio_codec(const char *); @@ -54,7 +53,14 @@ int encode(JobEventNotifier *notifier); int opt_new_audio_stream(void); void reset(ILogManager *logger); +#endif +DivXMediaFileBuilder::DivXMediaFileBuilder(MediaFileType type) : MediaFileBuilderImpl(type) +,logger(&LogManager::Instance()) +{ +} + +#ifdef USE_DIVX_MUX int StatusCallback(long lParam, int part, int partCount, const char *status) { JobEventNotifier *notifier = (JobEventNotifier *) lParam; @@ -62,13 +68,6 @@ return 0; } -DivXMediaFileBuilder::DivXMediaFileBuilder(MediaFileType type) : MediaFileBuilderImpl(type) -,logger(&LogManager::Instance()) -{ -} - -#define USE_DIVX_MUX -#ifdef USE_DIVX_MUX ErrorCode DivXMediaFileBuilder::Build(const std::string & outputMediaFilePath) { ErrorCode err = noErr; @@ -344,7 +343,7 @@ vector<TrackInfo *>::iterator iter(trackInfos.begin()), iterEnd(trackInfos.end()); - reset(); + reset(logger); while (iter != iterEnd) { Modified: DrDivX/trunk/drdivx2/src/dvd/DvdNavigator.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/dvd/DvdNavigator.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/dvd/DvdNavigator.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -26,7 +26,7 @@ #include "DvdNavigator.h" #include "IfoParser.h" - +#include "ApiCompatibility.h" using namespace Dvd; using namespace std; @@ -44,17 +44,29 @@ { TitleSet *titleSet = new TitleSet(); - char drive[_MAX_DIR]; - char dir[_MAX_DIR]; - char fname[_MAX_FNAME]; + string tmp(titleSetFilePath); + string inputFolderPath; + + size_t offset; + string find("\\"); + string replace("/"); + + for (; (offset = tmp.find(find)) != string::npos;) + { + tmp.replace(offset, find.length(), replace); + } + + offset = tmp.rfind('/'); + offset++; + + inputFolderPath = tmp.substr(0, offset); - _splitpath(titleSetFilePath.c_str(), drive, dir, fname, NULL); + string titleFileName = tmp.substr(offset, tmp.length() - offset); // Derive titleset id from filename // VTS_xx_yy.ifo - string strfname = string(fname); - string tmp = strfname.substr(0, strfname.rfind('_')); - tmp = tmp.substr(strfname.find('_')+1); + tmp = titleFileName.substr(0, titleFileName.rfind('_')); + tmp = tmp.substr(titleFileName.find('_') + 1); int id = atoi(tmp.c_str()); @@ -63,8 +75,6 @@ titleSet->setId(id); - string inputFolderPath = drive; - inputFolderPath += dir; navigateTitleSet(NULL, titleSet, inputFolderPath); @@ -115,7 +125,7 @@ { uint16_t i = 0; - char buffer[_MAX_PATH]; + char buffer[PATH_MAX]; sprintf(buffer, "VTS_%02d_0.IFO", titleSet->getId()); string vtsIfoFilePath = inputFolderPath; @@ -137,7 +147,7 @@ title->setId(i); titleSet->addTitle(title); - char vobFileName[_MAX_PATH]; + char vobFileName[PATH_MAX]; sprintf(vobFileName, "VTS_%02d_%01d.VOB", titleSet->getId(), i); string vob_name = vobFileName; Modified: DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/encoder/AudioTrackEncoder.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -190,7 +190,9 @@ report.report_analyzed = audio_analyzis_report; report.report_written = audio_analyzis_written_report; +#ifndef FIX_FOR_OSX mp3gain(dest.c_str(), &report); +#endif } encoderNotifier->SetProgressRange(0, 100); Modified: DrDivX/trunk/drdivx2/src/encoder/MetaDataTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/MetaDataTrackEncoder.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/encoder/MetaDataTrackEncoder.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -53,6 +53,8 @@ ErrorCode MetaDataTrackEncoder::Run(bool simulate) { ErrorCode err = noErr; + +#ifndef FIX_FOR_OSX ContainerType type = UnknownContainer; std::string dest; @@ -201,6 +203,7 @@ err = metaData->Serialize(dest); +#endif return err; } @@ -212,6 +215,7 @@ ErrorCode MetaDataTrackEncoder::Configure(IProfile *profile) { +#ifndef FIX_FOR_OSX string value = ProfilePropertyHelper::GetStringValue(profile, META_DATA_PROFILE_TITLE_PROP); if (!value.empty()) @@ -246,6 +250,7 @@ if (!value.empty()) metaData->SetEncoderURI(value); +#endif return noErr; } @@ -253,9 +258,11 @@ MetaDataTrackEncoder::~MetaDataTrackEncoder() { +#ifndef FIX_FOR_OSX if (metaData != NULL) { DestroyMetaData(&metaData); metaData = NULL; } +#endif } Modified: DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/encoder/PortableTrackEncoder.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -28,6 +28,7 @@ #endif #define AV_DONT_OVERRIDE_STDC +#define HAVE_AV_CONFIG_H #include <drffmpeg/avformat.h> #include <drffmpeg/framehook.h> #include <drffmpeg/opt.h> @@ -3042,6 +3043,8 @@ bool av_set_thread_logger(ILogManager *logger) { bool result = true; + +#ifdef _WIN32 unsigned long thread_id = GetCurrentThreadId(); log_classes_protect.wait(); @@ -3064,11 +3067,14 @@ } log_classes_protect.release(); +#endif + return result; } void av_log_drdivx(void* ptr, int level, const char* fmt, va_list vl) { +#ifdef _WIN32 static bool print_header=true; LogLevel lev; switch (level) @@ -3110,7 +3116,10 @@ } print_header = (strchr(fmt, '\n')!=NULL); } + log_classes_protect.release(); + +#endif } void reset(ILogManager *logger) Modified: DrDivX/trunk/drdivx2/src/encoder/SubtitleTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/SubtitleTrackEncoder.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/encoder/SubtitleTrackEncoder.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -42,8 +42,11 @@ using namespace std; -//#define USE_FFMPEG +#ifdef _WIN32 #define USE_BMP2XSUB +#else +#define USE_FFMPEG +#endif #if defined USE_FFMPEG extern int frame_height, frame_width; @@ -143,6 +146,7 @@ ContainerType type = UnknownContainer; std::string dest, src; int size = 0; + uint32_t trackIndex = 0; inputContainer->GetSource(src); @@ -162,7 +166,7 @@ outputContainer->GetSource(dest); } - reset(); + reset(logger); subtitle_disable = 0; audio_disable = 1; @@ -174,7 +178,6 @@ goto clean_exit; } - uint32_t trackIndex = 0; inputTrack->GetIndex(trackIndex); char tmp[255]; @@ -382,10 +385,12 @@ audio_disable = 1; video_disable = 1; +#ifndef FIX_FOR_OSX if (opt_subtitle_codec("xsub") != 0) { err = subEncConfigErr; } +#endif frame_width = GetUInt32PropertyValue(profile, SUBTITLE_ENC_WIDTH); frame_height = GetUInt32PropertyValue(profile, SUBTITLE_ENC_HEIGHT); Modified: DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/encoder/VideoTrackEncoder.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -259,13 +259,13 @@ case OnePassBitrateBased: case TwoPassBitrateBased: value = GetUInt32PropertyValue(profile, VIDEO_ENC_BITRATE_PROP) * 1000; - _snprintf(tmp, 255, "%d", value); + snprintf(tmp, 255, "%d", value); cmdline += string(tmp); cmdline += " "; break; case OnePassQualityBased: dblValue = GetFloatPropertyValue(profile, VIDEO_ENC_QUANTIZER_PROP); - _snprintf(tmp, 255, "%.1f", dblValue); + snprintf(tmp, 255, "%.1f", dblValue); cmdline += string(tmp); cmdline += " "; break; @@ -316,7 +316,7 @@ if (enableCropping) { cmdline += "-c "; - _snprintf(tmp, 255, "%d,%d,%d,%d ", + snprintf(tmp, 255, "%d,%d,%d,%d ", GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_LEFT_PROP), GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_RIGHT_PROP), GetUInt32PropertyValue(profile, VIDEO_ENC_CROP_TOP_PROP), @@ -325,7 +325,7 @@ } cmdline += "-r "; - _snprintf(tmp, 255, "%d,%d,%d ", resized_width, resized_height, value); // 1 for bilinear + snprintf(tmp, 255, "%d,%d,%d ", resized_width, resized_height, value); // 1 for bilinear cmdline += string(tmp); } } @@ -354,7 +354,7 @@ if (value != PresetsOff) { - _snprintf(tmp, 255, "-use_presets=1 -preset=%d ", value - 1); + snprintf(tmp, 255, "-use_presets=1 -preset=%d ", value - 1); cmdline += string(tmp); } else @@ -385,7 +385,7 @@ if (value != 50) { cmdline += "-sc "; - _snprintf(tmp, 255, "%d", value); + snprintf(tmp, 255, "%d", value); cmdline += string(tmp); cmdline += " "; } @@ -395,7 +395,7 @@ if (value != 300) { cmdline += "-key "; - _snprintf(tmp, 255, "%d", value); + snprintf(tmp, 255, "%d", value); cmdline += string(tmp); cmdline += " "; } Modified: DrDivX/trunk/drdivx2/src/gui/Batch.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/Batch.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/Batch.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -119,7 +119,7 @@ QString encodeOnStart = QString::fromUtf8(prefs->GetStringOption(ENCODE_ON_STARTUP).c_str()); jobBatch->SetStartImmediate(encodeOnStart != "false"); jobBatch->SetLogger( &(LogManager::Instance()) ); - jobBatch->setFolder((wchar_t *) jobFolderPath.utf16()); + jobBatch->SetFolder((wchar_t *) jobFolderPath.utf16()); jobBatch->AddListener(this); ui.jobBatchWidget->setJobBatch(*jobBatch); @@ -208,6 +208,8 @@ IMovie *movie = NULL; IContainerChecker *checker = NULL; uint32_t trackCount = 0; + IProfileBundle *profileBundle = NULL; + ISerializer *serializer = NULL; watchFolder->GetProperty(WATCH_FOLDER_CERTIFICATION_PROP, &property); Q_ASSERT(property != NULL); @@ -328,8 +330,6 @@ } job->SetInput(inputContainerBundle); - - IProfileBundle *profileBundle = NULL; job->GetProfileBundle(&profileBundle); Q_ASSERT(profileBundle != NULL); @@ -392,7 +392,6 @@ job->SetOutput(outputContainerBundle); - ISerializer *serializer = NULL; CreateSerializer(&serializer); serializer->Serialize((wchar_t *) jobFilePath.utf16(), job); Modified: DrDivX/trunk/drdivx2/src/gui/BatchEncodeThread.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/BatchEncodeThread.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/BatchEncodeThread.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -95,7 +95,10 @@ jobFolderPath = QString::fromUtf8(prefs->GetFolderPath(JOB_FOLDER_NAME).c_str()); LogManager::Instance().Log(InfoLog, BATCH, "BatchEncodeThread] Plugin Folder Path: %s", pluginFolderPath.toUtf8().data()); + +#ifdef _WIN32 drffmpeg_init(); +#endif while (true) { @@ -211,7 +214,10 @@ processFinished.unlock(); } + +#ifdef _WIN32 drffmpeg_exit(); +#endif } void BatchEncodeThread::customEvent(QEvent *event) Modified: DrDivX/trunk/drdivx2/src/gui/CodeDictionary.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/CodeDictionary.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/CodeDictionary.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -26,7 +26,6 @@ #include "AppDefaults.h" -#define USE_DIVX_MUX #ifdef USE_DIVX_MUX const char *ENCODE_FILE_EXT = ".divx"; #else Modified: DrDivX/trunk/drdivx2/src/gui/Expert.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/Expert.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/Expert.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -181,7 +181,7 @@ QString encodeOnStart = QString::fromUtf8(prefs->GetStringOption(ENCODE_ON_STARTUP).c_str()); jobBatch->SetStartImmediate(encodeOnStart == "true"); jobBatch->SetLogger( &(LogManager::Instance()) ); - jobBatch->setFolder((wchar_t *) jobFolderPath.utf16()); + jobBatch->SetFolder((wchar_t *) jobFolderPath.utf16()); jobBatch->AddListener(this); ui.jobBatchWidget->setJobBatch(*jobBatch); @@ -679,13 +679,15 @@ jobFolderScanMutex.lock(); - int fileCount = dir.count(); + QStringList entries = dir.entryList(); + int fileCount = entries.size(); + for (int i = 0; i < fileCount; i++) { - QString filePath = dir[i]; + QString filePath = entries.at(i); - if ((filePath != ".") && (filePath != "..") && (filePath != JOBS_FILE_NAME)) + if ((filePath.isEmpty() == false) && (filePath != ".") && (filePath != "..") && (filePath != JOBS_FILE_NAME)) { FoundJob(filePath); } @@ -699,7 +701,10 @@ bool result = false; QString path = jobFolderPath; +#ifndef FIX_FOR_OSX path += '/'; +#endif + path += filePath; Q_ASSERT(QFile::exists( path )); Modified: DrDivX/trunk/drdivx2/src/gui/InputWidget.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/InputWidget.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/InputWidget.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -482,16 +482,20 @@ { bool bResult = false; IContainerChecker *checker = NULL; + IPropertyBundle *bundle = NULL; IProperty *property = NULL; + ITrack *track = NULL; JobEventNotifier *notifier = NULL; - IMovie *movie = NULL; - IContainer *inputContainerBundle = NULL; uint32_t trackCount = 0; + uint32_t propertyCount = 0; uint32_t i = 0; + uint32_t j = 0; int k = 0; ErrorCode err = noErr; QFileInfo fileInfo; + IContainer *inputContainerBundle = NULL; + IMovie *movie = NULL; // request a reset of our hosts (to make room for a new job) CompoundWidgetEvent *event = new CompoundWidgetEvent(this, WIZARD_RESET_REQUEST, ""); Modified: DrDivX/trunk/drdivx2/src/gui/JobBatchWidget.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/JobBatchWidget.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/JobBatchWidget.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -240,7 +240,8 @@ listItem = new QTableWidgetItem( "" ); listItem->setData(Qt::UserRole, tooltip); - listItem->setData(Qt::UserRole+1, intptr_t(job)); + // OS X port FIXME + listItem->setData(Qt::UserRole + 1, uint(job)); listItem->setToolTip(tooltip); ui.BatchQ->setItem( currRow, 2, listItem ); @@ -260,7 +261,7 @@ for (int idx=0; idx<ui.BatchQ->rowCount(); idx++) { item = ui.BatchQ->item( idx, 2 ); - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); if (job == &removedJob) { ui.BatchQ->removeRow( idx ); @@ -301,7 +302,7 @@ for (int index=0; index<ui.BatchQ->rowCount(); index++) { item = ui.BatchQ->item( index, 2 ); - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); if (job == evt->job) { // update the status of all jobs after the row swapping @@ -329,7 +330,7 @@ for (int index=0; index<ui.BatchQ->rowCount()-1; index++) { item = ui.BatchQ->item( index, 2 ); - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); if (job == evt->job) { // update the status of all jobs after the row swapping @@ -361,7 +362,7 @@ for (row=0; row < ui.BatchQ->rowCount(); row++) { QTableWidgetItem *item = ui.BatchQ->item( row, 2 ); - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); if (job == runningJob) { ui.BatchQ->selectRow(row); @@ -386,7 +387,7 @@ if (ui.BatchQ->currentRow() >= 0) { QTableWidgetItem *item = ui.BatchQ->item( ui.BatchQ->currentRow(), 2 ); - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); JobStatus status = job->GetStatus(); ui.RemoveButton->setEnabled((status != JobRunning) && (runningJob != job)); ui.ConfigureButton->setEnabled(status != JobCompleted && status != JobRunning); @@ -418,7 +419,7 @@ item = ui.BatchQ->item( i, 2 ); if (item == NULL) break; - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); if (job == NULL) break; // let's update next time @@ -443,7 +444,7 @@ item = ui.BatchQ->item( i, 2 ); if (item == NULL) break; - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); if (job == NULL) break; // let's update next time @@ -582,7 +583,7 @@ if (row >= 0) { QTableWidgetItem *item = ui.BatchQ->item( row, 2 ); - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); Q_ASSERT(job != NULL); if (configure->Configure(job)) { @@ -605,7 +606,7 @@ ui.moveDownPushButton->setEnabled( row+1 < ui.BatchQ->rowCount() ); QTableWidgetItem *item = ui.BatchQ->item( row, 2 ); - IJob *job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + IJob *job = (IJob*) item->data(Qt::UserRole + 1).value<uint>(); FireJobSelected(job); @@ -629,7 +630,7 @@ for (int i = 0; i < ui.BatchQ->rowCount(); i++) { item = ui.BatchQ->item( i, 2 ); - job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); Q_ASSERT( job != NULL ); if (job->GetStatus() == JobRunning) @@ -646,7 +647,7 @@ if (canStartRow != -1) { item = ui.BatchQ->item( canStartRow, 2 ); - job = (IJob*)item->data(Qt::UserRole+1).value<intptr_t>(); + job = (IJob*)item->data(Qt::UserRole+1).value<uint>(); Q_ASSERT( job != NULL ); jobBatch->StartProcessing(canStartRow); Modified: DrDivX/trunk/drdivx2/src/gui/JobStatusWidget.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/JobStatusWidget.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/JobStatusWidget.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -254,7 +254,6 @@ void JobStatusWidget::on_locateFilePushButton_clicked() { -#ifdef _WIN32 QStringList cli; IContainer *outputContainer = NULL; job->GetOutput(&outputContainer); @@ -265,22 +264,22 @@ outputContainerBundle->GetContainer(0, &container); Q_ASSERT(container != NULL); - cli.push_back(QString::fromAscii("url.dll,FileProtocolHandler")); - string path; container->GetSource(path); QFileInfo file(QString::fromUtf8(path.c_str())); +#ifdef _WIN32 + cli.push_back(QString::fromAscii("url.dll,FileProtocolHandler")); cli.push_back(file.dir().path()); QProcess::startDetached(QString::fromAscii("rundll32.exe"), cli); #else -#error "Locating the encoded file is not supported on this OS!" + cli.push_back(file.dir().path()); + QProcess::startDetached(QString::fromAscii("open"), cli); #endif } void JobStatusWidget::on_playFilePushButton_clicked() { -#ifdef _WIN32 QStringList cli; IContainer *outputContainer = NULL; job->GetOutput(&outputContainer); @@ -290,16 +289,16 @@ IContainer *container = NULL; outputContainerBundle->GetContainer(0, &container); Q_ASSERT(container != NULL); - - cli.push_back(QString::fromAscii("url.dll,FileProtocolHandler")); - string path; container->GetSource(path); +#ifdef _WIN32 + cli.push_back(QString::fromAscii("url.dll,FileProtocolHandler")); cli.push_back(QString::fromUtf8(path.c_str())); QProcess::startDetached(QString::fromAscii("rundll32.exe"), cli); #else -#error "Playing the encoded file is not supported on this OS!" + cli.push_back(QString::fromUtf8(path.c_str())); + QProcess::startDetached(QString::fromAscii("open"), cli); #endif } Modified: DrDivX/trunk/drdivx2/src/gui/StatusGraphWidget.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/StatusGraphWidget.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/StatusGraphWidget.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -98,12 +98,15 @@ } size_t num_frames = geomet_size.width() / STATUS_BAR_WIDTH; std::vector<FrameStatus>::reverse_iterator item = frames.rbegin(); + +#ifndef FIX_FOR_OSX while (item != frames.rend() && num_frames--) { if (item->framesize > maxFramesize) maxFramesize = item->framesize; item++; } +#endif QPainter painter(this); QBrush brush(Qt::black, Qt::SolidPattern); @@ -121,6 +124,8 @@ int left_pos = num_frames * STATUS_BAR_WIDTH; int vert_pos; item = frames.rbegin(); + +#ifndef FIX_FOR_OSX while (item != frames.rend() && num_frames--) { //// QRect ( horiz_pos, vert_pos, width, height ) @@ -142,6 +147,7 @@ } item++; } +#endif } // add the text on top of the graphics and as a tooltip Modified: DrDivX/trunk/drdivx2/src/gui/TrackSelectionDialog.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/TrackSelectionDialog.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/TrackSelectionDialog.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -174,7 +174,7 @@ assert(p1 != NULL); PropertyValue val1; - val1.strVal = _strdup("00"); + val1.strVal = strdup("00"); val1.type = STRING_TYPE; err = p1->SetValue(val1); @@ -215,7 +215,7 @@ assert(p1 != NULL); PropertyValue val1; - val1.strVal = _strdup("00"); + val1.strVal = strdup("00"); val1.type = STRING_TYPE; err = p1->SetValue(val1); Modified: DrDivX/trunk/drdivx2/src/gui/main.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/gui/main.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/gui/main.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -72,9 +72,8 @@ { delete w; +#ifdef _WIN32 drffmpeg_exit(); - -#if defined(_WIN32) ::CloseHandle(encode_protec); #endif } @@ -118,6 +117,7 @@ translator.load(QString("gui_") + langCode, QCoreApplication::applicationDirPath()); a.installTranslator(&translator); +#ifndef FIX_FOR_OSX string codecVersion; string codecState; GetCodecInfo(codecVersion, codecState); @@ -144,6 +144,8 @@ return -1; } +#endif + if (argc >= 2 && QString(argv[1]).toLower() == QString(RESET_APP).toLower()) { if (QMessageBox::question(NULL, QObject::tr("DrDivXOSS"), @@ -163,7 +165,10 @@ return 0; } +#ifdef _WIN32 drffmpeg_init(); +#endif + av_log_set_callback(av_log_drdivx); int codecour, codecfound, formatour, formatfound; @@ -171,7 +176,10 @@ if (codecfound < codecour || formatfound < formatour) { QMessageBox::critical(NULL, QObject::tr("DrDivXOSS"), QObject::tr("You're running an old version of DrFFMPEG")); + +#ifdef _WIN32 drffmpeg_exit(); +#endif return -1; } @@ -182,6 +190,8 @@ InitProfileBundleManager(); + +#ifdef _WIN32 QLibrary divxmuxer("DivXMux.dll"); if (!divxmuxer.load()) { @@ -196,6 +206,8 @@ } divxmuxer.unload(); +#endif + if (argc < 2) { if (CanStart(EXPERT_APP)) @@ -226,7 +238,10 @@ if (w == NULL) { QMessageBox::warning(NULL, "DrDivXOSS", QObject::tr("An instance of Dr.DivX OSS is already running")); + +#ifdef _WIN32 drffmpeg_exit(); +#endif return -1; } @@ -258,7 +273,9 @@ #endif delete w; +#ifdef _WIN32 drffmpeg_exit(); +#endif #if 0 #if defined(_WIN32) Modified: DrDivX/trunk/drdivx2/src/job/JobBatchImpl.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/job/JobBatchImpl.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/job/JobBatchImpl.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -602,7 +602,7 @@ thread->setPriority(priority); } -void JobBatchImpl::setFolder(const wstring &folder) +void JobBatchImpl::SetFolder(const wstring &folder) { jobFolder = folder; } Modified: DrDivX/trunk/drdivx2/src/job/JobBatchImpl.h =================================================================== --- DrDivX/trunk/drdivx2/src/job/JobBatchImpl.h 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/job/JobBatchImpl.h 2006-09-06 20:29:11 UTC (rev 430) @@ -70,7 +70,7 @@ void ApplyDeserialized(); - void setFolder(const std::wstring &folder); + void SetFolder(const std::wstring &folder); size_t GetPendingJobs(); Modified: DrDivX/trunk/drdivx2/src/job/JobImpl.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/job/JobImpl.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/job/JobImpl.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -23,8 +23,9 @@ #endif #include <cmath> - +#ifdef _WIN32 #define INCLUDE_METADATA +#endif #include "DrError.h" #include "Deserializable.h" @@ -63,6 +64,7 @@ #include "Plugin.h" #include "PluginManager.h" #include "ProfileBundleNormalizer.h" +#include "ApiCompatibility.h" static const int CURRENT_JOB_VERSION = 1; static const int READABLE_JOB_VERSION = 1; @@ -598,7 +600,7 @@ notifier.UpdateStage(MetaDataTrackEncode); // Add a mandatory meta-data track - char outputFilePath[_MAX_PATH]; + char outputFilePath[PATH_MAX]; sprintf(outputFilePath, "%s%s-%d.%s", jobTmpFolderPath.c_str(), META_DATA_TRACK_FILE_NAME, i, META_DATA_TRACK_FILE_EXT); CreateContainer(outputFilePath, FileContainer, &out); // Construct meta-data track which contains technical info @@ -1085,7 +1087,7 @@ if (stage == VideoTrackEncode) { char tmpBuf[6]; - _itoa(pass, tmpBuf, 10); + snprintf(tmpBuf, 6, "%d", pass); xmlNewProp(stateNode, PASS_TAG, tmpBuf); } } @@ -1392,7 +1394,7 @@ } IContainer *out = NULL; - char outputFilePath[_MAX_PATH]; + char outputFilePath[PATH_MAX]; switch (trackType) { Modified: DrDivX/trunk/drdivx2/src/job/TrackMapperImpl.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/job/TrackMapperImpl.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/job/TrackMapperImpl.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -30,6 +30,7 @@ #include "SerializationTagId.h" #include "TrackMapperEvent.h" #include "TrackMapperListener.h" +#include "ApiCompatibility.h" using namespace std; @@ -157,10 +158,10 @@ trackMapperNode->LinkEndChild(trackMapNode); xmlNewProp(trackMapNode, TYPE_TAG, VIDEO_TAG); - _snprintf(tmp, 3, "%d", inTrackIndex); + snprintf(tmp, 3, "%d", inTrackIndex); xmlNewProp(trackMapNode, INPUT_TAG, tmp); - _snprintf(tmp, 3, "%d", i); + snprintf(tmp, 3, "%d", i); xmlNewProp(trackMapNode, OUTPUT_TAG, tmp); } @@ -180,10 +181,10 @@ trackMapperNode->LinkEndChild(trackMapNode); xmlNewProp(trackMapNode, TYPE_TAG, AUDIO_TAG); - _snprintf(tmp, 3, "%d", inTrackIndex); + snprintf(tmp, 3, "%d", inTrackIndex); xmlNewProp(trackMapNode, INPUT_TAG, tmp); - _snprintf(tmp, 3, "%d", i); + snprintf(tmp, 3, "%d", i); xmlNewProp(trackMapNode, OUTPUT_TAG, tmp); } @@ -203,10 +204,10 @@ trackMapperNode->LinkEndChild(trackMapNode); xmlNewProp(trackMapNode, TYPE_TAG, SUBTITLE_TAG); - _snprintf(tmp, 3, "%d", inTrackIndex); + snprintf(tmp, 3, "%d", inTrackIndex); xmlNewProp(trackMapNode, INPUT_TAG, tmp); - _snprintf(tmp, 3, "%d", i); + snprintf(tmp, 3, "%d", i); xmlNewProp(trackMapNode, OUTPUT_TAG, tmp); } Modified: DrDivX/trunk/drdivx2/src/job/VideoBitrateCompensator.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/job/VideoBitrateCompensator.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/job/VideoBitrateCompensator.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -152,7 +152,7 @@ struct __stat64 fileInfo; _stat64((const char *) source.c_str(), &fileInfo); #else - struct stat file_info; + struct stat fileInfo; stat((const char *) source.c_str(), &fileInfo); #endif Modified: DrDivX/trunk/drdivx2/src/media/ContainerBundleImpl.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/media/ContainerBundleImpl.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/media/ContainerBundleImpl.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -49,7 +49,7 @@ #include "LogManager.h" #include "ContainerEvent.h" #include "ContainerListener.h" - +#include "ApiCompatibility.h" using namespace std; ContainerBundleImpl::ContainerBundleImpl() : @@ -166,8 +166,8 @@ if (pos != string::npos) { - char ifoFilePath[_MAX_PATH]; - _snprintf(ifoFilePath, _MAX_PATH, "%s%d%s", vobFilePath.substr(0, pos + 1).c_str(), 0, ".ifo"); + char ifoFilePath[PATH_MAX]; + snprintf(ifoFilePath, PATH_MAX, "%s%d%s", vobFilePath.substr(0, pos + 1).c_str(), 0, ".ifo"); FILE *f = fopen(ifoFilePath, "rb"); Modified: DrDivX/trunk/drdivx2/src/profile/ProfileBundleManager.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/profile/ProfileBundleManager.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/profile/ProfileBundleManager.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -70,10 +70,29 @@ { assert(index < profileBundleFilePaths.size()); - char fname[_MAX_FNAME]; - _splitpath(WStringToString(profileBundleFilePaths[index]).c_str(), NULL, NULL, fname, NULL); + string tmp(WStringToString(profileBundleFilePaths[index])); - name = string(fname); + size_t offset; + string find("\\"); + string replace("/"); + + for (; (offset = tmp.find(find)) != string::npos;) + { + tmp.replace(offset, find.length(), replace); + } + + offset = tmp.rfind('/'); + offset++; + + name = tmp.substr(offset, tmp.length() - offset); + + offset = name.rfind('.'); + + if (offset != -1) + { + name = name.substr(0, offset); + } + return noErr; } Modified: DrDivX/trunk/drdivx2/src/property/OpaqueProperty.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/property/OpaqueProperty.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/property/OpaqueProperty.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -27,7 +27,7 @@ #include "MetaProperty.h" #include "PropertyImpl.h" #include "OpaqueProperty.h" - +#include "ApiCompatibility.h" using namespace std; OpaqueProperty::OpaqueProperty(IMetaProperty *metaProperty) @@ -75,7 +75,7 @@ for (int i = 0; i < this->value.len; i++) { char tmp[4]; - _snprintf(tmp, 4, "%d", this->value.opaqueVal[i]); + snprintf(tmp, 4, "%d", this->value.opaqueVal[i]); value += string(tmp); if (i != (this->value.len - 1)) @@ -94,7 +94,7 @@ for (int i = 0; i < this->value.len; i++) { char tmp[4]; - _snprintf(tmp, 4, "%d", this->value.opaqueVal[i]); + snprintf(tmp, 4, "%d", this->value.opaqueVal[i]); value += string(tmp); Modified: DrDivX/trunk/drdivx2/src/util/WhiteList.cpp =================================================================== --- DrDivX/trunk/drdivx2/src/util/WhiteList.cpp 2006-09-06 01:26:04 UTC (rev 429) +++ DrDivX/trunk/drdivx2/src/util/WhiteList.cpp 2006-09-06 20:29:11 UTC (rev 430) @@ -76,6 +76,7 @@ void IWhiteList::SetWhiteList() const { +#ifdef _WIN32 size_t i,j; int list_size; whitelist *white_list, *local_list; @@ -165,6 +166,8 @@ free(white_list); } + +#endif } ErrorCode IWhiteList::Deserialize(const TiXmlNode *element) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |