Skip to content

Commit da3b290

Browse files
committed
Merge pull request #33 from cchampet/fix_timecode
Fix timecode
2 parents 60f5fd7 + b2af46e commit da3b290

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/AvTranscoder/mediaProperty/VideoProperties.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,19 @@ int64_t VideoProperties::getStartTimecode() const
319319

320320
std::string VideoProperties::getStartTimecodeString() const
321321
{
322-
int64_t stratTimeCode = getStartTimecode();
322+
int64_t startTimeCode = getStartTimecode();
323323
std::ostringstream os;
324-
os << std::setfill( '0' );
325-
os << std::setw(2) << ( stratTimeCode >> 19 & 0x1f ) << ":"; // 5-bit hours
326-
os << std::setw(2) << ( stratTimeCode >> 13 & 0x3f ) << ":"; // 6-bit minutes
327-
os << std::setw(2) << ( stratTimeCode >> 6 & 0x3f ) ; // 6-bit seconds
328-
os << ( stratTimeCode & 1 << 24 ? ';' : ':' ); // 1-bit drop flag
329-
os << std::setw(2) << ( stratTimeCode & 0x3f ); // 6-bit frames
324+
if( startTimeCode == -1 )
325+
os << "unset";
326+
else
327+
{
328+
os << std::setfill( '0' );
329+
os << std::setw(2) << ( startTimeCode >> 19 & 0x1f ) << ":"; // 5-bit hours
330+
os << std::setw(2) << ( startTimeCode >> 13 & 0x3f ) << ":"; // 6-bit minutes
331+
os << std::setw(2) << ( startTimeCode >> 6 & 0x3f ) ; // 6-bit seconds
332+
os << ( startTimeCode & 1 << 24 ? ';' : ':' ); // 1-bit drop flag
333+
os << std::setw(2) << ( startTimeCode & 0x3f ); // 6-bit frames
334+
}
330335
return os.str();
331336
}
332337

@@ -573,7 +578,7 @@ PropertiesMap VideoProperties::getPropertiesAsMap() const
573578
detail::add( dataMap, "profile", getProfile() );
574579
detail::add( dataMap, "profileName", getProfileName() );
575580
detail::add( dataMap, "level", getLevel() );
576-
detail::add( dataMap, "startTimecode", getStartTimecode() );
581+
detail::add( dataMap, "startTimecode", getStartTimecodeString() );
577582
detail::add( dataMap, "width", getWidth() );
578583
detail::add( dataMap, "height", getHeight() );
579584
detail::add( dataMap, "pixelAspectRatio", getSar().num / getSar().den );

src/AvTranscoder/mediaProperty/VideoProperties.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class AvExport VideoProperties
8181
const PixelProperties& getPixelProperties() const { return _pixelProperties; }
8282
#endif
8383

84-
PropertiesMap getPropertiesAsMap() const; ///< Return all video properties as a map (name of property: value)
84+
PropertiesMap getPropertiesAsMap() const; ///< Return all video and pixel properties as a map (name of property: value)
8585

8686
private:
8787
/**

0 commit comments

Comments
 (0)