Internal change
PiperOrigin-RevId: 165039573
Change-Id: I3365d7bde5f31f4445f29d94ee86f824e8edfe7a
diff --git a/include/mp4v2/file.h b/include/mp4v2/file.h
index 0da200e..986bc9e 100644
--- a/include/mp4v2/file.h
+++ b/include/mp4v2/file.h
@@ -443,6 +443,20 @@
const char* fileName,
const MP4FileProvider* fileProvider DEFAULT(NULL) );
+/** Generalized version of above MP4Read, supporting reading a MP4 file at
+ * the specific file offset.
+ *
+ * @param fileName As for MP4Read
+ * @param fileOffset seek offset in file that MP4 container structure starts
+ * at.
+ */
+
+MP4V2_EXPORT
+MP4FileHandle MP4ReadProviderFromOffset(
+ const char* fileName,
+ const MP4FileProvider* fileProvider,
+ int64_t seekOffset );
+
/** @} ***********************************************************************/
#endif /* MP4V2_FILE_H */
diff --git a/src/mp4.cpp b/src/mp4.cpp
index 53fcdfa..ed14295 100644
--- a/src/mp4.cpp
+++ b/src/mp4.cpp
@@ -123,6 +123,12 @@
MP4FileHandle MP4ReadProvider( const char* fileName, const MP4FileProvider* fileProvider )
{
+ return MP4ReadProviderFromOffset(fileName, fileProvider, 0);
+}
+
+MP4FileHandle MP4ReadProviderFromOffset(
+ const char* fileName, const MP4FileProvider* fileProvider, int64_t seekOffset )
+{
if (!fileName)
return MP4_INVALID_FILE_HANDLE;
@@ -131,6 +137,7 @@
return MP4_INVALID_FILE_HANDLE;
try {
+ pFile->SetInitialSeekOffset( seekOffset );
pFile->Read( fileName, fileProvider );
return (MP4FileHandle)pFile;
}