@@ -48,7 +48,10 @@ void Transcoder::addStream(const InputStreamDesc& inputStreamDesc, const std::st
48
48
addRewrapStream (inputStreamDesc, offset);
49
49
// Transcode (transparent for the user)
50
50
else
51
- addTranscodeStream (inputStreamDesc, offset);
51
+ {
52
+ const ProfileLoader::Profile profile = getProfileFromInput (inputStreamDesc);
53
+ addStream (inputStreamDesc, profile, offset);
54
+ }
52
55
}
53
56
// Transcode
54
57
else
@@ -203,24 +206,6 @@ void Transcoder::addRewrapStream(const InputStreamDesc& inputStreamDesc, const f
203
206
_streamTranscoders.push_back (_streamTranscodersAllocated.back ());
204
207
}
205
208
206
- void Transcoder::addTranscodeStream (const InputStreamDesc& inputStreamDesc, const float offset)
207
- {
208
- // Get profile from input file
209
- InputFile inputFile (inputStreamDesc._filename );
210
- ProfileLoader::Profile profile = getProfileFromFile (inputFile, inputStreamDesc._streamIndex );
211
-
212
- // override number of channels parameters to manage demultiplexing
213
- if (inputStreamDesc.demultiplexing ())
214
- {
215
- // number of channels
216
- std::stringstream ss;
217
- ss << inputStreamDesc._channelIndexArray .size ();
218
- profile[constants::avProfileChannel] = ss.str ();
219
- }
220
-
221
- addTranscodeStream (inputStreamDesc, profile, offset);
222
- }
223
-
224
209
void Transcoder::addTranscodeStream (const InputStreamDesc& inputStreamDesc, const ProfileLoader::Profile& profile,
225
210
const float offset)
226
211
{
@@ -296,12 +281,14 @@ InputFile* Transcoder::addInputFile(const std::string& filename, const int strea
296
281
return referenceFile;
297
282
}
298
283
299
- ProfileLoader::Profile Transcoder::getProfileFromFile (InputFile& inputFile, const size_t streamIndex)
300
- {
301
- const StreamProperties* streamProperties = &inputFile.getProperties ().getStreamPropertiesWithIndex (streamIndex);
284
+ ProfileLoader::Profile Transcoder::getProfileFromInput (const InputStreamDesc& inputStreamDesc)
285
+ {
286
+ InputFile inputFile (inputStreamDesc._filename );
287
+
288
+ const StreamProperties* streamProperties = &inputFile.getProperties ().getStreamPropertiesWithIndex (inputStreamDesc._streamIndex );
302
289
const VideoProperties* videoProperties = NULL ;
303
290
const AudioProperties* audioProperties = NULL ;
304
- switch (inputFile.getStream (streamIndex ).getProperties ().getStreamType ())
291
+ switch (inputFile.getStream (inputStreamDesc. _streamIndex ).getProperties ().getStreamType ())
305
292
{
306
293
case AVMEDIA_TYPE_VIDEO:
307
294
{
@@ -343,9 +330,18 @@ ProfileLoader::Profile Transcoder::getProfileFromFile(InputFile& inputFile, cons
343
330
std::stringstream ss;
344
331
ss << audioProperties->getSampleRate ();
345
332
profile[constants::avProfileSampleRate] = ss.str ();
346
- ss.str (" " );
347
- ss << audioProperties->getNbChannels ();
348
- profile[constants::avProfileChannel] = ss.str ();
333
+ ss.str (" " );
334
+ // override number of channels parameters to manage demultiplexing
335
+ if (inputStreamDesc.demultiplexing ())
336
+ {
337
+ ss << inputStreamDesc._channelIndexArray .size ();
338
+ profile[constants::avProfileChannel] = ss.str ();
339
+ }
340
+ else
341
+ {
342
+ ss << audioProperties->getNbChannels ();
343
+ profile[constants::avProfileChannel] = ss.str ();
344
+ }
349
345
}
350
346
351
347
return profile;
0 commit comments