Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc8169ed

Browse files
author
Clement Champetier
committed
Manage duration as a float
Double type is not constructed the same way in C++ and Java, and doesnot exist in python. Our bindings of 'C++ double' could create issues,and since a fps with a simple precision is enough, we decided to returnfps as float.
1 parentc619856 commitc8169ed

12 files changed

+26
-29
lines changed

‎src/AvTranscoder/mediaProperty/FileProperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ double FileProperties::getStartTime() const
157157
return1.0 * (unsignedint)_avFormatContext->start_time / AV_TIME_BASE;
158158
}
159159

160-
doubleFileProperties::getDuration()const
160+
floatFileProperties::getDuration()const
161161
{
162162
if( ! _avFormatContext )
163163
throwstd::runtime_error("unknown format context" );

‎src/AvTranscoder/mediaProperty/FileProperties.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AvExport FileProperties
4444

4545
size_tgetProgramsCount()const;
4646
doublegetStartTime()const;
47-
doublegetDuration()const;///< in seconds
47+
floatgetDuration()const;///< in seconds
4848
size_tgetBitRate()const;///< total stream bitrate in bit/s, 0 if not available (result of a computation by ffmpeg)
4949
size_tgetPacketSize()const;
5050

‎src/AvTranscoder/mediaProperty/StreamProperties.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ Rational StreamProperties::getTimeBase() const
3737
return timeBase;
3838
}
3939

40-
doubleStreamProperties::getDuration()const
40+
floatStreamProperties::getDuration()const
4141
{
4242
Rational timeBase =getTimeBase();
43-
double duration = ( timeBase.num / (double) timeBase.den ) * _formatContext->streams[_streamIndex]->duration;
44-
return duration;
43+
return ( timeBase.num / (double) timeBase.den ) * _formatContext->streams[_streamIndex]->duration;
4544
}
4645

4746
PropertyVectorStreamProperties::getPropertiesAsVector()const

‎src/AvTranscoder/mediaProperty/StreamProperties.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AvExport StreamProperties
1818
size_tgetStreamIndex()const {return _streamIndex; }
1919
size_tgetStreamId()const;
2020
RationalgetTimeBase()const;
21-
doublegetDuration()const;///< in seconds
21+
floatgetDuration()const;///< in seconds
2222
const PropertyVector&getMetadatas()const {return _metadatas; }
2323

2424
#ifndef SWIG

‎src/AvTranscoder/mediaProperty/VideoProperties.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ float VideoProperties::getFps() const
523523
constsize_t nbFrames =getNbFrames();
524524
if( nbFrames )
525525
{
526-
double duration =getDuration();
527-
doubleepsilon = std::numeric_limits<double>::epsilon();
526+
constfloat duration =getDuration();
527+
constfloatepsilon = std::numeric_limits<float>::epsilon();
528528
if( duration > epsilon )
529529
return nbFrames / duration;
530530
}

‎src/AvTranscoder/stream/IInputStream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AvExport IInputStream
2222
virtualboolreadNextPacket( CodedData& data ) = 0;
2323

2424
virtualsize_tgetStreamIndex()const = 0;
25-
virtualdoublegetDuration()const = 0;
25+
virtualfloatgetDuration()const = 0;
2626
virtual AVMediaTypegetStreamType()const = 0;
2727

2828
//@{

‎src/AvTranscoder/stream/InputStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ AVMediaType InputStream::getStreamType() const
111111
return _inputFile->getFormatContext().getAVStream( _streamIndex ).codec->codec_type;
112112
}
113113

114-
doubleInputStream::getDuration()const
114+
floatInputStream::getDuration()const
115115
{
116116
return _inputFile->getProperties().getStreamPropertiesWithIndex( _streamIndex ).getDuration();
117117
}

‎src/AvTranscoder/stream/InputStream.hpp

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

2727
size_tgetStreamIndex()const {return _streamIndex; }
2828
/// Get duration of the stream, in seconds
29-
doublegetDuration()const;
29+
floatgetDuration()const;
3030
AVMediaTypegetStreamType()const;
3131

3232
VideoCodec&getVideoCodec();

‎src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ void StreamTranscoder::switchToInputDecoder()
482482
assert( _currentDecoder !=NULL );
483483
}
484484

485-
doubleStreamTranscoder::getDuration()const
485+
floatStreamTranscoder::getDuration()const
486486
{
487487
if( _inputStream )
488488
{
489-
double totalDuration = _inputStream->getDuration() + _offset;
489+
constfloat totalDuration = _inputStream->getDuration() + _offset;
490490
if( totalDuration <0 )
491491
{
492492
LOG_WARN("Offset of" << _offset <<"s applied to a stream with a duration of" << _inputStream->getDuration() <<"s. Set its duration to 0s." )
@@ -495,7 +495,7 @@ double StreamTranscoder::getDuration() const
495495
return totalDuration;
496496
}
497497
else
498-
return std::numeric_limits<double>::max();
498+
return std::numeric_limits<float>::max();
499499
}
500500

501501
StreamTranscoder::EProcessCaseStreamTranscoder::getProcessCase()const

‎src/AvTranscoder/transcoder/StreamTranscoder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class AvExport StreamTranscoder
6868
* @note if it's a generated stream, return limit of double.
6969
* @note if offset > duration of the stream, return 0
7070
*/
71-
doublegetDuration()const;
71+
floatgetDuration()const;
7272

7373
/// Returns a reference to the current decoder (from input file or from generator)
7474
IDecoder&getCurrentDecoder()const {return *_currentDecoder; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp