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

Commit4122382

Browse files
author
Clement Champetier
committed
Merge branch 'master' into develop
2 parents7566857 +eaf480e commit4122382

20 files changed

+95
-80
lines changed

‎src/AvTranscoder/mediaProperty/FileProperties.cpp

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,40 @@ void FileProperties::extractStreamProperties( IProgress& progress, const EAnalys
8282

8383
// once the streams vectors are filled, add their references the base streams vector
8484
for(size_t streamIndex =0; streamIndex < _videoStreams.size(); ++streamIndex )
85-
_streams[ _videoStreams.at( streamIndex ).getStreamIndex() ] = &_videoStreams.at( streamIndex );
85+
{
86+
constsize_t videoStreamIndex = _videoStreams.at( streamIndex ).getStreamIndex();
87+
_streams[ videoStreamIndex ] = &_videoStreams.at( streamIndex );
88+
}
8689

8790
for(size_t streamIndex =0; streamIndex < _audioStreams.size(); ++ streamIndex )
88-
_streams[ _audioStreams.at(streamIndex).getStreamIndex() ] = &_audioStreams.at(streamIndex);
91+
{
92+
constsize_t audioStreamIndex = _audioStreams.at( streamIndex ).getStreamIndex();
93+
_streams[ audioStreamIndex ] = &_audioStreams.at(streamIndex);
94+
}
8995

9096
for(size_t streamIndex =0; streamIndex < _dataStreams.size(); ++ streamIndex )
91-
_streams[ _dataStreams.at(streamIndex).getStreamIndex() ] = &_dataStreams.at(streamIndex);
97+
{
98+
constsize_t dataStreamIndex = _dataStreams.at( streamIndex ).getStreamIndex();
99+
_streams[ dataStreamIndex ] = &_dataStreams.at(streamIndex);
100+
}
92101

93102
for(size_t streamIndex =0; streamIndex < _subtitleStreams.size(); ++ streamIndex )
94-
_streams[ _subtitleStreams.at(streamIndex).getStreamIndex() ] = &_subtitleStreams.at(streamIndex);
103+
{
104+
constsize_t subtitleStreamIndex = _subtitleStreams.at( streamIndex ).getStreamIndex();
105+
_streams[ subtitleStreamIndex ] = &_subtitleStreams.at(streamIndex);
106+
}
95107

96108
for(size_t streamIndex =0; streamIndex < _attachementStreams.size(); ++ streamIndex )
97-
_streams[ _attachementStreams.at(streamIndex).getStreamIndex() ] = &_attachementStreams.at(streamIndex);
109+
{
110+
constsize_t attachementStreamIndex = _attachementStreams.at( streamIndex ).getStreamIndex();
111+
_streams[ attachementStreamIndex ] = &_attachementStreams.at(streamIndex);
112+
}
98113

99114
for(size_t streamIndex =0; streamIndex < _unknownStreams.size(); ++ streamIndex )
100-
_streams[ _unknownStreams.at(streamIndex).getStreamIndex() ] = &_unknownStreams.at(streamIndex);
115+
{
116+
constsize_t unknownStreamIndex = _unknownStreams.at( streamIndex ).getStreamIndex();
117+
_streams[ unknownStreamIndex ] = &_unknownStreams.at(streamIndex);
118+
}
101119

102120
// if the analysis level has decoded some streams parts, return at the beginning
103121
if( level > eAnalyseLevelHeader )
@@ -139,7 +157,7 @@ double FileProperties::getStartTime() const
139157
return1.0 * (unsignedint)_avFormatContext->start_time / AV_TIME_BASE;
140158
}
141159

142-
doubleFileProperties::getDuration()const
160+
floatFileProperties::getDuration()const
143161
{
144162
if( ! _avFormatContext )
145163
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 / (float) 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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,20 +518,20 @@ int VideoProperties::getLevel() const
518518
return _codecContext->level;
519519
}
520520

521-
doubleVideoProperties::getFps()const
521+
floatVideoProperties::getFps()const
522522
{
523-
size_t nbFrames =getNbFrames();
523+
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
}
531531

532532
// if nbFrames of stream is unknwon
533533
Rational timeBase =getTimeBase();
534-
double fps = timeBase.den / (double) timeBase.num;
534+
float fps = timeBase.den / (double) timeBase.num;
535535
if(std::isinf( fps ) )
536536
{
537537
std::ostringstream os;

‎src/AvTranscoder/mediaProperty/VideoProperties.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class AvExport VideoProperties : public StreamProperties
5656
intgetProfile()const;
5757
intgetLevel()const;
5858

59-
doublegetFps()const;
59+
floatgetFps()const;
6060

6161
boolhasBFrames()const;
6262
//bool isClosedGop() const;

‎src/AvTranscoder/stat/AudioStat.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ namespace avtranscoder
1212
classAvExport AudioStat
1313
{
1414
public:
15-
AudioStat(constdouble duration,constsize_t nbPackets )
15+
AudioStat(constfloat duration,constsize_t nbPackets )
1616
: _duration( duration )
1717
, _nbPackets( nbPackets )
1818
{}
1919

2020
public:
21-
double _duration;
21+
float _duration;
2222
size_t _nbPackets;
2323
};
2424

‎src/AvTranscoder/stat/VideoStat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace avtranscoder
77

88
doubleVideoStat::psnr(constdouble d )
99
{
10-
return -10.0 *log(d) /log(10.0);
10+
return -10.0 *log10(d);
1111
}
1212

1313
}

‎src/AvTranscoder/stat/VideoStat.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace avtranscoder
1212
classAvExport VideoStat
1313
{
1414
public:
15-
VideoStat(constdouble duration,constsize_t nbFrames )
15+
VideoStat(constfloat duration,constsize_t nbFrames )
1616
: _duration( duration )
1717
, _nbFrames( nbFrames )
1818
, _quality(0 )
@@ -23,7 +23,7 @@ class AvExport VideoStat
2323
staticdoublepsnr(constdouble d );
2424

2525
public:
26-
double _duration;
26+
float _duration;
2727
size_t _nbFrames;
2828
size_t _quality;///< Between 1 (good) and FF_LAMBDA_MAX (bad). 0 if unknown.
2929
double _psnr;///< 0 if unknown.

‎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
//@{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp