Add "U8" character code table for binary STL.
[libsub.git] / src / reader_factory.cc
index 5d38e4e9ec5a57365eed9c564bb89f59a8e1482e..fb717eac703ed1b475e06639d7afcfec11d7fb2c 100644 (file)
@@ -21,6 +21,8 @@
 #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>
@@ -28,7 +30,7 @@
 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>
@@ -59,5 +61,13 @@ sub::reader_factory (boost::filesystem::path file_name)
                }
        }
 
+       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> ();
 }