projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix problems with FFmpeg files that have all-zero stream IDs.
[dcpomatic.git]
/
src
/
lib
/
file_group.cc
diff --git
a/src/lib/file_group.cc
b/src/lib/file_group.cc
index 5f9531f4cceef1c3503f8ac7851e155acf6c611d..9c206514152acc077d84419a4afafe846283c4e3 100644
(file)
--- a/
src/lib/file_group.cc
+++ b/
src/lib/file_group.cc
@@
-18,9
+18,6
@@
*/
#include <cstdio>
*/
#include <cstdio>
-extern "C" {
-#include <libavformat/avio.h>
-}
#include <sndfile.h>
#include "file_group.h"
#include "exceptions.h"
#include <sndfile.h>
#include "file_group.h"
#include "exceptions.h"
@@
-28,6
+25,13
@@
extern "C" {
using std::vector;
using std::cout;
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)
FileGroup::FileGroup (boost::filesystem::path p)
: _current_path (0)
, _current_file (0)
@@
-52,6
+56,13
@@
FileGroup::~FileGroup ()
}
}
}
}
+void
+FileGroup::set_paths (vector<boost::filesystem::path> 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
/** 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
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.
*/
/* 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 += pos;
break;
case SEEK_END:
- full_pos = len - pos;
+ full_pos = len
gth()
- pos;
break;
break;
- case AVSEEK_SIZE:
- return len;
}
/* Seek to full_pos */
}
/* Seek to full_pos */