Skip to content

Commit 11b77d2

Browse files
committed
Merge pull request #61 from cchampet/fix_defaultDurationIsBasedOnStream
Default transcoding policy is based on stream 0 Clean getOutputDuration Transcoder method
2 parents a08947d + 018fa35 commit 11b77d2

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

app/avProcessor/avProcessor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ int main( int argc, char** argv )
107107

108108
// set verbose of all stream
109109
transcoder.setVerbose( verbose );
110-
transcoder.setProcessMethod( avtranscoder::eProcessMethodLongest );
111110

112111
if( verbose )
113112
std::cout << "start Transcode" << std::endl;

src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Transcoder::Transcoder( OutputFile& outputFile )
1717
, _streamTranscoders()
1818
, _streamTranscodersAllocated()
1919
, _profileLoader( true )
20-
, _eProcessMethod ( eProcessMethodLongest )
20+
, _eProcessMethod ( eProcessMethodBasedOnStream )
2121
, _mainStreamIndex( 0 )
2222
, _verbose( false )
2323
{
@@ -277,7 +277,7 @@ void Transcoder::process( IProgress& progress )
277277

278278
preProcessCodecLatency();
279279

280-
double totalDuration = getTotalDurationFromProcessMethod();
280+
double totalDuration = getOutputDuration();
281281

282282
size_t frame = 0;
283283
bool frameProcessed = true;
@@ -478,7 +478,7 @@ double Transcoder::getMaxTotalDuration() const
478478
return maxTotalDuration;
479479
}
480480

481-
double Transcoder::getTotalDurationFromProcessMethod() const
481+
double Transcoder::getOutputDuration() const
482482
{
483483
switch( _eProcessMethod )
484484
{

src/AvTranscoder/transcoder/Transcoder.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ namespace avtranscoder
1818
/**
1919
* @brief Enum to set a policy of how we manage the transcode in case of several streams.
2020
* eProcessMethodShortest: stop transcode at the end of the shortest stream.
21-
* eProcessMethodLongest: stop transcode at the end of the longest stream (default method).
22-
* eProcessMethodBasedOnStream: stop transcode at the end of an indicated stream (@see _indexBasedStream of Transcoder).
23-
* eProcessMethodInfinity: stop transcode by outside of avTranscoder.
21+
* eProcessMethodLongest: stop transcode at the end of the longest stream.
22+
* eProcessMethodBasedOnStream: stop transcode at the end of an indicated stream (@see _indexBasedStream attribute of Transcoder).
23+
* eProcessMethodInfinity: stop transcode by outside of avTranscoder (streaming mode)
2424
*/
2525
enum EProcessMethod
2626
{
@@ -121,8 +121,8 @@ class AvExport Transcoder
121121
StreamTranscoder& getStreamTranscoder( size_t streamIndex ) const { return *_streamTranscoders.at( streamIndex ); }
122122

123123
/**
124-
* @brief Set the transcodage politic.
125-
* @note By default eProcessMethodLongest.
124+
* @brief Set the transcoding policy.
125+
* @note By default eProcessMethodBasedOnStream at index 0.
126126
* @param indexBasedStream: in case of process method eProcessMethodBasedOnStream, stop transcode at the end of the indicated stream.
127127
*/
128128
void setProcessMethod( const EProcessMethod eProcessMethod, const size_t indexBasedStream = 0 );
@@ -146,26 +146,25 @@ class AvExport Transcoder
146146

147147
/**
148148
* @brief Get the duration of the stream.
149+
* @note If the stream is a generator, return limit of double.
149150
*/
150151
double getStreamDuration( size_t indexStream ) const;
151152

152153
/**
153154
* @brief Get the duration of the shortest stream.
154-
* @note if there is only generated streams, return limit of double.
155155
*/
156156
double getMinTotalDuration() const;
157157

158158
/**
159159
* @brief Get the duration of the longest stream.
160-
* @note if there is only generated streams, return limit of double.
161160
*/
162161
double getMaxTotalDuration() const;
163162

164163
/**
165164
* @brief Get the duration of the output program
166165
* @note Depends on the streams, the process method, and the main stream index.
167166
*/
168-
double getTotalDurationFromProcessMethod() const;
167+
double getOutputDuration() const;
169168

170169
/**
171170
* @brief Set for each StreamTranscoder if it is an infinity stream (switch to generator at the end of the stream).

0 commit comments

Comments
 (0)