X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Flib%2Ffile_group.cc;h=9c206514152acc077d84419a4afafe846283c4e3;hb=2d5b8cdde08044d323aa7193dfac6c9f8bca7131;hp=5f9531f4cceef1c3503f8ac7851e155acf6c611d;hpb=5a999debb53087de8188603ea9b9d928b2293978;p=dcpomatic.git diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc index 5f9531f4c..9c2065141 100644 --- a/src/lib/file_group.cc +++ b/src/lib/file_group.cc @@ -18,9 +18,6 @@ */ #include -extern "C" { -#include -} #include #include "file_group.h" #include "exceptions.h" @@ -28,6 +25,13 @@ extern "C" { using std::vector; using std::cout; +FileGroup::FileGroup () + : _current_path (0) + , _current_file (0) +{ + +} + FileGroup::FileGroup (boost::filesystem::path p) : _current_path (0) , _current_file (0) @@ -52,6 +56,13 @@ FileGroup::~FileGroup () } } +void +FileGroup::set_paths (vector const & p) +{ + _paths = p; + ensure_open_path (0); + seek (0, SEEK_SET); +} /** Ensure that the given path index in the content is the _current_file */ void @@ -76,8 +87,6 @@ FileGroup::ensure_open_path (size_t p) const int64_t FileGroup::seek (int64_t pos, int whence) const { - int64_t const len = length (); - /* Convert pos to `full_pos', which is an offset from the start of all the files. */ @@ -94,10 +103,8 @@ FileGroup::seek (int64_t pos, int whence) const full_pos += pos; break; case SEEK_END: - full_pos = len - pos; + full_pos = length() - pos; break; - case AVSEEK_SIZE: - return len; } /* Seek to full_pos */