*/
-#include <fstream>
-#include <boost/algorithm/string.hpp>
#include "reader_factory.h"
-#include "dcp_reader.h"
#include "stl_binary_reader.h"
#include "stl_text_reader.h"
+#include "dcp_reader.h"
+#include "subrip_reader.h"
+#include "sub_assert.h"
+#include <libxml++/libxml++.h>
+#include <boost/algorithm/string.hpp>
+#include <fstream>
using std::string;
using std::ifstream;
using boost::algorithm::ends_with;
-using boost::shared_ptr;
+using std::shared_ptr;
using namespace sub;
shared_ptr<Reader>
{
string ext = file_name.extension().string();
transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
-
- if (ext == ".xml" || ext == ".mxf") {
+
+ if (ext == ".xml") {
return shared_ptr<Reader> (new DCPReader (file_name));
- }
+ }
+
+ if (ext == ".mxf") {
+ /* Assume this is some MXF-wrapped SMPTE subtitles */
+ return shared_ptr<Reader> (new DCPReader (file_name));
+ }
if (ext == ".stl") {
/* Check the start of the DFC */
}
}
+ if (ext == ".srt") {
+ FILE* f = fopen (file_name.string().c_str(), "r");
+ SUB_ASSERT (f);
+ shared_ptr<Reader> r (new SubripReader(f));
+ fclose (f);
+ return r;
+ }
+
return shared_ptr<Reader> ();
}