Skip to content

Commit 9b9005b

Browse files
committed
Merge pull request #201 from cchampet/dev_StreamTranscoderGetProcessCase
StreamTranscoder: refactor how to get the current process case
2 parents 2c9198f + 0b4ef30 commit 9b9005b

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void StreamTranscoder::preProcessCodecLatency()
309309
return;
310310

311311
// set a decoder to preload generated frames
312-
if( isRewrapCase() )
312+
if( getProcessCase() == eProcessCaseRewrap )
313313
switchToGeneratorDecoder();
314314

315315
while( ( latency-- ) > 0 )
@@ -328,7 +328,7 @@ bool StreamTranscoder::processFrame()
328328
{
329329
LOG_INFO( "End of positive offset" )
330330

331-
if( isTranscodeCase() )
331+
if( getProcessCase() == eProcessCaseTranscode )
332332
switchToInputDecoder();
333333
else
334334
_currentDecoder = NULL;
@@ -356,7 +356,7 @@ bool StreamTranscoder::processFrame()
356356
}
357357
}
358358

359-
if( isRewrapCase() )
359+
if( getProcessCase() == eProcessCaseRewrap )
360360
return processRewrap();
361361

362362
return processTranscode( _subStreamIndex );
@@ -495,19 +495,14 @@ double StreamTranscoder::getDuration() const
495495
return std::numeric_limits<double>::max();
496496
}
497497

498-
bool StreamTranscoder::isTranscodeCase() const
498+
StreamTranscoder::EProcessCase StreamTranscoder::getProcessCase() const
499499
{
500-
return _inputStream && _inputDecoder;
501-
}
502-
503-
bool StreamTranscoder::isRewrapCase() const
504-
{
505-
return _inputStream && ! _inputDecoder;
506-
}
507-
508-
bool StreamTranscoder::isGeneratorCase() const
509-
{
510-
return ! _inputStream;
500+
if( _inputStream && _inputDecoder )
501+
return eProcessCaseTranscode;
502+
else if( _inputStream && ! _inputDecoder )
503+
return eProcessCaseRewrap;
504+
else
505+
return eProcessCaseGenerator;
511506
}
512507

513508
}

src/AvTranscoder/transcoder/StreamTranscoder.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,15 @@ class AvExport StreamTranscoder
9595
bool processRewrap();
9696
bool processTranscode( const int subStreamIndex = -1 ); ///< By default transcode all channels
9797

98-
bool isTranscodeCase() const;
99-
bool isRewrapCase() const;
100-
bool isGeneratorCase() const;
98+
//@{
99+
// Get the current process case.
100+
enum EProcessCase {
101+
eProcessCaseTranscode,
102+
eProcessCaseRewrap,
103+
eProcessCaseGenerator
104+
};
105+
EProcessCase getProcessCase() const;
106+
//@}
101107

102108
private:
103109
IInputStream* _inputStream; ///< Input stream to read next packet (has link, no ownership)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy