@@ -29,12 +29,14 @@ FileProperties::FileProperties(const FormatContext& formatContext)
29
29
30
30
void FileProperties::extractStreamProperties (IProgress& progress, const EAnalyseLevel level)
31
31
{
32
- clearStreamProperties ();
33
-
34
32
// if the analysis level wiil decode some streams parts, seek at the beginning
35
- if (level > eAnalyseLevelHeader)
33
+ if (level > eAnalyseLevelHeader && ! isRawFormat () )
36
34
const_cast <FormatContext*>(_formatContext)->seek (0 , AVSEEK_FLAG_BACKWARD);
37
35
36
+ // clear properties
37
+ clearStreamProperties ();
38
+
39
+ // reload properties
38
40
for (size_t streamIndex = 0 ; streamIndex < _formatContext->getNbStreams (); ++streamIndex)
39
41
{
40
42
switch (_formatContext->getAVStream (streamIndex).codec ->codec_type )
@@ -120,7 +122,7 @@ void FileProperties::extractStreamProperties(IProgress& progress, const EAnalyse
120
122
}
121
123
122
124
// if the analysis level has decoded some streams parts, return at the beginning
123
- if (level > eAnalyseLevelHeader)
125
+ if (level > eAnalyseLevelHeader && ! isRawFormat () )
124
126
const_cast <FormatContext*>(_formatContext)->seek (0 , AVSEEK_FLAG_BACKWARD);
125
127
}
126
128
@@ -145,6 +147,16 @@ std::string FileProperties::getFormatLongName() const
145
147
return _avFormatContext->iformat ->long_name ;
146
148
}
147
149
150
+ bool FileProperties::isRawFormat () const
151
+ {
152
+ if (getNbStreams () != 1 )
153
+ return false ;
154
+ // the format name should be the same as the codec name
155
+ if (getFormatName () == getStreamProperties ().at (0 )->getCodecName ())
156
+ return true ;
157
+ return false ;
158
+ }
159
+
148
160
std::string FileProperties::getFormatMimeType () const
149
161
{
150
162
#if LIBAVFORMAT_VERSION_MAJOR <= 55
0 commit comments