Skip to content

Commit 1dd2f6e

Browse files
Merge pull request #125 from cchampet/dev_rename_Profile_to_ProfileLoader
Profile: rename to ProfileLoader
2 parents b7bfe96 + e0b9d49 commit 1dd2f6e

27 files changed

+136
-151
lines changed

app/avTranscoder/avTranscoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void transcodeVideo( const char* inputfilename, const char* outputFilename )
2222

2323
// av_log_set_level( AV_LOG_DEBUG );
2424

25-
Profile profile( true );
25+
ProfileLoader profileLoader( true );
2626
ConsoleProgress p;
2727

2828
InputFile input( inputfilename );
@@ -37,7 +37,7 @@ void transcodeVideo( const char* inputfilename, const char* outputFilename )
3737

3838
// init video encoder
3939
AvOutputVideo outputVideo;
40-
outputVideo.setProfile( profile.getProfile( "xdcamhd422" ), VideoFrameDesc );
40+
outputVideo.setProfile( profileLoader.getProfile( "xdcamhd422" ), VideoFrameDesc );
4141
VideoFrame imageToEncode( outputVideo.getVideoCodec().getVideoFrameDesc() );
4242

4343
CodedData codedImage;

app/genericProcessor/genericProcessor.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static const std::string dummyAudioCodec = "pcm_s16le";
1717

1818
bool verbose = false;
1919

