Skip to content

Commit ac763ff

Browse files
author
Clement Champetier
committed
VideoProperties: fix nb decoded frames in analyseFull method
Use the number of decoded frames in analyseGopStructure method.
1 parent c33fb0f commit ac763ff

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/AvTranscoder/properties/VideoProperties.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,23 +568,27 @@ size_t VideoProperties::analyseGopStructure(IProgress& progress)
568568
return nbDecodedFrames;
569569
}
570570

571-
void VideoProperties::analyseFull(IProgress& progress)
571+
size_t VideoProperties::analyseFull(IProgress& progress)
572572
{
573-
analyseGopStructure(progress);
573+
const size_t nbDecodedFrames = analyseGopStructure(progress);
574+
575+
if(! _fileProperties->isRawFormat())
576+
return nbDecodedFrames;
574577

575578
if(! _formatContext || ! _codecContext || ! _codec)
576-
return;
579+
return 0;
577580
if(! _codecContext->width || ! _codecContext->height)
578-
return;
581+
return 0;
579582

580583
InputFile& file = const_cast<InputFile&>(_fileProperties->getInputFile());
581584
// Get the stream
582585
IInputStream& stream = file.getStream(_streamIndex);
583586
stream.activate();
584587
// Create a decoder
585588
VideoDecoder decoder(static_cast<InputStream&>(stream));
586-
587589
VideoFrame frame(VideoFrameDesc(getWidth(), getHeight(), getPixelFormatName(getPixelProperties().getAVPixelFormat())), false);
590+
591+
_nbFrames = nbDecodedFrames;
588592
while(decoder.decodeNextFrame(frame))
589593
{
590594
++_nbFrames;
@@ -598,6 +602,7 @@ void VideoProperties::analyseFull(IProgress& progress)
598602
{
599603
throw std::runtime_error("Invalid number of frames when decoding the video stream.");
600604
}
605+
return _nbFrames;
601606
}
602607

603608
PropertyVector& VideoProperties::fillVector(PropertyVector& data) const

src/AvTranscoder/properties/VideoProperties.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ class AvExport VideoProperties : public StreamProperties
111111

112112
/**
113113
* @param progress: callback to get analysis progression
114+
* @return the number of decoded frames to parse all the file.
114115
*/
115-
void analyseFull(IProgress& progress);
116+
size_t analyseFull(IProgress& progress);
116117

117118
#ifndef SWIG
118119
template <typename T>

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