Skip to content

Commit edc9345

Browse files
author
Clement Champetier
committed
FileProperties: fixed analysis of first GOP on raw format
* When extractStreamProperties, seek at the beginning of the file only if analyse gop on none raw format. * Tested with avc (h264 codec) and mp3 files.
1 parent c479c56 commit edc9345

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/AvTranscoder/properties/FileProperties.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ FileProperties::FileProperties(const FormatContext& formatContext)
2929

3030
void FileProperties::extractStreamProperties(IProgress& progress, const EAnalyseLevel level)
3131
{
32-
clearStreamProperties();
33-
3432
// if the analysis level wiil decode some streams parts, seek at the beginning
35-
if(level > eAnalyseLevelHeader)
33+
if(level > eAnalyseLevelHeader && ! isRawFormat())
3634
const_cast<FormatContext*>(_formatContext)->seek(0, AVSEEK_FLAG_BACKWARD);
3735

36+
// clear properties
37+
clearStreamProperties();
38+
39+
// reload properties
3840
for(size_t streamIndex = 0; streamIndex < _formatContext->getNbStreams(); ++streamIndex)
3941
{
4042
switch(_formatContext->getAVStream(streamIndex).codec->codec_type)
@@ -120,7 +122,7 @@ void FileProperties::extractStreamProperties(IProgress& progress, const EAnalyse
120122
}
121123

122124
// if the analysis level has decoded some streams parts, return at the beginning
123-
if(level > eAnalyseLevelHeader)
125+
if(level > eAnalyseLevelHeader && ! isRawFormat())
124126
const_cast<FormatContext*>(_formatContext)->seek(0, AVSEEK_FLAG_BACKWARD);
125127
}
126128

0 commit comments

Comments
 (0)