forked from avTranscoder/avTranscoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStreamTranscoder.cpp
More file actions
713 lines (616 loc) · 23.4 KB
/
Copy pathStreamTranscoder.cpp
File metadata and controls
713 lines (616 loc) · 23.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
#include "StreamTranscoder.hpp"
#include <AvTranscoder/stream/InputStream.hpp>
#include <AvTranscoder/decoder/VideoDecoder.hpp>
#include <AvTranscoder/decoder/AudioDecoder.hpp>
#include <AvTranscoder/decoder/VideoGenerator.hpp>
#include <AvTranscoder/decoder/AudioGenerator.hpp>
#include <AvTranscoder/encoder/VideoEncoder.hpp>
#include <AvTranscoder/encoder/AudioEncoder.hpp>
#include <AvTranscoder/transform/AudioTransform.hpp>
#include <AvTranscoder/transform/VideoTransform.hpp>
#include <cassert>
#include <limits>
#include <sstream>
#include <algorithm>
namespace avtranscoder
{
StreamTranscoder::StreamTranscoder(IInputStream& inputStream, IOutputFile& outputFile, const float offset)
: _inputStreamDesc()
, _inputStreams()
, _outputStream(NULL)
, _decodedData()
, _filteredData(NULL)
, _transformedData(NULL)
, _inputDecoders()
, _generators()
, _currentDecoder(NULL)
, _outputEncoder(NULL)
, _transform(NULL)
, _filterGraph(NULL)
, _offset(offset)
, _needToSwitchToGenerator(false)
{
_inputStreams.push_back(&inputStream);
// create a re-wrapping case
switch(inputStream.getProperties().getStreamType())
{
case AVMEDIA_TYPE_VIDEO:
{
// output stream
_outputStream = &outputFile.addVideoStream(inputStream.getVideoCodec());
try
{
// filter
_filterGraph = new FilterGraph(inputStream.getVideoCodec());
VideoFrameDesc inputFrameDesc(inputStream.getVideoCodec().getVideoFrameDesc());
// generator decoder
_generators.push_back(new VideoGenerator(inputFrameDesc));
// buffers to process
_decodedData.push_back(new VideoFrame(inputFrameDesc));
_filteredData = new VideoFrame(inputFrameDesc);
_transformedData = new VideoFrame(inputFrameDesc);
// transform
_transform = new VideoTransform();
// output encoder
VideoEncoder* outputVideo = new VideoEncoder(inputStream.getVideoCodec().getCodecName());
outputVideo->setupVideoEncoder(inputFrameDesc);
_outputEncoder = outputVideo;
}
catch(std::runtime_error& e)
{
LOG_WARN("Cannot create the video encoder for stream " << inputStream.getStreamIndex() << " if needed. "
<< e.what())
}
break;
}
case AVMEDIA_TYPE_AUDIO:
{
// output stream
_outputStream = &outputFile.addAudioStream(inputStream.getAudioCodec());
try
{
// filter
_filterGraph = new FilterGraph(inputStream.getAudioCodec());
AudioFrameDesc inputFrameDesc(inputStream.getAudioCodec().getAudioFrameDesc());
// generator decoder
_generators.push_back(new AudioGenerator(inputFrameDesc));
// buffers to process
_decodedData.push_back(new AudioFrame(inputFrameDesc));
_filteredData = new AudioFrame(inputFrameDesc);
_transformedData = new AudioFrame(inputFrameDesc);
// transform
_transform = new AudioTransform();
// output encoder
AudioEncoder* outputAudio = new AudioEncoder(inputStream.getAudioCodec().getCodecName());
outputAudio->setupAudioEncoder(inputFrameDesc);
_outputEncoder = outputAudio;
}
catch(std::runtime_error& e)
{
LOG_WARN("Cannot create the audio encoder for stream " << inputStream.getStreamIndex() << " if needed. "
<< e.what())
}
break;
}
case AVMEDIA_TYPE_DATA:
{
// @warning: rewrap a data stream can't be lengthen by a generator (end of rewrapping will end the all process)
_outputStream = &outputFile.addDataStream(inputStream.getDataCodec());
break;
}
default:
break;
}
setOffset(offset);
}
StreamTranscoder::StreamTranscoder(const std::vector<InputStreamDesc>& inputStreamsDesc, std::vector<IInputStream*>& inputStreams, IOutputFile& outputFile,
const ProfileLoader::Profile& profile, const float offset)
: _inputStreamDesc(inputStreamsDesc)
, _inputStreams(inputStreams)
, _outputStream(NULL)
, _decodedData()
, _filteredData(NULL)
, _transformedData(NULL)
, _inputDecoders()
, _generators()
, _currentDecoder(NULL)
, _outputEncoder(NULL)
, _transform(NULL)
, _filterGraph(NULL)
, _offset(offset)
, _needToSwitchToGenerator(false)
{
// add as many decoders as input streams
size_t nbOutputChannels = 0;
for(size_t index = 0; index < inputStreams.size(); ++index)
{
addDecoder(_inputStreamDesc.at(index), *_inputStreams.at(index));
nbOutputChannels += _inputStreamDesc.at(index)._channelIndexArray.size();
}
IInputStream& inputStream = *_inputStreams.at(0);
const InputStreamDesc& inputStreamDesc = inputStreamsDesc.at(0);
// create a transcode case
switch(inputStream.getProperties().getStreamType())
{
case AVMEDIA_TYPE_VIDEO:
{
// filter
_filterGraph = new FilterGraph(inputStream.getVideoCodec());
// output encoder
VideoEncoder* outputVideo = new VideoEncoder(profile.at(constants::avProfileCodec));
_outputEncoder = outputVideo;
VideoFrameDesc outputFrameDesc = inputStream.getVideoCodec().getVideoFrameDesc();
outputFrameDesc.setParameters(profile);
outputVideo->setupVideoEncoder(outputFrameDesc, profile);
// output stream
_outputStream = &outputFile.addVideoStream(outputVideo->getVideoCodec());
// buffers to process
_filteredData = new VideoFrame(inputStream.getVideoCodec().getVideoFrameDesc());
_transformedData = new VideoFrame(outputVideo->getVideoCodec().getVideoFrameDesc());
// transform
_transform = new VideoTransform();
break;
}
case AVMEDIA_TYPE_AUDIO:
{
// filter
_filterGraph = new FilterGraph(inputStream.getAudioCodec());
// merge two or more audio streams into a single multi-channel stream.
if(inputStreams.size() > 1)
{
std::stringstream mergeOptions;
mergeOptions << "inputs=" << inputStreams.size();
_filterGraph->addFilter("amerge", mergeOptions.str());
}
// output encoder
AudioEncoder* outputAudio = new AudioEncoder(profile.at(constants::avProfileCodec));
_outputEncoder = outputAudio;
AudioFrameDesc outputFrameDesc(inputStream.getAudioCodec().getAudioFrameDesc());
outputFrameDesc.setParameters(profile);
if(inputStreamDesc.demultiplexing())
outputFrameDesc._nbChannels = nbOutputChannels;
outputAudio->setupAudioEncoder(outputFrameDesc, profile);
// output stream
_outputStream = &outputFile.addAudioStream(outputAudio->getAudioCodec());
// buffers to process
AudioFrameDesc inputFrameDesc(inputStream.getAudioCodec().getAudioFrameDesc());
if(inputStreamDesc.demultiplexing())
inputFrameDesc._nbChannels = nbOutputChannels;
_filteredData = new AudioFrame(inputFrameDesc);
_transformedData = new AudioFrame(outputAudio->getAudioCodec().getAudioFrameDesc());
// transform
_transform = new AudioTransform();
break;
}
default:
{
throw std::runtime_error("unupported stream type");
break;
}
}
setOffset(offset);
}
void StreamTranscoder::addDecoder(const InputStreamDesc& inputStreamDesc, IInputStream& inputStream)
{
// create a transcode case
switch(inputStream.getProperties().getStreamType())
{
case AVMEDIA_TYPE_VIDEO:
{
// corresponding input decoder
VideoDecoder* inputVideo = new VideoDecoder(static_cast<InputStream&>(inputStream));
inputVideo->setupDecoder();
_inputDecoders.push_back(inputVideo);
_currentDecoder = inputVideo;
// buffers to get the decoded data
VideoFrame* inputFrame = new VideoFrame(inputStream.getVideoCodec().getVideoFrameDesc(), false);
_decodedData.push_back(inputFrame);
// generator decoder
_generators.push_back(new VideoGenerator(inputStream.getVideoCodec().getVideoFrameDesc()));
break;
}
case AVMEDIA_TYPE_AUDIO:
{
// corresponding input decoder
AudioDecoder* inputAudio = new AudioDecoder(static_cast<InputStream&>(inputStream));
inputAudio->setupDecoder();
_inputDecoders.push_back(inputAudio);
_currentDecoder = inputAudio;
// buffers to get the decoded data
AudioFrameDesc inputFrameDesc(inputStream.getAudioCodec().getAudioFrameDesc());
if(inputStreamDesc.demultiplexing())
inputFrameDesc._nbChannels = inputStreamDesc._channelIndexArray.size();
_decodedData.push_back(new AudioFrame(inputFrameDesc, false));
// generator decoder
_generators.push_back(new AudioGenerator(inputFrameDesc));
break;
}
default:
{
throw std::runtime_error("Unupported stream type");
break;
}
}
}
StreamTranscoder::StreamTranscoder(IOutputFile& outputFile, const ProfileLoader::Profile& profile)
: _inputStreamDesc()
, _inputStreams()
, _outputStream(NULL)
, _decodedData()
, _filteredData(NULL)
, _transformedData(NULL)
, _inputDecoders()
, _generators()
, _currentDecoder(NULL)
, _outputEncoder(NULL)
, _transform(NULL)
, _filterGraph(NULL)
, _offset(0)
, _needToSwitchToGenerator(false)
{
if(profile.find(constants::avProfileType)->second == constants::avProfileTypeVideo)
{
VideoCodec inputVideoCodec(eCodecTypeEncoder, profile.find(constants::avProfileCodec)->second);
VideoFrameDesc inputFrameDesc(profile);
inputVideoCodec.setImageParameters(inputFrameDesc);
// generator decoder
VideoGenerator* generator = new VideoGenerator(inputFrameDesc);
_generators.push_back(generator);
_currentDecoder = generator;
// filter
_filterGraph = new FilterGraph(inputVideoCodec);
// buffers to process
VideoFrameDesc outputFrameDesc = inputFrameDesc;
outputFrameDesc.setParameters(profile);
_decodedData.push_back(new VideoFrame(inputFrameDesc));
_filteredData = new VideoFrame(inputFrameDesc);
_transformedData = new VideoFrame(outputFrameDesc);
// transform
_transform = new VideoTransform();
// output encoder
VideoEncoder* outputVideo = new VideoEncoder(profile.at(constants::avProfileCodec));
outputVideo->setupVideoEncoder(outputFrameDesc, profile);
_outputEncoder = outputVideo;
// output stream
_outputStream = &outputFile.addVideoStream(outputVideo->getVideoCodec());
}
else if(profile.find(constants::avProfileType)->second == constants::avProfileTypeAudio)
{
AudioCodec inputAudioCodec(eCodecTypeEncoder, profile.find(constants::avProfileCodec)->second);
AudioFrameDesc inputFrameDesc(profile);
inputAudioCodec.setAudioParameters(inputFrameDesc);
// generator decoder
AudioGenerator* generator = new AudioGenerator(inputFrameDesc);
_generators.push_back(generator);
_currentDecoder = generator;
// filter
_filterGraph = new FilterGraph(inputAudioCodec);
// buffers to process
AudioFrameDesc outputFrameDesc = inputFrameDesc;
outputFrameDesc.setParameters(profile);
_decodedData.push_back(new AudioFrame(inputFrameDesc));
_filteredData = new AudioFrame(inputFrameDesc);
_transformedData = new AudioFrame(outputFrameDesc);
// transform
_transform = new AudioTransform();
// output encoder
AudioEncoder* outputAudio = new AudioEncoder(profile.at(constants::avProfileCodec));
outputAudio->setupAudioEncoder(outputFrameDesc, profile);
_outputEncoder = outputAudio;
// output stream
_outputStream = &outputFile.addAudioStream(outputAudio->getAudioCodec());
}
else
{
throw std::runtime_error("unupported stream type");
}
}
StreamTranscoder::~StreamTranscoder()
{
for(std::vector<IFrame*>::iterator it = _decodedData.begin(); it != _decodedData.end(); ++it)
{
delete(*it);
}
delete _filteredData;
delete _transformedData;
for(std::vector<IDecoder*>::iterator it = _inputDecoders.begin(); it != _inputDecoders.end(); ++it)
{
delete(*it);
}
for(std::vector<IDecoder*>::iterator it = _generators.begin(); it != _generators.end(); ++it)
{
delete(*it);
}
delete _outputEncoder;
delete _transform;
delete _filterGraph;
}
void StreamTranscoder::preProcessCodecLatency()
{
if(!_outputEncoder)
{
std::stringstream msg;
msg << "No encoder found: will not preProcessCodecLatency.";
LOG_INFO(msg.str())
return;
}
int latency = _outputEncoder->getCodec().getLatency();
LOG_DEBUG("Latency of stream: " << latency)
if(!latency || latency < _outputEncoder->getCodec().getAVCodecContext().frame_number)
return;
// set a decoder to preload generated frames
bool wasARewrapCase = false;
if(getProcessCase() == eProcessCaseRewrap)
{
switchToGeneratorDecoder();
wasARewrapCase = true;
}
while((latency--) > 0)
{
processFrame();
}
if(wasARewrapCase)
_currentDecoder = NULL;
}
bool StreamTranscoder::processFrame()
{
std::string msg = "Current process case of the stream is a ";
switch(getProcessCase())
{
case eProcessCaseTranscode:
msg += "transcode.";
break;
case eProcessCaseRewrap:
msg += "rewrap.";
break;
case eProcessCaseGenerator:
msg += "generator.";
break;
}
LOG_DEBUG(msg)
// Manage offset
if(_offset > 0)
{
const bool endOfOffset = _outputStream->getStreamDuration() >= _offset;
if(endOfOffset)
{
LOG_INFO("End of positive offset")
// free our frame data since some new buffers will be allocated by the decoders in the next step
for(std::vector<IFrame*>::iterator it = _decodedData.begin(); it != _decodedData.end(); ++it)
{
if((*it)->isDataAllocated())
(*it)->freeData();
}
// switch the decoder
if(! _inputDecoders.empty())
switchToInputDecoder();
else
_currentDecoder = NULL;
_offset = 0;
}
else
{
// process generator
if(_currentDecoder != _generators.at(0))
switchToGeneratorDecoder();
}
}
else if(_offset < 0)
{
bool endOfStream = false;
for(size_t index = 0; index < _inputStreams.size(); ++index)
{
endOfStream = endOfStream && _outputStream->getStreamDuration() >= (_inputStreams.at(index)->getProperties().getDuration() + _offset);
}
if(endOfStream)
{
LOG_INFO("End of negative offset")
if(_needToSwitchToGenerator)
switchToGeneratorDecoder();
_offset = 0;
}
}
if(getProcessCase() == eProcessCaseRewrap)
return processRewrap();
return processTranscode();
}
bool StreamTranscoder::processRewrap()
{
assert(_inputStreams.size() == 1);
assert(_outputStream != NULL);
LOG_DEBUG("StreamTranscoder::processRewrap")
CodedData data;
if(! _inputStreams.at(0)->readNextPacket(data))
{
if(_needToSwitchToGenerator)
{
switchToGeneratorDecoder();
return processTranscode();
}
return false;
}
const IOutputStream::EWrappingStatus wrappingStatus = _outputStream->wrap(data);
switch(wrappingStatus)
{
case IOutputStream::eWrappingSuccess:
return true;
case IOutputStream::eWrappingWaitingForData:
// the wrapper needs more data to write the current packet
return processFrame();
case IOutputStream::eWrappingError:
return false;
}
return true;
}
bool StreamTranscoder::processTranscode()
{
assert(_outputStream != NULL);
assert(_currentDecoder != NULL);
assert(_outputEncoder != NULL);
assert(! _decodedData.empty());
assert(_transform != NULL);
LOG_DEBUG("StreamTranscoder::processTranscode")
// Decode
LOG_DEBUG("Decode next frame")
bool decodingStatus = true;
for(size_t index = 0; index < _generators.size(); ++index)
{
if(getProcessCase() == eProcessCaseTranscode)
_currentDecoder = _inputDecoders.at(index);
else
_currentDecoder = _generators.at(index);
if(! _inputStreamDesc.empty() && _inputStreamDesc.at(index).demultiplexing())
decodingStatus = decodingStatus && _currentDecoder->decodeNextFrame(*_decodedData.at(index), _inputStreamDesc.at(index)._channelIndexArray);
else
decodingStatus = decodingStatus && _currentDecoder->decodeNextFrame(*_decodedData.at(index));
}
// check the next data buffers in case of audio frames
if(_decodedData.at(0)->isAudioFrame())
{
const int nbInputSamplesPerChannel = _decodedData.at(0)->getAVFrame().nb_samples;
if(nbInputSamplesPerChannel > _filteredData->getAVFrame().nb_samples)
{
LOG_WARN("The buffer of filtered data corresponds to a frame of " << _filteredData->getAVFrame().nb_samples << " samples. The decoded buffer contains " << nbInputSamplesPerChannel << " samples. Reallocate it.")
_filteredData->freeData();
_filteredData->getAVFrame().nb_samples = nbInputSamplesPerChannel;
_filteredData->allocateData();
}
if(nbInputSamplesPerChannel > _transformedData->getAVFrame().nb_samples)
{
LOG_WARN("The buffer of transformed data corresponds to a frame of " << _transformedData->getAVFrame().nb_samples << " samples. The decoded buffer contains " << nbInputSamplesPerChannel << " samples. Reallocate it.")
_transformedData->freeData();
_transformedData->getAVFrame().nb_samples = nbInputSamplesPerChannel;
_transformedData->allocateData();
}
}
// Transform
CodedData data;
if(decodingStatus)
{
IFrame* dataToTransform = NULL;
if(_filterGraph->hasFilters())
{
LOG_DEBUG("Filtering")
_filterGraph->process(_decodedData, *_filteredData);
dataToTransform = _filteredData;
}
else
{
dataToTransform = _decodedData.at(0);
}
LOG_DEBUG("Convert")
_transform->convert(*dataToTransform, *_transformedData);
LOG_DEBUG("Encode")
_outputEncoder->encodeFrame(*_transformedData, data);
}
else
{
LOG_DEBUG("Encode last frame(s)")
if(!_outputEncoder->encodeFrame(data))
{
if(_needToSwitchToGenerator)
{
switchToGeneratorDecoder();
LOG_INFO("Force reallocation of the decoded data buffers since the decoders could have cleared them.")
for(std::vector<IFrame*>::iterator it = _decodedData.begin(); it != _decodedData.end(); ++it)
{
if(! (*it)->isDataAllocated())
(*it)->allocateData();
}
return processTranscode();
}
return false;
}
}
// Wrap
LOG_DEBUG("wrap (" << data.getSize() << " bytes)")
const IOutputStream::EWrappingStatus wrappingStatus = _outputStream->wrap(data);
switch(wrappingStatus)
{
case IOutputStream::eWrappingSuccess:
return true;
case IOutputStream::eWrappingWaitingForData:
// the wrapper needs more data to write the current packet
return processFrame();
case IOutputStream::eWrappingError:
return false;
}
return true;
}
void StreamTranscoder::switchToGeneratorDecoder()
{
LOG_INFO("Switch to generator decoder")
_currentDecoder = _generators.at(0);
assert(_currentDecoder != NULL);
}
void StreamTranscoder::switchToInputDecoder()
{
LOG_INFO("Switch to input decoder")
_currentDecoder = _inputDecoders.at(0);
assert(_currentDecoder != NULL);
}
float StreamTranscoder::getDuration() const
{
if(! _inputStreams.empty())
{
float minStreamDuration = -1;
for(size_t index = 0; index < _inputStreams.size(); ++index)
{
const StreamProperties& streamProperties = _inputStreams.at(index)->getProperties();
if(minStreamDuration == -1 || streamProperties.getDuration() < minStreamDuration)
minStreamDuration = streamProperties.getDuration();
}
const float totalDuration = minStreamDuration + _offset;
if(totalDuration < 0)
{
LOG_WARN("Offset of " << _offset << "s applied to a stream with a duration of " << minStreamDuration
<< "s. Set its duration to 0s.")
return 0.;
}
return totalDuration;
}
// generator
else
return std::numeric_limits<float>::max();
}
bool StreamTranscoder::canSwitchToGenerator()
{
if(! _decodedData.empty() && ! _generators.empty() && _outputEncoder && _transform)
return true;
return false;
}
void StreamTranscoder::needToSwitchToGenerator(const bool needToSwitch)
{
if(needToSwitch && !canSwitchToGenerator())
{
std::stringstream os;
os << "The stream has a duration of " << getDuration() << "s.";
os << " It needs to switch to a generator during the process, but it cannot. ";
throw std::runtime_error(os.str());
}
_needToSwitchToGenerator = needToSwitch;
}
void StreamTranscoder::setOffset(const float offset)
{
_offset = offset;
if(_offset > 0)
{
needToSwitchToGenerator();
// allocate the frame since the process will start with some generated data
for(std::vector<IFrame*>::iterator it = _decodedData.begin(); it != _decodedData.end(); ++it)
{
if(! (*it)->isDataAllocated())
(*it)->allocateData();
}
}
}
StreamTranscoder::EProcessCase StreamTranscoder::getProcessCase() const
{
if(! _inputStreams.empty() && ! _inputDecoders.empty() && std::find(_inputDecoders.begin(), _inputDecoders.end(), _currentDecoder) != _inputDecoders.end() )
return eProcessCaseTranscode;
else if(! _inputStreams.empty() && _inputDecoders.empty() && !_currentDecoder)
return eProcessCaseRewrap;
else
return eProcessCaseGenerator;
}
}