@@ -16,6 +16,14 @@ Transcoder::Transcoder( OutputFile& outputFile )
16
16
17
17
Transcoder::~Transcoder ()
18
18
{
19
+ for ( std::vector< InputFile* >::iterator it = _inputFiles.begin (); it != _inputFiles.end (); ++it )
20
+ {
21
+ delete (*it);
22
+ }
23
+ for ( std::vector< StreamTranscoder* >::iterator it = _streamTranscoders.begin (); it != _streamTranscoders.end (); ++it )
24
+ {
25
+ delete (*it);
26
+ }
19
27
}
20
28
21
29
void Transcoder::add ( const std::string& filename, const size_t streamIndex, const std::string& profileName )
@@ -54,7 +62,7 @@ bool Transcoder::processFrame()
54
62
std::cout << " process frame" << std::endl;
55
63
for ( size_t streamIndex = 0 ; streamIndex < _streamTranscoders.size (); ++streamIndex )
56
64
{
57
- if ( ! _streamTranscoders.at ( streamIndex ). processFrame () )
65
+ if ( ! _streamTranscoders.at ( streamIndex )-> processFrame () )
58
66
{
59
67
_streamTranscoders.clear ();
60
68
}
@@ -117,7 +125,7 @@ void Transcoder::addRewrapStream( const std::string& filename, const size_t stre
117
125
{
118
126
InputFile* referenceFile = addInputFile ( filename, streamIndex );
119
127
120
- _streamTranscoders.push_back ( StreamTranscoder ( referenceFile->getStream ( streamIndex ), _outputFile ) );
128
+ _streamTranscoders.push_back ( new StreamTranscoder ( referenceFile->getStream ( streamIndex ), _outputFile ) );
121
129
_inputStreams.push_back ( &referenceFile->getStream ( streamIndex ) );
122
130
}
123
131
@@ -129,13 +137,13 @@ void Transcoder::addTranscodeStream( const std::string& filename, const size_t s
129
137
{
130
138
case AVMEDIA_TYPE_VIDEO:
131
139
{
132
- _streamTranscoders.push_back ( StreamTranscoder ( referenceFile->getStream ( streamIndex ), _outputFile, profile ) );
140
+ _streamTranscoders.push_back ( new StreamTranscoder ( referenceFile->getStream ( streamIndex ), _outputFile, profile ) );
133
141
_inputStreams.push_back ( &referenceFile->getStream ( streamIndex ) );
134
142
break ;
135
143
}
136
144
case AVMEDIA_TYPE_AUDIO:
137
145
{
138
- _streamTranscoders.push_back ( StreamTranscoder ( referenceFile->getStream ( streamIndex ), _outputFile, profile ) );
146
+ _streamTranscoders.push_back ( new StreamTranscoder ( referenceFile->getStream ( streamIndex ), _outputFile, profile ) );
139
147
_inputStreams.push_back ( &referenceFile->getStream ( streamIndex ) );
140
148
break ;
141
149
}
@@ -157,25 +165,25 @@ void Transcoder::addDummyStream( Profile::ProfileDesc& profile )
157
165
if ( profile.find ( Profile::avProfileType )->second == Profile::avProfileTypeAudio )
158
166
{
159
167
_dummyAudio.push_back ( DummyAudio () );
160
- _streamTranscoders.push_back ( StreamTranscoder ( _dummyAudio.back (), _outputFile, profile ) );
168
+ _streamTranscoders.push_back ( new StreamTranscoder ( _dummyAudio.back (), _outputFile, profile ) );
161
169
}
162
170
163
171
if ( profile.find ( Profile::avProfileType )->second == Profile::avProfileTypeVideo )
164
172
{
165
173
_dummyVideo.push_back ( DummyVideo () );
166
- _streamTranscoders.push_back ( StreamTranscoder ( _dummyVideo.back (), _outputFile, profile ) );
174
+ _streamTranscoders.push_back ( new StreamTranscoder ( _dummyVideo.back (), _outputFile, profile ) );
167
175
}
168
176
}
169
177
170
178
InputFile* Transcoder::addInputFile ( const std::string& filename, const size_t streamIndex )
171
179
{
172
180
InputFile* referenceFile = NULL ;
173
181
174
- for ( std::vector< InputFile >::iterator it = _inputFiles.begin (); it != _inputFiles.end (); ++it )
182
+ for ( std::vector< InputFile* >::iterator it = _inputFiles.begin (); it != _inputFiles.end (); ++it )
175
183
{
176
- if ( (*it). getFilename () == filename )
184
+ if ( (*it)-> getFilename () == filename )
177
185
{
178
- referenceFile = & (*it);
186
+ referenceFile = (*it);
179
187
break ;
180
188
}
181
189
}
@@ -184,8 +192,8 @@ InputFile* Transcoder::addInputFile( const std::string& filename, const size_t s
184
192
{
185
193
if ( _verbose )
186
194
std::cout << " new InputFile for " << filename << std::endl;
187
- _inputFiles.push_back ( InputFile ( filename ) );
188
- referenceFile = & _inputFiles.back ();
195
+ _inputFiles.push_back ( new InputFile ( filename ) );
196
+ referenceFile = _inputFiles.back ();
189
197
}
190
198
191
199
referenceFile->readStream ( streamIndex );
0 commit comments