Skip to content

Commit 00d1694

Browse files
author
Clement Champetier
committed
Profile: add update function
The function updates the corresponding profile, or create a new one if it doesn't exist.
1 parent b034e6e commit 00d1694

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/AvTranscoder/Profile.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ void Profile::loadProfiles()
7979
}
8080
}
8181

82+
void Profile::update( const ProfileDesc& profile )
83+
{
84+
std::string profileId( profile.find( avProfileIdentificator )->second );
85+
size_t profileIndex = 0;
86+
for( ProfilesDesc::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
87+
{
88+
if( (*it).find( avProfileIdentificator )->second == profileId )
89+
{
90+
_profiles.at( profileIndex ) = profile;
91+
return;
92+
}
93+
++profileIndex;
94+
}
95+
_profiles.push_back( profile );
96+
}
97+
8298
const Profile::ProfilesDesc& Profile::getProfiles()
8399
{
84100
return _profiles;

src/AvTranscoder/Profile.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class Profile
2727

2828
void loadProfiles();
2929

30+
void update( const ProfileDesc& profile );
31+
3032
const ProfilesDesc& getProfiles();
3133

3234
ProfilesDesc getVideoProfiles();

0 commit comments

Comments
 (0)