Skip to content

Commit 92440fa

Browse files
author
Clement Champetier
committed
mediaProperty: add template specification in detail namespace
Can use "add" function with a Rational.
1 parent 19d0161 commit 92440fa

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/AvTranscoder/mediaProperty/VideoProperties.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ std::string VideoProperties::getStartTimecodeString() const
335335
return os.str();
336336
}
337337

338-
339338
Rational VideoProperties::getTimeBase() const
340339
{
341340
if( ! _codecContext )
@@ -592,7 +591,7 @@ PropertiesMap VideoProperties::getPropertiesAsMap() const
592591
detail::add( dataMap, "interlaced ", isInterlaced() );
593592
detail::add( dataMap, "topFieldFirst", isTopFieldFirst() );
594593
detail::add( dataMap, "fieldOrder", getFieldOrder() );
595-
detail::add( dataMap, "timeBase", getTimeBase().num / (double) getTimeBase().den );
594+
detail::add( dataMap, "timeBase", getTimeBase() );
596595
detail::add( dataMap, "duration", getDuration() );
597596
detail::add( dataMap, "fps", getFps() );
598597
detail::add( dataMap, "nbFrame", getNbFrames() );

src/AvTranscoder/mediaProperty/util.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ void add( PropertiesMap& propertiesMap, const std::string& key, const bool& valu
2222
add( propertiesMap, key, value ? "True" : "False" );
2323
}
2424

25+
template<>
26+
void add( PropertiesMap& propertiesMap, const std::string& key, const Rational& value )
27+
{
28+
add( propertiesMap, key, value.num / (double) value.den );
29+
}
30+
2531
void fillMetadataDictionnary( AVDictionary* avdictionnary, PropertiesMap& metadata )
2632
{
2733
AVDictionaryEntry* tag = NULL;

src/AvTranscoder/mediaProperty/util.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ void add( PropertiesMap& propertiesMap, const std::string& key, const std::strin
3333
template<>
3434
void add( PropertiesMap& propertiesMap, const std::string& key, const bool& value );
3535

36+
template<>
37+
void add( PropertiesMap& propertiesMap, const std::string& key, const Rational& value );
38+
3639
/**
3740
* @brief Fill metadata parameter with the given AVDictionary.
3841
*/

0 commit comments

Comments
 (0)