20-
void parseConfigFile( const std::string& configFilename, avtranscoder::Transcoder& transcoder, avtranscoder::Profile& profile )
20+
void parseConfigFile( const std::string& configFilename, avtranscoder::Transcoder& transcoder )
2121
{
2222
std::ifstream configFile( configFilename.c_str(), std::ifstream::in );
2323

@@ -99,8 +99,6 @@ int main( int argc, char** argv )
9999
if( verbose )
100100
std::cout << "start ..." << std::endl;
101101

102-
avtranscoder::Profile profiles( true );
103-
104102
if( verbose )
105103
std::cout << "output file: " << argv[2] << std::endl;
106104

@@ -111,7 +109,7 @@ int main( int argc, char** argv )
111109

112110
if( verbose )
113111
std::cout << "parse config file" << std::endl;
114-
parseConfigFile( inputConfigFile, transcoder, profiles );
112+
parseConfigFile( inputConfigFile, transcoder );
115113

116114
// set verbose of all stream
117115
transcoder.setVerbose( verbose );

app/presetChecker/presetChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

22
#include <iostream>
33
#include <iomanip>
4-
#include <AvTranscoder/Profile.hpp>
4+
#include <AvTranscoder/ProfileLoader.hpp>
55

66
#include <AvTranscoder/essenceStream/AvOutputVideo.hpp>
77
#include <AvTranscoder/essenceStream/AvOutputAudio.hpp>
88

99

1010
int main( int argc, char** argv )
1111
{
12-
avtranscoder::Profile p;
12+
avtranscoder::ProfileLoader p;
1313
p.loadProfiles();
1414

1515
std::cout << p.getProfiles().size() << std::endl;

src/AvTranscoder/Profile.cpp renamed to src/AvTranscoder/ProfileLoader.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "Profile.hpp"
1+
#include "ProfileLoader.hpp"
22

33
#include "common.hpp"
44

@@ -16,18 +16,18 @@
1616
namespace avtranscoder
1717
{
1818

19-
Profile::Profile( bool autoload )
19+
ProfileLoader::ProfileLoader( bool autoload )
2020
{
2121
if( autoload )
2222
loadProfiles();
2323
}
2424

25-
void Profile::loadProfile( const std::string& avProfileFile )
25+
void ProfileLoader::loadProfile( const std::string& avProfileFile )
2626
{
2727
std::ifstream infile;
2828
infile.open( avProfileFile.c_str(), std::ifstream::in );
2929

30-
Profile::ProfileDesc customProfile;
30+
ProfileLoader::Profile customProfile;
3131

3232
std::string line;
3333
while( std::getline( infile, line ) )
@@ -50,7 +50,7 @@ void Profile::loadProfile( const std::string& avProfileFile )
5050
}
5151
}
5252

53-
void Profile::loadProfiles( const std::string& avProfilesPath )
53+
void ProfileLoader::loadProfiles( const std::string& avProfilesPath )
5454
{
5555
loadXdCamHD422( _profiles );
5656
loadDNxHD( _profiles );
@@ -83,11 +83,11 @@ void Profile::loadProfiles( const std::string& avProfilesPath )
8383
}
8484
}
8585

86-
void Profile::update( const ProfileDesc& profile )
86+
void ProfileLoader::update( const Profile& profile )
8787
{
8888
std::string profileId( profile.find( constants::avProfileIdentificator )->second );
8989
size_t profileIndex = 0;
90-
for( ProfilesDesc::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
90+
for( Profiles::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
9191
{
9292
if( (*it).find( constants::avProfileIdentificator )->second == profileId )
9393
{
@@ -100,16 +100,16 @@ void Profile::update( const ProfileDesc& profile )
100100
_profiles.push_back( profile );
101101
}
102102

103-
const Profile::ProfilesDesc& Profile::getProfiles()
103+
const ProfileLoader::Profiles& ProfileLoader::getProfiles()
104104
{
105105
return _profiles;
106106
}
107107

108-
Profile::ProfilesDesc Profile::getFormatProfiles()
108+
ProfileLoader::Profiles ProfileLoader::getFormatProfiles()
109109
{
110-
ProfilesDesc profiles;
110+
Profiles profiles;
111111

112-
for( ProfilesDesc::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
112+
for( Profiles::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
113113
{
114114
if( (*it).find( constants::avProfileType )->second == constants::avProfileTypeFormat )
115115
profiles.push_back( *it );
@@ -118,11 +118,11 @@ Profile::ProfilesDesc Profile::getFormatProfiles()
118118
return profiles;
119119
}
120120

121-
Profile::ProfilesDesc Profile::getVideoProfiles()
121+
ProfileLoader::Profiles ProfileLoader::getVideoProfiles()
122122
{
123-
ProfilesDesc profiles;
123+
Profiles profiles;
124124

125-
for( ProfilesDesc::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
125+
for( Profiles::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
126126
{
127127
if( (*it).find( constants::avProfileType )->second == constants::avProfileTypeVideo )
128128
profiles.push_back( *it );
@@ -131,11 +131,11 @@ Profile::ProfilesDesc Profile::getVideoProfiles()
131131
return profiles;
132132
}
133133

134-
Profile::ProfilesDesc Profile::getAudioProfiles()
134+
ProfileLoader::Profiles ProfileLoader::getAudioProfiles()
135135
{
136-
ProfilesDesc profiles;
136+
Profiles profiles;
137137

138-
for( ProfilesDesc::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
138+
for( Profiles::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
139139
{
140140
if( (*it).find( constants::avProfileType )->second == constants::avProfileTypeAudio )
141141
profiles.push_back( *it );
@@ -144,9 +144,9 @@ Profile::ProfilesDesc Profile::getAudioProfiles()
144144
return profiles;
145145
}
146146

147-
Profile::ProfileDesc& Profile::getProfile( const std::string& searchProfile )
147+
ProfileLoader::Profile& ProfileLoader::getProfile( const std::string& searchProfile )
148148
{
149-
for( ProfilesDesc::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
149+
for( Profiles::iterator it = _profiles.begin(); it != _profiles.end(); ++it )
150150
{
151151
if( (*it).find( constants::avProfileIdentificator )->second == searchProfile )
152152
{

src/AvTranscoder/Profile.hpp renamed to src/AvTranscoder/ProfileLoader.hpp

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,31 @@ namespace constants
2828
const std::string avProfileChannel = "ac";
2929
}
3030

31-
class AvExport Profile
31+
class AvExport ProfileLoader
3232
{
3333
public:
34-
35-
36-
public:
37-
// typedef std::pair< std::string, std::string > KeyDesc;
38-
typedef std::map< std::string, std::string > ProfileDesc;
39-
typedef std::vector< ProfileDesc > ProfilesDesc;
34+
typedef std::map< std::string, std::string > Profile;
35+
typedef std::vector< Profile > Profiles;
4036

4137
public:
42-
Profile( bool autoload = false );
38+
ProfileLoader( bool autoload = false );
4339

4440
void loadProfiles( const std::string& avProfilesPath = "" );
4541
void loadProfile( const std::string& avProfileFile );
4642

47-
void update( const ProfileDesc& profile );
43+
void update( const Profile& profile );
4844

49-
const ProfilesDesc& getProfiles();
45+
const Profiles& getProfiles();
5046

51-
ProfilesDesc getFormatProfiles();
52-
ProfilesDesc getVideoProfiles();
53-
ProfilesDesc getAudioProfiles();
47+
Profiles getFormatProfiles();
48+
Profiles getVideoProfiles();
49+
Profiles getAudioProfiles();
5450

55-
ProfileDesc& getProfile( const std::string& searchProfile );
51+
Profile& getProfile( const std::string& searchProfile );
5652

5753
private:
58-
ProfilesDesc _profiles;
59-
54+
Profiles _profiles;
6055
};
6156

62-
63-
6457
}
65-
#endif
58+
#endif

src/AvTranscoder/avTranscoder.i

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
%include "AvTranscoder/swig/avRational.i"
1414

1515
%{
16-
#include <AvTranscoder/Profile.hpp>
16+
#include <AvTranscoder/ProfileLoader.hpp>
1717

1818
#include <AvTranscoder/frame/Pixel.hpp>
1919
#include <AvTranscoder/frame/Frame.hpp>
@@ -27,8 +27,6 @@
2727

2828
#include <AvTranscoder/mediaProperty/mediaProperty.hpp>
2929

30-
#include <AvTranscoder/Profile.hpp>
31-
3230
#include <AvTranscoder/codedStream/IOutputStream.hpp>
3331
#include <AvTranscoder/codedStream/AvOutputStream.hpp>
3432

@@ -65,7 +63,7 @@ namespace std {
6563

6664
%include "AvTranscoder/progress/progress.i"
6765

68-
%include <AvTranscoder/Profile.hpp>
66+
%include <AvTranscoder/ProfileLoader.hpp>
6967

7068
%include <AvTranscoder/frame/Pixel.hpp>
7169
%include <AvTranscoder/frame/Frame.hpp>
@@ -79,8 +77,6 @@ namespace std {
7977

8078
%include <AvTranscoder/mediaProperty/mediaProperty.hpp>
8179

82-
%include <AvTranscoder/Profile.hpp>
83-
8480
%include <AvTranscoder/codedStream/IOutputStream.hpp>
8581
%include <AvTranscoder/codedStream/AvOutputStream.hpp>
8682

src/AvTranscoder/essenceStream/AvInputVideo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ void AvInputVideo::flushDecoder()
127127
avcodec_flush_buffers( _codec.getAVCodecContext() );
128128
}
129129

130-
void AvInputVideo::setProfile( const Profile::ProfileDesc& desc )
130+
void AvInputVideo::setProfile( const ProfileLoader::Profile& profile )
131131
{
132132
Context codecContext( _codec.getAVCodecContext() );
133133

134-
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
134+
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )
135135
{
136136
if( (*it).first == constants::avProfileIdentificator ||
137137
(*it).first == constants::avProfileIdentificatorHuman ||

src/AvTranscoder/essenceStream/AvInputVideo.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "IInputEssence.hpp"
55
#include <AvTranscoder/codec/VideoCodec.hpp>
6-
#include <AvTranscoder/Profile.hpp>
6+
#include <AvTranscoder/ProfileLoader.hpp>
77

88
struct AVFrame;
99

@@ -25,7 +25,7 @@ class AvExport AvInputVideo : public IInputEssence
2525

2626
void flushDecoder();
2727

28-
void setProfile( const Profile::ProfileDesc& desc );
28+
void setProfile( const ProfileLoader::Profile& profile );
2929

3030
private:
3131
AvInputStream* _inputStream;

src/AvTranscoder/essenceStream/AvOutputAudio.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,20 @@ bool AvOutputAudio::encodeFrame( Frame& codedFrame )
171171
#endif
172172
}
173173

174-
void AvOutputAudio::setProfile( const Profile::ProfileDesc& desc, const AudioFrameDesc& frameDesc )
174+
void AvOutputAudio::setProfile( const ProfileLoader::Profile& profile, const AudioFrameDesc& frameDesc )
175175
{
176-
if( ! desc.count( constants::avProfileCodec ) ||
177-
! desc.count( constants::avProfileSampleFormat ) )
176+
if( ! profile.count( constants::avProfileCodec ) ||
177+
! profile.count( constants::avProfileSampleFormat ) )
178178
{
179-
throw std::runtime_error( "The profile " + desc.find( constants::avProfileIdentificatorHuman )->second + " is invalid." );
179+
throw std::runtime_error( "The profile " + profile.find( constants::avProfileIdentificatorHuman )->second + " is invalid." );
180180
}
181181

182-
_codec.setCodec( eCodecTypeEncoder, desc.find( constants::avProfileCodec )->second );
182+
_codec.setCodec( eCodecTypeEncoder, profile.find( constants::avProfileCodec )->second );
183183
_codec.setAudioParameters( frameDesc );
184184

185185
Context codecContext( _codec.getAVCodecContext() );
186186

187-
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
187+
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )
188188
{
189189
if( (*it).first == constants::avProfileIdentificator ||
190190
(*it).first == constants::avProfileIdentificatorHuman ||
@@ -206,7 +206,7 @@ void AvOutputAudio::setProfile( const Profile::ProfileDesc& desc, const AudioFra
206206

207207
setup();
208208

209-
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
209+
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )
210210
{
211211
if( (*it).first == constants::avProfileIdentificator ||
212212
(*it).first == constants::avProfileIdentificatorHuman ||

src/AvTranscoder/essenceStream/AvOutputAudio.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "IOutputEssence.hpp"
55
#include <AvTranscoder/codec/AudioCodec.hpp>
6-
#include <AvTranscoder/Profile.hpp>
6+
#include <AvTranscoder/ProfileLoader.hpp>
77

88
namespace avtranscoder
99
{
@@ -25,7 +25,7 @@ class AvExport AvOutputAudio : public IOutputEssence
2525
*/
2626
bool encodeFrame( Frame& codedFrame );
2727

28-
void setProfile( const Profile::ProfileDesc& desc, const AudioFrameDesc& frameDesc );
28+
void setProfile( const ProfileLoader::Profile& profile, const AudioFrameDesc& frameDesc );
2929

3030
ICodec& getCodec() { return _codec; }
3131
AudioCodec& getAudioCodec() { return _codec; }

src/AvTranscoder/essenceStream/AvOutputVideo.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,25 +172,25 @@ bool AvOutputVideo::encodeFrame( Frame& codedFrame )
172172
#endif
173173
}
174174

175-
void AvOutputVideo::setProfile( const Profile::ProfileDesc& desc, const avtranscoder::VideoFrameDesc& frameDesc )
175+
void AvOutputVideo::setProfile( const ProfileLoader::Profile& profile, const avtranscoder::VideoFrameDesc& frameDesc )
176176
{
177-
if( ! desc.count( constants::avProfileCodec ) ||
178-
! desc.count( constants::avProfilePixelFormat ) ||
179-
! desc.count( constants::avProfileFrameRate ) )
177+
if( ! profile.count( constants::avProfileCodec ) ||
178+
! profile.count( constants::avProfilePixelFormat ) ||
179+
! profile.count( constants::avProfileFrameRate ) )
180180
{
181-
throw std::runtime_error( "The profile " + desc.find( constants::avProfileIdentificatorHuman )->second + " is invalid." );
181+
throw std::runtime_error( "The profile " + profile.find( constants::avProfileIdentificatorHuman )->second + " is invalid." );
182182
}
183183

184-
_codec.setCodec( eCodecTypeEncoder, desc.find( constants::avProfileCodec )->second );
184+
_codec.setCodec( eCodecTypeEncoder, profile.find( constants::avProfileCodec )->second );
185185

186-
const size_t frameRate = std::strtoul( desc.find( constants::avProfileFrameRate )->second.c_str(), NULL, 0 );
186+
const size_t frameRate = std::strtoul( profile.find( constants::avProfileFrameRate )->second.c_str(), NULL, 0 );
187187
_codec.setTimeBase( 1, frameRate );
188188

189189
_codec.setImageParameters( frameDesc );
190190

191191
Context codecContext( _codec.getAVCodecContext() );
192192

193-
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
193+
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )
194194
{
195195
if( (*it).first == constants::avProfileIdentificator ||
196196
(*it).first == constants::avProfileIdentificatorHuman ||
@@ -213,7 +213,7 @@ void AvOutputVideo::setProfile( const Profile::ProfileDesc& desc, const avtransc
213213

214214
setup();
215215

216-
for( Profile::ProfileDesc::const_iterator it = desc.begin(); it != desc.end(); ++it )
216+
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )
217217
{
218218
if( (*it).first == constants::avProfileIdentificator ||
219219
(*it).first == constants::avProfileIdentificatorHuman ||

0 commit comments

Comments
 (0)