@@ -67,7 +67,14 @@ void Transcoder::addStream(const InputStreamDesc& inputStreamDesc, const Profile
67
67
if (!inputStreamDesc._filename .length ())
68
68
throw std::runtime_error (" Can't transcode a stream without a filename indicated." );
69
69
70
- addTranscodeStream (inputStreamDesc, profile, offset);
70
+ std::vector<InputStreamDesc> inputStreamDescArray;
71
+ inputStreamDescArray.push_back (inputStreamDesc);
72
+ addStream (inputStreamDescArray, profile, offset);
73
+ }
74
+
75
+ void Transcoder::addStream (const std::vector<InputStreamDesc>& inputStreamDescArray, const ProfileLoader::Profile& profile, const float offset)
76
+ {
77
+ addTranscodeStream (inputStreamDescArray, profile, offset);
71
78
}
72
79
73
80
void Transcoder::addGeneratedStream (const std::string& encodingProfileName)
@@ -206,39 +213,31 @@ void Transcoder::addRewrapStream(const InputStreamDesc& inputStreamDesc, const f
206
213
_streamTranscoders.push_back (_streamTranscodersAllocated.back ());
207
214
}
208
215
209
- void Transcoder::addTranscodeStream (const InputStreamDesc& inputStreamDesc , const ProfileLoader::Profile& profile,
216
+ void Transcoder::addTranscodeStream (const std::vector< InputStreamDesc>& inputStreamDescArray , const ProfileLoader::Profile& profile,
210
217
const float offset)
211
218
{
212
219
// Add profile
213
220
if (!_profileLoader.hasProfile (profile))
214
221
_profileLoader.loadProfile (profile);
215
222
216
- LOG_INFO (" Add transcode stream from " << inputStreamDesc << " with encodingProfile="
217
- << profile.at (constants::avProfileIdentificatorHuman) << std::endl
223
+ std::stringstream sources;
224
+ for (size_t index = 0 ; index < inputStreamDescArray.size (); ++index)
225
+ sources << inputStreamDescArray.at (index);
226
+ LOG_INFO (" Add transcode stream from the following inputs:" << std::endl << sources.str ()
227
+ << " with encodingProfile=" << profile.at (constants::avProfileIdentificatorHuman) << std::endl
218
228
<< " and offset=" << offset << " s" )
219
229
220
230
// Add input file
221
- InputFile* referenceFile = addInputFile (inputStreamDesc._filename , inputStreamDesc._streamIndex , offset);
222
- IInputStream& inputStream = referenceFile->getStream (inputStreamDesc._streamIndex );
223
-
224
- switch (inputStream.getProperties ().getStreamType ())
231
+ std::vector<IInputStream*> inputStreams;
232
+ for (std::vector<InputStreamDesc>::const_iterator it = inputStreamDescArray.begin (); it != inputStreamDescArray.end (); ++it)
225
233
{
226
- case AVMEDIA_TYPE_VIDEO:
227
- case AVMEDIA_TYPE_AUDIO:
228
- {
229
- _streamTranscodersAllocated.push_back (
230
- new StreamTranscoder (inputStreamDesc, inputStream, _outputFile, profile, offset));
231
- _streamTranscoders.push_back (_streamTranscodersAllocated.back ());
232
- break ;
233
- }
234
- case AVMEDIA_TYPE_DATA:
235
- case AVMEDIA_TYPE_SUBTITLE:
236
- case AVMEDIA_TYPE_ATTACHMENT:
237
- default :
238
- {
239
- throw std::runtime_error (" unsupported media type in transcode setup" );
240
- }
234
+ InputFile* referenceFile = addInputFile (it->_filename , it->_streamIndex , offset);
235
+ inputStreams.push_back (&referenceFile->getStream (it->_streamIndex ));
241
236
}
237
+
238
+ _streamTranscodersAllocated.push_back (
239
+ new StreamTranscoder (inputStreamDescArray, inputStreams, _outputFile, profile, offset));
240
+ _streamTranscoders.push_back (_streamTranscodersAllocated.back ());
242
241
}
243
242
244
243
InputFile* Transcoder::addInputFile (const std::string& filename, const int streamIndex, const float offset)
0 commit comments