Skip to content

Commit 294aa03

Browse files
author
Clement Champetier
committed
FileProperties: fix InputFile analysis
* When manually analyse an InputFile, the previous StreamProperties created are used to access the codec (if decoding is needed). * So in that cases, the _streams vector should be cleared after the new analysis.
1 parent 2d92597 commit 294aa03

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/AvTranscoder/properties/FileProperties.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ void FileProperties::extractStreamProperties(IProgress& progress, const EAnalyse
3636
const_cast<InputFile&>(_file).seekAtFrame(0, AVSEEK_FLAG_BACKWARD);
3737

3838
// clear properties
39-
clearStreamProperties();
39+
_videoStreams.clear();
40+
_audioStreams.clear();
41+
_dataStreams.clear();
42+
_subtitleStreams.clear();
43+
_attachementStreams.clear();
44+
_unknownStreams.clear();
4045

4146
// reload properties
4247
for(size_t streamIndex = 0; streamIndex < _formatContext->getNbStreams(); ++streamIndex)
@@ -86,6 +91,9 @@ void FileProperties::extractStreamProperties(IProgress& progress, const EAnalyse
8691
}
8792
}
8893

94+
// clear streams
95+
_streams.clear();
96+
8997
// once the streams vectors are filled, add their references the base streams vector
9098
for(size_t streamIndex = 0; streamIndex < _videoStreams.size(); ++streamIndex)
9199
{
@@ -373,18 +381,6 @@ std::string FileProperties::allPropertiesAsJson() const
373381
return writer.build();
374382
}
375383

376-
void FileProperties::clearStreamProperties()
377-
{
378-
_streams.clear();
379-
380-
_videoStreams.clear();
381-
_audioStreams.clear();
382-
_dataStreams.clear();
383-
_subtitleStreams.clear();
384-
_attachementStreams.clear();
385-
_unknownStreams.clear();
386-
}
387-
388384
std::ostream& operator<<(std::ostream& flux, const FileProperties& fileProperties)
389385
{
390386
flux << std::left;

src/AvTranscoder/properties/FileProperties.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ class AvExport FileProperties
107107
}
108108
#endif
109109

110-
void clearStreamProperties(); ///< Clear all array of stream properties
111-
112110
private:
113111
const InputFile& _file; ///< Has link (no ownership)
114112
const FormatContext* _formatContext; ///< Has link (no ownership)

0 commit comments

Comments
 (0)