Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcda8459

Browse files
author
Clement Champetier
committed
transcoder: manage offset with a float type
Double precision is not needed to express this offset in seconds.
1 parentaad1bbf commitcda8459

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

‎src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace avtranscoder
2323
StreamTranscoder::StreamTranscoder(
2424
IInputStream& inputStream,
2525
IOutputFile& outputFile,
26-
constdouble offset
26+
constfloat offset
2727
)
2828
: _inputStream( &inputStream )
2929
, _outputStream(NULL )
@@ -109,7 +109,7 @@ StreamTranscoder::StreamTranscoder(
109109
IOutputFile& outputFile,
110110
const ProfileLoader::Profile& profile,
111111
constint subStreamIndex,
112-
constdouble offset
112+
constfloat offset
113113
)
114114
: _inputStream( &inputStream )
115115
, _outputStream(NULL )

‎src/AvTranscoder/transcoder/StreamTranscoder.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class AvExport StreamTranscoder
2929
* @brief rewrap stream
3030
* @note offset feature when rewrap a stream is not supported
3131
**/
32-
StreamTranscoder( IInputStream& inputStream, IOutputFile& outputFile,constdouble offset =0 );
32+
StreamTranscoder( IInputStream& inputStream, IOutputFile& outputFile,constfloat offset =0 );
3333

3434
/**
3535
* @brief transcode stream
3636
**/
37-
StreamTranscoder( IInputStream& inputStream, IOutputFile& outputFile,const ProfileLoader::Profile& profile,constint subStreamIndex = -1,constdouble offset =0 );
37+
StreamTranscoder( IInputStream& inputStream, IOutputFile& outputFile,const ProfileLoader::Profile& profile,constint subStreamIndex = -1,constfloat offset =0 );
3838

3939
/**
4040
* @brief encode from a generated stream
@@ -121,7 +121,7 @@ class AvExport StreamTranscoder
121121

122122
int _subStreamIndex;///< Index of channel that is processed from the input stream (<0 if no demultiplexing).
123123

124-
double _offset;///< Offset, in seconds, at the beginning of the StreamTranscoder.
124+
float _offset;///< Offset, in seconds, at the beginning of the StreamTranscoder.
125125

126126
bool _canSwitchToGenerator;///< Automatically switch to a generator at the end of the stream
127127
};

‎src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Transcoder::~Transcoder()
3333
}
3434
}
3535

36-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const std::string& profileName,constdouble offset )
36+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const std::string& profileName,constfloat offset )
3737
{
3838
// Re-wrap
3939
if( profileName.length() ==0 )
@@ -52,7 +52,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
5252
}
5353
}
5454

55-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const std::string& profileName, ICodec& codec,constdouble offset )
55+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const std::string& profileName, ICodec& codec,constfloat offset )
5656
{
5757
// Re-wrap
5858
if( profileName.length() ==0 )
@@ -71,7 +71,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
7171
}
7272
}
7373

74-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile,constdouble offset )
74+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile,constfloat offset )
7575
{
7676
// Check filename
7777
if( ! filename.length() )
@@ -80,7 +80,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
8080
addTranscodeStream( filename, streamIndex, -1, profile, offset );
8181
}
8282

83-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constdouble offset )
83+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constfloat offset )
8484
{
8585
// Generator
8686
if( ! filename.length() )
@@ -94,7 +94,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
9494
}
9595
}
9696

97-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName,constdouble offset )
97+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName,constfloat offset )
9898
{
9999
// No subStream selected
100100
if( subStreamIndex <0 )
@@ -124,7 +124,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
124124
}
125125
}
126126

127-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName, ICodec& codec,constdouble offset )
127+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName, ICodec& codec,constfloat offset )
128128
{
129129
// No subStream selected
130130
if( subStreamIndex <0 )
@@ -155,7 +155,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
155155
}
156156
}
157157

158-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constdouble offset )
158+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constfloat offset )
159159
{
160160
// No subStream selected
161161
if( subStreamIndex <0 )
@@ -171,7 +171,7 @@ void Transcoder::add( const std::string& filename, const size_t streamIndex, con
171171
addTranscodeStream( filename, streamIndex, subStreamIndex, profile, offset );
172172
}
173173

174-
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constdouble offset )
174+
voidTranscoder::add(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constfloat offset )
175175
{
176176
// No subStream selected
177177
if( subStreamIndex <0 )
@@ -282,7 +282,7 @@ void Transcoder::setProcessMethod( const EProcessMethod eProcessMethod, const si
282282
_outputDuration = outputDuration;
283283
}
284284

285-
voidTranscoder::addRewrapStream(const std::string& filename,constsize_t streamIndex,constdouble offset )
285+
voidTranscoder::addRewrapStream(const std::string& filename,constsize_t streamIndex,constfloat offset )
286286
{
287287
LOG_INFO("Add rewrap stream from file '" << filename <<"' / index=" << streamIndex <<" / offset=" << offset <<"s" )
288288

@@ -292,7 +292,7 @@ void Transcoder::addRewrapStream( const std::string& filename, const size_t stre
292292
_streamTranscoders.push_back( _streamTranscodersAllocated.back() );
293293
}
294294

295-
voidTranscoder::addTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,constdouble offset )
295+
voidTranscoder::addTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,constfloat offset )
296296
{
297297
// Get profile from input file
298298
InputFileinputFile( filename );
@@ -306,7 +306,7 @@ void Transcoder::addTranscodeStream( const std::string& filename, const size_t s
306306
addTranscodeStream( filename, streamIndex, subStreamIndex, profile, offset );
307307
}
308308

309-
voidTranscoder::addTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constdouble offset )
309+
voidTranscoder::addTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constfloat offset )
310310
{
311311
// Add profile
312312
if( ! _profileLoader.hasProfile( profile ) )
@@ -348,7 +348,7 @@ void Transcoder::addDummyStream( const ProfileLoader::Profile& profile, const IC
348348
_streamTranscoders.push_back( _streamTranscodersAllocated.back() );
349349
}
350350

351-
InputFile*Transcoder::addInputFile(const std::string& filename,constsize_t streamIndex,constdouble offset )
351+
InputFile*Transcoder::addInputFile(const std::string& filename,constsize_t streamIndex,constfloat offset )
352352
{
353353
InputFile* referenceFile =NULL;
354354

@@ -532,7 +532,7 @@ void Transcoder::fillProcessStat( ProcessStat& processStat )
532532
if( encoderContext.coded_frame && ( encoderContext.flags & CODEC_FLAG_PSNR) )
533533
{
534534
videoStat._quality = encoderContext.coded_frame->quality;
535-
videoStat._psnr =VideoStat::psnr(encoderContext.coded_frame->error[0] / (encoderContext.width * encoderContext.height *255.0 *255.0));
535+
videoStat._psnr =VideoStat::psnr(encoderContext.coded_frame->error[0] / (encoderContext.width * encoderContext.height *255.0 *255.0 ));
536536
}
537537
processStat.addVideoStat( streamIndex, videoStat );
538538
break;

‎src/AvTranscoder/transcoder/Transcoder.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,45 +58,45 @@ class AvExport Transcoder
5858
* If offset is positive, the transcoder will generate black images or silence (depending on the type of stream) before the stream to process.
5959
* If offset is negative, the transcoder will seek in the stream and start process at this specific time.
6060
*/
61-
voidadd(const std::string& filename,constsize_t streamIndex,const std::string& profileName ="",constdouble offset =0 );
61+
voidadd(const std::string& filename,constsize_t streamIndex,const std::string& profileName ="",constfloat offset =0 );
6262
/*
6363
* @note If filename is empty, add a generated stream.
6464
* @note If filename is empty, profileName can't be empty (no sens to rewrap a generated stream).
6565
*/
66-
voidadd(const std::string& filename,constsize_t streamIndex,const std::string& profileName, ICodec& codec,constdouble offset =0 );
66+
voidadd(const std::string& filename,constsize_t streamIndex,const std::string& profileName, ICodec& codec,constfloat offset =0 );
6767

