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: 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) {+ std::ostringstream buf;+ buf << "Can't open '" << SourceFile << "': " << strerror(errno);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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);+ std::ostringstream buf;+ buf << "Can't parse Matroska file: " << ErrorMessage;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } 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) {+ std::ostringstream buf;+ buf << "Can't create decompressor: " << ErrorMessage;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } } 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);+ std::ostringstream buf;+ buf << "Can't create decompressor: " << ErrorMessage;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } } Index: 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) {+ std::ostringstream buf;+ buf << "Error decompressing data: " << cs_GetLastError(CS);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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)) {+ std::ostringstream buf;+ buf << "fseek(): " << strerror(errno);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_SEEKING, buf.str());+ } 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));+ std::ostringstream buf;+ buf << "Error reading frame: " << strerror(errno);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_SEEKING, buf.str()); } } 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) {+ std::ostringstream buf;+ buf << "Couldn't open " << SourceFile;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } if (av_find_stream_info(FormatContext) < 0) { av_close_input_file(FormatContext);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) {+ std::ostringstream buf;+ buf << "Can't open '" << SourceFile << "': " << strerror(errno);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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);+ std::ostringstream buf;+ buf << "Can't parse Matroska file: " << ErrorMessage;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } @@ -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);+ std::ostringstream buf;+ buf << "Can't create decompressor: " << ErrorMessage;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } } 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()) {+ std::ostringstream buf;+ buf << "Failed to open '" << TimecodeFile << "' for writing";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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) {+ std::ostringstream buf;+ buf << "Failed to open '" << Filename << "' for hashing";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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);+ std::ostringstream buf;+ buf << "Failed to read '" << Filename << "' for hashing";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } 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);+ std::ostringstream buf;+ buf << "Failed to seek with offset " << BlockSize << " from file end in '" << Filename << "' for hashing";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } 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);+ std::ostringstream buf;+ buf << "Failed to seek to end of '" << Filename << "' for hashing";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } *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()) {+ std::ostringstream buf;+ buf << "Failed to open '" << IndexFile << "' for writing";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } // 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()) {+ std::ostringstream buf;+ buf << "Failed to open '" << IndexFile << "' for reading";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } // 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) {+ std::ostringstream buf;+ buf << "'" << IndexFile << "' is not a valid index file";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } - 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) {+ std::ostringstream buf;+ buf << "'" << IndexFile << "' is not the expected index version";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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()) {+ std::ostringstream buf;+ buf << "A different FFmpeg build was used to create '" << IndexFile << "'";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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);+ std::ostringstream buf;+ buf << "Unknown error while reading index information in '" << IndexFile << "'";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } } @@ -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) {+ std::ostringstream buf;+ buf << "Can't open '" << Filename << "'";+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } // Do matroska indexing instead? if (!strcmp(FormatContext->iformat->name, "matroska")) {Index: src/core/utils.h===================================================================--- src/core/utils.h (revision 226)+++ src/core/utils.h (working copy)@@ -22,9 +22,9 @@ #define UTILS_H #include <vector>+#include <sstream> #include <fstream> #include <cstdio>-#include <boost/format.hpp> #include "ffms.h" #include "matroskaparser.h" @@ -78,7 +78,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/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) {+ std::ostringstream buf;+ buf << "Can't open '" << SourceFile << "': " << strerror(errno);+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str());+ } 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);+ std::ostringstream buf;+ buf << "Can't parse Matroska file: " << ErrorMessage;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } 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);+ std::ostringstream buf;+ buf << "Can't create decompressor: " << ErrorMessage;+ throw FFMS_Exception(FFMS_ERROR_PARSER, FFMS_ERROR_FILE_READ, buf.str()); } } Index: src/core/audiosource.h===================================================================--- src/core/audiosource.h (revision 226)+++ src/core/audiosource.h (working copy)@@ -28,6 +28,7 @@ #include <vector> #include <list>+#include <sstream> #include <memory> #include "indexing.h" #include "utils.h"Index: src/core/videosource.h===================================================================--- src/core/videosource.h (revision 226)+++ src/core/videosource.h (working copy)@@ -32,6 +32,7 @@ #include "ffmscompat.h" #include <vector>+#include <sstream> #include "indexing.h" #include "utils.h" #include "ffms.h"