Skip to content

Commit 465af95

Browse files
author
Clement Champetier
committed
VideoProperties: refactor seek to the beginning of the file after analysis
1 parent ac763ff commit 465af95

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/AvTranscoder/properties/VideoProperties.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ VideoProperties::VideoProperties(const FileProperties& fileProperties, const siz
3838
_firstGopTimeCode = _codecContext->timecode_frame_start;
3939
}
4040

41-
if(_levelAnalysis == eAnalyseLevelFirstGop)
42-
analyseGopStructure(progress);
43-
else if(_levelAnalysis == eAnalyseLevelFull)
44-
analyseFull(progress);
41+
if(_levelAnalysis > eAnalyseLevelHeader)
42+
{
43+
if(_levelAnalysis == eAnalyseLevelFirstGop)
44+
analyseGopStructure(progress);
45+
else if(_levelAnalysis == eAnalyseLevelFull)
46+
analyseFull(progress);
47+
48+
// Returns at the beginning of the stream
49+
const_cast<InputFile&>(_fileProperties->getInputFile()).seekAtFrame(0, AVSEEK_FLAG_BYTE);
50+
}
4551
}
4652

4753
std::string VideoProperties::getProfileName() const
@@ -557,9 +563,6 @@ size_t VideoProperties::analyseGopStructure(IProgress& progress)
557563
}
558564
}
559565

560-
// Returns at the beginning of the stream
561-
file.seekAtFrame(0, AVSEEK_FLAG_BYTE);
562-
563566
// Check GOP size
564567
if(_gopSize <= 0)
565568
{
@@ -594,9 +597,6 @@ size_t VideoProperties::analyseFull(IProgress& progress)
594597
++_nbFrames;
595598
}
596599

597-
// Returns at the beginning of the stream
598-
file.seekAtFrame(0, AVSEEK_FLAG_BYTE);
599-
600600
// Check GOP size
601601
if(_nbFrames <= 0)
602602
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy