Skip to content

Commit 447392a

Browse files
author
Clement Champetier
committed
IInputStream: remove getDuration
1 parent 10b5a09 commit 447392a

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

src/AvTranscoder/stream/IInputStream.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class AvExport IInputStream
3131
*/
3232
virtual const StreamProperties& getProperties() const = 0;
3333
virtual size_t getStreamIndex() const = 0;
34-
virtual float getDuration() const = 0; ///< Get duration of the stream, in seconds
3534

3635
//@{
3736
/**

src/AvTranscoder/stream/InputStream.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ const StreamProperties& InputStream::getProperties() const
113113
return _inputFile->getProperties().getStreamPropertiesWithIndex( _streamIndex );
114114
}
115115

116-
float InputStream::getDuration() const
117-
{
118-
return _inputFile->getProperties().getStreamPropertiesWithIndex( _streamIndex ).getDuration();
119-
}
120-
121116
void InputStream::addPacket( const AVPacket& packet )
122117
{
123118
// Do not cache data if the stream is declared as unused in process

src/AvTranscoder/stream/InputStream.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class AvExport InputStream : public IInputStream
2626

2727
const StreamProperties& getProperties() const;
2828
size_t getStreamIndex() const { return _streamIndex; }
29-
float getDuration() const;
3029

3130
VideoCodec& getVideoCodec();
3231
AudioCodec& getAudioCodec();

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ bool StreamTranscoder::processFrame()
383383
}
384384
else if( _offset < 0 )
385385
{
386-
const bool endOfStream = _outputStream->getStreamDuration() >= ( _inputStream->getDuration() + _offset );
386+
const bool endOfStream = _outputStream->getStreamDuration() >= ( _inputStream->getProperties().getDuration() + _offset );
387387
if( endOfStream )
388388
{
389389
LOG_INFO( "End of negative offset" )
@@ -516,10 +516,11 @@ float StreamTranscoder::getDuration() const
516516
{
517517
if( _inputStream )
518518
{
519-
const float totalDuration = _inputStream->getDuration() + _offset;
519+
const StreamProperties& streamProperties = _inputStream->getProperties();
520+
const float totalDuration = streamProperties.getDuration() + _offset;
520521
if( totalDuration < 0 )
521522
{
522-
LOG_WARN( "Offset of " << _offset << "s applied to a stream with a duration of " << _inputStream->getDuration() << "s. Set its duration to 0s." )
523+
LOG_WARN( "Offset of " << _offset << "s applied to a stream with a duration of " << streamProperties.getDuration() << "s. Set its duration to 0s." )
523524
return 0.;
524525
}
525526
return totalDuration;

0 commit comments

Comments
 (0)