aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoroskvadd <oskvadd@hushmail.com>2016-06-06 17:06:10 +0200
committeroskvadd <oskvadd@hushmail.com>2016-06-06 18:32:07 +0200
commitb0e3be09a7418dff76bd96661fa8beda96a4140b (patch)
tree96ca2fca96ee80e0a010a2745f630740425f2b02 /lib
parentf11ba1e46826df1f2e3ea7c8f134b015c0e36c59 (diff)
Speed up startup time for movies in split rar archives.
This patch cuts down on the seek time for files in stored rar archives.
Diffstat (limited to 'lib')
-rw-r--r--lib/UnrarXLib/volume.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/UnrarXLib/volume.cpp b/lib/UnrarXLib/volume.cpp
index b24e98bd61..1c1d95008a 100644
--- a/lib/UnrarXLib/volume.cpp
+++ b/lib/UnrarXLib/volume.cpp
@@ -20,8 +20,23 @@ bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Comman
Arc.Close();
char NextName[NM];
- strcpy(NextName,Arc.FileName);
- NextVolumeName(NextName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+ if(DataIO != NULL && (DataIO->m_iSeekTo > Arc.NewLhd.FullPackSize)){
+ if (Arc.Volume && Arc.NotFirstVolume)
+ VolNameToFirstName(Arc.FileName,NextName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING));
+ else
+ strcpy(NextName,Arc.FileName);
+
+ Int64 FastSeek = 0;
+ while(FastSeek+Arc.NewLhd.FullPackSize < DataIO->m_iSeekTo){
+ NextVolumeName(NextName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+ FastSeek += Arc.NewLhd.FullPackSize;
+ }
+ DataIO->CurUnpRead = FastSeek;
+
+ }else{
+ strcpy(NextName,Arc.FileName);
+ NextVolumeName(NextName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+ }
#if !defined(SFX_MODULE) && !defined(RARDLL)
bool RecoveryDone=false;