@@ -319,7 +319,7 @@ bool StreamTranscoder::processRewrap()
319
319
return true ;
320
320
}
321
321
322
- bool StreamTranscoder::processTranscode ()
322
+ bool StreamTranscoder::processTranscode ( const int subStreamIndex )
323
323
{
324
324
assert ( _inputEssence != NULL );
325
325
assert ( _currentEssence != NULL );
@@ -341,72 +341,13 @@ bool StreamTranscoder::processTranscode()
341
341
_offsetPassed = true ;
342
342
}
343
343
344
- if ( _currentEssence->readNextFrame ( *_sourceBuffer ) )
345
- {
346
- if ( _verbose )
347
- std::cout << " convert (" << _sourceBuffer->getSize () << " bytes)" << std::endl;
348
- _transform->convert ( *_sourceBuffer, *_frameBuffer );
349
- if ( _verbose )
350
- std::cout << " encode (" << _frameBuffer->getSize () << " bytes)" << std::endl;
351
- _outputEssence->encodeFrame ( *_frameBuffer, data );
352
- }
344
+ bool decodingStatus = false ;
345
+ if ( subStreamIndex == -1 )
346
+ decodingStatus = _currentEssence->readNextFrame ( *_sourceBuffer );
353
347
else
354
- {
355
- if ( _verbose )
356
- std::cout << " encode last frame(s)" << std::endl;
357
- if ( ! _outputEssence->encodeFrame ( data ) )
358
- {
359
- if ( _infinityStream )
360
- {
361
- switchToGeneratorEssence ();
362
- return processTranscode ();
363
- }
364
- return false ;
365
- }
366
- }
367
-
368
- if ( _verbose )
369
- std::cout << " wrap (" << data.getSize () << " bytes)" << std::endl;
370
-
371
- IOutputStream::EWrappingStatus wrappingStatus = _outputStream->wrap ( data );
372
-
373
- switch ( wrappingStatus )
374
- {
375
- case IOutputStream::eWrappingSuccess:
376
- return true ;
377
- case IOutputStream::eWrappingWaitingForData:
378
- // the wrapper needs more data to write the current packet
379
- return processTranscode ();
380
- case IOutputStream::eWrappingError:
381
- return false ;
382
- }
383
-
384
- return true ;
385
- }
386
-
387
- bool StreamTranscoder::processTranscode ( const int subStreamIndex )
388
- {
389
- assert ( _inputEssence != NULL );
390
- assert ( _currentEssence != NULL );
391
- assert ( _outputEssence != NULL );
392
- assert ( _sourceBuffer != NULL );
393
- assert ( _frameBuffer != NULL );
394
- assert ( _transform != NULL );
395
-
396
- CodedData data;
397
- if ( _verbose )
398
- std::cout << " transcode a frame " << std::endl;
399
-
400
- if ( _offset &&
401
- _frameProcessed > _offset &&
402
- ! _offsetPassed &&
403
- _takeFromGenerator )
404
- {
405
- switchToInputEssence ();
406
- _offsetPassed = true ;
407
- }
348
+ decodingStatus = _currentEssence->readNextFrame ( *_sourceBuffer, subStreamIndex );
408
349
409
- if ( _currentEssence-> readNextFrame ( *_sourceBuffer, subStreamIndex ) )
350
+ if ( decodingStatus )
410
351
{
411
352
if ( _verbose )
412
353
std::cout << " convert (" << _sourceBuffer->getSize () << " bytes)" << std::endl;
0 commit comments