rendered paste bodyIndex: doc/compiling.txt===================================================================--- doc/compiling.txt (revision 226)+++ doc/compiling.txt (working copy)@@ -4,7 +4,6 @@ Define FFMS_EXPORTS Define HAALISOURCE to use haali's splitters for some containers (only works on windows) Link to FFmpeg and zlib-Have the Boost headers installed Files: compat.hIndex: doc/ffms2-api.html===================================================================Cannot display: file marked as a binary type.svn:mime-type = application/xhtml+xmlIndex: src/core/utils.cpp===================================================================--- src/core/utils.cpp (revision 226)+++ src/core/utils.cpp (working copy)@@ -54,9 +54,6 @@ FFMS_Exception::FFMS_Exception(int ErrorType, int SubType, const std::string &Message) : _ErrorType(ErrorType), _SubType(SubType), _Message(Message) { } -FFMS_Exception::FFMS_Exception(int ErrorType, int SubType, const boost::format &Message) : _ErrorType(ErrorType), _SubType(SubType), _Message(Message.str()) {-}- FFMS_Exception::~FFMS_Exception() throw () { } @@ -137,9 +134,11 @@ for (;;) { int ReadBytes = cs_ReadData(CS, Context.CSBuffer, sizeof(Context.CSBuffer));- if (ReadBytes < 0)- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Error decompressing data: %1%") % cs_GetLastError(CS));+ if (ReadBytes < 0) {+ char buf[256];+ sprintf(buf, "Error decompressing data: %s", cs_GetLastError(CS));+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf);+ } if (ReadBytes == 0) { FrameSize = DecompressedFrameSize;@@ -160,9 +159,11 @@ DecompressedFrameSize += ReadBytes; } } else {- if (fseeko(Context.ST.fp, FilePos, SEEK_SET))- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_SEEKING,- boost::format("fseek(): %1%") % strerror(errno));+ if (fseeko(Context.ST.fp, FilePos, SEEK_SET)) {+ char buf[256];+ sprintf(buf, "fseek(): %s", strerror(errno));+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_SEEKING, buf);+ } if (Context.BufferSize < FrameSize) { Context.BufferSize = FrameSize;@@ -179,8 +180,9 @@ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, "Unexpected EOF while reading frame"); } else {- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_SEEKING,- boost::format("Error reading frame: %1%") % strerror(errno));+ char buf[256];+ sprintf(buf, "Error reading frame: %s", strerror(errno));+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_SEEKING, buf); } } else { throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,@@ -454,9 +456,11 @@ #endif void LAVFOpenFile(const char *SourceFile, AVFormatContext *&FormatContext) {- if (av_open_input_file(&FormatContext, SourceFile, NULL, 0, NULL) != 0)- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Couldn't open '%1'") % SourceFile);+ if (av_open_input_file(&FormatContext, SourceFile, NULL, 0, NULL) != 0) {+ char buf[256];+ sprintf(buf, "Couldn't open '%s'", SourceFile);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf);+ } if (av_find_stream_info(FormatContext) < 0) { av_close_input_file(FormatContext);Index: src/core/matroskaindexer.cpp===================================================================--- src/core/matroskaindexer.cpp (revision 226)+++ src/core/matroskaindexer.cpp (working copy)@@ -32,17 +32,20 @@ InitStdIoStream(&MC.ST); MC.ST.fp = ffms_fopen(SourceFile, "rb");- if (MC.ST.fp == NULL)- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Can't open '%1%': %2%") % SourceFile % strerror(errno));+ if (MC.ST.fp == NULL) {+ char buf[256];+ sprintf(buf, "Can't open '%s': %s", SourceFile, strerror(errno));+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf);+ } setvbuf(MC.ST.fp, NULL, _IOFBF, CACHESIZE); MF = mkv_OpenEx(&MC.ST.base, 0, 0, ErrorMessage, sizeof(ErrorMessage)); if (MF == NULL) { fclose(MC.ST.fp);- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Can't parse Matroska file: %1%") % ErrorMessage);+ char buf[256];+ sprintf(buf, "Can't parse Matroska file: %s", ErrorMessage);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf); } for (unsigned int i = 0; i < mkv_GetNumTracks(MF); i++) {@@ -82,9 +85,11 @@ if (TI->CompEnabled) { VideoContexts[i].CS = cs_Create(MF, i, ErrorMessage, sizeof(ErrorMessage));- if (VideoContexts[i].CS == NULL)- throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED,- boost::format("Can't create decompressor: %1%") % ErrorMessage);+ if (VideoContexts[i].CS == NULL) {+ char buf[256];+ sprintf(buf, "Can't create decompressor: %s", ErrorMessage);+ throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED, buf);+ } } VideoContexts[i].CodecContext = CodecContext;@@ -101,8 +106,9 @@ if (AudioContexts[i].CS == NULL) { av_freep(&AudioCodecContext); AudioContexts[i].CodecContext = NULL;- throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED,- boost::format("Can't create decompressor: %1%") % ErrorMessage);+ char buf[256];+ sprintf(buf, "Can't create decompressor: %s", ErrorMessage);+ throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED, buf); } } Index: src/core/matroskaaudio.cpp===================================================================--- src/core/matroskaaudio.cpp (revision 226)+++ src/core/matroskaaudio.cpp (working copy)@@ -42,17 +42,20 @@ Frames = (*Index)[Track]; MC.ST.fp = ffms_fopen(SourceFile, "rb");- if (MC.ST.fp == NULL)- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Can't open '%1%': %2%") % SourceFile % strerror(errno));+ if (MC.ST.fp == NULL) {+ char buf[256];+ sprintf(buf, "Can't open '%s': %s", SourceFile, strerror(errno));+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf);+ } setvbuf(MC.ST.fp, NULL, _IOFBF, CACHESIZE); MF = mkv_OpenEx(&MC.ST.base, 0, 0, ErrorMessage, sizeof(ErrorMessage)); if (MF == NULL) { fclose(MC.ST.fp);- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Can't parse Matroska file: %1%") % ErrorMessage);+ char buf[256];+ sprintf(buf, "Can't parse Matroska file: %s", ErrorMessage);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf); } @@ -62,8 +65,9 @@ CS = cs_Create(MF, Track, ErrorMessage, sizeof(ErrorMessage)); if (CS == NULL) { Free(false);- throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED,- boost::format("Can't create decompressor: %1%") % ErrorMessage);+ char buf[256];+ sprintf(buf, "Can't create decompressor: %s", ErrorMessage);+ throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED, buf); } } Index: src/core/utils.h===================================================================--- src/core/utils.h (revision 226)+++ src/core/utils.h (working copy)@@ -24,7 +24,6 @@ #include <vector> #include <fstream> #include <cstdio>-#include <boost/format.hpp> #include "ffms.h" #include "matroskaparser.h" @@ -78,7 +77,6 @@ public: FFMS_Exception(int ErrorType, int SubType, const char *Message = ""); FFMS_Exception(int ErrorType, int SubType, const std::string &Message);- FFMS_Exception(int ErrorType, int SubType, const boost::format &Message); ~FFMS_Exception() throw (); const std::string &GetErrorMessage() const; int CopyOut(FFMS_ErrorInfo *ErrorInfo) const;Index: src/core/indexing.cpp===================================================================--- src/core/indexing.cpp (revision 226)+++ src/core/indexing.cpp (working copy)@@ -119,9 +119,11 @@ void FFMS_Track::WriteTimecodes(const char *TimecodeFile) { ffms_fstream Timecodes(TimecodeFile, std::ios::out | std::ios::trunc); - if (!Timecodes.is_open())- throw FFMS_Exception(FFMS_ERROR_TRACK, FFMS_ERROR_FILE_WRITE,- boost::format("Failed to open '%1%' for writing") % TimecodeFile);+ if (!Timecodes.is_open()) {+ char buf[256];+ sprintf(buf, "Failed to open '%s' for writing", TimecodeFile);+ throw FFMS_Exception(FFMS_ERROR_TRACK, FFMS_ERROR_FILE_WRITE, buf);+ } Timecodes << "# timecode format v2\n"; @@ -183,9 +185,11 @@ void FFMS_Index::CalculateFileSignature(const char *Filename, int64_t *Filesize, uint8_t Digest[20]) { FILE *SFile = ffms_fopen(Filename,"rb"); - if (SFile == NULL)- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ,- boost::format("Failed to open '%1%' for hashing") % Filename);+ if (SFile == NULL) {+ char buf[256];+ sprintf(buf, "Failed to open '%s' for hashing", Filename);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ, buf);+ } const int BlockSize = 1024*1024; std::vector<uint8_t> FileBuffer(BlockSize);@@ -198,8 +202,9 @@ if (ferror(SFile) && !feof(SFile)) { av_sha1_final(ctx, Digest); fclose(SFile);- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ,- boost::format("Failed to read '%1%' for hashing") % Filename);+ char buf[256];+ sprintf(buf, "Failed to read '%s' for hashing", Filename);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ, buf); } av_sha1_update(ctx, &FileBuffer[0], BlockSize); @@ -209,8 +214,9 @@ if (ferror(SFile) && !feof(SFile)) { av_sha1_final(ctx, Digest); fclose(SFile);- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ,- boost::format("Failed to seek with offset %1% from file end in '%2%' for hashing") % BlockSize % Filename);+ char buf[256];+ sprintf(buf, "Failed to seek with offset %d from file end in '%s' for hashing", BlockSize, Filename);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ, buf); } av_sha1_update(ctx, &FileBuffer[0], BlockSize); @@ -218,8 +224,9 @@ if (ferror(SFile)) { av_sha1_final(ctx, Digest); fclose(SFile);- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ,- boost::format("Failed to seek to end of '%1%' for hashing") % Filename);+ char buf[256];+ sprintf(buf, "Failed to seek to end of '%s' for hashing", Filename);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ, buf); } *Filesize = ftello(SFile); fclose(SFile);@@ -260,9 +267,11 @@ void FFMS_Index::WriteIndex(const char *IndexFile) { ffms_fstream IndexStream(IndexFile, std::ios::out | std::ios::binary | std::ios::trunc); - if (!IndexStream.is_open()) - throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_WRITE,- boost::format("Failed to open '%1%' for writing") % IndexFile);+ if (!IndexStream.is_open()) {+ char buf[256];+ sprintf(buf, "Failed to open '%s' for writing", IndexFile);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_WRITE, buf);+ } // Write the index file header IndexHeader IH;@@ -295,26 +304,34 @@ void FFMS_Index::ReadIndex(const char *IndexFile) { ffms_fstream Index(IndexFile, std::ios::in | std::ios::binary); - if (!Index.is_open())- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ,- boost::format("Failed to open '%1%' for reading") % IndexFile);+ if (!Index.is_open()) {+ char buf[256];+ sprintf(buf, "Failed to open '%s' for writing", IndexFile);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_FILE_READ, buf);+ } // Read the index file header IndexHeader IH; Index.read(reinterpret_cast<char *>(&IH), sizeof(IH));- if (IH.Id != INDEXID)- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_INVALID_ARGUMENT,- boost::format("'%1%' is not a valid index file") % IndexFile);+ if (IH.Id != INDEXID) {+ char buf[256];+ sprintf(buf, "'%s' is not a valid index file", IndexFile);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_INVALID_ARGUMENT, buf);+ } - if (IH.Version != FFMS_VERSION)- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_VERSION,- boost::format("'%1%' is not the expected index version") % IndexFile);+ if (IH.Version != FFMS_VERSION) {+ char buf[256];+ sprintf(buf, "'%s' is not the expected index version", IndexFile);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_VERSION, buf);+ } if (IH.LAVUVersion != avutil_version() || IH.LAVFVersion != avformat_version() || IH.LAVCVersion != avcodec_version() || IH.LSWSVersion != swscale_version() ||- IH.LPPVersion != postproc_version())- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_VERSION,- boost::format("A different FFmpeg build was used to create '%1%'") % IndexFile);+ IH.LPPVersion != postproc_version()) {+ char buf[256];+ sprintf(buf, "A different FFmpeg build was used to create '%s'", IndexFile);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_VERSION, buf);+ } if (!(IH.Decoder & FFMS_GetEnabledSources())) throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_NOT_AVAILABLE,@@ -337,8 +354,9 @@ } } catch (...) {- throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_UNKNOWN,- boost::format("Unknown error while reading index information in '%1%'") % IndexFile);+ char buf[256];+ sprintf(buf, "Unknown error while reading index information in '%s'", IndexFile);+ throw FFMS_Exception(FFMS_ERROR_INDEX, FFMS_ERROR_UNKNOWN, buf); } } @@ -380,9 +398,11 @@ FFMS_Indexer *FFMS_Indexer::CreateIndexer(const char *Filename) { AVFormatContext *FormatContext = NULL; - if (av_open_input_file(&FormatContext, Filename, NULL, 0, NULL) != 0)- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Can't open '%1%'") % Filename);+ if (av_open_input_file(&FormatContext, Filename, NULL, 0, NULL) != 0) {+ char buf[256];+ sprintf(buf, "Can't open '%s'", Filename);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf);+ } // Do matroska indexing instead? if (!strcmp(FormatContext->iformat->name, "matroska")) {Index: src/core/matroskavideo.cpp===================================================================--- src/core/matroskavideo.cpp (revision 226)+++ src/core/matroskavideo.cpp (working copy)@@ -47,17 +47,20 @@ Frames = (*Index)[VideoTrack]; MC.ST.fp = ffms_fopen(SourceFile, "rb");- if (MC.ST.fp == NULL)- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Can't open '%1%': %2%") % SourceFile % strerror(errno));+ if (MC.ST.fp == NULL) {+ char buf[256];+ sprintf(buf, "Can't open '%s': %s", SourceFile, strerror(errno));+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf);+ } setvbuf(MC.ST.fp, NULL, _IOFBF, CACHESIZE); MF = mkv_OpenEx(&MC.ST.base, 0, 0, ErrorMessage, sizeof(ErrorMessage)); if (MF == NULL) { fclose(MC.ST.fp);- throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ,- boost::format("Can't parse Matroska file: %1%") % ErrorMessage);+ char buf[256];+ sprintf(buf, "Can't parse Matroska file: %s", ErrorMessage);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf); } TI = mkv_GetTrackInfo(MF, VideoTrack);@@ -66,8 +69,9 @@ CS = cs_Create(MF, VideoTrack, ErrorMessage, sizeof(ErrorMessage)); if (CS == NULL) { Free(false);- throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED,- boost::format("Can't create decompressor: %1%") % ErrorMessage);+ char buf[256];+ sprintf(buf, "Can't create decompressor: %s", ErrorMessage);+ throw FFMS_Exception(FFMS_ERROR_CODEC, FFMS_ERROR_UNSUPPORTED, buf); } }