6868
/**
6969
* @brief Add a stream and set a custom profile
7070
* @note Profile will be updated, be sure to pass unique profile name.
7171
*/
72-
voidadd(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile,constdouble offset =0 );
72+
voidadd(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile,constfloat offset =0 );
7373
/*
7474
* @note If filename is empty, add a generated stream.
7575
*/
76-
voidadd(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constdouble offset =0 );
76+
voidadd(const std::string& filename,constsize_t streamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constfloat offset =0 );
7777

7878
/**
7979
* @brief Add a stream and set a profile
8080
* @note If profileName is empty, rewrap.
8181
* @note If subStreamIndex is negative, no substream is selected it's the stream.
8282
*/
83-
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName ="",constdouble offset =0 );
83+
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName ="",constfloat offset =0 );
8484
/**
8585
* @note If filename is empty, add a generated stream.
8686
* @note If filename is empty, profileName can't be empty (no sens to rewrap a generated stream).
8787
*/
88-
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName, ICodec& codec,constdouble offset =0 );
88+
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const std::string& profileName, ICodec& codec,constfloat offset =0 );
8989

9090
/**
9191
* @brief Add a stream and set a custom profile
9292
* @note Profile will be updated, be sure to pass unique profile name.
9393
* @note If subStreamIndex is negative, no substream is selected it's the stream.
9494
*/
95-
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constdouble offset =0 );
95+
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constfloat offset =0 );
9696
/**
9797
* @note If filename is empty, add a generated stream.
9898
*/
99-
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constdouble offset =0 );
99+
voidadd(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile, ICodec& codec,constfloat offset =0 );
100100

101101
/**
102102
* @brief Add the stream
@@ -152,14 +152,14 @@ class AvExport Transcoder
152152
voidsetProcessMethod(const EProcessMethod eProcessMethod,constsize_t indexBasedStream =0,constdouble outputDuration =0 );
153153

154154
private:
155-
voidaddRewrapStream(const std::string& filename,constsize_t streamIndex,constdouble offset );
155+
voidaddRewrapStream(const std::string& filename,constsize_t streamIndex,constfloat offset );
156156

157-
voidaddTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,constdouble offset );
158-
voidaddTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constdouble offset =0 );
157+
voidaddTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,constfloat offset );
158+
voidaddTranscodeStream(const std::string& filename,constsize_t streamIndex,constint subStreamIndex,const ProfileLoader::Profile& profile,constfloat offset =0 );
159159

160160
voidaddDummyStream(const ProfileLoader::Profile& profile,const ICodec& codec );
161161

162-
InputFile*addInputFile(const std::string& filename,constsize_t streamIndex,constdouble offset );
162+
InputFile*addInputFile(const std::string& filename,constsize_t streamIndex,constfloat offset );
163163

164164
ProfileLoader::ProfilegetProfileFromFile( InputFile& inputFile,constsize_t streamIndex );///< The function analyses the inputFile
165165

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp