summaryrefslogtreecommitdiffstats
path: root/libvpx/third_party
diff options
context:
space:
mode:
Diffstat (limited to 'libvpx/third_party')
-rw-r--r--libvpx/third_party/libwebm/README.webm2
-rw-r--r--libvpx/third_party/libwebm/mkvmuxerutil.cpp4
-rw-r--r--libvpx/third_party/libwebm/mkvreader.cpp29
-rw-r--r--libvpx/third_party/libwebm/mkvreader.hpp8
4 files changed, 33 insertions, 10 deletions
diff --git a/libvpx/third_party/libwebm/README.webm b/libvpx/third_party/libwebm/README.webm
index b13c8cb..2c7570d 100644
--- a/libvpx/third_party/libwebm/README.webm
+++ b/libvpx/third_party/libwebm/README.webm
@@ -1,5 +1,5 @@
URL: https://chromium.googlesource.com/webm/libwebm
-Version: 630a0e3c338e1b32bddf513a2dad807908d2976a
+Version: a7118d8ec564e9db841da1eb01f547f3229f240a
License: BSD
License File: LICENSE.txt
diff --git a/libvpx/third_party/libwebm/mkvmuxerutil.cpp b/libvpx/third_party/libwebm/mkvmuxerutil.cpp
index 96350e9..18060e9 100644
--- a/libvpx/third_party/libwebm/mkvmuxerutil.cpp
+++ b/libvpx/third_party/libwebm/mkvmuxerutil.cpp
@@ -292,11 +292,11 @@ bool WriteEbmlElement(IMkvWriter* writer, uint64 type, const char* value) {
if (WriteID(writer, type))
return false;
- const int32 length = strlen(value);
+ const uint64 length = strlen(value);
if (WriteUInt(writer, length))
return false;
- if (writer->Write(value, length))
+ if (writer->Write(value, static_cast<const uint32>(length)))
return false;
return true;
diff --git a/libvpx/third_party/libwebm/mkvreader.cpp b/libvpx/third_party/libwebm/mkvreader.cpp
index cb3567f..b4b2459 100644
--- a/libvpx/third_party/libwebm/mkvreader.cpp
+++ b/libvpx/third_party/libwebm/mkvreader.cpp
@@ -14,13 +14,20 @@ namespace mkvparser
{
MkvReader::MkvReader() :
- m_file(NULL)
-{
+ m_file(NULL),
+ reader_owns_file_(true) {
}
-MkvReader::~MkvReader()
-{
+MkvReader::MkvReader(FILE* fp) :
+ m_file(fp),
+ reader_owns_file_(false) {
+ GetFileSize();
+}
+
+MkvReader::~MkvReader() {
+ if (reader_owns_file_)
Close();
+ m_file = NULL;
}
int MkvReader::Open(const char* fileName)
@@ -42,12 +49,17 @@ int MkvReader::Open(const char* fileName)
if (m_file == NULL)
return -1;
#endif
+ return !GetFileSize();
+}
+bool MkvReader::GetFileSize() {
+ if (m_file == NULL)
+ return false;
#ifdef _MSC_VER
int status = _fseeki64(m_file, 0L, SEEK_END);
if (status)
- return -1; //error
+ return false; //error
m_length = _ftelli64(m_file);
#else
@@ -56,16 +68,19 @@ int MkvReader::Open(const char* fileName)
#endif
assert(m_length >= 0);
+ if (m_length < 0)
+ return false;
+
#ifdef _MSC_VER
status = _fseeki64(m_file, 0L, SEEK_SET);
if (status)
- return -1; //error
+ return false; //error
#else
fseek(m_file, 0L, SEEK_SET);
#endif
- return 0;
+ return true;
}
void MkvReader::Close()
diff --git a/libvpx/third_party/libwebm/mkvreader.hpp b/libvpx/third_party/libwebm/mkvreader.hpp
index adcc29f..8ebdd99 100644
--- a/libvpx/third_party/libwebm/mkvreader.hpp
+++ b/libvpx/third_party/libwebm/mkvreader.hpp
@@ -21,6 +21,7 @@ class MkvReader : public IMkvReader
MkvReader& operator=(const MkvReader&);
public:
MkvReader();
+ MkvReader(FILE* fp);
virtual ~MkvReader();
int Open(const char*);
@@ -29,8 +30,15 @@ public:
virtual int Read(long long position, long length, unsigned char* buffer);
virtual int Length(long long* total, long long* available);
private:
+
+ // Determines the size of the file. This is called either by the constructor
+ // or by the Open function depending on file ownership. Returns true on
+ // success.
+ bool GetFileSize();
+
long long m_length;
FILE* m_file;
+ bool reader_owns_file_;
};
} //end namespace mkvparser